C

Please create a java plugin 1.21.10 papermc that you have 1h30m playtime and than you would be kicked from the server and every day thats is resetting the time and you can add time with /time add player <time> and /time set %player% <time> and /time infinte %player% so you have infinite time and you can see the time in the simplescore plugin. And when you are in combat you can't be kicked off the server the combat plugin was already made

Kodari AI
KodariApr 24 at 4:28 pm 13,326 (v2)

I’ll create a daily playtime limiter plugin that enforces play time limits with combat protection.

DailyPlaytime
A playtime management plugin that enforces daily play limits. Players receive 90 minutes of playtime per day that resets at midnight. Features include admin commands to add, set, or grant infinite playtime, automatic kick when time expires, combat protection to prevent unfair kicks during combat, and scoreboard integration via PlaceholderAPI to display remaining time. Time tracking persists across server restarts.

Now I’ll create the plugin structure with all necessary files:

Perfect! I’ve created a complete DailyPlaytime plugin with the following features:

Core Features:

  • 90-minute (5400 seconds) daily playtime limit per player

  • Daily reset at midnight (configurable timezone)

  • Automatic kick when time expires

  • Combat protection - players won’t be kicked while in combat

  • Time tracking persists across server restarts

Commands:

  • /time add <player> <time> - Add time (supports formats: 1h30m, 90m, 5400s)

  • /time set <player> <time> - Set exact time

  • /time infinite <player> - Toggle unlimited playtime

  • /time check [player] - View remaining time

Integrations:

  • Combat plugins: Auto-detects CombatLogX, DeluxeCombat, or CombatTagPlus

  • PlaceholderAPI: Provides placeholders for SimpleScore scoreboard display

    • %dailyplaytime_time% - Formatted time (1h 30m 45s)

    • %dailyplaytime_seconds% - Raw seconds

    • %dailyplaytime_time_formatted% - HH:MM:SS format

    • %dailyplaytime_time_bar% - Visual progress bar

Additional Features:

  • Warning messages at configurable thresholds (10m, 5m, 1m, 30s, 10s)

  • Bypass permission (dailyplaytime.bypass)

  • Daily automatic reset with timezone support

  • Debug mode for troubleshooting

Players will see their remaining time on join and receive warnings as time runs low. The plugin integrates seamlessly with your combat system to prevent unfair kicks during fights!

C

this is the combat file can you adjust the playtime plugin?

--- 📎 Attached 1 file(s):

File: pasted-code-1777049377370.txt

txt
package com.kilian754.combatPlugin.Combat;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;

public class CombatCommand implements CommandExecutor, TabCompleter {

    private final CombatPlugin plugin;

    public CombatCommand(CombatPlugin plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 0) {
            if (!sender.hasPermission("combat.admin")) {
                send(sender, plugin.getConfig().getString("messages.no-permission", "&cDazu hast du keine Rechte."));
                return true;
            }
            send(sender, "&eNutze: /combat reload, /combat freeze <player>, /combat unfreeze <player>, /combat tp <player>");
            return true;
        }

        if (args[0].equalsIgnoreCase("tp")) {
            if (!(sender instanceof Player player)) {
                send(sender, plugin.getConfig().getString("messages.player-only", "&cNur Spieler können das benutzen."));
                return true;
            }

            if (!sender.hasPermission("combat.tp")) {
                send(sender, plugin.getConfig().getString("messages.no-permission", "&cDazu hast du keine Rechte."));
                return true;
            }

            if (args.length < 2) {
                send(sender, "&eNutze: /combat tp <player>");
                return true;
            }

            Player target = Bukkit.getPlayerExact(args[1]);
            if (target == null) {
                send(sender, plugin.getConfig().getString("messages.player-not-found", "&cDieser Spieler wurde nicht gefunden."));
                return true;
            }

            player.teleport(target.getLocation());
            send(sender, "&aDu wurdest zu &e" + target.getName() + " &ateleportiert.");
            return true;
        }

