J
J
JiMoon2021-12-26 09:08:31
Java
JiMoon, 2021-12-26 09:08:31

Why is the error displayed and how to fix it?

bonsuar (sorry for not asking a question on rubukkit.org)
I am writing my minecraft plugin, and my passage is underlined in red
19 line, for loop, player variable
help(
Code:

package me.dicksuckerjimoon.jimoonreward;

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

import java.io.IOException;

public class DonateDiscordAPI extends JavaPlugin {

    private DonateDiscordAPI plugin;

    public DonateDiscordAPI(Main main) {
        this.plugin = plugin;
    }

    public static void getPlayerGroup(Player player) throws IOException {
        for (Player <b>player</b> : Bukkit.getOfflinePlayers()) {
            if (player.hasPermission("group.default")) {
                Runtime.getRuntime().exec("/bin/bash -c python3 /Users/antongorestov/JiMoonProjects/JiMoonDonate/test.py");
            }
    }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergey, 2021-12-26
@Jimoon

Java syntax forbids reassigning the name of a variable that is already declared in the outer scope
you have the same variable name in the loop and in the method argumentplayer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question