Spigot Random TP 1.1

Teleports the player to a random location.

  1. Jad

    Jad

    Jad submitted a new resource:

    Random TP - Teleports the player to a random location.

    Read more about this resource...
     
  2. You could make it worth a lot more to a lot more players by adding a Factions hook, so you don't get teleported into a factions territory.

    Also, you could add an option to use a list of world guard regions to avoid/ignore to keep players out of those areas as well.

    Another nice feature would be to have a min/max option for coordinates, so that players get teleported further than a certain distance but not more than the max distance.
     
  3. Code (Text):
    public static randomtp plugin;
    Unused and unassigned field. Although, it's a sure good thing you didn't assign anything it or else it would cause a memory leak. Remove that field immediately.

    Code (Text):

      Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable()
      {
      public void run()
      {
      randomtp.this.cooldown.remove(player);
      player.sendMessage(ChatColor.GREEN + "You can use '/randomtp' again.");
      }
      }, 1200L);
    If a player logouts within that minute of waiting for that task to be executed, you could encounter issues. For one, the server would have a temporary memory leak since you don't release that Player reference until the minute is up. Secondly, the methods may throw exceptions(I'm not sure if they fail silently or not).
     
  4. Jad

    Jad

    Well, then.

    I don't recommend this plugin! xD
    It's really just a test on how the posting process of spigot is for me, so if a mod or admin deleted it, I wouldn't care.
     
  5. With that attitude, you're not going to get much support from any plugin you make, if you care about your projects, then others will also care.
     
  6. Jad

    Jad

    Actually, for future plugins, how am I supposed to add a cool down without memory leaks?
     
  7. Jad

    Jad

    I can add a min and max feature, it would be really easy to do.
     
  8. You have to think outside the box. Perhaps you could have a Map<Player, Integer> and a single repeating task running every second that decrements all of the values until 0 is reached. Once 0 is reached, perform the tasks you normally would. Oh, and don't forget to remove the Player from the map when they logout.
     
  9. Jad

    Jad

    So from what I understand, I create a new array that stores the player and an integar, another for loop or other kind of loop that decreases the int until 0, once it reaches 0 then remove the player from the array so they can use the command again.

    One problem, if they log out, it would remove them, and they join back and have no more cool down. People could exploit this easily. And please don't use too complex java terms, I'm new to the plugin world.
     
  10. No. You just took my words and spit them out all chewed up.

    In that case, store player UUIDs instead of the player object itself.
     
  11. Jad

    Jad

    Okay, then this plugin isn't abandoned!
     
  12. Jad

    Jad

  13. Jad

    Jad

    I don't know how to mark a plugin abandoned, but this is.
    I got another bigger plugin to work on, and this one has too much bugs to fix.
    And lastly, there are already many plugins which have the same name as mine, and are more compatible.

    Thanks for 1 good review anyway, it's not the best plugin, but I got a great one coming soon!