Added new data class for list of protected players. Created new event for entities getting damaged and made it so that protected players don't take damage.

This commit is contained in:
micle
2021-06-03 15:55:23 +01:00
parent 9a6489bf56
commit 21381e07af
5 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,26 @@
package com.micle.loginprotection.data;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class ProtectedPlayers {
private final List<ProtectedPlayer> protected_players = new ArrayList<>();
public ProtectedPlayers() { }
public void addPlayer(UUID player_uuid) {
protected_players.add(new ProtectedPlayer(player_uuid));
}
public ProtectedPlayer getPlayer(UUID player_uuid) {
ProtectedPlayer player = null;
for (ProtectedPlayer protected_player : protected_players) {
player = protected_player;
if (player.getPlayerUUID() == player_uuid) {
break;
}
}
return player;
}
}