Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Dec 14, 2013
1 parent f6356e1 commit 67ea014
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 122 deletions.
Expand Up @@ -6,104 +6,13 @@
import net.aufdemrand.denizen.Denizen;
import net.aufdemrand.denizen.interfaces.RegistrationableInstance;
import net.aufdemrand.denizen.interfaces.dRegistry;
import net.aufdemrand.denizen.scripts.commands.core.AdjustCommand;
import net.aufdemrand.denizen.scripts.commands.core.CooldownCommand;
import net.aufdemrand.denizen.scripts.commands.core.DefineCommand;
import net.aufdemrand.denizen.scripts.commands.core.DetermineCommand;
import net.aufdemrand.denizen.scripts.commands.core.FailCommand;
import net.aufdemrand.denizen.scripts.commands.core.FinishCommand;
import net.aufdemrand.denizen.scripts.commands.core.FlagCommand;
import net.aufdemrand.denizen.scripts.commands.core.ForEachCommand;
import net.aufdemrand.denizen.scripts.commands.core.IfCommand;
import net.aufdemrand.denizen.scripts.commands.core.InjectCommand;
import net.aufdemrand.denizen.scripts.commands.core.LogCommand;
import net.aufdemrand.denizen.scripts.commands.core.NoteCommand;
import net.aufdemrand.denizen.scripts.commands.core.QueueCommand;
import net.aufdemrand.denizen.scripts.commands.core.RandomCommand;
import net.aufdemrand.denizen.scripts.commands.core.RepeatCommand;
import net.aufdemrand.denizen.scripts.commands.core.ResetCommand;
import net.aufdemrand.denizen.scripts.commands.core.RunCommand;
import net.aufdemrand.denizen.scripts.commands.core.RuntaskCommand;
import net.aufdemrand.denizen.scripts.commands.core.WaitCommand;
import net.aufdemrand.denizen.scripts.commands.core.YamlCommand;
import net.aufdemrand.denizen.scripts.commands.core.ZapCommand;
import net.aufdemrand.denizen.scripts.commands.entity.AgeCommand;
import net.aufdemrand.denizen.scripts.commands.entity.AnimateCommand;
import net.aufdemrand.denizen.scripts.commands.entity.AttackCommand;
import net.aufdemrand.denizen.scripts.commands.entity.BurnCommand;
import net.aufdemrand.denizen.scripts.commands.entity.CastCommand;
import net.aufdemrand.denizen.scripts.commands.entity.EquipCommand;
import net.aufdemrand.denizen.scripts.commands.entity.FeedCommand;
import net.aufdemrand.denizen.scripts.commands.entity.FlyCommand;
import net.aufdemrand.denizen.scripts.commands.entity.HeadCommand;
import net.aufdemrand.denizen.scripts.commands.entity.HealCommand;
import net.aufdemrand.denizen.scripts.commands.entity.HealthCommand;
import net.aufdemrand.denizen.scripts.commands.entity.HurtCommand;
import net.aufdemrand.denizen.scripts.commands.entity.InvisibleCommand;
import net.aufdemrand.denizen.scripts.commands.entity.LeashCommand;
import net.aufdemrand.denizen.scripts.commands.entity.LookCommand;
import net.aufdemrand.denizen.scripts.commands.entity.MountCommand;
import net.aufdemrand.denizen.scripts.commands.entity.NameplateCommand;
import net.aufdemrand.denizen.scripts.commands.entity.PushCommand;
import net.aufdemrand.denizen.scripts.commands.entity.RemoveCommand;
import net.aufdemrand.denizen.scripts.commands.entity.RotateCommand;
import net.aufdemrand.denizen.scripts.commands.entity.ShootCommand;
import net.aufdemrand.denizen.scripts.commands.entity.SpawnCommand;
import net.aufdemrand.denizen.scripts.commands.entity.TeleportCommand;
import net.aufdemrand.denizen.scripts.commands.item.DisplayItemCommand;
import net.aufdemrand.denizen.scripts.commands.item.GiveCommand;
import net.aufdemrand.denizen.scripts.commands.item.InventoryCommand;
import net.aufdemrand.denizen.scripts.commands.item.ScribeCommand;
import net.aufdemrand.denizen.scripts.commands.item.TakeCommand;
import net.aufdemrand.denizen.scripts.commands.npc.AnchorCommand;
import net.aufdemrand.denizen.scripts.commands.npc.AssignmentCommand;
import net.aufdemrand.denizen.scripts.commands.npc.CreateCommand;
import net.aufdemrand.denizen.scripts.commands.npc.DespawnCommand;
import net.aufdemrand.denizen.scripts.commands.npc.DisengageCommand;
import net.aufdemrand.denizen.scripts.commands.npc.EngageCommand;
import net.aufdemrand.denizen.scripts.commands.npc.FishCommand;
import net.aufdemrand.denizen.scripts.commands.npc.FollowCommand;
import net.aufdemrand.denizen.scripts.commands.npc.LookcloseCommand;
import net.aufdemrand.denizen.scripts.commands.npc.PauseCommand;
import net.aufdemrand.denizen.scripts.commands.npc.PoseCommand;
import net.aufdemrand.denizen.scripts.commands.npc.RenameCommand;
import net.aufdemrand.denizen.scripts.commands.npc.SitCommand;
import net.aufdemrand.denizen.scripts.commands.npc.StandCommand;
import net.aufdemrand.denizen.scripts.commands.npc.TraitCommand;
import net.aufdemrand.denizen.scripts.commands.npc.TriggerCommand;
import net.aufdemrand.denizen.scripts.commands.npc.VulnerableCommand;
import net.aufdemrand.denizen.scripts.commands.npc.WalkCommand;
import net.aufdemrand.denizen.scripts.commands.player.ChatCommand;
import net.aufdemrand.denizen.scripts.commands.player.CompassCommand;
import net.aufdemrand.denizen.scripts.commands.player.ExperienceCommand;
import net.aufdemrand.denizen.scripts.commands.player.GroupCommand;
import net.aufdemrand.denizen.scripts.commands.player.ListenCommand;
import net.aufdemrand.denizen.scripts.commands.player.NarrateCommand;
import net.aufdemrand.denizen.scripts.commands.player.OxygenCommand;
import net.aufdemrand.denizen.scripts.commands.player.PermissionCommand;
import net.aufdemrand.denizen.scripts.commands.player.ShowFakeCommand;
import net.aufdemrand.denizen.scripts.commands.server.AnnounceCommand;
import net.aufdemrand.denizen.scripts.commands.server.ExecuteCommand;
import net.aufdemrand.denizen.scripts.commands.server.ScoreboardCommand;
import net.aufdemrand.denizen.scripts.commands.world.AnimateChestCommand;
import net.aufdemrand.denizen.scripts.commands.world.BreakCommand;
import net.aufdemrand.denizen.scripts.commands.world.ChunkLoadCommand;
import net.aufdemrand.denizen.scripts.commands.world.CopyBlockCommand;
import net.aufdemrand.denizen.scripts.commands.world.CreateWorldCommand;
import net.aufdemrand.denizen.scripts.commands.world.DropCommand;
import net.aufdemrand.denizen.scripts.commands.world.ExplodeCommand;
import net.aufdemrand.denizen.scripts.commands.world.FireworkCommand;
import net.aufdemrand.denizen.scripts.commands.world.MidiCommand;
import net.aufdemrand.denizen.scripts.commands.world.ModifyBlockCommand;
import net.aufdemrand.denizen.scripts.commands.world.PlayEffectCommand;
import net.aufdemrand.denizen.scripts.commands.world.PlaySoundCommand;
import net.aufdemrand.denizen.scripts.commands.world.SchematicCommand;
import net.aufdemrand.denizen.scripts.commands.world.SignCommand;
import net.aufdemrand.denizen.scripts.commands.world.StrikeCommand;
import net.aufdemrand.denizen.scripts.commands.world.SwitchCommand;
import net.aufdemrand.denizen.scripts.commands.world.TimeCommand;
import net.aufdemrand.denizen.scripts.commands.world.ViewerCommand;
import net.aufdemrand.denizen.scripts.commands.world.WeatherCommand;
import net.aufdemrand.denizen.scripts.commands.core.*;
import net.aufdemrand.denizen.scripts.commands.entity.*;
import net.aufdemrand.denizen.scripts.commands.item.*;
import net.aufdemrand.denizen.scripts.commands.npc.*;
import net.aufdemrand.denizen.scripts.commands.player.*;
import net.aufdemrand.denizen.scripts.commands.server.*;
import net.aufdemrand.denizen.scripts.commands.world.*;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizen.utilities.depends.Depends;