        if (!sender.hasPermission("combat.admin")) {
            send(sender, plugin.getConfig().getString("messages.no-permission", "&cDazu hast du keine Rechte."));
            return true;
        }

        if (args[0].equalsIgnoreCase("reload")) {
            plugin.reloadConfig();
            plugin.getCombatManager().reloadVisuals();
            send(sender, plugin.getConfig().getString("messages.reload", "&aDie config.yml wurde neu geladen."));
            return true;
        }

        if (args[0].equalsIgnoreCase("freeze")) {
            if (args.length < 2) {
                send(sender, plugin.getConfig().getString("messages.freeze-usage", "&eNutze: /combat freeze <player>"));
                return true;
            }

            Player target = Bukkit.getPlayerExact(args[1]);
            if (target == null) {
                send(sender, plugin.getConfig().getString("messages.player-not-found", "&cDieser Spieler wurde nicht gefunden."));
                return true;
            }

            if (!plugin.getFreezeManager().freeze(target)) {
                send(sender, plugin.getConfig().getString("messages.already-frozen", "&e%player% ist bereits eingefroren.")
                        .replace("%player%", target.getName()));
                return true;
            }

            send(sender, plugin.getConfig().getString("messages.freeze-success", "&a%player% wurde eingefroren.")
                    .replace("%player%", target.getName()));

            target.sendTitle(
                    legacy(plugin.getConfig().getString("messages.freeze-title", "&b&lFREEZE")),
                    legacy(plugin.getConfig().getString("messages.frozen-message", "&cDu bist eingefroren!")),
                    10, 70, 20
            );
            return true;
        }

        if (args[0].equalsIgnoreCase("unfreeze")) {
            if (args.length < 2) {
                send(sender, plugin.getConfig().getString("messages.unfreeze-usage", "&eNutze: /combat unfreeze <player>"));
                return true;
            }

            Player target = Bukkit.getPlayerExact(args[1]);
            if (target == null) {
                send(sender, plugin.getConfig().getString("messages.player-not-found", "&cDieser Spieler wurde nicht gefunden."));
                return true;
            }

            if (!plugin.getFreezeManager().unfreeze(target)) {
                send(sender, plugin.getConfig().getString("messages.not-frozen", "&e%player% ist nicht eingefroren.")
                        .replace("%player%", target.getName()));
                return true;
            }

            send(sender, plugin.getConfig().getString("messages.unfreeze-success", "&a%player% wurde entfroren.")
                    .replace("%player%", target.getName()));
            target.resetTitle();
            return true;
        }

        send(sender, "&eNutze: /combat reload, /combat freeze <player>, /combat unfreeze <player>, /combat tp <player>");
        return true;
    }

    @Override
    public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
        List<String> list = new ArrayList<>();

        if (args.length == 1) {
            if (sender.hasPermission("combat.admin")) {
                list.add("reload");
                list.add("freeze");
                list.add("unfreeze");
            }
            if (sender.hasPermission("combat.tp")) {
                list.add("tp");
            }
            return filter(list, args[0]);
        }

        if (args.length == 2) {
            boolean allowPlayers =
                    (args[0].equalsIgnoreCase("freeze") && sender.hasPermission("combat.admin")) ||
                            (args[0].equalsIgnoreCase("unfreeze") && sender.hasPermission("combat.admin")) ||
                            (args[0].equalsIgnoreCase("tp") && sender.hasPermission("combat.tp"));

            if (allowPlayers) {
                for (Player player : Bukkit.getOnlinePlayers()) {
                    list.add(player.getName());
                }
                return filter(list, args[1]);
            }
        }

        return list;
    }

    private List<String> filter(List<String> input, String current) {
        List<String> result = new ArrayList<>();
        for (String s : input) {
            if (s.toLowerCase().startsWith(current.toLowerCase())) {
                result.add(s);
            }
        }
        return result;
    }

    private void send(CommandSender sender, String msg) {
        sender.sendMessage(color(msg));
    }

    private Component color(String msg) {
        return LegacyComponentSerializer.legacyAmpersand().deserialize(msg);
    }

    private String legacy(String msg) {
        return msg.replace("&", "§");
    }
}
1 image attached
Kodari AI
KodariApr 24 at 4:51 pm 5,353 (v2)

