-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1562e66
commit cdc3b48
Showing
4 changed files
with
27 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
toast.version=0.2.0 | ||
toast.version=0.3.0 |
23 changes: 0 additions & 23 deletions
23
src/main/java/jaci/openrio/toast/core/command/cmd/CommandGroovyScript.groovy
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
src/main/java/jaci/openrio/toast/core/command/cmd/CommandGroovyScript.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package jaci.openrio.toast.core.command.cmd; | ||
|
||
import groovy.lang.Binding; | ||
import groovy.lang.GroovyShell; | ||
import jaci.openrio.toast.core.Toast; | ||
import jaci.openrio.toast.core.command.FuzzyCommand; | ||
import jaci.openrio.toast.core.shared.GlobalBlackboard; | ||
|
||
public class CommandGroovyScript extends FuzzyCommand { | ||
@Override | ||
public boolean shouldInvoke(String message) { | ||
return message.startsWith("script"); | ||
} | ||
|
||
@Override | ||
public void invokeCommand(String message) { | ||
String groovy = message.replaceFirst("script", ""); | ||
Binding binding = new Binding(); | ||
binding.setVariable("_global", GlobalBlackboard.INSTANCE); | ||
binding.setVariable("_toast", Toast.getToast()); | ||
GroovyShell shell = new GroovyShell(binding); | ||
shell.evaluate(groovy); | ||
} | ||
|
||
} |