Package dev.scsupercraft.teamstages.data
Class TeamStageHelper.PlayerHelper
java.lang.Object
dev.scsupercraft.teamstages.data.TeamStageHelper.PlayerHelper
- Enclosing class:
- TeamStageHelper
A helper class for managing player stages.
Get an instance of this class using TeamStageHelper.player().
-
Method Summary
Modifier and TypeMethodDescriptionvoidAttempts to give a player a stage.intclearStages(net.minecraft.server.level.ServerPlayer player) Removes all stages from a player.net.darkhax.gamestages.data.IStageDatagetPlayerData(net.minecraft.world.entity.player.Player player) Attempts to resolve the player stage data for a player.booleanChecks if the player has all of the stages.booleanhasAllOf(net.minecraft.world.entity.player.Player player, Collection<String> stages) Checks if the player has all of the stages.booleanhasAllOf(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, String... stages) Checks if the player has all of the stages.booleanhasAllOf(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, Collection<String> stages) Checks if the player has all of the stages.booleanChecks if the player has at least one of many possible stages.booleanhasAnyOf(net.minecraft.world.entity.player.Player player, Collection<String> stages) Checks if the player has at least one of many possible stages.booleanhasAnyOf(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, String... stages) Checks if the player has at least one of many possible stages.booleanhasAnyOf(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, Collection<String> stages) Checks if the player has at least one of many possible stages.booleanChecks if a player has a stage.booleanhasStage(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, String stage) Checks if a player has a stage.voidremoveStage(net.minecraft.server.level.ServerPlayer player, String... stages) Attempts to remove a stage from a player.
-
Method Details
-
hasStage
Checks if a player has a stage.- Parameters:
player- The player to check.stage- The stage to look for.- Returns:
- Whether or not they have the stage.
-
hasStage
public boolean hasStage(net.minecraft.world.entity.player.Player player, @Nullable net.darkhax.gamestages.data.IStageData data, String stage) Checks if a player has a stage.- Parameters:
player- The player to check.data- The player's stage data.stage- The stage to look for.- Returns:
- Whether or not they have the stage.
-
hasAnyOf
Checks if the player has at least one of many possible stages.- Parameters:
player- The player to check.stages- The stages to look for.- Returns:
- Whether or not the player had at least one of the stages.
-
hasAnyOf
Checks if the player has at least one of many possible stages.- Parameters:
player- The player to check.stages- The stages to look for.- Returns:
- Whether or not the player had at least one of the stages.
-
hasAnyOf
public boolean hasAnyOf(net.minecraft.world.entity.player.Player player, @Nullable net.darkhax.gamestages.data.IStageData data, Collection<String> stages) Checks if the player has at least one of many possible stages.- Parameters:
player- The player to check.data- The player's stage data.stages- The stages to look for.- Returns:
- Whether or not the player had at least one of the stages.
-
hasAnyOf
public boolean hasAnyOf(net.minecraft.world.entity.player.Player player, @Nullable net.darkhax.gamestages.data.IStageData data, String... stages) Checks if the player has at least one of many possible stages.- Parameters:
player- The player to check.data- The player's stage data.stages- The stages to look for.- Returns:
- Whether or not the player had at least one of the stages.
-
hasAllOf
Checks if the player has all of the stages.- Parameters:
player- The player to check.stages- The stages to look for.- Returns:
- Whether or not the player had all the stages.
-
hasAllOf
Checks if the player has all of the stages.- Parameters:
player- The player to check.stages- The stages to look for.- Returns:
- Whether or not the player had all the stages.
-
hasAllOf
public boolean hasAllOf(net.minecraft.world.entity.player.Player player, @Nullable net.darkhax.gamestages.data.IStageData data, Collection<String> stages) Checks if the player has all of the stages.- Parameters:
player- The player to check.data- The player's stage data.stages- The stages to look for.- Returns:
- Whether or not the player had all the stages.
-
hasAllOf
public boolean hasAllOf(net.minecraft.world.entity.player.Player player, @Nullable net.darkhax.gamestages.data.IStageData data, String... stages) Checks if the player has all of the stages.- Parameters:
player- The player to check.data- The player's stage data.stages- The stages to look for.- Returns:
- Whether or not the player had all the stages.
-
addStage
Attempts to give a player a stage. Events may cancel this.- Parameters:
player- The player to give the stage.stages- The stage to give.
-
removeStage
Attempts to remove a stage from a player. Events may cancel this.- Parameters:
player- The player to remove the stage from.stages- The stage to remove.
-
clearStages
public int clearStages(net.minecraft.server.level.ServerPlayer player) Removes all stages from a player.- Parameters:
player- The player to clear the stages of.- Returns:
- The amount of stages that were removed.
-
getPlayerData
@Nullable public net.darkhax.gamestages.data.IStageData getPlayerData(net.minecraft.world.entity.player.Player player) Attempts to resolve the player stage data for a player. If it is a real server player it will look up their data using UUID. If it's a FakePlayer it will check the fake player data file. If it's a client player it will use the client's synced data cache.- Parameters:
player- The player to resolve.- Returns:
- The stage data that was found. Will be null if nothing could be found.
-