kimsookju

1.21.11 plugin papaer

📎 1 file 1,701 chars
📄
pasted-code-1787049151140.txt
txt 61 lines
▶
Create a Minecraft Java Edition mod that completely disables entities during a challenge.

### Commands

* `/noentt start`
* `/noentt stop`

### `/noentt start`

When activated:

* Immediately remove **every existing entity in the entire world**.
* Prevent all entities from spawning or being created afterward.
* Players must remain unaffected.

This includes:

* Mobs, animals, monsters
* Villagers and wandering traders
* Boats and minecarts
* Armor stands, item frames, paintings
* Dropped items
* XP orbs
* Arrows and all projectiles
* Ender pearls, snowballs, eggs
* Fishing bobbers
* TNT entities
* Falling blocks
* Any other vanilla or modded entity

The world must contain **zero non-player entities** while the challenge is active.

### Entity Prevention

While active:

* Block natural mob spawning.
* Block entity creation from blocks and players.
* Block dropped items and XP orbs.
* Block projectiles and vehicles.
* Block entities created by commands.
* Prevent modded entities when possible.
* If an entity somehow bypasses the prevention system, immediately remove it.

Use appropriate entity/spawn hooks for the target Minecraft version. Do not rely only on disabling mob spawning.

### `/noentt stop`

* Disable the challenge.
* Restore normal entity spawning and creation.
* Do not permanently modify the world.
* Minecraft should return to normal behavior immediately.

### Requirements

* Multiplayer compatible.
* `/noentt start` and `/noentt stop` should be safe to run repeatedly.
* Challenge state should remain active until `/noentt stop`.
* Players can still move, place blocks, break blocks, and play normally.
* Keep the mod lightweight and avoid unnecessary processing.
Kodari AI
KodariAug 18 at 10:34 am 1
EntityVoidChallenge
A Bukkit/Paper plugin that completely disables all non-player entities during a challenge mode. Provides /noentt start and /noentt stop commands. On activation, instantly removes every existing entity in the world including mobs, animals, villagers, vehicles, projectiles, dropped items, XP orbs, and modded entities. Prevents all entity spawning through natural spawn blocking, entity creation event cancellation, and projectile/vehicle prevention. Includes a safety sweep that removes any bypassing entities. Players remain fully functional with movement, block placement, and breaking. Multiplayer compatible with safe repeated command execution. Lightweight design with minimal processing overhead, restoring normal behavior immediately on deactivation.
  1. Create the Paper 1.21.11 Gradle project and plugin metadata.

  2. Implement the challenge manager with immediate cleanup and a lightweight active-state safety sweep.

  3. Register command and Paper/Bukkit entity-prevention listeners.

Implemented the Paper 1.21.11 NoEntt plugin.

  • Added Gradle project configuration targeting Java 21 and Paper API 1.21.11.

  • Added /noentt start and /noentt stop with operator permission.

  • Removes all existing non-player entities across loaded worlds when started.

  • Blocks entity spawning, item drops, projectiles, vehicles, hanging entities, fishing hooks, and loaded entities.

  • Runs an active safety sweep every tick to remove entities that bypass event prevention.

  • Players remain unaffected, and stopping restores normal entity behavior.

kimsookju

엔더드래곤은 엔티티 삭제 대상에서 제외하고, 아이템 떨어드릴수있게 해줘

Kodari AI
KodariAug 18 at 11:17 am 1
  1. 엔더 드래곤을 모든 삭제·차단 대상에서 제외합니다.

  2. 아이템 드롭 차단을 해제하되, 기존 엔티티 전면 차단은 유지합니다.

엔더 드래곤 예외 처리를 먼저 적용합니다. 엔더 드래곤은 기존 개체 정리, 로드된 개체 정리, 주기적 안전 정리, 신규 스폰 차단에서 모두 제외됩니다.

아이템 드롭은 PlayerDropItemEvent만 허용하는 것으로는 부족하므로, 실제로 생성되는 Item 엔티티도 스폰 차단·안전 정리에서 제외하고 드롭 이벤트 취소 로직을 제거합니다. XP 오브와 기타 엔티티는 계속 차단됩니다.변경 완료했습니다.

  • 엔더 드래곤(EnderDragon)

    • 기존 월드 정리 대상에서 제외

    • 신규 스폰 차단 대상에서 제외

    • 주기적인 안전 정리 대상에서 제외

  • 떨어진 아이템(Item)

    • 플레이어가 아이템을 떨어뜨릴 수 있도록 허용

    • 아이템 엔티티 스폰 허용

    • 기존 아이템 삭제 대상에서 제외

  • XP 오브, 투사체, 차량, 몹 등 나머지 엔티티 차단은 유지됩니다.

