Hello, I recently created a model to edit my config in xml, but I have a doubt, to restore the status of the players after restart you will have to create a loop? Because I don't think it would be a good idea to do that, I would like your opinion.
for (Vip vip : VipData.getInstance().getVip())
{
if (player.getMemos().getLong(vip.getType().toString(), 0) > 0)
{
long now = Calendar.getInstance().getTimeInMillis();
long endDay = player.getMemos().getLong(vip.getType().toString());
if (now > endDay)
player.deleteVip(vip.getType());
else
{
player.setVip(vip);
if (!vip.getMessage().isEmpty())
World.announceToOnlinePlayers(player.getClan() != null ? vip.getMessageClan().replace("%player%", player.getName()).replace("%clan%", player.getClan().getName()) : vip.getMessage().replace("%player%", player.getName()), true);
player.broadcastUserInfo();
}
}
}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Williams
Hello, I recently created a model to edit my config in xml, but I have a doubt, to restore the status of the players after restart you will have to create a loop? Because I don't think it would be a good idea to do that, I would like your opinion.
for (Vip vip : VipData.getInstance().getVip()) { if (player.getMemos().getLong(vip.getType().toString(), 0) > 0) { long now = Calendar.getInstance().getTimeInMillis(); long endDay = player.getMemos().getLong(vip.getType().toString()); if (now > endDay) player.deleteVip(vip.getType()); else { player.setVip(vip); if (!vip.getMessage().isEmpty()) World.announceToOnlinePlayers(player.getClan() != null ? vip.getMessageClan().replace("%player%", player.getName()).replace("%clan%", player.getClan().getName()) : vip.getMessage().replace("%player%", player.getName()), true); player.broadcastUserInfo(); } } }
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.