skazy_gamerz

Create A plugin in which when a player joins he gets 18 min for grace period in that time no other could kill him

Kodari AI
KodariMar 3 at 6:52 am 8,584 (v2)

I’ll create a grace period plugin that protects players from PvP damage for 18 minutes after joining.

GracePeriod
A comprehensive grace period system that protects new players from PvP combat for 18 minutes after joining the server. Features include customizable duration, persistent data storage across restarts, automatic expiry notifications, admin commands to manage grace periods, and configurable messages. Players are notified when their protection starts and ends, ensuring a safe introduction to the server.

Plugin created! Players now receive 18 minutes of PvP protection when they join the server.

Features:

  • 18-minute grace period on join (configurable to 1080 seconds)

  • Protection from all PvP damage during grace period

  • Persistent data storage across restarts

  • Admin commands to manage grace periods

  • Optional settings: first-join-only, remove-on-combat

  • Customizable messages with time formatting

  • Permission bypass for admins

Commands:

  • /grace - Check your grace period status

  • /grace <player> - Check another player’s status (admin)

  • /graceadmin give <player> [seconds] - Give grace period

  • /graceadmin remove <player> - Remove grace period

  • /graceadmin check <player> - Check player’s remaining time

Permissions:

  • graceperiod.admin - Access admin commands

  • graceperiod.bypass - Bypass grace protection (can damage protected players)

skazy_gamerz

add one more thing /grace reset @a to reset all player's grace

Kodari AI
KodariMar 3 at 7:40 am 8,840 (v2)

I’ll add the reset all players functionality to the grace admin command.

  • Adding reset @a functionality to admin command

  • Updating config messages for reset action

Added /grace reset @a command to reset all online players’ grace periods, with proper messaging and support for individual player reset as well.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
11 661
src/main/java/com/example/graceperiod/GracePeriod.java
package com.example.graceperiod;

import com.example.graceperiod.commands.GraceAdminCommand;
import com.example.graceperiod.commands.GraceCommand;
import com.example.graceperiod.listeners.DamageListener;
import com.example.graceperiod.listeners.PlayerJoinListener;
import com.example.graceperiod.managers.ConfigManager;
import com.example.graceperiod.managers.DataManager;
import com.example.graceperiod.managers.GracePeriodManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class GracePeriod extends JavaPlugin {
    
    private ConfigManager configManager;
    private DataManager dataManager;
    private GracePeriodManager gracePeriodManager;
    
    @Override
    public void onEnable() {
        this.configManager = new ConfigManager(this);
        this.dataManager = new DataManager(this);
        this.gracePeriodManager = new GracePeriodManager(this);
        
        dataManager.loadData();
        
        getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
        getServer().getPluginManager().registerEvents(new DamageListener(this), this);
        
        getCommand("grace").setExecutor(new GraceCommand(this));
        getCommand("graceadmin").setExecutor(new GraceAdminCommand(this));
        
        getLogger().info("GracePeriod has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (gracePeriodManager != null) {
            gracePeriodManager.shutdown();
        }
        if (dataManager != null) {
            dataManager.saveData();
        }
        getLogger().info("GracePeriod has been disabled!");
    }
}