Morris Luternauer

ask me anything if it is not clear

📎 1 file 2,992 chars
📄
pasted-code-1795341109942.txt
txt 36 lines
▶

### Core Game Loop & Mechanics:
1. **Lobby & Freeze Phase:**
   - The mod must support any number of players.
   - When a game starts, all players are frozen in place (cannot move, jump, or break/place blocks) and are completely invulnerable (no damage taken) while roles are being assigned.
   - Once the role assignment countdown finishes, players are unfrozen and the timers begin.

2. **Role Assignment & Reroll Mechanic:**
   - There are two roles: **Crewmate** (Innocents) and **Impostor**.
   - **Configurable Chance:** Based on a configurable percentage (0% to 100%), the game first rolls whether there is an Impostor in the game at all (e.g., a 20% chance that *nobody* is an Impostor, creating pure paranoia).
   - **Impostor Count:** If the roll succeeds, the game randomly assigns X players as Impostors (configurable number).
   - Players are privately notified of their role via screen.
   - **Reroll:** Every time a Voting Phase ends without an Impostor being caught, all roles are completely re-rolled using the exact same rules (meaning an Impostor could become innocent, an innocent could become an Impostor, or there might suddenly be no Impostor at all).

3. **Win Conditions:**
   - **Crewmates Win:** Either by defeating the Ender Dragon (beating Minecraft) before the global time limit runs out, OR by successfully voting out an Impostor during a Voting Phase.
   - **Impostors Win:** By preventing the Crewmates from beating the Ender Dragon before the global time limit expires (e.g., through subtle sabotage, wasting time, or killing them), without getting caught.

4. **Voting Phase:**
   - Occurs automatically on a recurring timer (e.g., every 20 minutes).
   - During the Voting Phase, all players become invulnerable ("immortal") and optionally frozen or teleported to a safe meeting spot (make this toggleable or keep them frozen in place).
   - Players use a GUI or chat command (e.g., `/vote ` or `/vote skip`) to vote on who they think the Impostor is.
   - **Voting Outcomes:** 
     - If the majority votes for a **Crewmate** (or skips): Nobody dies, the game resumes, and **all roles are immediately re-rolled**.
     - If the majority votes for an **Impostor**: The game ends immediately, and the Crewmates win.

5. **In-Game Configuration Menu (GUI):**
   - Create a clean, user-friendly configuration screen accessible from the main menu / mod list (e.g., using Cloth Config or a custom Screen) and/or via `/impostor config` commands.
   - Configurable settings must include:
     - **Global Speedrun Timer** (in minutes, e.g., default 120 minutes / 2 hours).
     - **Voting Interval** (in minutes, e.g., default 20 minutes).
     - **Voting Duration** (in seconds, e.g., default 60 seconds).
     - **Impostor Spawn Chance** (0% to 100% chance that at least one Impostor exists in the round).
     - **Number of Impostors** (integer, e.g., 1 to 10).
     - **Freeze during Voting** (Boolean: true/false).
Kodari AI
KodariToday at 9:52 am 2
ImpostorSpeedrun
A Minecraft plugin that transforms speedrunning into a social deduction game. Players are frozen and invulnerable during role assignment, then randomly assigned as Crewmate or Impostor based on configurable spawn chance and count. Crewmates win by defeating the Ender Dragon before a global timer expires or by voting out an Impostor during periodic voting phases. Impostors win by preventing dragon defeat through sabotage without being caught. Voting phases occur on a recurring timer with configurable duration, freeze behavior, and GUI-based voting. If voting fails to catch an Impostor, all roles are re-rolled, creating paranoia. Features an in-game configuration GUI for timers, chances, and impostor counts.
  • Add a server-wide game with private roles, timed meetings, voting, and win conditions.

  • Add admin commands for starting, stopping, and configuring games.

Created the Impostor speedrun plugin.

  • Use /impostor start, /impostor stop, and /impostor status to manage a game.

  • Use /impostor config to view and change settings; changes apply to the next game.

  • During meetings, players vote with /vote <player> or /vote skip. A player needs a majority of all current participants to be selected.

  • All online players at the start participate. Players who disconnect leave the game.

Morris Luternauer

how do i install it

Kodari AI
KodariToday at 10:05 am 1
  1. In Kodari, click Compile in the top bar. On mobile, tap ⋮ → Compile Project.

  2. Click Compile, then Download when it succeeds.

  3. Put the downloaded .jar in your server’s plugins folder.

  4. Restart your Paper or Spigot server.

Morris Luternauer

no i dont have a server we play via direct connection how the essential mod does

Kodari AI
KodariToday at 10:06 am 1

This project is a server plugin, so it won’t run in an Essential-hosted world. You’d need a client-compatible mod instead.

Kodari supports Fabric mods for Minecraft 26.3, 26.2, 1.21.11, 1.21.4, 1.20.4, 1.19.4, and 1.18.2. Which Minecraft version are you playing?

Morris Luternauer

26.2

Kodari AI
KodariToday at 10:06 am 1

Kodari supports a Fabric mod for Minecraft 26.2 that can work with an Essential-hosted world.

