mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 13:15:28 +01:00
Renamed GameModePlaceholders to GameModePlaceholder
(enum names should be singular)
This commit is contained in:
parent
1d119ddea1
commit
b0d4604c63
@ -7,7 +7,7 @@ import java.text.DateFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
|
||||
public enum GameModePlaceholders {
|
||||
public enum GameModePlaceholder {
|
||||
|
||||
/* World-related */
|
||||
WORLD_FRIENDLY_NAME("world_friendly_name", (addon, user, island) -> addon.getWorldSettings().getFriendlyName()),
|
||||
@ -74,7 +74,7 @@ public enum GameModePlaceholders {
|
||||
*/
|
||||
private GameModePlaceholderReplacer replacer;
|
||||
|
||||
GameModePlaceholders(String placeholder, GameModePlaceholderReplacer replacer) {
|
||||
GameModePlaceholder(String placeholder, GameModePlaceholderReplacer replacer) {
|
||||
this.placeholder = placeholder;
|
||||
this.replacer = replacer;
|
||||
}
|
@ -7,7 +7,7 @@ import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
|
||||
import world.bentobox.bentobox.api.user.User;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.lists.GameModePlaceholders;
|
||||
import world.bentobox.bentobox.lists.GameModePlaceholder;
|
||||
|
||||
/**
|
||||
* Registers default placeholders for all GameModes. Will not overwrite any that the gamemode addon itself implements.
|
||||
@ -40,8 +40,8 @@ public class GameModePlaceholderManager {
|
||||
*/
|
||||
class DefaultPlaceholder implements PlaceholderReplacer {
|
||||
private final GameModeAddon addon;
|
||||
private final GameModePlaceholders type;
|
||||
public DefaultPlaceholder(GameModeAddon addon, GameModePlaceholders type) {
|
||||
private final GameModePlaceholder type;
|
||||
public DefaultPlaceholder(GameModeAddon addon, GameModePlaceholder type) {
|
||||
this.addon = addon;
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import world.bentobox.bentobox.api.addons.Addon;
|
||||
import world.bentobox.bentobox.api.addons.GameModeAddon;
|
||||
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
|
||||
import world.bentobox.bentobox.hooks.PlaceholderAPIHook;
|
||||
import world.bentobox.bentobox.lists.GameModePlaceholders;
|
||||
import world.bentobox.bentobox.lists.GameModePlaceholder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
@ -61,14 +61,14 @@ public class PlaceholdersManager {
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public void registerDefaultPlaceholders(@NonNull GameModeAddon addon) {
|
||||
Arrays.stream(GameModePlaceholders.values())
|
||||
Arrays.stream(GameModePlaceholder.values())
|
||||
.filter(placeholder -> !isPlaceholder(addon, placeholder.getPlaceholder()))
|
||||
.forEach(placeholder -> registerPlaceholder(addon, placeholder.getPlaceholder(), new DefaultPlaceholder(addon, placeholder)));
|
||||
|
||||
// TODO legacy placeholders, do not forget to remove at some point
|
||||
String prefix = addon.getDescription().getName().toLowerCase();
|
||||
Map<GameModePlaceholders, String> placeholders = new EnumMap<>(GameModePlaceholders.class);
|
||||
Arrays.stream(GameModePlaceholders.values()).forEach(placeholder -> placeholders.put(placeholder, prefix + "-" + placeholder.getPlaceholder().replace('_', '-')));
|
||||
Map<GameModePlaceholder, String> placeholders = new EnumMap<>(GameModePlaceholder.class);
|
||||
Arrays.stream(GameModePlaceholder.values()).forEach(placeholder -> placeholders.put(placeholder, prefix + "-" + placeholder.getPlaceholder().replace('_', '-')));
|
||||
|
||||
// Register placeholders only if they have not already been registered by the addon itself
|
||||
placeholders.entrySet().stream().filter(en -> !isPlaceholder(addon, en.getValue()))
|
||||
|
Loading…
Reference in New Issue
Block a user