Make it so when a player logs in that you update the quest tab text for that player only.
|
obviously i want to update quest tab text, but i don't want to send this:every cycle.Code:for (Player p : players) { if ((p != null) && (p.isActive())) { InterfaceHandler.writeText(new QuestTab(p)); p.send(new SendMessage("sent quest tab")); } }
when would be the best time to send this?
Make it so when a player logs in that you update the quest tab text for that player only.
Update the entire quest tab for the player logging in (don't loop through the entire player list), this way you can ensure it's only called once. You don't need to loop through all of the players like you're doing, unless you want to have some dynamic feature in the quest tab like a server time that dynamically updates. If you had a kill counter or something, you would update that text for that player when they kill another player. Don't put this in any tick, it doesn't need to be in there. Tick is called every 600 ms, so that's a lot of packets every cycle.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |