Skip to content

Instantly share code, notes, and snippets.

@cacciatc
Created February 11, 2013 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cacciatc/4757310 to your computer and use it in GitHub Desktop.
Save cacciatc/4757310 to your computer and use it in GitHub Desktop.
Accept and skeleton listener.
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