Skip to content
Permalink
Browse files

add uuid targets

  • Loading branch information...
mcmonkey4eva committed Mar 30, 2019
1 parent 6642562 commit 305641239345ed44178bf3a964f4fc0b71c13a56
@@ -155,11 +155,8 @@ These are all valid targets and ignores:
- In 1.13 or higher: DOLPHIN, DROWNED, COD, SALMON, PUFFERFISH, TROPICAL_FISH, PHANTOM, TURTLE
- Also allowed: player:NAME(REGEX), npc:NAME(REGEX), entityname:NAME(REGEX), helditem:MATERIALNAME(REGEX), group:GROUPNAME(EXACT)
- Also, event:pvp/pvnpc/pve/pvsentinel
- Also, via internal sample integrations: sbteam:SCOREBOARD\_TEAM\_HERE, healthabove:PERCENTAGE and healthbelow:PERCENTAGE, permission:PERM.KEY, squad:SENTINEL\_SQUAD\_NAME, uuid:UUID
- Also, event:message,SOMETEXT will match chat messages that contain 'sometext'.
- Also, sbteam:SCOREBOARD\_TEAM\_HERE
- Also, healthabove:PERCENTAGE and healthbelow:PERCENTAGE
- Also, permission:PERM.KEY
- Also, squad:SENTINEL\_SQUAD\_NAME
- Also anything listed in the integrations section above!
- You can also add multi-targets - that is, `multi:TARGET_ONE,TARGET_TWO,...` to have multiple targets required together.
- For example: `multi:PLAYER,PLAYER,CHICKEN` will make the NPC angry at 2 players and a chicken if they are all together.
@@ -304,6 +304,7 @@ public void run() {
registerIntegration(new SentinelPermissions());
registerIntegration(new SentinelSBTeams());
registerIntegration(new SentinelSquads());
registerIntegration(new SentinelUUID());
if (Bukkit.getPluginManager().getPlugin("Towny") != null) {
try {
registerIntegration(new SentinelTowny());
@@ -0,0 +1,36 @@
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 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;
}
}

0 comments on commit 3056412

Please sign in to comment.
You can’t perform that action at this time.