I’ll adjust the playtime plugin to integrate with your custom combat plugin. Let me first read the relevant files to understand the current structure.

Now I’ll update the CombatIntegration class to support your custom combat plugin:

Perfect! I’ve updated the DailyPlaytime plugin to integrate with your custom CombatPlugin. Here’s what changed:

Integration Updates:

  • Added detection for your CombatPlugin (checks for it first before other combat plugins)

  • Added checkCustomCombat() method that uses reflection to access your CombatManager.isInCombat(Player) method

  • Players in combat will NOT be kicked when their time expires

  • Once they leave combat, they have a configurable delay before being kicked (default 5 seconds)

How it works:

  1. When a player’s time expires, they’re marked for pending kick

  2. Every second, the system checks if they’re still in combat

  3. If in combat: kick is postponed, player stays online

  4. If NOT in combat: countdown starts before kick

  5. Player sees countdown messages (if configured)

The integration uses reflection to call CombatManager.isInCombat(player) from your combat plugin, so it will work automatically as long as your CombatManager has that method!

C

package com.dailyplaytime.command;

please chage it to

com.kilian754.combatPlugin.Time

Kodari AI
KodariApr 24 at 4:53 pm 3,958 (v2)

I’ll read the project files first to understand the current structure, then move the package.

I’ll move the package from com.dailyplaytime to com.kilian754.combatPlugin.Time and update the necessary configuration files.

Package renamed from com.dailyplaytime to com.kilian754.combatPlugin.Time with all imports, package declarations, and configuration files updated automatically.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
12 1,074
src/main/java/com/kilian754/combatPlugin/Time/DailyPlaytime.java
package com.kilian754.combatPlugin.Time;

import com.kilian754.combatPlugin.Time.command.TimeCommand;
import com.kilian754.combatPlugin.Time.integration.CombatIntegration;
import com.kilian754.combatPlugin.Time.integration.PlaceholderExpansion;
import com.kilian754.combatPlugin.Time.listener.PlayerListener;
import com.kilian754.combatPlugin.Time.manager.PlayerTimeManager;
import com.kilian754.combatPlugin.Time.task.TimeTickTask;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

import java.io.File;

@Getter
public class DailyPlaytime extends JavaPlugin {

    private PlayerTimeManager timeManager;
    private CombatIntegration combatIntegration;
    private FileConfiguration messages;
    private TimeTickTask timeTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        loadMessages();

        this.timeManager = new PlayerTimeManager(this);
        this.combatIntegration = new CombatIntegration(this);
        this.timeTask = new TimeTickTask(this);

        getCommand("time").setExecutor(new TimeCommand(this));
        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);

        int interval = getConfig().getInt("check-interval", 20);
        timeTask.runTaskTimer(this, interval, interval);

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            new PlaceholderExpansion(this).register();
            getLogger().info("PlaceholderAPI integration enabled!");
        }

        getLogger().info("DailyPlaytime has been enabled!");
    }

    @Override
    public void onDisable() {
        if (timeTask != null) {
            timeTask.cancel();
        }
        if (timeManager != null) {
            timeManager.saveAllData();
        }
        getLogger().info("DailyPlaytime has been disabled!");
    }

    private void loadMessages() {
        File messagesFile = new File(getDataFolder(), "messages.yml");
        if (!messagesFile.exists()) {
            saveResource("messages.yml", false);
        }
        messages = YamlConfiguration.loadConfiguration(messagesFile);
    }

    public String getMessage(String path) {
        return messages.getString(path, "&cMessage not found: " + path);
    }

    public String getFormattedMessage(String path) {
        String prefix = getMessage("prefix");
        String message = getMessage(path);
        return colorize(prefix + message);
    }

    public String colorize(String text) {
        return text.replace("&", "§");
    }
}