mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 03:55:35 +01:00
Ensure Citizens is enabled when processing events, fixes #1146
This commit is contained in:
parent
cf4a1a7303
commit
5d846c7670
@ -80,11 +80,11 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 1:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorKillMobs");
|
||||
case 2:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorCatchFish");
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorTameMobs");
|
||||
case 3:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorMilkCows");
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorCatchFish");
|
||||
case 4:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorTameMobs");
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorMilkCows");
|
||||
case 5:
|
||||
return ChatColor.YELLOW + Lang.get("stageEditorShearSheep");
|
||||
case 6:
|
||||
@ -129,22 +129,6 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
||||
return text;
|
||||
}
|
||||
case 2:
|
||||
if (context.getSessionData(pref + CK.S_FISH) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Integer fish = (Integer) context.getSessionData(pref + CK.S_FISH);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + fish + " " + Lang.get("stageEditorFish")
|
||||
+ ChatColor.GRAY + ")\n";
|
||||
}
|
||||
case 3:
|
||||
if (context.getSessionData(pref + CK.S_COW_MILK) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Integer cows = (Integer) context.getSessionData(pref + CK.S_COW_MILK);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + cows + " " + Lang.get("stageEditorCows")
|
||||
+ ChatColor.GRAY + ")\n";
|
||||
}
|
||||
case 4:
|
||||
if (context.getSessionData(pref + CK.S_TAME_TYPES) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -157,6 +141,22 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 3:
|
||||
if (context.getSessionData(pref + CK.S_FISH) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Integer fish = (Integer) context.getSessionData(pref + CK.S_FISH);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + fish + " " + Lang.get("stageEditorFish")
|
||||
+ ChatColor.GRAY + ")\n";
|
||||
}
|
||||
case 4:
|
||||
if (context.getSessionData(pref + CK.S_COW_MILK) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
Integer cows = (Integer) context.getSessionData(pref + CK.S_COW_MILK);
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + cows + " " + Lang.get("stageEditorCows")
|
||||
+ ChatColor.GRAY + ")\n";
|
||||
}
|
||||
case 5:
|
||||
if (context.getSessionData(pref + CK.S_SHEAR_COLORS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
@ -198,11 +198,11 @@ public class MobsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 1:
|
||||
return new MobListPrompt();
|
||||
case 2:
|
||||
return new FishPrompt();
|
||||
return new TameListPrompt();
|
||||
case 3:
|
||||
return new CowsPrompt();
|
||||
return new FishPrompt();
|
||||
case 4:
|
||||
return new TameListPrompt();
|
||||
return new CowsPrompt();
|
||||
case 5:
|
||||
return new ShearListPrompt();
|
||||
case 6:
|
||||
|
@ -56,6 +56,10 @@ public class NpcListener implements Listener {
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
// Ensure that Citizens is linked (may not be if it loads after Quests)
|
||||
return;
|
||||
}
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getClicker().getUniqueId())) {
|
||||
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID "
|
||||
+ evt.getNPC().getId());
|
||||
@ -300,6 +304,10 @@ public class NpcListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onNPCLeftClick(NPCLeftClickEvent evt) {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
// Ensure that Citizens is linked (may not be if it loads after Quests)
|
||||
return;
|
||||
}
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getClicker().getUniqueId())) {
|
||||
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN
|
||||
+ Lang.get("id") + " " + evt.getNPC().getId());
|
||||
@ -308,6 +316,10 @@ public class NpcListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onNPCDeath(NPCDeathEvent evt) {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
// Ensure that Citizens is linked (may not be if it loads after Quests)
|
||||
return;
|
||||
}
|
||||
if (evt.getNPC() == null || evt.getNPC().getEntity() == null
|
||||
|| evt.getNPC().getEntity().getLastDamageCause() == null) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user