[HELP] Mod Offiline Player

RicardoJRE

Heir
Customer
Hello, can anyone help modify this code so that players who are logged out are unable to get the target?
The code works to take the player offline, but if they are in a farm area, it is possible to kill the player.

<code>

package Anunciar;


import l2.gameserver.listener.actor.player.OnPlayerExitListener;
import l2.gameserver.model.Player;
import l2.gameserver.model.actor.listener.CharListenerList;
import l2.gameserver.scripts.Functions;
import l2.gameserver.scripts.ScriptFile;

public class StayOnline extends Functions implements ScriptFile, OnPlayerExitListener
{


@Override
public void onPlayerExit(Player player) {



if (player.getOnlineTime() > 43200) {
String name = player.getName();
player.getFarmSystem().stopFarmTask(false);
player.setVar("offline", String.valueOf(System.currentTimeMillis() / 1000L), -1L);
} else if (player.getOnlineTime() == 0) {
String VoteURL = "https://site.com";
player.sendPacket(new OpenUrl(VoteURL));
} else {
String VoteURL = "https://site.com";
player.sendPacket(new OpenUrl(VoteURL));
}

}



@Override
public void onLoad() {

System.out.println("DEIXAR CHAR LOGADO ON");
CharListenerList.addGlobal(this);

}

@Override
public void onReload() {

}

@Override
public void onShutdown() {

}
}

</code>
 
Back
Top