Expand Down
Expand Up @@ -85,41 +85,32 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {

if (!scriptEntry.hasObject("entities")
&& arg.matchesArgumentList(dEntity.class)) {

scriptEntry.addObject("entities", ((dList) arg.asType(dList.class)).filter(dEntity.class));
}
&& arg.matchesArgumentList(dEntity.class))
scriptEntry.addObject("entities", arg.asType(dList.class).filter(dEntity.class));

else if (!scriptEntry.hasObject("agetype")
&& arg.matchesEnum(AgeType.values())) {
// add Action
&& arg.matchesEnum(AgeType.values()))
scriptEntry.addObject("agetype", AgeType.valueOf(arg.getValue().toUpperCase()));
}


else if (!scriptEntry.hasObject("age")
&& arg.matchesPrimitive(aH.PrimitiveType.Integer)) {

&& arg.matchesPrimitive(aH.PrimitiveType.Integer))
scriptEntry.addObject("age", arg.asElement());
}

else if (!scriptEntry.hasObject("lock")
&& arg.matches("lock")) {
&& arg.matches("lock"))
scriptEntry.addObject("lock", Element.TRUE);

scriptEntry.addObject("lock", "");
}

else arg.reportUnhandled();
}

// Check to make sure required arguments have been filled

if (!scriptEntry.hasObject("entities"))
throw new InvalidArgumentsException("Must specify entity/entities!");

