Solved Bukkit Coding (Player Interact) [HELP]

Discussion in 'Plugin Development' started by benzimmer123, Nov 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    benzimmer123

    Please help, can someone tell me why this code gives me no errors but does nothing at all!
    Thanks in advance!:)

    CODE:

    Code:java
    1. @EventHandler
    2. public void onPlayerInteracts(PlayerInteractEvent e) {
    3. Player p = e.getPlayer();
    4. if (e.getClickedBlock().getState() instanceof EnderChest) {
    5. if (!getConfig().getBoolean(p.getName() + ".UsedKit")) {
    6. return;
    7. } else {
    8. p.sendMessage(ChatColor.RED + "You cannot use this with a kit.");
    9. }
    10. }
    11. }
     
  2. Offline

    Doamax

    Are you registering the events? I think that
    Code:java
    1. if (e.getClickedBlock().getState() instanceof EnderChest) {

    should be
    Code:java
    1. if (e.getClickedBlock().getType() == Material.ENDERCHEST) {
     
    benzimmer123 and jimbo8 like this.
  3. Offline

    benzimmer123

    Ill give it a try thanks;)

    Doamax
    It worked, thanks for your help!:D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  4. Offline

    Doamax

    No problem, just because it doesn't give errors doesn't mean it works.
     
  5. Offline

    benzimmer123

Thread Status:
Not open for further replies.

Share This Page