Solved Ambiguous method call. Both

Discussion in 'Plugin Development' started by DigitalCookie, Apr 26, 2014.

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

    DigitalCookie

    Code:java
    1. if(arena.getPlayerCount() >= arena.getMax() && !player.hasPermission("siege.fullgame")) {
    2. plugin.getMessageSender().sendMessage(player, Message.FULLGAME.toString().replace("%arena%", arenaName));
    3. return;
    4. }
    5.  
    6. this.inventories.put(playerName, player.getInventory().getContents());
    7. player.getInventory().clear();
    8.  
    9. this.armors.put(playerName, player.getInventory().getArmorContents());
    10. player.getInventory().setArmorContents(null);
    11.  
    12. this.gamemodes.put(playerName, player.getGameMode());
    13. player.setGameMode(GameMode.SURVIVAL);
    14.  
    15. this.fireticks.put(playerName, player.getFireTicks());
    16. player.setFireTicks(0);
    17.  
    18. this.foodlevels.put(playerName, player.getFoodLevel());
    19. player.setFoodLevel(20);
    20.  
    21. this.healths.put(playerName, player.getHealth() != 20);
    22. player.setHealth(20.0D);
    23.  
    24. this.experiences.put(playerName, player.getExp());
    25. player.setExp(0.0F);
    26.  
    27. this.potions.put(playerName, player.getActivePotionEffects());
    28. player.getActivePotionEffects().clear();
    29.  
    30. player.teleport((arena.getAttacking().contains(playerName) ? arena.getAttackingLobby() : arena.getDefendingLobby()));
    31.  
    32. arena.getPlayers().add(playerName);
    33.  
    34. if(plugin.getInventoryClick().getChosenKits().containsKey(playerName))
    35. plugin.getKitManager().equipKit(player, plugin.getInventoryClick().getChosenKits().get(playerName).getName());
    36.  
    37. plugin.getScoreBoardManager().updateScoreBoard(player);


    Getting errors on: this.healths.put(playerName, player.getHealth() != 20);
    player.setHealth(20.0D); for "Ambiguous method call. Both
     
  2. Offline

    TGRHavoc

    DigitalCookie
    Is your Hashmap, for saving the players' health, save the player and a boolean? If not then there's your probolem.
     
  3. Offline

    d3v1n302418

    Use bukkit instead of craftbukkit, or just add bukkit to your build path and move bukkit to above craftbukkit.
     
  4. Offline

    Slikey

    ((double) getHealth()) != 20
    should do the trick.. i think^^
     
  5. Offline

    TGRHavoc

    It won't if his HashMap uses a Double/Integer/Long, only a Boolean.
     
  6. Offline

    deathline75

    If you rely on craftbukkit, then you are going to have to replace player.setHealth(20.0D); with :
    Code:java
    1. Damageable d = (Damageable) player.getPlayer();
    2. player.getPlayer().setHealth(20.0D);
     
  7. Offline

    DigitalCookie

    Great it works!
    Does anyone know how too export with intellji?

    Getting this wierd error when I try to join the server

    Code:
    [12:03:41 INFO]: UUID of player Zanilla is 878b34f342bf4527bce1d4ea6c95539b
    [12:03:42 INFO]: Zanilla[/127.0.0.1:52503] logged in with entity id 177 at ([world] -1559.5, 4.0, 1228.5)
    [12:03:42 INFO]: Zanilla lost connection: Internal Exception: java.io.IOException: Broken pipe
    [12:03:42 INFO]: Zanilla left the game.
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  8. Offline

    DigitalCookie

Thread Status:
Not open for further replies.

Share This Page