* Clean up part 1 - Removed lots of dead code - Removed unncessary files not in use - Cleaned up small bits of code - Removed a few warnings - Server.java ---> GameEngine.java - Constants.java ---> GameConstants.java * Cape Dye Rewrote cape dying * Packaging - redone ----> com.rebotted * PacketSender/clean up - ActionSender ---> PacketSender - Moved many more packets to packetsender - Cleaned up more dead code * Merge Client/Player - Merged Client.java with Player.java (both were doing same thing so redundant to have both) - Removed some more dead code - Tidy a few small things up * Quests/more clean up - Removed more dead code - Made quests static in order to clean them up a bit * More cleanup - Removed some more of the dead quest code - Correcting naming of some of the shop variables
72 lines
1.7 KiB
Java
72 lines
1.7 KiB
Java
package com.rebotted.game.content.combat.melee;
|
|
|
|
import com.rebotted.game.players.Client;
|
|
|
|
/**
|
|
* 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.lastIndexOf(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;
|
|
|
|
}
|