SignQuests Api
SignQuests api system below with a few examples, if more examples are needed leave a comment below!
SignQuests Events:
- PlayerClickObjectiveSignEvent
- PlayerClickQuestNpcEvent
- PlayerClickQuestSignEvent
- PlayerCreateObjectiveSignEvent
- PlayerCreateQuestNpcEvent
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | SignQuestsApi api = new SignQuestsApi(); /* Gives you accecs to all the sign quests. This class has been made as straight forward as possible, regardless there are soo many methods there is no point explaning them all. */ Examples of **PlayerClickQuestNpcEvent** event: @EventHandler public void onPlayerClickQuestNpc(PlayerClickQuestNpcEvent e){ Player player = e.getPlayer(); //Gets the player that clicked the quest or redeem npc. String quest_name = e.getQuest(); //Gets the quest that npc is binded to. LivingEntity quest_npc = e.getQuestNpc(); //Gets the npc entity. QuestType quest_type = e.getQuestType(); //Gets the quest type if (quest_type == QuestType.QUEST){ player.sendMessage(ChatColor.GREEN + "You clicked a quest npc."); } if (quest_type == QuestType.REDEEM){ player.sendMessage(ChatColor.GREEN + "You clicked a redeem npc."); } player.sendMessage(ChatColor.RED + "You clicked quest " + quest_name + "."); player.sendMessage(ChatColor.LIGHT_PURPLE + "Quest npc type is: " + quest_npc.getType().getName().toLowerCase()); } Example of **PlayerCreateObjectiveSignEvent** event: @EventHandler public void onPlayerCreateObjectiveSign(PlayerCreateObjectiveSignEvent e){ Player player = e.getPlayer(); //Gets the player that has created the objective sign. Sign sign = e.getObjectiveSign(); //Gets the objective sign created. ItemStack objective_item = e.getObjectiveSignItem(); //Gets the objective item binded to the created objective sign. if (objective_item.getType() == Material.BEDROCK){ player.sendMessage(ChatColor.RED + "You cannot create a objective sign with bedrock."); sign.setLine(0, "BAD"); e.setCancelled(true); } } Examples of **PlayerClickObjectiveSignEvent** event: @EventHandler public void onPlayerClickObjectiveSignEvent(PlayerClickObjectiveSignEvent e){ Player player = e.getPlayer(); //Gets player that clicked a objective sign. Sign sign = e.getObjectiveSign(); //Gets the objective sign clicked. ItemStack objective_item = e.getObjectiveItem(); //Gets the objective sign item. if (player.getExpToLevel() < 10){ player.sendMessage(ChatColor.RED + "You cannot use this objective sign with a exp level below 10."); e.setCancelled(true); } } |
Comments