Solved Not Having Location

Discussion in 'Plugin Development' started by Tyep, May 9, 2014.

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

    Tyep

    Code:java
    1. package me.Tyep;
    2.  
    3. import org.bukkit.Effect;
    4. import org.bukkit.Location;
    5. import org.bukkit.event.Listener;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class Game extends JavaPlugin implements Listener {
    9.  
    10. public void playCircularEffect(Location loction, Effect effect, boolean v) {
    11. for(int i = 0; i <=8;i+= ((!v && (i ==3)) ? 2 : 1))
    12. location.getWorld().playEffect(location, effect, i);
    13. }
    14.  
    15. }

    Plz Help thx! btw i am newb :3
     
  2. Offline

    jthort

    English only please :)

    Anyway I don't think you actually explained what's wrong with it, or showed us the error. Can you please provide more information please so I can help yah out :) Thanks
     
  3. Offline

    mokomama

    you have to create the variable "location" and also you have to add onDisable and onEnable. for example put this before "public void PlayCircularEffect"
    Code:java
    1. public void onDisable() {
    2. log("Plugin has been disabled.");
    3. }
    4.  
    5. public void onEnable() {
    6. PluginManager pm = getServer().getPluginManager();
    7.  
    8. pm.registerEvents(this, this);
    9.  
    10. log("Plugin has successfully enabled.");
    11. }
    12.  
    13.  
    14. Location location = new Location(player.getLocation());


    so it would look like this:

    Code:java
    1. package me.Tyep;
    2.  
    3. import org.bukkit.Effect;
    4. import org.bukkit.Location;
    5. import org.bukkit.event.Listener;
    6. import org.bukkit.plugin.java.JavaPlugin;
    7.  
    8. public class Game extends JavaPlugin implements Listener {
    9.  
    10. public void onDisable() {
    11. log("Plugin has been disabled.");
    12. }
    13.  
    14. public void onEnable() {
    15. PluginManager pm = getServer().getPluginManager();
    16.  
    17. pm.registerEvents(this, this);
    18.  
    19. log("Plugin has successfully enabled.");
    20. }
    21.  
    22.  
    23. Location location = new Location(player.getLocation());
    24.  
    25. public void playCircularEffect(Location loction, Effect effect, boolean v) {
    26. for(int i = 0; i <=8;i+= ((!v && (i ==3)) ? 2 : 1))
    27. location.getWorld().playEffect(location, effect, i);
    28. }
    29.  
    30. }
     
  4. Offline

    Tyep

    ok
    location.getWorld().playEffect(location, effect, i); the location parts of that is giving me a error
     
  5. Offline

    jthort

    mokomama Why would you register the events with no events?

    Tyep Wait, is this your main class?
     
  6. Offline

    xTigerRebornx

    Tyep The arguement in your method is spelled Loction, but you are trying to invoke it on location
     
    jthort likes this.
  7. Offline

    Tyep

    ok thx :D
     
  8. Offline

    mokomama


    jthort whoops, I copied and pasted this from one of my plugins to save time and forgot to take that out
     
    jthort likes this.
Thread Status:
Not open for further replies.

Share This Page