mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-16 17:14:16 +02:00
Fixed indentation in GameModePlaceholderManager
This commit is contained in:
parent
01e1147c7f
commit
00546c2cb6
@ -18,22 +18,22 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class GameModePlaceholderManager {
|
public class GameModePlaceholderManager {
|
||||||
|
|
||||||
private BentoBox plugin;
|
private BentoBox plugin;
|
||||||
|
|
||||||
public GameModePlaceholderManager(BentoBox plugin) {
|
public GameModePlaceholderManager(BentoBox plugin) {
|
||||||
super();
|
super();
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerGameModePlaceholders(GameModeAddon addon) {
|
public void registerGameModePlaceholders(GameModeAddon addon) {
|
||||||
String prefix = addon.getDescription().getName().toLowerCase();
|
String prefix = addon.getDescription().getName().toLowerCase();
|
||||||
Map<GameModePlaceholders, String> placeholders = new EnumMap<>(GameModePlaceholders.class);
|
Map<GameModePlaceholders, String> placeholders = new EnumMap<>(GameModePlaceholders.class);
|
||||||
Arrays.stream(GameModePlaceholders.values()).forEach(placeholder -> placeholders.put(placeholder, prefix + "-" + placeholder.getPlaceholder()));
|
Arrays.stream(GameModePlaceholders.values()).forEach(placeholder -> placeholders.put(placeholder, prefix + "-" + placeholder.getPlaceholder()));
|
||||||
|
|
||||||
// Register placeholders only if they have not already been registered by the addon itself
|
// Register placeholders only if they have not already been registered by the addon itself
|
||||||
placeholders.entrySet().stream().filter(en -> !plugin.getPlaceholdersManager().isPlaceholder(addon, en.getValue()))
|
placeholders.entrySet().stream().filter(en -> !plugin.getPlaceholdersManager().isPlaceholder(addon, en.getValue()))
|
||||||
.forEach(en -> plugin.getPlaceholdersManager().registerPlaceholder(en.getValue(), new DefaultPlaceholder(addon, en.getKey())));
|
.forEach(en -> plugin.getPlaceholdersManager().registerPlaceholder(en.getValue(), new DefaultPlaceholder(addon, en.getKey())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,28 +42,28 @@ public class GameModePlaceholderManager {
|
|||||||
* @since 1.4.0
|
* @since 1.4.0
|
||||||
*/
|
*/
|
||||||
class DefaultPlaceholder implements PlaceholderReplacer {
|
class DefaultPlaceholder implements PlaceholderReplacer {
|
||||||
private final GameModeAddon addon;
|
private final GameModeAddon addon;
|
||||||
private final GameModePlaceholders type;
|
private final GameModePlaceholders type;
|
||||||
public DefaultPlaceholder(GameModeAddon addon, GameModePlaceholders type) {
|
public DefaultPlaceholder(GameModeAddon addon, GameModePlaceholders type) {
|
||||||
super();
|
super();
|
||||||
this.addon = addon;
|
this.addon = addon;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see world.bentobox.bentobox.api.placeholders.PlaceholderReplacer#onReplace(world.bentobox.bentobox.api.user.User)
|
* @see world.bentobox.bentobox.api.placeholders.PlaceholderReplacer#onReplace(world.bentobox.bentobox.api.user.User)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String onReplace(User user) {
|
public String onReplace(User user) {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
Island island = addon.getIslands().getIsland(addon.getOverWorld(), user);
|
Island island = addon.getIslands().getIsland(addon.getOverWorld(), user);
|
||||||
if (island == null) {
|
if (island == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return type.getReplacer().onReplace(addon, user, island);
|
return type.getReplacer().onReplace(addon, user, island);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user