nyxara19

Create a war system plugin. You can disable this plugin into certain world at the config.yml and also I want you to add a feature were at war period, they can not a certain item you ban during war, I want you to make it configurable for war and grace period at war.yml or /war ban <hold_item>> and grace.yml or /grace ban <hold_item>. Also add a bypass permission for the bannable items like warsystem.bypass so that I can toggle it off or no on luckperms and also add message.yml. Also make the author of this Velrion/Kryzi (one person)

The features will be:

  • /war period (Anyone can kill during war period)
  • /grace period (You can not kill anyone during grace period)
Kodari AI
KodariAug 28 at 5:11 am 1
WarSystem
A comprehensive war and grace period management plugin for Minecraft servers. Administrators can toggle war or grace periods globally or per-world via commands, with world-specific disabling configured in config.yml. During war periods, players can PvP freely, while grace periods prevent all combat. The plugin features a configurable item ban system where admins can ban items during war or grace periods using /war ban &lt;hold_item&gt; and /grace ban &lt;hold_item&gt;, with banned items becoming unusable during active periods. A bypass permission (warsystem.bypass) allows designated players to use banned items regardless of active periods. All messages are customizable through message.yml, and war/grace settings are stored in separate configuration files for easy management.
  1. Create the Gradle project and plugin metadata.

  2. Add configurable settings, messages, war/grace ban storage, and runtime period management.

  3. Add /war and /grace commands with period and item-ban controls.

  4. Add combat and banned-item enforcement, including disabled worlds and warsystem.bypass.

  1. Created the WarSystem plugin with author Velrion/Kryzi.

  2. Added /war and /grace commands:

    • period

    • ban [item]

    • unban [item]

    • status

    • reload

  3. Added configurable disabled worlds in config.yml.

  4. Added persistent ban lists in war.yml and grace.yml.

  5. Added configurable messages in messages.yml.

  6. Added warsystem.bypass permission for banned-item bypasses.

  7. Added grace-period PvP protection and war-period PvP support.

  8. Added enforcement for banned items when interacting, breaking, placing, attacking, or launching projectiles.

nyxara19

remove /grace command, also make the detection of ban item that they can not use, wear, or switch it into offhand or use it at offhand slot

Kodari AI
KodariAug 28 at 5:56 am 1
  1. Remove the /grace command and its registration.

  2. Expand banned-item enforcement to block use, equipping, offhand switching, and offhand use.

Removed /grace from plugin.yml and stopped registering it.

Updated banned-item detection to block banned items during active periods when players:

  • Use them from the main hand or offhand

  • Equip them as armor

  • Move them into the offhand slot

  • Swap them into the offhand using hotkeys

  • Drag them into armor or offhand slots

  • Switch to them in the hotbar

  • Use them for block placement, breaking, interaction, attacking, or projectiles

The warsystem.bypass permission still bypasses all banned-item restrictions.

nyxara19

make also when the war started, it will announce to all players who's online on the server, same as war ended, make itnalso configuratable at config.yml

Kodari AI
KodariAug 28 at 5:57 am 1
  1. Add configurable war start/end broadcast messages and enable toggles in config.yml.

  2. Broadcast those messages to all online players when /war period starts or ends, with message placeholders supported.

  3. Keep command feedback and existing period behavior unchanged.

Added configurable war announcements in config.yml:

YAML
announcements:
  war-started:
    enabled: true
    message: '&cWar period started. Players can damage each other.'
  war-ended:
    enabled: true
    message: '&aWar period ended.'

When /war period starts or ends the war, the configured message is broadcast to all online players. Set enabled: false to disable either announcement.

nyxara19

make also the announcement title to all players who's online if the war is started or the war is ended

Kodari AI
KodariAug 28 at 5:59 am 1
  1. Add configurable title, subtitle, and display timing for war start/end announcements.

  2. Send the configured title to every online player alongside the existing broadcast message.

  3. Keep blank title/subtitle values supported so either line can be disabled.

Added configurable war start/end titles in config.yml, including:

  • Title

  • Subtitle

  • Fade-in duration

  • Display duration

  • Fade-out duration

Titles are now sent to every online player when the war starts or ends, alongside the existing chat announcement. Blank title or subtitle values can be used to hide either line.

nyxara19

