Skip to content

Commit

Permalink
Added support for PlayersContainer in the API
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Jan 1, 2022
1 parent 26b5547 commit dd40235
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 24 deletions.
@@ -1,6 +1,7 @@
package com.bgsoftware.superiorskyblock.api.handlers;

import com.bgsoftware.superiorskyblock.api.island.PlayerRole;
import com.bgsoftware.superiorskyblock.api.player.container.PlayersContainer;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import org.bukkit.entity.Player;

Expand Down Expand Up @@ -110,4 +111,9 @@ public interface PlayersManager {
@Deprecated
List<PlayerRole> getRoles();

/**
* Get the players container.
*/
PlayersContainer getPlayersContainer();

}
@@ -0,0 +1,46 @@
package com.bgsoftware.superiorskyblock.api.player.container;

import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;

import javax.annotation.Nullable;
import java.util.List;
import java.util.UUID;

public interface PlayersContainer {

/**
* Get a player by its name.
*
* @param name The name of the player.
*/
@Nullable
SuperiorPlayer getSuperiorPlayer(String name);

/**
* Get a player by its uuid.
*
* @param uuid The uuid of the player.
*/
@Nullable
SuperiorPlayer getSuperiorPlayer(UUID uuid);

/**
* Get all the players.
*/
List<SuperiorPlayer> getAllPlayers();

/**
* Add a player to the container.
*
* @param superiorPlayer The player to add.
*/
void addPlayer(SuperiorPlayer superiorPlayer);

/**
* Remove a player from the container.
*
* @param superiorPlayer The player to remove.
*/
void removePlayer(SuperiorPlayer superiorPlayer);

}
Expand Up @@ -8,7 +8,7 @@
import com.bgsoftware.superiorskyblock.database.DatabaseResult;
import com.bgsoftware.superiorskyblock.database.bridge.PlayersDatabaseBridge;
import com.bgsoftware.superiorskyblock.handler.AbstractHandler;
import com.bgsoftware.superiorskyblock.player.container.PlayersContainer;
import com.bgsoftware.superiorskyblock.api.player.container.PlayersContainer;
import com.google.common.base.Preconditions;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -114,6 +114,11 @@ public List<PlayerRole> getRoles() {
return plugin.getRoles().getRoles();
}

@Override
public PlayersContainer getPlayersContainer() {
return this.playersContainer;
}

public SuperiorPlayer getSuperiorPlayer(CommandSender commandSender) {
return getSuperiorPlayer((Player) commandSender);
}
Expand Down
@@ -1,5 +1,6 @@
package com.bgsoftware.superiorskyblock.player.container;

import com.bgsoftware.superiorskyblock.api.player.container.PlayersContainer;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import org.jetbrains.annotations.Nullable;

Expand Down

This file was deleted.

0 comments on commit dd40235

Please sign in to comment.