// Use default duration if one is not specified
throw new InvalidArgumentsException("No valid entities specified.");

// Use default age if one is not specified
scriptEntry.defaultObject("age", new Element(1));

}

@SuppressWarnings("unchecked")
Expand All @@ -134,9 +125,9 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept

// Report to dB
dB.report(scriptEntry, getName(), (lock ? aH.debugObj("lock", lock) : "") +
(ageType != null ? aH.debugObj("agetype", ageType)
: aH.debugObj("age", age)) +
aH.debugObj("entities", entities.toString()));
(ageType != null ? aH.debugObj("agetype", ageType)
: aH.debugObj("age", age)) +
aH.debugObj("entities", entities.toString()));

// Go through all the entities and set their ages
for (dEntity entity : entities) {
Expand Down
Expand Up @@ -38,15 +38,15 @@ else if (arg.matchesPrimitive(aH.PrimitiveType.Boolean))
scriptEntry.addObject("toggle", arg.asElement());

else if (arg.matchesArgumentType(dNPC.class))
scriptEntry.setNPC((dNPC) arg.asType(dNPC.class));
scriptEntry.setNPC(arg.asType(dNPC.class));

else arg.reportUnhandled();
}

// Only required thing is a valid NPC. This may be an already linked
// NPC, or one specified by arguments
if (scriptEntry.getNPC() == null)
throw new InvalidArgumentsException("This command requires a NPC!");
throw new InvalidArgumentsException("This command requires an NPC!");

}

Expand Down
Expand Up @@ -53,7 +53,7 @@ else if (arg.matchesArgumentType(dLocation.class)) {

// Even if the target is a player, this command requires an NPC to get the pose from.
if (!scriptEntry.hasNPC())
throw new InvalidArgumentsException("This command requires a linked NPC!");
throw new InvalidArgumentsException("This command requires an NPC!");

// It also requires a pose ID
if (!scriptEntry.hasObject("id"))
Expand Down

0 comments on commit 67ea014

Please sign in to comment.