NoSuchMethodError

Discussion in 'Plugin Development' started by HappyPikachu, Jan 6, 2013.

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

    HappyPikachu

  2. Offline

    Siguza

    Maybe use Factions 1.6.9.4 instead of 1.6.9.2 when compiling.
     
  3. Offline

    caseif

    Well, this exception is thrown when you attempt to reference a method which is not defined for the given type. The problem line of code is
    Code:java
    1. if (pFaction.getRelationTo(npFaction).equals(rel.ALLY)) {

    implying that .getRelationTo() is undefined for type Faction, or .equals() is undefined for type Rel. You should really run your code through a program such as Eclipse to avoid these types of errors.
     
  4. Offline

    HappyPikachu

    Siguza Those versions use the same relation methods. Issue is only reported by beta users (1.7.x, 1.8.x).

    AngryNerd I compile against Factions 1.6.2 and 1.8.0 in Eclipse with no issues/errors. What I don't understand is, how this could happen after I check the version for which method to call! :(
     
  5. Offline

    HappyPikachu

  6. Offline

    fireblast709

    HappyPikachu apparently the version it is run with uses Relation, while the code uses Rel
     
  7. Offline

    HappyPikachu

    fireblast709 I must be doing something wrong with the version check then? All of the reports so far have been from servers with beta Factions, but only the 1.6.x versions use Relation. :confused: I'll verify the version for that ticket.

    Despite Eclipse saying otherwise, I got the feeling AngryNerd may have been right about .equals(). After seeing how this commit was handled, I'll start using the following instead:
    Code:java
    1. if (pFaction.getRelationTo(npFaction) == Rel.ALLY) {
     
  8. Offline

    fireblast709

    you should be able to use .equals() and == with enums iirc
     
Thread Status:
Not open for further replies.

Share This Page