Solved PlayerInteractEvent has no method 'getPLayer'

Discussion in 'Bukkit Help' started by NoobDoesMC, Jun 20, 2016.

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

    NoobDoesMC

    I am new to developing bukkit plugins, and I am trying to create a listener which sends the player a message whenever they left-click.

    However, my compiler throws this error:

    Code:
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project WizardServer: Compilation failure
    [ERROR] /Users/.../WizardServer/src/main/java/io/github/theonlygusti/wizardserver/PlayerListener.java:[26,24] cannot find symbol
    [ERROR] symbol:   method getPLayer()
    [ERROR] location: variable event of type org.bukkit.event.player.PlayerJoinEvent
    I am trying to compile with maven: mvn clean install

    The error means, to the best of my knowledge, that event.getPlayer() doesn't exist.

    Here is the offending code:

    Code:
    package io.github.theonlygusti.wizardserver;
    
    /**
    * Just import everything
    * because I cannot be bothered to
    * deal with errors later.
    */
    
    import org.bukkit.*;
    import org.bukkit.event.*;
    import org.bukkit.entity.*;
    import org.bukkit.inventory.*;
    import org.bukkit.event.player.*;
    import org.bukkit.event.block.*;
    
    public class PlayerListener implements Listener {
      /**
       * The PlayerListener class implements all the player
       * event listeners which we use, for example when a
       * player tries to use a spell this class is responsible.
       */
      public static WizardServer plugin;
    
      @EventHandler(priority=EventPriority.HIGH)
      public void onPlayerInteract(PlayerInteractEvent event) {
        Player player = event.getPLayer(); // ERROR: getPlayer symbol not found
    
        // check whether left or right click
        if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_AIR) {
          switch (player.getItemInHand().getType()) {
            default:  player.sendMessage("§cYou left clicked.");
          }
        }
      }
    }
    Line 26 seems to be throwing the error, but I have no idea why.
     
    Last edited: Jun 20, 2016
  2. Online

    timtower Administrator Administrator Moderator

    @NoobDoesMC Check the casing on getPlayer, you have getPLayer
     
  3. Offline

    NoobDoesMC

    fml

    I cannot believe I posted this......

    I mean, thank you for revealing that, but seriously, HOW THE **** DID I NOT SEE THAT MYSELF?

    uurgrggrrgghhhhh

    I feel so dumb....

    Is there a way for me to delete this forever? xD
     
  4. Online

    timtower Administrator Administrator Moderator

    Nope :p
     
Thread Status:
Not open for further replies.

Share This Page