[unsolved] Last fixes (multiple problems, free free to solve any)

Discussion in 'Plugin Development' started by Ironraptor3, Feb 22, 2014.

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

    Ironraptor3

    Hai, before anything else, thanks for reading! So I'm on the last bit of my first plugin (it was a really long one, took about a 1 1/2 months to make), but the last class I made (its magic with different classes), has a few move bugs in it. Any help is appreciated, I will make this in sections to make it easier if you are short on time/lazy like me

    1) I have no idea where the error is on this, so I will post the entire code. No console errors. This is supposed to drag along anything it hits, however it behaves strangely. It phases through walls, goes in strange directions, and above all: whenever it hits something, its velocity immediately chances to the y axis, and it flies up to sky block, also phasing through walls. I use similar code in other moves, none of it has ever phased through walls or gone in different directions:

    Code:java
    1. public HeavenBlast(final Player player) {
    2. if (magiclevel.containsKey(player.getName()) && magiclevel.get(player.getName()) >= MagicRequirement) {
    3. magiclevel.put(player.getName(), magiclevel.get(player.getName()) - MagicRequirement);
    4. BarAPI.displayBar(player, ChatColor.LIGHT_PURPLE + "Magic Level", magiclevel.get(player.getName()), 1220, true);
    5. final Item i = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.GLOWSTONE));
    6. i.setPickupDelay(Integer.MAX_VALUE);
    7.  
    8. direction = player.getLocation().getDirection().normalize().multiply(speed);
    9.  
    10. new BukkitRunnable() {
    11.  
    12. @Override
    13. public void run() {
    14.  
    15. count++;
    16. i.setVelocity(direction);
    17. if (count % 6 == 0) {
    18. for (int x = -radius; x < radius; x++) {
    19. for (int y = -radius; y < radius; y++)
    20. for (int z = -radius; z < radius; z++) {
    21. i.getWorld().playEffect(i.getLocation().add(x,y,z), Effect.STEP_SOUND, Material.GLOWSTONE);
    22. }
    23. }
    24. }
    25.  
    26. for (Entity e : i.getNearbyEntities(radius, radius, radius)) {
    27. if (!affected.contains(e) && e != player) {
    28. affected.add(e);
    29. }
    30. }
    31. for (Entity e : affected) {
    32. if (count % 2 == 0) {
    33. if ( e.getLocation().distanceSquared(i.getLocation()) > radius) {
    34. if (e instanceof LivingEntity) {
    35. Location loc = i.getLocation();
    36. loc.setPitch(((LivingEntity) e).getLocation().getPitch());
    37. loc.setYaw(((LivingEntity) e).getLocation().getYaw());
    38. e.teleport(loc);
    39. }
    40. else {
    41. e.teleport(i.getLocation().add(direction));
    42. }
    43. }
    44. }
    45. e.setVelocity(direction.add(new Vector(0, .1, 0)));
    46. }
    47.  
    48. if (count >= duration) {
    49. for (Entity e : affected) {
    50. if (e instanceof LivingEntity) ((LivingEntity) e).damage(damage);
    51. }
    52. i.remove();
    53. cancel();
    54. }
    55.  
    56. }
    57.  
    58. }.runTaskTimer(Main.plugin, 0, 1);
    59. }
    60. }
    61. }


    I realize I have probably made a mistake, because I am still nooby. I cannot find it though, and thank you for your help once again. I will add any other errors I find below this line, thanks (some have been removed after looking at them with fresher eyes):
    ---------------------------------------------------------------------------------------------------------

    ***Huge ass paranoia, though it will probably be a problem, if you can, please solve this V

    Ok so, I've been testing the things that work for a while, but something came up. It may be my eyes playing tricks on me, but would creating multiple instances of a move at once screw up the time? I've only noticed things a few blocks off when i decided to spam a few moves a few times. If the way I'm doing it (classes stemming from the event handler class) is like this, and i have a LOT of fixing to do, any suggestions? I was looking at orion's bending code and saw the advanceall() methods, which kinda has me concerned, but i guess that is what i would need to do something similar to that. Oh well, I have the determination to fix it, so just tell me and ill get it done.
     
  2. Offline

    Ironraptor3

  3. Offline

    badboysteee98

    Try putting this on GitHub then people can edit the code and help you other then having 100 comments of code on here
     
  4. Offline

    Ironraptor3

    Good idea, though I'm a little lazy lol. Can't someone just help me here real fast? Thanks for your time if you are reading this btw. Sorry i haven't bumped/responded in a while, I've been busy
     
  5. Offline

    Jombi

    Nobody is going to just drop what they're doing and write your code for you. If you have specific questions, ask them. But don't expect people to take time to do the work for you. You'll never learn anything that way.
     
  6. Offline

    Ironraptor3

    Jombi no idea what you are talking about. These are specific questions stemming from the code i have already wrote. I never said to rewrite all of the code. Maybe you could write something HELPFUL on a help forum, instead of criticizing me based on your false assumptions

    EDIT: also, you are helping people on a forum, why are you complaining about "taking the time out of people's day?" Also, i specifically put in the first paragraph and organized it, saying that: "..make it easier if you are short on time.. or lazy". Why are you complaining in a help forum btw? Its not like i made a mistake that i can just look up, like saving a player to a list. These are just bugs that i couldn't fix, and couldn't find any similar things within an hour of searching on the forums.

    This all seems harsh because I read your post with a spiteful/arrogant tone in mind^
     
Thread Status:
Not open for further replies.

Share This Page