-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathPlaceholderAPIHook.java
More file actions
55 lines (39 loc) · 1.15 KB
/
PlaceholderAPIHook.java
File metadata and controls
55 lines (39 loc) · 1.15 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.github.aasmus.pvptoggle.utils;
import org.bukkit.entity.Player;
import com.github.aasmus.pvptoggle.PvPToggle;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class PlaceholderAPIHook extends PlaceholderExpansion {
private PvPToggle plugin;
public PlaceholderAPIHook(PvPToggle plugin) {
this.plugin = plugin;
}
@Override
public String onPlaceholderRequest(Player player, String identifier) {
if(player == null) { return ""; }
//Placeholder: %pvptoggle_positive_rep%
if(identifier.equals("pvp_state")) {
return PvPToggle.instance.players.get(player.getUniqueId()) ? PvPToggle.instance.getConfig().getString("MESSAGES.PLACEHOLDER_OFF") : PvPToggle.instance.getConfig().getString("MESSAGES.PLACEHOLDER_ON");
}
return null;
}
@Override
public boolean persist() {
return true;
}
@Override
public boolean canRegister() {
return true;
}
@Override
public String getIdentifier() {
return "PvPToggle";
}
@Override
public String getAuthor() {
return plugin.getDescription().getAuthors().toString();
}
@Override
public String getVersion() {
return plugin.getDescription().getVersion();
}
}