Skip to content

Texts Component

com.eu.habbo.core.texts.TextsComponent

The TextsComponent class in the Arcturus project is responsible for managing text resources. This documentation will guide you on how to access and use the different methods provided by this component.

Accessing the Texts Component

To access the Texts Component instance, you need to use the Emulator class. Here's an example of how you can do it:

java
TextsComponent texts = Emulator.getComponent(TextsComponent.class);

Methods

The TextsComponent class provides the following methods:

getValue

java
String getValue(String key)

Returns the value associated with the given key if it exists. Otherwise, it returns an empty string.

getValue with Default Value

java
String getValue(String key, String defaultValue)

Returns the value associated with the given key if it exists. If the key is not found, it returns the defaultValue provided.

getBoolean

java
boolean getBoolean(String key)

Returns the boolean representation of the value associated with the given key. If the key is not found or the value cannot be converted to a boolean, it returns false.

getBoolean with Default Value

java
boolean getBoolean(String key, boolean defaultValue)

Returns the boolean representation of the value associated with the given key. If the key is not found or the value cannot be converted to a boolean, it returns the defaultValue provided.

getInt

java
int getInt(String key)

Returns the integer representation of the value associated with the given key. If the key is not found or the value cannot be converted to an integer, it returns 0.

getInt with Default Value

java
int getInt(String key, int defaultValue)

Returns the integer representation of the value associated with the given key. If the key is not found or the value cannot be converted to an integer, it returns the defaultValue provided.

update

java
void update(String key, String value)

Updates the value associated with the given key to the provided value.

register

java
void register(String key, String value)

Registers a new configuration key and value. If the key already exists, the method will not replace the existing value.

reloadComponent

java
void reloadComponent()

Reloads the Texts Component by querying the database for text resources.

Example Usage

Here's an example of how you can use the TextsComponent methods:

java
String value = texts.getValue("welcome_message", "Welcome to the game!");

boolean enableSounds = texts.getBoolean("enable_sounds", true);

int maxPlayers = texts.getInt("max_players", 1000);

texts.update("welcome_message", "Welcome to our new world!");

texts.register("new_message", "Hello, world!");