use of net.dzikoysk.funnyguilds.feature.hooks.vault.VaultHook in project FunnyGuilds by FunnyGuilds.
the class HookManager method setupHooks.
public void setupHooks() {
this.setupHook("WorldEdit", true, pluginName -> {
try {
Class.forName("com.sk89q.worldedit.Vector");
return new WorldEdit6Hook(pluginName);
} catch (ClassNotFoundException exception) {
return new WorldEdit7Hook(pluginName);
}
}, true).subscribe(hook -> WORLD_EDIT = hook);
this.setupHook("BungeeTabListPlus", true, pluginName -> {
try {
Class.forName("codecrafter47.bungeetablistplus.api.bukkit.Variable");
return new BungeeTabListPlusHook(pluginName, plugin);
} catch (ClassNotFoundException exception) {
return null;
}
}, true).subscribe(hook -> BUNGEE_TAB_LIST_PLUS = hook);
this.setupHook("Vault", true, VaultHook::new, true).subscribe(hook -> VAULT = hook);
this.setupHook("MVdWPlaceholderAPI", true, pluginName -> new MVdWPlaceholderAPIHook(pluginName, plugin), true).subscribe(hook -> MVDW_PLACEHOLDER_API = hook);
this.setupHook("PlaceholderAPI", true, pluginName -> new PlaceholderAPIHook(pluginName, plugin), true).subscribe(hook -> PLACEHOLDER_API = hook);
this.setupHook("LeaderHeads", true, pluginName -> new LeaderHeadsHook(pluginName, plugin), true).subscribe(hook -> LEADER_HEADS = hook);
this.<HologramHook>setupHook("HolographicDisplays", true, pluginName -> new HolographicDisplaysHook(pluginName, plugin), true).subscribe(hook -> HOLOGRAPHIC_DISPLAYS = hook);
}
use of net.dzikoysk.funnyguilds.feature.hooks.vault.VaultHook in project FunnyGuilds by FunnyGuilds.
the class DefaultTablistVariables method install.
public static void install(TablistVariablesParser parser) {
parser.add(new TimeFormattedVariable("HOUR", (user, time) -> time.getHour()));
parser.add(new TimeFormattedVariable("MINUTE", (user, time) -> time.getMinute()));
parser.add(new TimeFormattedVariable("SECOND", (user, time) -> time.getSecond()));
parser.add(new TimeFormattedVariable("DAY_OF_WEEK", (user, time) -> time.getDayOfWeek().getDisplayName(TextStyle.FULL, POLISH_LOCALE)));
parser.add(new TimeFormattedVariable("DAY_OF_MONTH", (user, time) -> time.getDayOfMonth()));
parser.add(new TimeFormattedVariable("MONTH", (user, time) -> time.getMonth().getDisplayName(TextStyle.FULL, POLISH_LOCALE)));
parser.add(new TimeFormattedVariable("MONTH_NUMBER", (user, time) -> time.getMonthValue()));
parser.add(new TimeFormattedVariable("YEAR", (user, time) -> time.getYear()));
parser.add(new SimpleTablistVariable("TPS", user -> MinecraftServerUtils.getFormattedTPS()));
parser.add(new SimpleTablistVariable("WORLD", user -> user.getPlayer().map(Player::getWorld).map(World::getName).orElseGet("")));
parser.add(new SimpleTablistVariable("ONLINE", user -> user.getPlayer().map(player -> Bukkit.getOnlinePlayers().stream().filter(player::canSee).count()).map(value -> Long.toString(value)).orElseGet("")));
for (TablistVariable variable : getFunnyVariables().values()) {
parser.add(variable);
}
if (HookManager.WORLD_GUARD.isPresent()) {
String wgRegionNoValue = FunnyGuilds.getInstance().getMessageConfiguration().wgRegionNoValue;
parser.add(new SimpleTablistVariable("WG-REGION", user -> {
List<String> regionNames = getWorldGuardRegionNames(user);
return regionNames != null && !regionNames.isEmpty() ? regionNames.get(0) : wgRegionNoValue;
}));
parser.add(new SimpleTablistVariable("WG-REGIONS", user -> {
List<String> regionNames = getWorldGuardRegionNames(user);
return regionNames != null && !regionNames.isEmpty() ? Joiner.on(", ").join(regionNames) : wgRegionNoValue;
}));
}
if (HookManager.VAULT.isPresent() && VaultHook.isEconomyHooked()) {
parser.add(new SimpleTablistVariable("VAULT-MONEY", user -> {
return user.getPlayer().map(VaultHook::accountBalance).map(value -> Double.toString(value)).orElseGet("");
}));
}
}
Aggregations