Class TeamStageHelper.PlayerHelper

java.lang.Object
dev.scsupercraft.teamstages.data.TeamStageHelper.PlayerHelper
Enclosing class:
TeamStageHelper

public static class TeamStageHelper.PlayerHelper extends Object
A helper class for managing player stages.

Get an instance of this class using TeamStageHelper.player().

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addStage(net.minecraft.server.level.ServerPlayer player, String... stages)
    Attempts to give a player a stage.
    int
    clearStages(net.minecraft.server.level.ServerPlayer player)
    Removes all stages from a player.
    net.darkhax.gamestages.data.IStageData
    getPlayerData(net.minecraft.world.entity.player.Player player)
    Attempts to resolve the player stage data for a player.
    boolean
    hasAllOf(net.minecraft.world.entity.player.Player player, String... stages)
    Checks if the player has all of the stages.
    boolean
    hasAllOf(net.minecraft.world.entity.player.Player player, Collection<String> stages)
    Checks if the player has all of the stages.
    boolean
    hasAllOf(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, String... stages)
    Checks if the player has all of the stages.
    boolean
    hasAllOf(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.
    boolean
    hasAnyOf(net.minecraft.world.entity.player.Player player, String... stages)
    Checks if the player has at least one of many possible stages.
    boolean
    hasAnyOf(net.minecraft.world.entity.player.Player player, Collection<String> stages)
    Checks if the player has at least one of many possible stages.
    boolean
    hasAnyOf(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.
    boolean
    hasAnyOf(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.
    boolean
    hasStage(net.minecraft.world.entity.player.Player player, String stage)
    Checks if a player has a stage.
    boolean
    hasStage(net.minecraft.world.entity.player.Player player, net.darkhax.gamestages.data.IStageData data, String stage)
    Checks if a player has a stage.
    void
    removeStage(net.minecraft.server.level.ServerPlayer player, String... stages)
    Attempts to remove a stage from a player.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • hasStage

      public boolean hasStage(net.minecraft.world.entity.player.Player player, String stage)
      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

      public boolean hasAnyOf(net.minecraft.world.entity.player.Player player, String... stages)
      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, Collection<String> stages)
      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

      public boolean hasAllOf(net.minecraft.world.entity.player.Player player, String... stages)
      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, Collection<String> stages)
      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

      public void addStage(net.minecraft.server.level.ServerPlayer player, String... stages)
      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

      public void removeStage(net.minecraft.server.level.ServerPlayer player, String... stages)
      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.