A
A
Aviloo2022-01-06 21:47:54
Java
Aviloo, 2022-01-06 21:47:54

Concatenation error: value cannot be resolved to a variable?

Hello forumites. I am having trouble concatenating strings in java. Please help!

package rStats.pack.mainlab;
 
import java.util.concurrent.ConcurrentHashMap;
 
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
 
public class PlayerExp implements Listener {
    private static final ConcurrentHashMap<Player, Integer> playersData = new ConcurrentHashMap<>();
    public static void addValue(Player p, int value) {
        playersData.putIfAbsent(p, playersData.getOrDefault(p, 0) + value);
        return;
    }
    public static void getValue(Player p) {
        playersData.getOrDefault(p, 0);
    }
    @EventHandler
    public void BlockBreak(BlockBreakEvent e) {
        Player p = e.getPlayer();
        addValue(p, 10);
        p.sendMessage("Вам начислено 10 очков");
    }
    public void join(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        getValue(p);
        p.sendMessage("Твой уровень равен " + value);
    }
        
}


Mistake:
value cannot be resolved to a variable

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question