-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
SentinelUUID.java
41 lines (34 loc) · 1013 Bytes
/
SentinelUUID.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
package org.mcmonkey.sentinel.integration;
import org.bukkit.entity.LivingEntity;
import org.mcmonkey.sentinel.SentinelIntegration;
import java.util.UUID;
public class SentinelUUID extends SentinelIntegration {
@Override
public String getTargetHelp() {
return "uuid:UUID";
}
@Override
public String[] getTargetPrefixes() {
return new String[] { "uuid" };
}
@Override
public boolean shouldLowerCaseValue() {
return true;
}
@Override
public boolean isTarget(LivingEntity ent, String prefix, String value) {
try {
if (prefix.equals("uuid")) {
return ent.getUniqueId().equals(UUID.fromString(value));
}
}
catch (IllegalArgumentException ex) {
// Do nothing.
// TODO: Maybe show a one-time warning?
}
catch (Exception ex) {
ex.printStackTrace();
}
return false;
}
}