Skip to content

Commit

Permalink
⚡ Don't emit empty OxidePluginEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGraversen committed Sep 26, 2023
1 parent f8aed11 commit 579c86d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ protected Function<RustRconResponse, Optional<OxidePluginEvent>> eventParser() {
final var message = payload.getMessage();
final var pluginName = message.substring(message.indexOf('[') + 1, message.indexOf(']')).trim();
final var pluginMessage = message.substring(pluginName.length() + 2).trim();

if (pluginName.isEmpty() || pluginMessage.isEmpty()) {
return Optional.empty();
}

final var oxidePluginEvent = new OxidePluginEvent(pluginName, pluginMessage);
return Optional.of(oxidePluginEvent);
};
Expand Down

0 comments on commit 579c86d

Please sign in to comment.