Plugin not working and showing as non-mod

I tried to create my own plugin for privates, just to learn how to create plugins, but the plugin doesn’t work, and in the console it is mentioned only once as “non-mod”.
Console log:

[18:34:35] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[18:34:35] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[18:34:35] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[18:34:35] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2860 for Minecraft 1.12.2 loading
[18:34:35] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_341, running on Windows 11:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_341
[18:34:35] [main/INFO] [FML]: Searching E:\server huini\.\mods for mods
[18:34:35] [main/INFO] [FML]: Loading tweaker org.spongepowered.asm.launch.MixinTweaker from spongeforge-1.12.2-2838-7.4.7.jar
[18:34:35] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:34:35] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.launch.MixinTweaker
[18:34:35] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.8 Source=file:/E:/server%20huini/./mods/spongeforge-1.12.2-2838-7.4.7.jar Service=LaunchWrapper Env=SERVER
[18:34:36] [main/WARN] [FML]: The coremod SpongeCoremod (org.spongepowered.mod.SpongeCoremod) is not signed!
[18:34:36] [main/INFO] [mixin]: Compatibility level set to JAVA_8
[18:34:36] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[18:34:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:34:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[18:34:36] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:34:40] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[18:34:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[18:34:40] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.launch.MixinTweaker
[18:34:40] [main/INFO] [mixin]: Initialised Mixin FML Remapper Adapter with net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper@27e32fe4
[18:34:40] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[18:34:42] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[18:34:42] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.mixin.EnvironmentStateTweaker
[18:34:42] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[18:34:42] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.mixin.EnvironmentStateTweaker
[18:34:52] [main/WARN] [mixin]: @Mixin target net/minecraft/block/state/BlockStateContainer$StateImplementation is public in mixins.common.api.json:mcp.block.state.StateImplementationMixin_API and should be specified in value
[18:35:41] [main/WARN] [mixin]: Static binding violation: PRIVATE @Overwrite method func_189509_E in mixins.common.core.json:world.WorldMixin cannot reduce visibiliy of PUBLIC target method, visibility will be upgraded.
[18:35:57] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[18:36:25] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.12.2
[18:36:26] [Server thread/INFO] [FML]: MinecraftForge v14.23.5.2860 Initialized
[18:36:26] [Server thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[18:36:26] [Server thread/INFO] [FML]: Invalid recipe found with multiple oredict ingredients in the same ingredient...
[18:36:26] [Server thread/INFO] [FML]: Replaced 1227 ore ingredients
[18:36:29] [Server thread/INFO] [Sponge]: Found mcmod.info at jar:file:/E:/server%20huini/./mods/spongeforge-1.12.2-2838-7.4.7.jar!/mcmod.info
[18:36:29] [Server thread/INFO] [Sponge]: Creating injector in stage 'PRODUCTION'
[18:36:40] [Server thread/INFO] [FML]: Searching E:\server huini\.\mods for mods
[18:36:40] [Server thread/INFO] [FML]: Searching %s for plugins
[18:36:41] [Server thread/INFO] [FML]: Forge Mod Loader has identified 7 mods to load
[18:36:41] [Server thread/WARN] [FML]: Missing English translation for FML: assets/fml/lang/en_us.lang
[18:36:41] [Server thread/WARN] [FML]: Missing English translation for spongeapi: assets/spongeapi/lang/en_us.lang
[18:36:41] [Server thread/WARN] [FML]: Missing English translation for spongeforge: assets/spongeforge/lang/en_us.lang
[18:36:41] [Server thread/INFO] [FML]: FML has found a non-mod file plugin-for-no-name.jar in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.
[18:36:41] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, spongeapi, sponge, spongeforge] at CLIENT
[18:36:41] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, spongeapi, sponge, spongeforge] at SERVER
[18:36:42] [Server thread/WARN] [Sponge]: There's no certificate fingerprint available
[18:36:42] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[18:36:42] [Server thread/INFO] [FML]: Found 1168 ObjectHolder annotations
[18:36:42] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[18:36:42] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[18:36:42] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[18:36:42] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[18:36:42] [Server thread/INFO] [org.spongepowered.mod.SpongeMod]: Log test
[18:36:44] [Server thread/INFO] [FML]: Applying holder lookups
[18:36:44] [Server thread/INFO] [FML]: Holder lookups applied
[18:36:44] [Server thread/INFO] [FML]: Applying holder lookups
[18:36:44] [Server thread/INFO] [FML]: Holder lookups applied
[18:36:44] [Server thread/WARN] [FML]: Potentially Dangerous alternative prefix `sponge` for name `human`, expected `spongeforge`. This could be a intended override, but in most cases indicates a broken mod.
[18:36:44] [Server thread/INFO] [FML]: Applying holder lookups
[18:36:44] [Server thread/INFO] [FML]: Holder lookups applied
[18:36:44] [Server thread/INFO] [FML]: Applying holder lookups
[18:36:44] [Server thread/INFO] [FML]: Holder lookups applied
[18:36:44] [Server thread/INFO] [FML]: Injecting itemstacks
[18:36:44] [Server thread/INFO] [FML]: Itemstack injection complete
[18:36:44] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Loading properties
[18:36:44] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Default game type: SURVIVAL
[18:36:44] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Generating keypair
[18:36:44] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting Minecraft server on *:25565
[18:36:44] [Server thread/INFO] [net.minecraft.network.NetworkSystem]: Using default channel type
[18:36:45] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: AHEAD Target: null
[18:36:45] [Forge Version Check/INFO] [forge.VersionCheck]: [spongeforge] Starting version check at https://files.minecraftforge.net/maven/org/spongepowered/spongeforge/promotions_slim.json
[18:36:45] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[18:36:45] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: The server will make no attempt to authenticate usernames. Beware.
[18:36:45] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[18:36:45] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: To change this, set "online-mode" to "true" in the server.properties file.
[18:36:46] [Server thread/INFO] [FML]: Applying holder lookups
[18:36:46] [Server thread/INFO] [FML]: Holder lookups applied
[18:36:46] [Server thread/INFO] [FML]: Injecting itemstacks
[18:36:46] [Server thread/INFO] [FML]: Itemstack injection complete
[18:36:46] [Forge Version Check/INFO] [forge.VersionCheck]: [spongeforge] Found status: OUTDATED Target: 7.1.2
[18:36:46] [Server thread/INFO] [FML]: Forge Mod Loader has successfully loaded 7 mods
[18:36:47] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Preparing level "world"
[18:36:47] [Server thread/INFO] [Sponge]: Checking for worlds that need to be migrated...
[18:36:47] [Server thread/INFO] [Sponge]: No worlds were found in need of migration.
[18:36:47] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[18:36:48] [Server thread/INFO] [FML]: Applying holder lookups
[18:36:48] [Server thread/INFO] [FML]: Holder lookups applied
[18:36:49] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[18:36:50] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 6 advancement trees
[18:36:50] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing start region for world world (minecraft:overworld/0)
[18:36:51] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 0%
[18:36:52] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 9%
[18:36:53] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 48%
[18:36:54] [Server thread/INFO] [Sponge]: Loading world [world] (minecraft:overworld/0)
[18:36:55] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[18:36:55] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 6 advancement trees
[18:36:55] [Server thread/INFO] [Sponge]: Loading world [DIM-1] (minecraft:nether/-1)
[18:36:55] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[18:36:55] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 6 advancement trees
[18:36:55] [Server thread/INFO] [Sponge]: Loading world [DIM1] (minecraft:the_end/1)
[18:36:55] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Done (8,876s)! For help, type "help" or "?"
[18:37:55] [Netty Server IO #2/INFO] [FML]: Client protocol version 2
[18:37:55] [Netty Server IO #2/INFO] [FML]: Client attempting to join with 5 mods : [email protected],[email protected],[email protected],[email protected],[email protected]
[18:37:55] [Netty Server IO #2/INFO] [FML]: Attempting connection with missing mods [spongeapi, sponge, spongeforge] at CLIENT
[18:37:55] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[18:37:55] [Server thread/INFO] [net.minecraft.server.management.PlayerList]: VPStarPlatinum [/127.0.0.1:61831] logged in with entity id [344] in world (minecraft:overworld/0) at (-199.78587354425133, 75.0, 364.59704758848665).
[18:37:55] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: VPStarPlatinum joined the game
[18:41:23] [Server thread/INFO] [net.minecraft.network.NetHandlerPlayServer]: VPStarPlatinum lost connection: Disconnected
[18:41:29] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: VPStarPlatinum left the game
[18:41:29] [Server thread/WARN] [net.minecraft.server.MinecraftServer]: Can't keep up! Did the system time change, or is the server overloaded? Running 5779ms behind, skipping 115 tick(s)
[18:41:31] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Unknown command. Try /help for a list of commands
[18:41:33] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Unknown command. Try /help for a list of commands
[18:41:35] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Stopping the server
[18:41:35] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server
[18:41:35] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players
[18:41:35] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds
[18:41:35] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'world'/0
[18:41:35] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'DIM-1'/-1
[18:41:35] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'DIM1'/1
[18:41:35] [Server thread/INFO] [Sponge]: Unloading world [world] (minecraft:overworld/0)
[18:41:35] [Server thread/INFO] [Sponge]: Unloading world [DIM-1] (minecraft:nether/-1)
[18:41:35] [Server thread/INFO] [Sponge]: Unloading world [DIM1] (minecraft:the_end/1)

Plugin code:

package idi.nahui.pluginfornoname;

import com.google.inject.Inject;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.LinearComponents;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.format.TextDecoration;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.api.Server;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.parameter.Parameter;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Cancellable;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.block.InteractBlockEvent;
import org.spongepowered.api.event.lifecycle.ConstructPluginEvent;
import org.spongepowered.api.event.lifecycle.RegisterCommandEvent;
import org.spongepowered.api.event.lifecycle.StartingEngineEvent;
import org.spongepowered.api.event.lifecycle.StoppingEngineEvent;
import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.math.vector.Vector3i;
import org.spongepowered.plugin.PluginContainer;
import org.spongepowered.plugin.builtin.jvm.Plugin;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

import java.io.*;
import java.util.*;
import java.util.ArrayList;

/**
 * The main class of your Sponge plugin.
 *
 * <p>All methods are optional -- some common event registrations are included as a jumping-off point.</p>
 */
@Plugin("plugin-for-no-name")
public class Plugin_for_no_name {

    private final PluginContainer container;
    private final Logger logger;
    private Map<UUID, Territory> privateTerritories;

    @Inject
    Plugin_for_no_name(final PluginContainer container, final Logger logger) {
        this.container = container;
        this.logger = logger;
    }

    @Listener
    public void onConstructPlugin(final ConstructPluginEvent event) {
        // Perform any one-time setup
        this.logger.info("test");
    }
    @Listener
    public void onServerStarting(final StartingEngineEvent<Server> event) {
        // Any setup per-game instance. This can run multiple times when
        // using the integrated (singleplayer) server.
        privateTerritories = new HashMap<>();
        loadTerritories();
    }

    @Listener
    public void onServerStopping(final StoppingEngineEvent<Server> event) {
        // Any tear down per-game instance. This can run multiple times when
        // using the integrated (singleplayer) server.
        saveTerritories();
    }

    @Listener
    public void onRegisterCommands(final RegisterCommandEvent<Command.Parameterized> event) {
        // Register a simple command
        // When possible, all commands should be registered within a command register event
        final Parameter.Value<String> nameParam = Parameter.string().key("name").build();
        event.register(this.container, Command.builder()
            .addParameter(nameParam)
            .permission("plugin-for-no-name.command.greet")
            .executor(ctx -> {
                final String name = ctx.requireOne(nameParam);
                ctx.sendMessage(Identity.nil(), LinearComponents.linear(
                    NamedTextColor.AQUA,
                    Component.text("Hello "),
                    Component.text(name, Style.style(TextDecoration.BOLD)),
                    Component.text("!")
                ));

                return CommandResult.success();
            })
            .build(), "greet", "wave");
        event.register(this.container, Command.builder()
                .shortDescription(Component.text("set pos 1"))
                .executor(src -> {
                    if (src instanceof Player) {
                        Player player = (Player) src;
                        privateTerritories.putIfAbsent(player.uniqueId(), new Territory());
                        Territory territory = privateTerritories.get(player.uniqueId());
                        territory.SetPos1(player.blockPosition());
                        player.sendMessage(Component.text("done"));
                    }
                    return CommandResult.success();
                })
                .build(), "setPos1");
        event.register(this.container, Command.builder()
                .shortDescription(Component.text("set pos 2"))
                .executor(src -> {
                    if (src instanceof Player) {
                        Player player = (Player) src;
                        privateTerritories.putIfAbsent(player.uniqueId(), new Territory());
                        Territory territory = privateTerritories.get(player.uniqueId());
                        territory.SetPos2(player.blockPosition());
                        player.sendMessage(Component.text("done"));
                    }
                    return CommandResult.success();
                })
                .build(), "setPos2");
        event.register(this.container, Command.builder()
                .shortDescription(Component.text("Заприватить территорию"))
                .executor(src -> {
                    if (src instanceof Player) {
                        Player player = (Player) src;
                        Territory territory = privateTerritories.get(player.uniqueId());
                        if (territory != null && territory.isComplete()) {
                            territory.SetOwner(player.uniqueId());
                            player.sendMessage(Component.text("the territory is locked"));
                            saveTerritories();
                        } else {
                            player.sendMessage(Component.text("for private you need to put 2 positions"));
                        }
                    }
                    return CommandResult.success();
                })
                .build(), "privateTerritory");
    }
    @Listener
    public void onInteractBlock(InteractBlockEvent event) {
        if (event.cause().first(Player.class).isPresent()) {
            Player player = event.cause().first(Player.class).get();
            privateTerritories.forEach((uuid, territory) -> {
                if (territory.isInside(event.block().position()) && event instanceof Cancellable) {
                    ((Cancellable) event).setCancelled(true);
                    player.sendMessage(Component.text("You cannot interact with blocks in this area!"));
                }
            });
        }
    }
    private void saveTerritories() {
        try (FileOutputStream fileOut = new FileOutputStream("territories.ser");
             ObjectOutputStream out = new ObjectOutputStream(fileOut)) {
            out.writeObject(privateTerritories);
            out.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void loadTerritories() {
        try (FileInputStream fileIn = new FileInputStream("territories.ser");
             ObjectInputStream in = new ObjectInputStream(fileIn)) {
            Object obj = in.readObject();
            if (obj instanceof Map) {
                privateTerritories = (Map<UUID, Territory>) obj;
            }
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }


    private class Territory
    {
        private UUID ownerID;
        public Vector3i pos1;
        public Vector3i pos2;

        public void SetOwner(UUID playerID)
        {
            this.ownerID = playerID;
        }
        public void SetPos1(Vector3i pos1)
        {
            this.pos1 = pos1;
        }
        public void SetPos2(Vector3i pos2)
        {
            this.pos2 = pos2;
        }
        public boolean isComplete() {
            return pos1 != null && pos2 != null;
        }
        public boolean isInside(Vector3i position) {
            if (pos1 != null && pos2 != null) {
                int minX = Math.min(pos1.x(), pos2.x());
                int minY = Math.min(pos1.y(), pos2.y());
                int minZ = Math.min(pos1.z(), pos2.z());
                int maxX = Math.max(pos1.x(), pos2.x());
                int maxY = Math.max(pos1.y(), pos2.y());
                int maxZ = Math.max(pos1.z(), pos2.z());

                return position.x() >= minX && position.x() <= maxX &&
                        position.y() >= minY && position.y() <= maxY &&
                        position.z() >= minZ && position.z() <= maxZ;
            }
            return false;
        }
    }
}

You have written code for api 8 while your server is api 7. Api 8 changed how plugins boot so this is why its being detected as a none plugin. Hope this helps

Thanks a lot. That is, I need to put “7 - Lambdas” in the “Language Level” column in the project settings? There’s also an “SDK” here, but that’s not it, right?

I dont know what you mean. I think your not saying all the information required for that statement to make sense.

As in what Language Level and what SDK? And where is here

Oh do you mean Intellij? Setting up the sdk? And language level (you mean 8 - Lamdas).

If you use maven or gradle project then that is done for you. It is highly recommended you do that. More info on the docs.

https://docs.spongepowered.org/stable/en-GB/plugin/workspace/idea.html

Yes, I am using Intellij Idea. I followed the instructions, but I feel like I’m missing something. After the command instructions, logger.info() and so on still don’t work. Plugin is only mentioned once in the console as “non-mod”. Maybe I just put the plugin in the wrong place? I put the plugin in the “mods->plugins” folder. And I put the SpongeForge in the “mods” folder

If your still using api 8, can i make sure you have the sponge_plugins.json file inside the META-INF folder?

https://docs.spongepowered.org/stable/en-GB/plugin/plugin-meta.html

If your using API 7 then the plugins just go in the mods folder

Now I’ll try to put the plugin just in the “mods” folder. And yes I have a sponge_plugins.json file inside the META-INF folder

No, nothing worked

Can i make sure that the .jar has the file inside by opening it up with winrar or something (if you are on windows and done have a jar opener then you can change the .jar to .zip and then extract the files.

From there it needs to be META-INF/sponge_plugins.json

Are you using api 7 or api 8?

As for the API version, I’m not entirely sure, but I think it’s API 8

Api version doesnt have anything to do with java version.

Api version has to do with the minecraft version.

1.12.2 = api 7
1.16.5 = api 8

How to downgrade to API 7? Of course, I poked here, but I’m not sure that I did everything right. Now all my code is in error)

Api 7 is very different to 8 (thanks to changes in minecraft 1.13) so it will fill out in errors.

Thankfully the sponge docs can help you. The bar on the left can open up and at the bottom there is a option for 7.4.0. if you click that it will open the docs in api 7 mode

If you have any particular questions then by all means ask. I dont have much to go off from “everything is in error”

Well, for example, in the paragraph “Creating a plugin » Commands » Creating a team” in the instructions for API 7.4.0, it is shown that the command should be created like this:

import org.spongepowered.api.Sponge;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.command.spec.CommandSpec;

PluginContainer plugin = ...;

CommandSpec myCommandSpec = CommandSpec.builder()
    .description(Text.of("Hello World Command"))
    .permission("myplugin.command.helloworld")
    .executor(new HelloWorldCommand())
    .build();

Sponge.getCommandManager().register(plugin, myCommandSpec, "helloworld", "hello", "test");

But I just can’t find the CommandSpec class and Sponge.getCommandManager
I can register a command only in the old way for API 8 and higher:

event.register(this.container, Command.builder()
                .shortDescription(Component.text("set pos 1"))
                .executor(src -> {
                    if (src instanceof Player) {
                        Player player = (Player) src;
                        privateTerritories.putIfAbsent(player.uniqueId(), new Territory());
                        Territory territory = privateTerritories.get(player.uniqueId());
                        territory.setPos1(player.blockPosition());
                        player.sendMessage(Component.text("done"));
                    }
                    return CommandResult.success();
                })
                .build(), "setPos1");

also build.gradle.kts I changed to version 7.4.0:

@file:Suppress("DEPRECATION")

import org.spongepowered.gradle.plugin.config.PluginLoaders
import org.spongepowered.plugin.metadata.model.PluginDependency

plugins {
    `java-library`
    id("org.spongepowered.gradle.plugin") version "0.9.0"
}

group = "idi.nahui"
version = "1.0-SNAPSHOT"

repositories {
    jcenter()
}

sponge {
    apiVersion("7.2.0")
    license("All-Rights-Reserved")
    loader {
        name(PluginLoaders.JAVA_PLAIN)
        version("1.0")
    }
    plugin("plugin-for-no-name") {
        displayName("plugin-for-no-name")
        entrypoint("idi.nahui.pluginfornoname.Plugin_for_no_name")
        description("My plugin description")
        links {
            // homepage("https://spongepowered.org")
            // source("https://spongepowered.org/source")
            // issues("https://spongepowered.org/issues")
        }
        dependency("spongeapi") {
            loadOrder(PluginDependency.LoadOrder.AFTER)
            optional(false)
        }
    }
}

val javaTarget = 7
java {
    sourceCompatibility = JavaVersion.toVersion(javaTarget)
    targetCompatibility = JavaVersion.toVersion(javaTarget)
    if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
        toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
    }
}

tasks.withType(JavaCompile::class).configureEach {
    options.apply {
        encoding = "utf-8" // Consistent source file encoding
        if (JavaVersion.current().isJava10Compatible) {
            release.set(javaTarget)
        }
    }
}

// Make sure all tasks which produce archives (jar, sources jar, javadoc jar, etc) produce more consistent output
tasks.withType(AbstractArchiveTask::class).configureEach {
    isReproducibleFileOrder = true
    isPreserveFileTimestamps = false
}

Am I forgetting something? I also followed all the steps in “Creating Plugin » Preparing Workspace » Configuring IntelliJ IDEA” (specifically about configuring Intelluj IDEA)

You havent changed the api target. You have changed the java target which is the version of java to use. This needs to be set to 8 on API 7 as API 7 cannot use a newer or older Java version.

The spongeGradle your using is designed for API 8 as proven by the loader.

It maybe best if you dont use sponge gradle for api 7 and just specify sponge as a dependency

plugins {
    `java-library`
}

group = "idi.nahui"
version = "1.0-SNAPSHOT"

repositories {
    jcenter()
    maven {
        name = 'sponge-repo'
        url = 'https://repo.spongepowered.org/maven'
    }
}

val javaTarget = 8
java {
    sourceCompatibility = JavaVersion.toVersion(javaTarget)
    targetCompatibility = JavaVersion.toVersion(javaTarget)
    if (JavaVersion.current() < JavaVersion.toVersion(javaTarget)) {
        toolchain.languageVersion.set(JavaLanguageVersion.of(javaTarget))
    }
}

dependencies {
    compile 'org.spongepowered:spongeapi:7.4.0'
}

You can read more here

https://docs.spongepowered.org/7.4.0/en/plugin/project/gradle.html#without-spongegradle

I did as you said, but I think I did something wrong because it only got worse