evbzy

can you make me a mobtoggle plugin to put in my paper minecraft server running 26.1.2 that you can enable and disable with a menu i want it to have an option where i can make the default on or off for people and i want it to save that data and i want the mobs to not spawn at all in the loaded chunks of the player but if someone has it on next to someone that has it off they spawn i want the toggle button to be in the middle of the inventory slots with green concrete on and red concrete off when the menu pops up and when you hover over it says toggle mob spawning - on/off and red when off and light green when on

Kodari AI
KodariAug 10 at 3:03 am 6
MobToggleGUI
A Paper plugin for Minecraft 26.1.2 providing per-player mob spawning control through an interactive GUI menu. Players toggle mob spawning on/off via a central button displaying green concrete when enabled and red concrete when disabled, with hover text showing "Toggle Mob Spawning - On/Off". The plugin features a configurable default state for new players, persists player preferences to a data file, and prevents mobs from spawning in chunks loaded by players who have spawning disabled. When players with different settings are nearby, mobs spawn normally to accommodate enabled players. The GUI uses a 27-slot inventory with the toggle button centered at slot 13, offering intuitive visual feedback through color-coded concrete blocks.

Created the MobToggle Paper plugin.

  • /mobtoggle opens a 27-slot menu with the toggle centered in slot 13.

  • Green concrete represents ON; red concrete represents OFF.

  • Hover text reads Toggle mob spawning - ON/OFF, colored light green/red.

  • Player preferences persist in plugins/MobToggle/players.yml.

  • Set new-player default behavior in config.yml with default-enabled: true/false.

  • Natural creature spawns are cancelled in chunks loaded only by players with spawning disabled; an enabled player loading the same chunk allows spawning.

evbzy

it doesnt work for endermen

Kodari AI
KodariAug 10 at 3:09 am 2
  • Cancel Enderman teleports into chunks loaded exclusively by players with mob spawning disabled.

  • Keep normal spawning and teleporting available when an enabled player loads that chunk.

Enderman teleports into disabled players’ loaded chunks are now cancelled, while enabled players nearby still allow them.

evbzy

someone was saying they couldnt cure zombie villagers so can you fix that because it dissapears

Kodari AI
KodariAug 14 at 1:17 am 2

Zombie-villager curing is now exempt from the spawn filter, so the cured villager remains even in a disabled player’s loaded chunk.

Cured zombie villagers are now exempt from MobToggle’s spawn cancellation, so curing succeeds normally.

evbzy

make it so if a villager turns into a zombie villager while the chunk is loaded it wont despawn it

Kodari AI
KodariAug 14 at 1:19 am 1

Zombie-villager conversions are now exempt from the spawn filter.

Villager-to-zombie-villager conversions (INFECTION) are now exempt, so they will not disappear in chunks loaded by players with mob spawning disabled.

evbzy

remove the last two prompts

Kodari AI
KodariAug 14 at 1:28 am 1

Removed the zombie-villager curing and infection exemptions.

evbzy

wen people are breeding villagers their villagers dissapear and the iron golems and stuff fix issues like this

Kodari AI
KodariAug 29 at 5:08 pm 3
  • Preserve mob creation caused by gameplay transformations, breeding, structures, and player actions.

  • Continue blocking only ordinary environmental spawning in chunks where every nearby player has spawning disabled.

  • Keep mixed-player chunks enabled as before.

Fixed the spawn filter to block only environmental spawning:

  • Villager breeding no longer removes baby villagers.

  • Villager infection and curing work normally.

  • Iron golems created by villagers or players remain.

  • Player-created, transformed, summoned, or structure-generated mobs remain.

  • Natural, chunk-generation, jockey, and patrol spawns are still blocked when all nearby players have spawning disabled.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
10 342
src/main/java/com/kodari/mobtoggle/MobTogglePlugin.java
package com.kodari.mobtoggle;

import com.kodari.mobtoggle.command.MobToggleCommand;
import com.kodari.mobtoggle.listener.MobSpawnListener;
import com.kodari.mobtoggle.listener.MobToggleMenuListener;
import com.kodari.mobtoggle.storage.PlayerToggleStorage;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

public final class MobTogglePlugin extends JavaPlugin {

    private PlayerToggleStorage toggleStorage;

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

        toggleStorage = new PlayerToggleStorage(this);
        toggleStorage.load();

        Bukkit.getPluginManager().registerEvents(new MobSpawnListener(toggleStorage), this);
        Bukkit.getPluginManager().registerEvents(new MobToggleMenuListener(toggleStorage), this);

        PluginCommand command = Objects.requireNonNull(getCommand("mobtoggle"), "mobtoggle command is missing from plugin.yml");
        command.setExecutor(new MobToggleCommand(toggleStorage));
    }

    @Override
    public void onDisable() {
        if (toggleStorage != null) {
            toggleStorage.save();
        }
    }
}