Problem with the getting the player

Discussion in 'Plugin Development' started by KaiPol, Dec 10, 2013.

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

    KaiPol

    Here's my code:
    Code:java
    1. public void run() {
    2. Bukkit.broadcastMessage(ChatColor.GREEN + "VOTING IS OVER!");
    3. if(IronVote2 > IronVote1){
    4. Bukkit.broadcastMessage(ChatColor.DARK_PURPLE + "The winning map is: Woodwork!");
    5. IronVote1 = 0;
    6. IronVote2 = 0;
    7.  
    8. }
    9. if(IronVote1 > IronVote2){
    10. Bukkit.broadcastMessage(ChatColor.DARK_PURPLE + "The winning map is: Malfunction!");
    11. IronVote1 = 0;
    12. IronVote2 = 0;
    13. }
    14. if(IronVote1 == IronVote2){
    15. Bukkit.broadcastMessage(ChatColor.DARK_PURPLE + "The winning map is: Malfunction!");
    16. IronVote1 = 0;
    17. IronVote2 = 0;
    18. player.sendMessage("Hi");
    19. }
    20. }
    21. }, 600L);

    It says I can't get the player unless I turn it to final and I don't want to do that.
     
  2. Offline

    The_Doctor_123

    KaiPol likes this.
  3. Offline

    samosaara

    *maybe he will realize he just make a inner class and he can't uses non-final variables inside it :O*
     
  4. Offline

    Wolfey

    KaiPol you have to use player variable outside the method, for that you have to initialize it, try that?
     
  5. Offline

    samosaara

    The_Doctor_123 his thread and your answer make me think, why it's needs to be final? What is the point? I know, I need to, and how to do it and sh*t... but, why it has to be final?
     
    KaiPol likes this.
  6. Offline

    KaiPol

    The_Doctor_123 I thought it would give me an error with the rest of the command :eek:
    Thank you!
     
  7. Offline

    The_Doctor_123

    samosaara
    It's technical. Java would take a performance loss if it weren't final.
     
  8. Offline

    1Rogue

  9. Offline

    samosaara

    Oh yeah, our beloved blazing fast java would lost performance.
     
  10. Offline

    The_Doctor_123

    1Rogue
    It was worth a shot. :p
     
  11. Offline

    1Rogue


    Again, it's not about performance. At all. For one thing, java is comparable to speeds of other languages such as C#, it is merely more resource-intensive on computer distributions of the JVM, with JVM warmup times aside.
     
    L33m4n123 likes this.
  12. Offline

    samosaara

    1Rogue I got computer C with X specifications. And I got an C++ program who does Y, I got a java program who does Y either. The C++ program will run faster, because is requires less resource, The java program will run slower because it's needs more resources. So java = slow.
     
  13. Offline

    The_Doctor_123

    ...

    Obviously you don't understand that it depends on what you're doing.
     
  14. Offline

    1Rogue


    resources required/used != speed of the process
     
Thread Status:
Not open for further replies.

Share This Page