Created
February 11, 2013 20:26
-
-
Save cacciatc/4757310 to your computer and use it in GitHub Desktop.
Accept and skeleton listener.
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
skeleton_kill_counter:function(event,data){ | |
var target = data.getEntity(); | |
var killer = target.getKiller(); | |
// check if it is the player who did the killing and if a skeleton was the target | |
if(killer != null && killer.getUniqueId() == getPlayerObject().getUniqueId() && target.getType() == org.bukkit.entity.EntityType.SKELETON && quest.store.players[killer.name] != null){ | |
quest.store.players[killer.name].skeleton_counter = (quest.store.players[killer.name].skeleton_counter + 1); | |
if(quest.store.players[killer.name].skeleton_counter < 10){ | |
killer.sendMessage("" + quest.store.players[killer.name].skeleton_counter + "/10 skeletons killed."); | |
} | |
else{ | |
killer.sendMessage("Return to the priest to recieve your reward."); | |
} | |
} | |
}, | |
accept_quest:function(){ | |
var player = getPlayerObject(); | |
if(quest.store.players[player.name] != null){ | |
quest.store.players[player.name].accepted = true; | |
// add skeleton killing watch | |
events.on("entity.EntityDeathEvent",this.skeleton_kill_counter); | |
player.sendMessage("\nYou accepted the quest: SKELETON MENACE.\n"); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment