-
Notifications
You must be signed in to change notification settings - Fork 32
Structure Configuration Signs
Using CustomStructure Addons, developers can define custom Structure Configuration Signs for use.
To create a custom configuration sign, create a new class that extends the abstract class StructureSign:
public class CustomSign extends StructureSign {
@Override
public boolean onStructureSpawn(@NotNull Location location, @NotNull Structure structure) {
return true;
}
}Your class is required to implement the onStructureSpawn method. This method is called when your structure sign is detected within a spawned structure and is being replaced. The return value determines whether or not the sign should be replaced with air. If you return true, then the sign will be removed. If false is returned, then the sign is not removed.
Note: The default constructor must exist.
In this example, the sign broadcasts the messages specified on the second line, x amount of times. x is defined by the third line on the sign.
[CustomSign]
{message}
{count}
public class CustomSign extends StructureSign {
@Override
public boolean onStructureSpawn(@NotNull Location location, @NotNull Structure structure) {
if(!hasArgument(0)) {
Bukkit.broadcastMessage("No message defined!");
return true;
}
String message = getStringArgument(0);
int messageCount = 1;
if(hasArgument(1)) {
messageCount = getStylizedIntArgument(1);
}
for(int i = 0; i < messageCount; i++) {
Bukkit.broadcastMessage(message);
}
return true;
}
}You register a custom sign using your CustomStructureAddon class.
myAddon.registerStructureSign("CustomSign", CustomSign.class);Custom Structure WIKI
- Main Page
- Installation
- Commands
- Creating Schematics
-
Structure Configuration
- Structure Configuration File
- Configuration Signs
- Weighted Probability
- Updating The Plugin
- Addons
- Developer API