forked from Medieval-Realm/TokenManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMVdWPlaceholderHook.java
More file actions
35 lines (27 loc) · 1.47 KB
/
MVdWPlaceholderHook.java
File metadata and controls
35 lines (27 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package me.realized.tokenmanager.hook.hooks;
import be.maximvdw.placeholderapi.PlaceholderAPI;
import be.maximvdw.placeholderapi.PlaceholderReplaceEvent;
import be.maximvdw.placeholderapi.PlaceholderReplacer;
import me.realized.tokenmanager.TokenManagerPlugin;
import me.realized.tokenmanager.util.hook.PluginHook;
public class MVdWPlaceholderHook extends PluginHook<TokenManagerPlugin> {
public MVdWPlaceholderHook(final TokenManagerPlugin plugin) {
super(plugin, "MVdWPlaceholderAPI");
final Placeholders placeholders = new Placeholders();
PlaceholderAPI.registerPlaceholder(plugin, "tm_tokens", placeholders);
PlaceholderAPI.registerPlaceholder(plugin, "tm_tokens_raw", placeholders);
PlaceholderAPI.registerPlaceholder(plugin, "tm_tokens_commas", placeholders);
PlaceholderAPI.registerPlaceholder(plugin, "tm_tokens_formatted", placeholders);
PlaceholderAPI.registerPlaceholder(plugin, "tm_rank", placeholders);
for (int i = 1; i <= 10; i++) {
PlaceholderAPI.registerPlaceholder(plugin, "tm_top_name_" + i, placeholders);
PlaceholderAPI.registerPlaceholder(plugin, "tm_top_tokens_" + i, placeholders);
}
}
public class Placeholders implements PlaceholderReplacer {
@Override
public String onPlaceholderReplace(final PlaceholderReplaceEvent event) {
return plugin.handlePlaceholderRequest(event.getPlayer(), event.getPlaceholder().substring(3));
}
}
}