Switch to Fabric 26.2

Morris Luternauer

Compilation Error Missing required files for Fabric mod

Kodari AI
KodariToday at 10:07 am 3

The build fails because the existing files are still a Bukkit plugin, not a Fabric mod. Adding the missing Fabric files alone won’t fix it—the game logic also needs to be ported to Fabric 26.2 for your Essential-hosted world.

Morris Luternauer

okay do everything to make it possible

Kodari AI
KodariToday at 10:12 am 8
  • Replace the Bukkit plugin with a Fabric mod that runs in the host’s world.

  • Port the game phases, voting, protections, and persistent command-based configuration.

  • Keep role notifications private and make the mod usable over an Essential connection.

Converted the plugin into a Fabric 26.2 mod for an Essential-hosted world. It includes timed rounds, private roles, voting, rerolls, and command-based configuration.

Compile and download the jar in Kodari, then install it alongside Fabric API and Essential. The host can use /impostor start and /impostor config; players vote with /vote <player> or /vote skip.

The build hasn’t been verified yet—if compilation fails, use Auto-fix in the chat.

Morris Luternauer

can u add a timer that pauses on the votings and also a new role a fake impostor his goal is to make the speedrunners belive that he is the impostor

Kodari AI
KodariToday at 3:44 pm 1

Two details before I add the fake impostor:

  1. Should the fake impostor win immediately if voted out, instead of the crewmates winning?

  2. Should the fake impostor be assigned in addition to any real impostors, including in rounds with no real impostor?

I’ll make the global speedrun timer pause during voting and resume afterward.

Morris Luternauer

if the fake impostor is voted out he winns immediately

Kodari AI
KodariToday at 3:44 pm 1

Should every round have one fake impostor in addition to any real impostors, even when the roll selects no real impostor?

Morris Luternauer

yes but i want to configure how many there are

Kodari AI
KodariToday at 3:47 pm 2
  1. Pause the speedrun timer during voting.

  2. Add configurable fake impostors who win if voted out, including in rounds without real impostors.

  • Added an on-screen speedrun timer that pauses during voting.

  • Added fake impostors: if one receives a majority vote, that player wins immediately.

  • Set their number with /impostor config fake-impostor-count <0-10>. Changes apply to the next game.

Fake impostors are assigned independently of the real-impostor chance and are rerolled after inconclusive votes. If there aren’t enough players for both counts, real impostors take priority.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 417
src/main/java/com/kodari/impostor/ImpostorMod.java
package com.kodari.impostor;

import com.mojang.brigadier.arguments.StringArgumentType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.server.permissions.Permissions;
import net.minecraft.world.InteractionResult;

public final class ImpostorMod implements ModInitializer {
    public static final Game GAME = new Game();

    @Override
    public void onInitialize() {
        ServerTickEvents.END_SERVER_TICK.register(GAME::tick);
        ServerLifecycleEvents.SERVER_STOPPED.register(server -> GAME.reset());
        ServerPlayConnectionEvents.DISCONNECT.register((handler, server) -> GAME.disconnect(server, handler.player));
        ServerLivingEntityEvents.ALLOW_DAMAGE.register((entity, source, amount) -> !GAME.protectedPlayer(entity));
        PlayerBlockBreakEvents.BEFORE.register((level, player, pos, state, blockEntity) -> !GAME.frozen(player));
        UseBlockCallback.EVENT.register((player, level, hand, hit) -> GAME.frozen(player) ? InteractionResult.FAIL : InteractionResult.PASS);

        CommandRegistrationCallback.EVENT.register((dispatcher, registry, environment) -> {
            dispatcher.register(Commands.literal("impostor")
                .then(Commands.literal("status").executes(ctx -> {
                    ctx.getSource().sendSuccess(() -> Component.literal(GAME.status()), false);
                    return 1;
                }))
                .then(Commands.literal("start")
                    .requires(source -> source.permissions().hasPermission(Permissions.COMMANDS_MODERATOR))
                    .executes(ctx -> GAME.start(ctx.getSource())))
                .then(Commands.literal("stop")
                    .requires(source -> source.permissions().hasPermission(Permissions.COMMANDS_MODERATOR))
                    .executes(ctx -> GAME.stopCommand(ctx.getSource())))
                .then(Commands.literal("config")
                    .requires(source -> source.permissions().hasPermission(Permissions.COMMANDS_MODERATOR))
                    .executes(ctx -> GAME.showConfig(ctx.getSource()))
                    .then(Commands.argument("setting", StringArgumentType.word())
                        .then(Commands.argument("value", StringArgumentType.word())
                            .executes(ctx -> GAME.configure(ctx.getSource(), StringArgumentType.getString(ctx, "setting"), StringArgumentType.getString(ctx, "value")))))));
            dispatcher.register(Commands.literal("vote")
                .then(Commands.argument("target", StringArgumentType.word())
                    .executes(ctx -> GAME.vote(ctx.getSource().getServer(), ctx.getSource().getPlayerOrException(), StringArgumentType.getString(ctx, "target")))));
        });
    }
}