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 TypeMethodDescriptionvoid
List
<net.minecraft.world.item.ItemStack> getArmor()
Returns a deep copy of the armor contents.net.minecraft.world.item.ItemStack
getBoots()
net.minecraft.world.item.ItemStack
net.minecraft.world.item.ItemStack
Returns a deep copy of the inventory contents.int
net.minecraft.world.item.ItemStack
getItemAtSlot
(Integer slot) net.minecraft.world.item.ItemStack
int
getName()
boolean
hasItemInSlot
(Integer slot) void
removeItem
(Integer slot) void
Sets the armor contents with a deep copy of the provided items.void
setArmorSlot
(int slot, net.minecraft.world.item.ItemStack item) void
setInventory
(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()
-