Class PlayerRole
java.lang.Object
at.setup_studios.mc_milsim.gameplay.player.PlayerRole
Represents a player role
This class manages role-specific attributes, inventory, and armor loadouts.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerRole(String name, String displayName, int maxPlayers, String description) Creates a new PlayerRole with specified attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidList<net.minecraft.world.item.ItemStack> getArmor()Returns a deep copy of the armor contents.net.minecraft.world.item.ItemStackgetBoots()net.minecraft.world.item.ItemStacknet.minecraft.world.item.ItemStackReturns a deep copy of the inventory contents.intnet.minecraft.world.item.ItemStackgetItemAtSlot(Integer slot) net.minecraft.world.item.ItemStackintgetName()booleanhasItemInSlot(Integer slot) voidremoveItem(Integer slot) voidSets the armor contents with a deep copy of the provided items.voidsetArmorSlot(int slot, net.minecraft.world.item.ItemStack item) voidsetInventory(Map<Integer, net.minecraft.world.item.ItemStack> items) Sets the inventory contents with a deep copy of the provided items.toString()Returns a formatted string representation of the role.
-
Constructor Details
-
PlayerRole
Creates a new PlayerRole with specified attributes.- Parameters:
name- The internal name of the roledisplayName- The displayed name of the rolemaxPlayers- Maximum number of players that can have this role per teamdescription- A detailed description of the role- Throws:
IllegalArgumentException- if any parameter is null or if maxPlayers is less than or equal to 0
-
-
Method Details
-
setInventory
-
setArmor
Sets the armor contents with a deep copy of the provided items.- Parameters:
items- List of armor ItemStacks in order: helmet, chestplate, leggings, boots
-
getInventory
-
getArmor
Returns a deep copy of the armor contents.- Returns:
- List of armor ItemStacks
-
toString
-
getName
-
getDisplayName
-
getDescription
-
getMaxPlayersPerTeam
public int getMaxPlayersPerTeam() -
getItemAtSlot
-
hasItemInSlot
-
addItem
-
removeItem
-
getInventorySize
public int getInventorySize() -
setArmorSlot
public void setArmorSlot(int slot, net.minecraft.world.item.ItemStack item) -
getHelmet
public net.minecraft.world.item.ItemStack getHelmet() -
getChestplate
public net.minecraft.world.item.ItemStack getChestplate() -
getLeggins
public net.minecraft.world.item.ItemStack getLeggins() -
getBoots
public net.minecraft.world.item.ItemStack getBoots()
-