Interface LobbyItem
public interface LobbyItem
Represents an actual item that will be added into the hotbar to players during the lobby phase
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCommand
(String cmd) Adds a command that will be executed whenever a player uses the item.Returns all commands that will be executed whenever a player uses the item.Returns the name of the item exactly the same as it has been configured.@Nullable LobbyItemHandler
Returns the handler that handles the execution of an item.@Nullable String
Returns the id of the current set handler for this item.getItem()
Returns the item that will be set into the hotbar.default String
getName()
ReturnsgetConfigName()
, but formats it into the default configured language.getName
(@Nullable CommandSender sender) ReturnsgetConfigName()
, but formats it and translates it to the givensender
.int
getSlot()
Returns the slot to which this item will be added to.boolean
Returns whether the commands (getCommands()
) will be executed as console or as the player who used the item.boolean
removeCommand
(String cmd) Removes a command from thegetCommands()
List.void
setCommandsAsConsole
(boolean value) Set whether the commands (getCommands()
) will be executed as console or as the player who used the item.void
setConfigName
(String name) Set the unformatted name of the config.void
setHandler
(@Nullable LobbyItemHandler handler) Set the handler for this item.void
setHandlerId
(@Nullable String id) Set the handler id of this item.void
Set the item that will be set into the hotbar.
-
Method Details
-
getName
ReturnsgetConfigName()
, but formats it into the default configured language.- Returns:
- The name in the default language
-
getName
ReturnsgetConfigName()
, but formats it and translates it to the givensender
.- Parameters:
sender
- The person from which it should look up the language. Null if it should take the default language- Returns:
- The name in the language of the sender
-
getConfigName
String getConfigName()Returns the name of the item exactly the same as it has been configured.- Returns:
- The raw name
-
setConfigName
Set the unformatted name of the config.- Parameters:
name
- The new raw name
-
getSlot
int getSlot()Returns the slot to which this item will be added to.- Returns:
- The slot in the hotbar at which this item is located at.
-
getItem
ItemStack getItem()Returns the item that will be set into the hotbar.- Returns:
- The item/icon
-
setItem
Set the item that will be set into the hotbar.- Parameters:
is
- The new item/icon
-
getHandler
Returns the handler that handles the execution of an item.May be
null
even whengetHandlerId()
returns a non-null value. This means that no handler has been registered under the given id.- Returns:
- The handler of this item,
null
if none under the set id is registered
-
getHandlerId
Returns the id of the current set handler for this item. It's possible thatnull
is being returned, this means that none has been defined yet.- Returns:
- The set handler id, may be
null
-
setHandler
Set the handler for this item. Make sure it's registered, otherwise no change is being applied.Passing
null
causes the item to do nothing when used.- Parameters:
handler
- The new handler, may benull
-
setHandlerId
Set the handler id of this item. It'll automatically updatesetHandler(LobbyItemHandler)
if the given id is registered. If the handler under the given id isn't registered then the id will still be anyways.- Parameters:
id
- The id of the handler, may benull
-
getCommands
Returns all commands that will be executed whenever a player uses the item.- Returns:
- The commands that will be executed on use
- See Also:
-
isCommandsAsConsole
boolean isCommandsAsConsole()Returns whether the commands (getCommands()
) will be executed as console or as the player who used the item.- Returns:
true
if the commands will be executed as console,false
if as the player
-
setCommandsAsConsole
void setCommandsAsConsole(boolean value) Set whether the commands (getCommands()
) will be executed as console or as the player who used the item.- Parameters:
value
-true
if the commands will be executed as console,false
if as the player
-
addCommand
Adds a command that will be executed whenever a player uses the item.- Parameters:
cmd
- The command that will be executed on use
-
removeCommand
Removes a command from thegetCommands()
List. That command won't be executed any further if the operation was successful (returnstrue
).- Parameters:
cmd
- The command that shall be removed- Returns:
false
if it wouldn't have been executed anyways
-