I'm trying to put in a hashmap the right clicked sign, but with the signs update in 1.14, I'm not able. How should I do it? My code is this: Code (Java): @EventHandler public void clickSign(PlayerInteractEvent e) { Player p = e.getPlayer(); if(e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock() instanceof Sign) { s.getSigns().put(p, (Sign)e.getClickedBlock()); p.sendMessage("Guardado"); } }
Adding to that, you could also get the type of the Block (Block#getType(), which returns a Material) If you are unsure about what the actual Type of the Block is, you can always print the type Code (Java): System.out.println(e.getClickedBlock().getClass()); In most cases, however, a block (as @robertlit said) is better defined by its block-state.
Remember the built in spawn protection in server.properties prevents right clicks in spawn so turn it off or don't test in protected spawn area
Also be sure you imported Sign properly. You want it from org.bukkit.block not the one from org.bukkit.material.
If the replys above dont solve your problem, you can try checking for diffrent signtypes. SIGNPOST, WALLSIGN etc.....
You’d store a Location because it makes sense, not because it causes a memory leak. You can leak memory storing anything if you don’t remove it, just storing a block doesn’t cause a memory leak in itself.