Skip to content

Commit

Permalink
Allow perpetual daylight.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcernat committed Jul 4, 2013
1 parent a7dd452 commit e484e24
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
import net.citizensnpcs.util.PlayerAnimation;

/**
* Animate a list of entities using an EntityEffect.
* Animate a list of entities using a PlayerAnimation from Citizens2
* or an EntityEffect from Bukkit.
*
* @author David Cernat
*/
Expand Down Expand Up @@ -77,6 +78,8 @@ public void execute(final ScriptEntry scriptEntry) throws CommandExecutionExcept

Player player = (Player) entity.getBukkitEntity();

// Go through Citizens' PlayerAnimations and find the one
// that matches
PlayerAnimation[] animationArray = PlayerAnimation.class.getEnumConstants();

for (PlayerAnimation current : animationArray) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.aufdemrand.denizen.scripts.commands.world;

import org.bukkit.Bukkit;

import net.aufdemrand.denizen.exceptions.CommandExecutionException;
import net.aufdemrand.denizen.exceptions.InvalidArgumentsException;
import net.aufdemrand.denizen.scripts.ScriptEntry;
Expand All @@ -25,30 +27,34 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
for (aH.Argument arg : aH.interpret(scriptEntry.getArguments())) {

if (!scriptEntry.hasObject("type")
&& arg.matchesEnum(Type.values()))
&& arg.matchesEnum(Type.values())) {
// add type
scriptEntry.addObject("type", Type.valueOf(arg.getValue().toUpperCase()));

else if (!scriptEntry.hasObject("world")
&& arg.matchesArgumentType(dWorld.class))
// add value
scriptEntry.addObject("world", arg.asType(dWorld.class));
}

else if (!scriptEntry.hasObject("value")
&& arg.matchesArgumentType(Duration.class))
&& arg.matchesArgumentType(Duration.class)) {
// add value
scriptEntry.addObject("value", arg.asType(Duration.class));
}

else if (!scriptEntry.hasObject("world")
&& arg.matchesArgumentType(dWorld.class)) {
// add world
scriptEntry.addObject("world", arg.asType(dWorld.class));
}
}

// Check to make sure required arguments have been filled

if ((!scriptEntry.hasObject("value")))
throw new InvalidArgumentsException(Messages.ERROR_MISSING_OTHER, "VALUE");

// Use default world if none has been specified

if (!scriptEntry.hasObject("world"))
if (!scriptEntry.hasObject("world")) {
scriptEntry.addObject("world", dWorld.valueOf("world"));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ public void timeEvent() {
Map<String, Object> context = new HashMap<String, Object>();

context.put("time", String.valueOf(hour));
context.put("world", world.getName());
context.put("world", new dWorld(world));

doEvents(Arrays.asList("time change in " + world.getName(),
doEvents(Arrays.asList("time changes in " + world.getName(),
hour + ":00 in " + world.getName()),
null, null, context);

Expand Down Expand Up @@ -984,7 +984,8 @@ public void joinEvent(PlayerJoinEvent event) {
context.put("message", event.getJoinMessage());

String determination = doEvents(Arrays.asList
("player join"),
("player joins",
"player join"),
null, event.getPlayer(), context);

// Handle message
Expand Down Expand Up @@ -1049,7 +1050,8 @@ public void quitEvent(PlayerQuitEvent event) {
context.put("message", event.getQuitMessage());

String determination = doEvents(Arrays.asList
("player quits"),
("player quits",
"player quit"),
null, event.getPlayer(), context).toUpperCase();

// Handle determine message
Expand Down

0 comments on commit e484e24

Please sign in to comment.