kimsookju

명령어가 없어 +23w13a_or_bq버전도 가능하게해줘

Kodari AI
KodariSep 12 at 2:16 pm 1
  1. /noentt 명령어 미등록 원인을 확인하고 실제 실행 가능하도록 수정합니다.

  2. 23w13a_or_b 데이터팩 버전 표기를 포함해 해당 버전에서도 동작하도록 호환 설정을 추가합니다.

수정했습니다.

  • /noentt 명령어 등록 확인 로직 추가

  • plugin.yml의 명령어 등록 유지 및 누락 시 플러그인 로그에 원인 출력

  • 권한 제한 제거: 이제 OP가 아니어도 /noentt start, /noentt stop 사용 가능

  • api-version을 1.19로 낮춰 Paper 1.19 이상 호환

  • Java 바이트코드 대상 버전을 17로 설정해 구버전 Java 환경 호환성 향상

주의: 23w13a_or_b는 정식 릴리스 버전이 아닌 Minecraft 스냅샷이며, Bukkit/Paper 플러그인을 직접 실행할 수 있는 서버 버전이 아닙니다. 따라서 이 플러그인은 해당 스냅샷 자체가 아니라 Paper 1.19 이상 서버에서 사용할 수 있습니다.

변경 후에는 /reload보다 서버를 완전히 재시작해야 하며, 그래도 명령어가 없으면 콘솔에 표시되는 플러그인 로딩 오류를 확인해야 합니다.

kimsookju

흙블록이 아주 잘만 나오는데?

Kodari AI
KodariSep 12 at 2:20 pm 1

흙이 아이템으로 떨어지는 것은 현재 요청대로 허용된 상태이고, 흙 블록이 낙하 블록 엔티티로 생성되거나 엔티티가 블록을 변경하는 경우는 별도로 차단해야 합니다. 해당 이벤트를 추가해 즉시 취소·삭제하겠습니다.

흙 블록이 낙하 블록 엔티티로 생성되거나 엔티티에 의해 블록으로 변경되는 경우를 차단하도록 수정했습니다.

  • EntityChangeBlockEvent 취소

  • 해당 엔티티 즉시 삭제

  • 기존 엔더 드래곤 예외 유지

  • 플레이어의 정상적인 블록 설치·파괴는 유지

  • 플레이어가 떨어뜨리는 아이템과 블록 파괴로 나오는 아이템은 계속 허용

서버를 완전히 재시작한 뒤 다시 테스트하면 됩니다.

kimsookju

아니 블록캐면 아이템이 잘 나온다니까? 모든 엔티티를 없애라고

Kodari AI
KodariSep 12 at 2:24 pm 3

아이템 엔티티 예외가 남아 있어서 블록을 캘 때 드롭이 유지되고 있었습니다. 엔더 드래곤만 예외로 두고, 드롭 아이템을 포함한 모든 비플레이어 엔티티를 즉시 제거·생성 차단합니다.

수정했습니다. 블록을 캘 때 생성되는 드롭 아이템도 이제 엔티티로 즉시 차단·삭제됩니다.

  • 엔더 드래곤만 예외

  • 플레이어 외 모든 엔티티 삭제

  • 아이템 드롭, XP, 투사체, 몹, 차량 등 전부 차단

  • /noentt start 상태에서 블록을 캐도 아이템이 남지 않습니다.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
7 287
src/main/java/com/kodari/noentt/NoEnttPlugin.java
package com.kodari.noentt;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class NoEnttPlugin extends JavaPlugin {
    private EntitySuppressionManager suppressionManager;

    @Override
    public void onEnable() {
        suppressionManager = new EntitySuppressionManager(this);

        Bukkit.getPluginManager().registerEvents(
                new EntitySuppressionListener(suppressionManager), this);

        NoEnttCommand command = new NoEnttCommand(suppressionManager);
        if (getCommand("noentt") == null) {
            getLogger().severe("The /noentt command is missing from plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        getCommand("noentt").setExecutor(command);
        getCommand("noentt").setTabCompleter(command);
    }

    @Override
    public void onDisable() {
        if (suppressionManager != null) {
            suppressionManager.shutdown();
        }
    }
}