Just fixed formatting for better readability, no real changes.

This commit is contained in:
Michael Vorburger 2015-04-19 16:40:06 +02:00
parent e1e78587f4
commit 0423141bf1
2 changed files with 40 additions and 35 deletions

View file

@ -21,8 +21,8 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
//protected Map<CommandSender,ScriptCraftEvaluator> playerContexts = new HashMap<CommandSender,ScriptCraftEvaluator>();
private String NO_JAVASCRIPT_MESSAGE = "No JavaScript Engine available. ScriptCraft will not work without Javascript.";
protected ScriptEngine engine = null;
@Override
public void onEnable()
@Override public void onEnable()
{
Thread currentThread = Thread.currentThread();
ClassLoader previousClassLoader = currentThread.getContextClassLoader();
@ -44,6 +44,7 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
currentThread.setContextClassLoader(previousClassLoader);
}
}
public List<String> onTabComplete(CommandSender sender, Command cmd,
String alias,
String[] args)
@ -66,7 +67,6 @@ public class ScriptCraftPlugin extends JavaPlugin implements Listener
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
{
boolean result = false;
String javascriptCode = "";
Object jsResult = null;
if (this.engine == null) {
this.getLogger().severe(NO_JAVASCRIPT_MESSAGE);

View file

@ -16,12 +16,8 @@ import net.canarymod.commandsys.Command;
import net.canarymod.commandsys.TabComplete;
import net.canarymod.chat.MessageReceiver;
import net.canarymod.Canary;
import net.canarymod.api.inventory.recipes.CraftingRecipe;
import net.canarymod.api.inventory.recipes.RecipeRow;
import net.canarymod.api.inventory.Item;
// event help stuff
import net.canarymod.hook.Dispatcher;
import net.canarymod.plugin.PluginListener;
import net.canarymod.hook.Hook;
public class ScriptCraftPlugin extends Plugin implements PluginListener, CommandListener
@ -31,6 +27,7 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
private String NO_JAVASCRIPT_MESSAGE = "No JavaScript Engine available. " +
"ScriptCraft will not work without Javascript.";
protected ScriptEngine engine = null;
@Override
public void disable(){
try {
@ -39,6 +36,7 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
this.getLogman().error(e.getMessage());
}
}
@Override
public boolean enable()
{
@ -62,11 +60,15 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
e.printStackTrace();
this.getLogman().error(e.getMessage());
}
return true;
}
public static interface IDispatcher {
public void execute(PluginListener listener, Hook hook);
}
public Dispatcher getDispatcher(final IDispatcher impl){
return new Dispatcher(){
public void execute(PluginListener listener, Hook hook){
@ -74,6 +76,7 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
}
};
}
static class ScriptCraftTask extends ServerTask {
private Runnable runnable = null;
public ScriptCraftTask(Runnable runnable, TaskOwner owner, long delay, boolean continuous){
@ -91,8 +94,6 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
}
private void executeCommand( MessageReceiver sender, String[] args) {
boolean result = false;
String javascriptCode = "";
Object jsResult = null;
if (this.engine == null){
this.getLogman().error(NO_JAVASCRIPT_MESSAGE);
@ -110,6 +111,7 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
}
return;
}
@Command(
aliases = { "js" },
description = "Execute Javascript code",
@ -119,6 +121,7 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
executeCommand(sender, args);
}
/*
groupmod permission add visitors canary.jsp
groupmod permission add visitors canary.command.jsp
@ -148,10 +151,12 @@ public class ScriptCraftPlugin extends Plugin implements PluginListener, Command
}
return result;
}
@TabComplete (commands = { "js" })
public List<String> jsComplete(MessageReceiver sender, String[] args){
return complete(sender, args, "js");
}
@TabComplete (commands = { "jsp" })
public List<String> jspComplete(MessageReceiver sender, String[] args){
return complete(sender, args, "jsp");