Trying to make plugin that regenerates block... Need Help!

Discussion in 'Spigot Plugin Help' started by angmusae2015, Feb 29, 2020.

  1. Code (Java):

    import java.util.HashMap;

    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;

    public class RegenBlock implements Listener {
        public static HashMap<Location, Material> regenBlockList = new HashMap<Location, Material>();
        public static HashMap<Player, Location> record = new HashMap<Player, Location>();

        public void BlockBreakAlarm(BlockBreakEvent event) {
            Player player = event.getPlayer();
            Location location = event.getBlock().getLocation();
            Material type = event.getBlock().getType();

            if(regenBlockList.containsKey(location)) {

            player.sendMessage("Block '" + type + "' on '" + location.toString() + "'.");
            player.sendMessage("Regen block : " + regenBlockList.containsKey(location));

            record.put(player, location);
    and this is my code in event code.
    Code (Text):
    if(regenBlockList.containsKey(location)) {
    this part of the code won't work.
    Why is it doing nothing?
  2. May you provide us the part where you put a new entry in your HashMap?