Skip to content

Commit

Permalink
minor cleanups and meta
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 25, 2022
1 parent 4b5098b commit 2051b46
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
Expand Up @@ -1332,7 +1332,7 @@ else if (input.size() > 1) {
// Returns a new ListTag excluding the items at the specified index.
// Note the index input options described at <@link objecttype listtag>
// @Example
// # Narrates a list of "two|three|four"
// # Narrates a list of "one|three|four"
// - narrate <list[one|two|three|four].remove[2]>
// -->
tagProcessor.registerTag(ListTag.class, ListTag.class, "remove", (attribute, object, indices) -> { // non-static due to hacked sub-tag
Expand Down
Expand Up @@ -71,6 +71,8 @@ public static void load() {
//
// There is intentionally no tag that can read the value of a secret.
//
// You can reload the secrets file via "/denizen reload config"
//
// -->

@Fetchable("secret")
Expand Down
Expand Up @@ -168,14 +168,16 @@ public static void executeCommand(ScriptEntry scriptEntry) {
});
}
}, scriptEntry);
return;
}
else if (action.asString().equalsIgnoreCase("disconnect")) {
Jedis con = connections.get(redisID);
if (con == null) {
Debug.echoError(scriptEntry, "Not connected to redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
return;
}
if (action.asString().equalsIgnoreCase("disconnect")) {
scriptEntry.setFinished(true);
if (!connections.containsKey(redisID)) {
Debug.echoError(scriptEntry, "Not connected to redis server with ID '" + redisID + "'!");
return;
}
Jedis con = connections.remove(redisID);
JedisPubSub pubSub = subscriptions.remove(redisID);
if (pubSub != null) {
try {
Expand All @@ -195,12 +197,6 @@ else if (action.asString().equalsIgnoreCase("disconnect")) {
Debug.echoDebug(scriptEntry, "Disconnected from '" + redisID + "'.");
}
else if (action.asString().equalsIgnoreCase("subscribe")) {
Jedis con = connections.get(redisID);
if (con == null) {
Debug.echoError(scriptEntry, "Not connected to redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
return;
}
if (subscriptions.containsKey(redisID)) {
Debug.echoError(scriptEntry, "Already subscribed to a channel on redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
Expand All @@ -216,10 +212,6 @@ else if (action.asString().equalsIgnoreCase("subscribe")) {
}
else if (action.asString().equalsIgnoreCase("unsubscribe")) {
scriptEntry.setFinished(true);
if (!connections.containsKey(redisID)) {
Debug.echoError(scriptEntry, "Not connected to redis server with ID '" + redisID + "'!");
return;
}
if (!subscriptions.containsKey(redisID)) {
Debug.echoError(scriptEntry, "Not subscribed to redis server with ID '" + redisID + "'!");
return;
Expand All @@ -238,12 +230,6 @@ else if (action.asString().equalsIgnoreCase("publish")) {
scriptEntry.setFinished(true);
return;
}
final Jedis con = connections.get(redisID);
if (con == null) {
Debug.echoError(scriptEntry, "Not connected to redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
return;
}
if (subscriptions.containsKey(redisID)) {
Debug.echoError(scriptEntry, "Cannot publish messages while subscribed to redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
Expand Down Expand Up @@ -279,12 +265,6 @@ else if (action.asString().equalsIgnoreCase("command")) {
scriptEntry.setFinished(true);
return;
}
final Jedis con = connections.get(redisID);
if (con == null) {
Debug.echoError(scriptEntry, "Not connected to redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
return;
}
if (subscriptions.containsKey(redisID)) {
Debug.echoError(scriptEntry, "Cannot run commands while subscribed to redis server with ID '" + redisID + "'!");
scriptEntry.setFinished(true);
Expand Down

0 comments on commit 2051b46

Please sign in to comment.