Code:
src\server\model\players\Client.java:51: error: constructor PlayerKilling in cla
ss PlayerKilling cannot be applied to given types;
private PlayerKilling playerKilling = new PlayerKilling(this);
^
required: no arguments
found: Client
reason: actual and formal argument lists differ in length
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Press any key to continue . . .
dawat
Code:
package server.model.players;
/**
* @author Core
* Handles adding and removing hosts to the players array list.
*/
public class PlayerKilling {
/**
* Adds the host of the killed player.
*@param client Player that saves the host.
*@param host Host address of the killed player.
*@return True if the host is added to the players array.
*/
public static boolean addHostToList(Client client, String host) {
if(client != null) {
return client.lastKilledPlayers.add(host);
}
return false;
}
/**
* Checks if the host is already on the players array.
* @param client Player that is adding the killed players host.
* @param host Host address of the killed player.
* @return True if the host is on the players array.
*/
public static boolean hostOnList(Client client, String host) {
if(client != null) {
if(client.lastKilledPlayers.indexOf(host) >= KILL_WAIT_MAX) {
removeHostFromList(client, host);
return false;
}
return client.lastKilledPlayers.contains(host);
}
return false;
}
/**
* Removes the host from the players array.
* @param client Player that is removing the host.
* @param host Host that is being removed.
* @return True if host is successfully removed.
*/
public static boolean removeHostFromList(Client client, String host) {
if(client != null) {
return client.lastKilledPlayers.remove(host);
}
return false;
}
/*
* Amount of kills you have to wait before the host is deleted.
*/
public static final int KILL_WAIT_MAX = 3;
}