Will this cause lagg?

Discussion in 'Plugin Development' started by Gamesareme, Aug 26, 2014.

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


    So I have made a bit of code, but I think it may cause lagg. It works fine on my test server but I have no idea what would happen if it went onto my big one.
    So this is the code. Could someone tell me if this is the most efficient way of doing this?
        public void onPlayerMoveEvent(PlayerMoveEvent event){
            Player player = event.getPlayer();
            FileConfiguration arena = plugin.getConfig("Arenas", "");
            for(String s: arena.getStringList("Arenas")){
                if(plugin.s.playerandarena.get(s) !=null && plugin.s.playerandarena.get(s).contains(player.getName())){
    if there are a hundred+ players, it is in my opinion that this will cause bukkit loads of lagg.

    Really? No one knows?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 10, 2016
  2. Offline


    Yes, eventually. Cache the list.
  3. Offline


  4. Offline


    It will cause, if you've seen how many times move event fires, you will realize that opening a file and writing/reading to and from it for all those players is a pain in the backside. Change that somehow :/
  5. Most likely, yes, PlayerMoveEvent even fires when the player moves it's camera around.
  6. Offline


    • does getConfig(String, String) load it fresh from file each time?
    • What type is the playerarena value?
Thread Status:
Not open for further replies.

Share This Page