resker_official

write me a plugin that if someone joins that is not opped everything is stone for them and if an opped user does the command /antiflash HGGZJS it makes everything back to normal instead of stone so it brings back the blocks but only for himself

Kodari AI
KodariApr 29 at 7:26 pm 7,793 (v2)

I’ll create an anti-flash authentication plugin where everyone sees stone blocks until opped users unlock with a password.

AntiFlash
A security plugin that obfuscates all blocks as stone for players until they authenticate. Non-opped players always see stone blocks, while opped players must use a password command to unlock normal block rendering. Features per-player visual manipulation, persistent unlock tracking, and configurable password protection. Ideal for protecting builds from reconnaissance or preventing grief coordination.

I’ll use Bukkit’s sendBlockChange API to modify what blocks players see without needing ProtocolLib, making it simple and compatible.

Plugin created! AntiFlash obfuscates all blocks as stone until opped players authenticate with /antiflash HGGZJS. Non-opped players always see stone. The unlock status persists across restarts, and the visual changes are per-player only.

resker_official
📎 1 file 1,467 chars
📄
pasted-code-1777638730210.txt
txt 12 lines
▶
[12:32:13 WARN]: [AntiFlash] Task #9 for AntiFlash v1.0 generated an exception
java.lang.IllegalAccessError: class com.antiflash.PlayerListener$1 tried to access private field com.antiflash.PlayerListener.plugin (com.antiflash.PlayerListener$1 and com.antiflash.PlayerListener are in unnamed module of loader 'AntiFlash-1.0.jar' @11e739c6)
	at AntiFlash-1.0.jar//com.antiflash.PlayerListener$1.run(PlayerListener.java:25) ~[?:?]
	at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:78) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:474) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1802) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1655) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.dedicated.DedicatedServer.tickServer(DedicatedServer.java:449) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.processPacketsAndTick(MinecraftServer.java:1713) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1383) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:304) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?]
resker_official

use protocol lib

📎 1 file 1,467 chars
📄
pasted-code-1777731904680.txt
txt 12 lines
▶
[12:32:13 WARN]: [AntiFlash] Task #9 for AntiFlash v1.0 generated an exception
java.lang.IllegalAccessError: class com.antiflash.PlayerListener$1 tried to access private field com.antiflash.PlayerListener.plugin (com.antiflash.PlayerListener$1 and com.antiflash.PlayerListener are in unnamed module of loader 'AntiFlash-1.0.jar' @11e739c6)
	at AntiFlash-1.0.jar//com.antiflash.PlayerListener$1.run(PlayerListener.java:25) ~[?:?]
	at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:78) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:474) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1802) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1655) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.dedicated.DedicatedServer.tickServer(DedicatedServer.java:449) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.processPacketsAndTick(MinecraftServer.java:1713) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1383) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:304) ~[paper-26.1.2.jar:26.1.2-52-174eab0]
	at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?]
Kodari AI
KodariMay 2 at 2:29 pm 35,474 (v2)

I’ll switch to ProtocolLib for packet-level block manipulation and fix the access error.

Now update the main class to remove the periodic update task since ProtocolLib handles everything automatically:

Perfect! I’ve converted the plugin to use ProtocolLib for packet-level block manipulation and fixed the access error.

Changes Made:

  1. Added ProtocolLib - dependency in build.gradle and plugin.yml

  2. Rewrote VisualManager - now intercepts chunk packets (PacketPlayOutLevelChunkWithLight) and block change packets, replacing all solid blocks with stone for non-unlocked players

  3. Fixed IllegalAccessError - removed the problematic BukkitRunnable that accessed private fields

  4. Removed periodic tasks - ProtocolLib handles everything automatically via packet listeners

  5. Simplified config - removed visual-radius and update-interval (no longer needed)

How It Works:

  • ProtocolLib intercepts all chunk and block packets before they reach players

  • For non-unlocked players, all solid blocks are automatically replaced with stone in the packet data

  • When an opped player runs /antiflash HGGZJS, they’re unlocked and chunks refresh to show real blocks

  • Much more efficient - no periodic tasks, works automatically for all world updates

The plugin now requires ProtocolLib to be installed on the server.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
8 355
src/main/java/com/antiflash/AntiFlash.java
package com.antiflash;

import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public final class AntiFlash extends JavaPlugin {

    private DataManager dataManager;
    private VisualManager visualManager;
    private Set<UUID> unlockedPlayers;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.dataManager = new DataManager(this);
        this.unlockedPlayers = dataManager.loadUnlockedPlayers();
        this.visualManager = new VisualManager(this, unlockedPlayers);
        
        getCommand("antiflash").setExecutor(new UnlockCommand(this));
        getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
        
        getLogger().info("AntiFlash enabled! All players will see stone blocks until unlocked.");
    }

    @Override
    public void onDisable() {
        dataManager.saveUnlockedPlayers(unlockedPlayers);
        
        getLogger().info("AntiFlash disabled.");
    }

    public boolean isUnlocked(Player player) {
        return unlockedPlayers.contains(player.getUniqueId());
    }

    public void unlockPlayer(Player player) {
        unlockedPlayers.add(player.getUniqueId());
        dataManager.saveUnlockedPlayers(unlockedPlayers);
    }

    public Set<UUID> getUnlockedPlayers() {
        return unlockedPlayers;
    }
}