Create a plugin called "DayCounter+" this is a minecraft plugin that calculates and shows the day of your minecraft world including the time, add permissions, commands, placeholders. Show the day and time in bukkit bossbar or action bar it is configurable and toggable as well, make sure that the time and day is always up to date and add a option to reset the day. Also show a popup title message on screen whenever the new day starts it is configurable as well and supports hex colors and symbols also add a messagw in chat in what day is the world currently in, as well the time and world name.
I’ll create a comprehensive DayCounter+ plugin with all the requested features.
DayCounter+ plugin created successfully! Here’s what I’ve implemented:
Features:
✅ Day tracking per world with persistent storage
✅ BossBar & ActionBar displays (configurable)
✅ Toggle display on/off per player
✅ Title popup when new day starts
✅ Chat messages for new days
✅ Hex color support (&#RRGGBB format)
✅ Real-time updates (configurable interval)
✅ Day reset functionality
✅ PlaceholderAPI support
Commands:
/day- Check current day/day toggle- Toggle display/day reset- Reset day counter/day check- Check current info/day reload- Reload config
Permissions:
daycounter.use- View info (default: true)daycounter.toggle- Toggle display (default: true)daycounter.reset- Reset days (default: op)daycounter.reload- Reload config (default: op)daycounter.admin- All permissions (default: op)
Placeholders:
%daycounter_day%- Current day number%daycounter_time%- Time of day (Morning/Noon/etc)%daycounter_world%- World name%daycounter_display%- Combined day + time
Configuration includes:
Display type selection (BossBar/ActionBar)
Custom time period names with colors
Title & chat message customization
Per-world tracking options
Auto-save intervals
Also add coordinates info as well so I chose to display it to the action bar it shows the coordinates first, 2nd is the day, 3rd time same in the bossbar
I’ll add coordinates to the action bar display in the order: coordinates, day, time (matching boss bar format).
Now I’ll update the DisplayManager to add coordinates to the action bar display in the format: coordinates, day, time.
Done! Added coordinates to the action bar display. The format is now:
Coordinates (X, Y, Z) first
Day count second
Time of day third
The action bar will show: X, Y, Z | ☀ Day # | Time and updates in real-time as you move.
display: type: ACTIONBAR
when the display type is set to ACTIONBAR, the bossbar still stays on screen, make sure that if the display type is ACTIONBAR remove the bossbar on screen and if the display type is BOSSBAR remove the actionbar on screen
but add an configurable option that can use both display type to show at once
also add a admin command that can make end the day and start next day
I’ll analyze the current implementation and fix the display type handling, add a BOTH option, and create an admin command to skip to the next day.
Now I’ll fix the display type handling to properly remove the opposite display type, add a BOTH option, and create an admin command to skip to the next day.
The compilation failed with this error:
Validation failed for compilation: Compilation failed with 3 error(s):
ERROR in src/main/java/com/daycounter/commands/DayCommand.java at line 176: cannot find symbol
plugin.getDayManager().skipToNextDay(player.getWorld());
^
symbol: method skipToNextDay(World)
location: class DayManager
ERROR in src/main/java/com/daycounter/commands/DayCommand.java at line 176: cannot find symbol
plugin.getDayManager().skipToNextDay(player.getWorld());
^
symbol: method skipToNextDay(World)
location: class DayManager
ERROR in src/main/java/com/daycounter/commands/DayCommand.java at line 176: cannot find symbol
plugin.getDayManager().skipToNextDay(player.getWorld());
^
symbol: method skipToNextDay(World)
location: class DayManager
=== COMPILATION ERROR ANALYSIS ===
MISSING METHODS:
- skipToNextDay(World)
ACTION: Check method names and signatures
FILES TO INVESTIGATE:
- src/main/java/com/daycounter/commands/DayCommand.java
- src/main/java/com/daycounter/commands/DayCommand.java
exceeds maximum
Please fix this error by creating a new artifact with the corrected code.
I need to read the files to understand the missing method and fix the compilation error.
Analysis
The error is clear: DayCommand.java line 176 calls skipToNextDay(World) method on DayManager, but this method doesn’t exist in DayManager.java.
I need to add the skipToNextDay method to DayManager.
Added the missing skipToNextDay(World) method to DayManager that increments the day counter, updates the last time, sets world time to morning, and saves the data.
[13:49:23 ERROR]: Command exception: /dc skip org.bukkit.command.CommandException: Unhandled exception executing command 'dc' in plugin DayCounterPlus v1.0.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.21.10-R0.1-SNAPSHOT.jar:?] at io.papermc.paper.command.brigadier.bukkit.BukkitCommandNode$BukkitBrigCommand.run(BukkitCommandNode.java:83) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.3.10.jar:?] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:30) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:13) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:105) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:458) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.Commands.performCommand(Commands.java:364) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.commands.Commands.performCommand(Commands.java:352) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2321) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$12(ServerGamePacketListenerImpl.java:2294) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:176) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1537) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:180) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:150) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1517) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1511) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.recordTaskExecutionTimeWhileWaiting(MinecraftServer.java:1229) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1352) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:384) ~[paper-1.21.10.jar:1.21.10-129-3e25649] at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?] Caused by: java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getString(String)" is null at DayCounterPlus-1.0.0.jar/com.daycounter.commands.DayCommand.handleSkip(DayCommand.java:180) ~[DayCounterPlus-1.0.0.jar:?] at DayCounterPlus-1.0.0.jar/com.daycounter.commands.DayCommand.onCommand(DayCommand.java:67) ~[DayCounterPlus-1.0.0.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.21.10-R0.1-SNAPSHOT.jar:?] ... 24 more
I need to check the DayCommand file and config to identify the missing configuration key causing the NullPointerException.
Analysis
The error occurs at line 180 in DayCommand.java in the handleSkip method. The issue is that messages.day-skipped is missing from the config.yml file.
Looking at line 180:
String message = plugin.getConfig().getString("messages.day-skipped")
.replace("{day}", String.valueOf(newDay))
The config has no day-skipped message defined, so getString() returns null, causing the NullPointerException when calling .replace().
Fix
Adding the missing configuration key:
Fixed by adding the missing day-skipped message to config.yml. The /dc skip command will now work properly.
add a sound when the new day start and the screen title pops up [configurable]
I’ll add a configurable sound that plays when a new day starts. Let me read the relevant files first.
Now I’ll add a configurable sound that plays when a new day starts. I’ll update the config.yml to add sound settings and modify DayManager.java to play the sound.
Done! I’ve added a configurable sound that plays when a new day starts. The changes include:
Config additions:
sound.enabled- Toggle sound on/off (default: true)sound.type- Sound name (default: ENTITY_PLAYER_LEVELUP)sound.volume- Volume level (default: 1.0)sound.pitch- Pitch level (default: 1.0)
Code changes:
Added
playNewDaySound()method that uses XSound for cross-version compatibilitySound plays to all players in the world when a new day starts
Sound plays alongside the title and chat messages
You can change the sound to any valid Minecraft sound (e.g., BLOCK_NOTE_BLOCK_PLING, ENTITY_EXPERIENCE_ORB_PICKUP, UI_TOAST_CHALLENGE_COMPLETE, etc.).
update the version and jar file name into 1.0.2
I’ll update the version to 1.0.2 in both build.gradle and plugin.yml.
Updated version to 1.0.2 in both build.gradle and plugin.yml. The JAR file will now be generated as DayCounterPlus-1.0.2.jar when you build the project.
PLACEHOLDERS? WHERE
package com.daycounter;
import com.daycounter.commands.DayCommand;
import com.daycounter.listeners.PlayerListener;
import com.daycounter.managers.DayManager;
import com.daycounter.managers.DisplayManager;
import com.daycounter.placeholders.DayCounterExpansion;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class DayCounterPlus extends JavaPlugin {
@Getter
private static DayCounterPlus instance;
@Getter
private DayManager dayManager;
@Getter
private DisplayManager displayManager;
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
this.dayManager = new DayManager(this);
this.displayManager = new DisplayManager(this);
getCommand("day").setExecutor(new DayCommand(this));
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
dayManager.startTracking();
displayManager.startUpdating();
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new DayCounterExpansion(this).register();
getLogger().info("PlaceholderAPI expansion registered!");
}
getLogger().info("DayCounter+ has been enabled!");
}
@Override
public void onDisable() {
if (displayManager != null) {
displayManager.shutdown();
}
if (dayManager != null) {
dayManager.shutdown();
}
getLogger().info("DayCounter+ has been disabled!");
}
}