so im trying to make a hcf core, and for some reason this code doesnt work. it adds enderpearl: to the scoreboard and i cant use an enderpearl when its on, but when i use an enderpearl and the timer is off, then it adds the scoreboard, sends me the wrong message, but doesnt register the enderpearl:
public class EnderpearlEvent implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
PlayerScoreboard scoreboard = PlayerScoreboard.getScoreboard(p);
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(p.getItemInHand().getType() == Material.ENDER_PEARL) {
if(scoreboard.getEntry("enderpearl") == null) {
e.setCancelled(false);
new Entry("enderpearl", scoreboard)
.setCountdown(true)
.setText(ChatColor.GOLD + "Enderpearl:" + ChatColor.WHITE)
.setTime(16)
.send();
}
if(scoreboard.getEntry("enderpearl") != null) {
e.setCancelled(true);
p.updateInventory();
p.sendMessage(ChatColor.RED + "You are still on enderpearl cooldown!");
}
}
}
}
}
help would be appreciated, thanks!
public class EnderpearlEvent implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
PlayerScoreboard scoreboard = PlayerScoreboard.getScoreboard(p);
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(p.getItemInHand().getType() == Material.ENDER_PEARL) {
if(scoreboard.getEntry("enderpearl") == null) {
e.setCancelled(false);
new Entry("enderpearl", scoreboard)
.setCountdown(true)
.setText(ChatColor.GOLD + "Enderpearl:" + ChatColor.WHITE)
.setTime(16)
.send();
}
if(scoreboard.getEntry("enderpearl") != null) {
e.setCancelled(true);
p.updateInventory();
p.sendMessage(ChatColor.RED + "You are still on enderpearl cooldown!");
}
}
}
}
}
help would be appreciated, thanks!
