Files
MobArena/src/main/java/com/garbagemule/MobArena/signs/SetsLines.java
T
Andreas Troelsen 84249640d1 Add support for join, leave, and info signs.
The ability to execute commands by hitting signs is already implemented by other plugins, but by creating built-in support for such signs, it's possible to leverage information about the plugin and its current state. This implementation allows for displaying live information about player counts, waves, etc. on the signs in addition to tying actions to them.

Customizable templates defined in the new signs.yml config-file can be bound to signs during the in-game sign creation, and users can define state-specific templates that change based on whether an arena is completely idle, has players in the lobby, or is running and in full swing.

Sign data is stored in data/signs.data as a YAML-formatted file that shouldn't be modified directly, effectively separating configuration (templates in signs.yml) and data (coordinates and parameters in signs.data).

Closes #385
2018-06-14 00:29:11 +02:00

23 lines
499 B
Java

package com.garbagemule.MobArena.signs;
import org.bukkit.Location;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
class SetsLines {
void set(Location location, String[] lines) {
BlockState state = location.getBlock().getState();
if (!(state instanceof Sign)) {
return;
}
Sign sign = (Sign) state;
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i]);
}
sign.update();
}
}