[NOT SOLVED]Find players within a radius

Discussion in 'Plugin Development' started by remieman1, Feb 26, 2013.

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

    chasechocolate

    remieman1
    Code:java
    1. @EventHandler
    2. public void onArrayPlace(BlockPlaceEvent event){
    3. Player player = event.getPlayer();
    4. Block block = event.getBlock();
    5. if(block.getType() == Material.BEACON){
    6. for(Entity entity : player.getNearbyEntities(6.0D, 6.0D, 6.0D){
    7. if(entity instanceof Player){
    8. Player nearby = (Player) entity;
    9. nearby.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 600, 1)); //Healing for 30 seconds (600 ticks)
    10. }
    11. }
    12. }
    13.  
    14. //Make it disappear after 30 seconds (600 ticks)
    15. new BukkitRunnable(){
    16. @Override
    17. public void run(){
    18. block.setType(Material.AIR);
    19. }
    20. }.runTaskLater(<plugin instance>, 600L);
    21. }
     
  2. Offline

    remieman1

    • only error is
    • Caused by: java.lang.Error: Unresolved compilation problems:
    • Syntax error, insert ")" to complete MethodInvocation
    • Syntax error, insert ";" to complete Statement
    • Syntax error on token "plugin", < expected after this token
    • Syntax error, insert ">" to complete ReferenceType1
    • Syntax error, unexpected end of method
    • at com.ultimatehg.BGAbilities.ABListener.onArrayPlace(ABListener.java:303)
    • at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    • at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    • at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    • at java.lang.reflect.Method.invoke(Unknown Source)
    • at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
    • ... 19 more
    i tryed fixing it but just made more syntax errors and i tested it without the dissapearing code and it didnt work but no errors on placement chasechocolate
     
  3. Offline

    Tirelessly

    I'm going to kill myself
     
  4. Offline

    remieman1

    Tirelessly hey dont hate :D bro im new to bukkit coding its so different than runescpae private server coding :( sorry. and i did what it said to do and it gave more syntax errors.
     
  5. Offline

    Tirelessly

    Clearly <plugin instance> should be replaced with an instance of your plugin.
     
  6. Offline

    remieman1

    Clearly <plugin instance> should be replaced with an instance of your plugin.?
    Tirelessly im confused. dont judge me :D im loling also at how dumb iam
     
  7. Offline

    AmShaegar

    <plugin instance> should be a variable name which contains a reference to you plugin.

    Code:
    private JavaPlugin plugin;
     
    public SomeListener(Plugin plugin) {
        this.plugin = plugin;
    }
    So <plugin instance> would be plugin now.
     
  8. Offline

    remieman1

    only problem now is that the potion effect doesnt work but the beacon dissappears after 600 ticks= 30 seconds
    @am shaegar chasechocolate and i tried everything this is my new code now
    Code:
    @EventHandler
    public void onArrayPlace(BlockPlaceEvent event){
      Player player = event.getPlayer();
      final Block block = event.getBlock();
      if(block.getType() == Material.BEACON){
        for(Entity entity : player.getNearbyEntities(6.0D, 6.0D, 6.0D)){
          if(entity instanceof Player){
            Player nearby = (Player) entity;
            nearby.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 600, 1)); //Healing for 30 seconds (600 ticks)
          }
        }
      }
     
      //Make it disappear after 30 seconds (600 ticks)
      new BukkitRunnable(){
        @Override
        public void run(){
          block.setType(Material.AIR);
        }
      }.runTaskLater(plugin, 600L);
    }
    BUMP

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  9. Offline

    AmShaegar

    Code:
    Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
        public void run() {
            // check for players inside radius
        }
    }, 0, 20); // start instantly, run every 1s(20 ticks)
    Show some effort. We wont do your plugin for you. Except you wanna pay me.
     
  10. Offline

    remieman1

    AmShaegar chasechocolate i tryed that didnt work and iam showing some effort its just that I know nothing about radius and my plugin has much more than this one ability..
     
  11. Offline

    chasechocolate

    remieman1 the potion effect should work... Does it give any errors?
     
  12. Offline

    remieman1

    chasechocolate help

    and no it does not give any errors

    Tirelessly

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  13. Offline

    Tirelessly

    No, I can't help people who don't try to help themselves.
     
  14. Offline

    ZeusAllMighty11

    lol asking people to do all his dirty work, so he can take all credit for this.

    Please do the following:
    1) Smash head on keyboard Learn basic java
    2) Please learn the basics of using external jars in Java such as the BukkitAPI
    3) Please, goes along with point 1, learn syntax (sentence structure). Forgetting ) ( { } ' " is just ridiculous to keep bumping your thread with
    4) Please don't ask for help again unless you truly are going to act like you're not 12, and you have already put in a decent effort into the situation. If you feel like you really need it and you can't do that, we have a search button



    Tirelessly

    I laughed so hard when I saw your post (even though suicide's not a joke)
     
    AngryNerd and wacossusca34 like this.
  15. Offline

    remieman1

    lol ZeusAllMighty11 fucking and you to Tirelessly you dont think i fucking tried u think i want people to do my dirty work well fucking suck my dick bitch ass you can suck a dick. And the syntax error was cause i didnt remove <> ok so suck a dick so just look at what your typing your making a fool of yourself you prick. Im not a no life prick that spends all my time on this shit I have a social life unlike you, you fucking prick say this in my face you fucking nerd.
     
  16. Offline

    ZeusAllMighty11

    0_o I was trying to help honestly, but you are just an all out mad kid!
     
    lol768 likes this.
  17. Offline

    remieman1

    im not no one insults me ok seriously if you read my post it says im not that good with bukkit coding ZeusAllMighty11 sorry.
     
  18. Offline

    ZeusAllMighty11

    Turn your computer off and sleep or do something productive - spending time flaming on a message board is useless.

    If you want to actually make plugins, you have to put in if you want to take out later.


    Think of it like a bank:
    - You put in a few hundred dollars
    - Overtime, as you slowly add more money into it, the money increases even more because what you already had plus what you've been adding

    - Eventually, you'll be nearly set for anything you can imagine (within reasonable Java boundaries/limitations) but you really did put a lot of time and money into doing so
     
  19. Offline

    remieman1

    ZeusAllMighty11 you dont get it im fucking pissed ive spent all my free time on this for the last week so it doesnt need to do with w.e you said so it makes whats you type all invalid
     
  20. Offline

    Tirelessly

    fite me irl kid ill reck u i get many womans

    ZeusAllMighty11 I'm dying
     
  21. Offline

    ZeusAllMighty11

    Tirelessly

    fite me at pax bro do u even lift
    #yolooooo
     
    AngryNerd and wacossusca34 like this.
  22. Offline

    AmShaegar

    Wow, an entire week? Sorry for beeing sarcastic but people like me spend years of free time in such projects. Although I am quite new to Bukkit. And I say that after 3 months of working with it. Started my plugin on December.

    Developing a plugin is not something that comes over night. And flaming people who actually did help you a lot and spent their free time to teach you how to code is ridiculous.
     
  23. Offline

    wacossusca34

    All-time favorite post. I believe this is one of the worst cases of flaming I've ever seen.
     
  24. Offline

    c0mp

    Please have another look at the ToS and Rules, take a breather to un-piss-off yourself, and come on back when you're ready for civilized discourse.
     
Thread Status:
Not open for further replies.

Share This Page