Skip to content

Commit

Permalink
Error if ExprLogMessage is used outside of LogEvt
Browse files Browse the repository at this point in the history
  • Loading branch information
Blueyescat committed Sep 15, 2018
1 parent b6572c8 commit b1c8ae1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.apache.tools.ant.filters.ReplaceTokens

group = 'me.blueyescat.skriptlogs'
version = '0.1.0'
version = '0.1.1'

apply plugin: 'java'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bukkit.event.Event;
import org.eclipse.jdt.annotation.Nullable;

import ch.njol.skript.ScriptLoader;
import ch.njol.skript.Skript;
import ch.njol.skript.doc.Description;
import ch.njol.skript.doc.Examples;
Expand Down Expand Up @@ -32,6 +33,10 @@ public class ExprLogMessage extends SimpleExpression<String> {

@Override
public boolean init(final Expression<?>[] exprs, final int matchedPattern, final Kleenean isDelayed, final ParseResult parseResult) {
if (!ScriptLoader.isCurrentEvent(LogEvt.class)) {
Skript.error("The logged message expression can't be used outside of a log event");
return false;
}
return true;
}

Expand Down

0 comments on commit b1c8ae1

Please sign in to comment.