Skip to content

Commit

Permalink
clean the TemplateCommand
Browse files Browse the repository at this point in the history
And put my name on things purely because I can. If auf can do it, why
can't I?
  • Loading branch information
mcmonkey4eva committed Nov 12, 2014
1 parent c016180 commit 268547e
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package net.aufdemrand.denizen.scripts.commands.core;

import net.aufdemrand.denizen.objects.Element;
import net.aufdemrand.denizen.objects.dLocation;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.exceptions.CommandExecutionException;
import net.aufdemrand.denizencore.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizen.scripts.ScriptEntry;
Expand All @@ -12,35 +15,33 @@
*
* If loading externally, implement dExternal and its load() method.
*
* @author Jeremy Schroeder
* @author Jeremy Schroeder, mcmonkey
*/
public class _templateCommand extends AbstractCommand {

@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {

// Interpret arguments

for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {

// if (!scriptEntry.hasObject("required_integer")
// && arg.matchesPrimitive(aH.PrimitiveType.Integer))
// scriptEntry.addObject("required_integer", arg.asElement());
if (!scriptEntry.hasObject("required_integer")
&& arg.matchesPrimitive(aH.PrimitiveType.Integer))
scriptEntry.addObject("required_integer", arg.asElement());

// if (!scriptEntry.hasObject("required_location")
// && arg.matchesArgumentType(dLocation.class))
// scriptEntry.addObject("required_location", arg.asType(dLocation.class));
if (!scriptEntry.hasObject("required_location")
&& arg.matchesArgumentType(dLocation.class))
scriptEntry.addObject("required_location", arg.asType(dLocation.class));

//else
//arg.reportUnhandled();
else
arg.reportUnhandled();

}


// Check for required information

// if (!scriptEntry.hasObject("required_object"))
// throw new InvalidArgumentsException("Must have required object!");
if (!scriptEntry.hasObject("required_object"))
throw new InvalidArgumentsException("Must have required object!");

}

Expand All @@ -50,15 +51,13 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

// Fetch required objects

// Element required_integer = scriptEntry.getElement("required_integer");
// dLocation required_location = (dLocation) scriptEntry.getObject("required_location");

Element required_integer = scriptEntry.getElement("required_integer");
dLocation required_location = (dLocation) scriptEntry.getObject("required_location");

// Debug the execution

// dB.report(scriptEntry, getName(), required_integer.debug()
// + required_location.debug());

dB.report(scriptEntry, getName(), required_integer.debug()
+ required_location.debug());

// Do the execution

Expand Down

0 comments on commit 268547e

Please sign in to comment.