Make the detection of ban item only detects when the player use, wear, switch offhand or use it on offhand so that it wont spam any message on the chat

Kodari AI
KodariAug 28 at 6:15 am 1

Updated banned-item detection so it only checks and sends a message when the player:

  • Uses the item from the main hand or offhand

  • Wears/equips the item

  • Switches the item into the offhand

  • Uses the item while it is in the offhand

Removed checks that caused chat spam from:

  • Attacking with banned items

  • Breaking blocks

  • Placing blocks

  • Launching projectiles

  • Switching hotbar items

  • Moving banned items through unrelated inventory actions

  • Moving items from the offhand to the main hand

warsystem.bypass still bypasses all banned-item checks.

nyxara19

They can still use those item that are ban during war like I tried to equip the elytra, I can still equip it, same as fireworks, when I am gliding I can use elytra and fireworks, can you fix that? Also when the detection detects a ban item that has been use, wear, switch to offhand or use an item on offhand will automatically put the item back on the inventory since it dissapear when the detection detects an ban item. Fix it please.

Kodari AI
KodariAug 28 at 6:31 am 3
  1. Cover elytra/firework use through the relevant interaction and inventory paths, including offhand.

  2. Restore blocked items after cancelled client/server inventory actions so banned stacks remain in the player inventory.

  3. Avoid new chat spam by issuing one configurable ban message per blocked action.

Fixed the banned-item enforcement:

  • Banned armor, including Elytra, is now removed from the equipment slot and returned to the player’s inventory.

  • Players cannot start gliding with a banned Elytra.

  • Players already gliding are forced to stop, and the banned Elytra is returned.

  • Banned items used from the main hand or offhand are removed from the hand and returned to the inventory.

  • Banned items switched into the offhand are blocked.

  • Armor and offhand inventory placement is blocked.

  • Cancelled inventory actions refresh the client inventory to prevent item disappearance.

  • The bypass permission warsystem.bypass remains respected.

  • Chat messages are only sent for the attempted banned action, avoiding extra detection spam.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
14 815
src/main/java/com/velrion/warsystem/WarSystemPlugin.java
package com.velrion.warsystem;

import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public final class WarSystemPlugin extends JavaPlugin {
    private SettingsManager settingsManager;
    private MessageManager messageManager;
    private PeriodManager periodManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("war.yml", false);
        saveResource("grace.yml", false);
        saveResource("messages.yml", false);

        settingsManager = new SettingsManager(this);
        messageManager = new MessageManager(this);
        periodManager = new PeriodManager(this);

        registerCommand("war", Period.WAR);
        getServer().getPluginManager().registerEvents(new WarListener(this), this);
    }

    public SettingsManager getSettingsManager() {
        return settingsManager;
    }

    public MessageManager getMessageManager() {
        return messageManager;
    }

    public PeriodManager getPeriodManager() {
        return periodManager;
    }

    public void reloadManagers() {
        settingsManager.reload();
        messageManager.reload();
        periodManager.reloadBannedItems();
    }

    public void broadcastAnnouncement(String announcement) {
        if (!settingsManager.isAnnouncementEnabled(announcement)) {
            return;
        }

        String message = settingsManager.getAnnouncement(announcement);
        if (message.isBlank()) {
            return;
        }
        getServer().broadcastMessage(ChatColor.translateAlternateColorCodes('&', message));

        String title = ChatColor.translateAlternateColorCodes('&', settingsManager.getAnnouncementTitle(announcement));
        String subtitle = ChatColor.translateAlternateColorCodes('&', settingsManager.getAnnouncementSubtitle(announcement));
        int fadeIn = settingsManager.getAnnouncementFadeIn(announcement);
        int stay = settingsManager.getAnnouncementStay(announcement);
        int fadeOut = settingsManager.getAnnouncementFadeOut(announcement);
        for (Player player : getServer().getOnlinePlayers()) {
            player.sendTitle(title, subtitle, fadeIn, stay, fadeOut);
        }
    }

    private void registerCommand(String name, Period period) {
        PluginCommand command = getCommand(name);
        if (command == null) {
            getLogger().severe("Command '" + name + "' is missing from plugin.yml.");
            return;
        }

        PeriodCommand executor = new PeriodCommand(this, period);
        command.setExecutor(executor);
        command.setTabCompleter(executor);
    }
}