-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
PVPStatsPlayerProperties.java
121 lines (99 loc) · 3.67 KB
/
PVPStatsPlayerProperties.java
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package com.denizenscript.depenizen.bukkit.properties.pvpstats;
import com.denizenscript.denizen.objects.dPlayer;
import com.denizenscript.denizencore.objects.Element;
import com.denizenscript.denizencore.objects.dObject;
import com.denizenscript.denizencore.tags.Attribute;
import com.denizenscript.denizencore.objects.properties.Property;
import com.denizenscript.denizencore.objects.Mechanism;
import net.slipcor.pvpstats.PVPData;
public class PVPStatsPlayerProperties implements Property {
@Override
public String getPropertyString() {
return null;
}
@Override
public String getPropertyId() {
return "PVPStatsPlayer";
}
@Override
public void adjust(Mechanism mechanism) {
// None
}
public static boolean describes(dObject object) {
return object instanceof dPlayer;
}
public static PVPStatsPlayerProperties getFrom(dObject object) {
if (!describes(object)) {
return null;
}
else {
return new PVPStatsPlayerProperties((dPlayer) object);
}
}
public static final String[] handledTags = new String[] {
"pvpstats"
};
public static final String[] handledMechs = new String[] {
}; // None
public PVPStatsPlayerProperties(dPlayer player) {
this.playerName = player.getName();
}
String playerName = null;
@Override
public String getAttribute(Attribute attribute) {
if (attribute.startsWith("pvpstats")) {
attribute = attribute.fulfill(1);
// <--[tag]
// @attribute <p@player.pvpstats.deaths>
// @returns Element
// @description
// Returns the number of times the player has died.
// @Plugin Depenizen, PvP Stats
// -->
if (attribute.startsWith("deaths")) {
return new Element(PVPData.getDeaths(playerName)).getAttribute(attribute.fulfill(1));
}
// <--[tag]
// @attribute <p@player.pvpstats.elo>
// @returns Element
// @description
// Returns the Elo rating of the player.
// @Plugin Depenizen, PvP Stats
// -->
if (attribute.startsWith("elo")) {
return new Element(PVPData.getEloScore(playerName)).getAttribute(attribute.fulfill(1));
}
// <--[tag]
// @attribute <p@player.pvpstats.kills>
// @returns Element
// @description
// Returns the number of players the player has killed.
// @Plugin Depenizen, PvP Stats
// -->
if (attribute.startsWith("kills")) {
return new Element(PVPData.getKills(playerName)).getAttribute(attribute.fulfill(1));
}
// <--[tag]
// @attribute <p@player.pvpstats.streak>
// @returns Element
// @description
// Returns the current kill streak of the player.
// @Plugin Depenizen, PvP Stats
// -->
if (attribute.startsWith("streak")) {
return new Element(PVPData.getStreak(playerName)).getAttribute(attribute.fulfill(1));
}
// <--[tag]
// @attribute <p@player.pvpstats.max_streak>
// @returns Element
// @description
// Returns the highest kill streak of the player.
// @Plugin Depenizen, PvP Stats
// -->
if (attribute.startsWith("max_streak")) {
return new Element(PVPData.getMaxStreak(playerName)).getAttribute(attribute.fulfill(1));
}
}
return null;
}
}