mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 21:56:28 +01:00
Preliminary support for ZNPCs
This commit is contained in:
parent
7cbf317b42
commit
2f360562a6
@ -124,6 +124,12 @@
|
|||||||
<version>3.1.6</version>
|
<version>3.1.6</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.gonalez</groupId>
|
||||||
|
<artifactId>znpc-servers</artifactId>
|
||||||
|
<version>21a0650</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.PikaMug</groupId>
|
<groupId>com.github.PikaMug</groupId>
|
||||||
<artifactId>Unite</artifactId>
|
<artifactId>Unite</artifactId>
|
||||||
|
@ -18,6 +18,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.herocraftonline.heroes.Heroes;
|
import com.herocraftonline.heroes.Heroes;
|
||||||
import com.herocraftonline.heroes.characters.Hero;
|
import com.herocraftonline.heroes.characters.Hero;
|
||||||
|
import io.github.znetworkw.znpcservers.ServersNPC;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
||||||
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
||||||
@ -61,15 +62,15 @@ public interface IDependencies {
|
|||||||
|
|
||||||
CitizensBooksAPI getCitizensBooksApi();
|
CitizensBooksAPI getCitizensBooksApi();
|
||||||
|
|
||||||
|
ServersNPC getZnpcs();
|
||||||
|
|
||||||
PartiesAPI getPartiesApi();
|
PartiesAPI getPartiesApi();
|
||||||
|
|
||||||
boolean isPluginAvailable(final String pluginName);
|
boolean isPluginAvailable(final String pluginName);
|
||||||
|
|
||||||
boolean runDenizenScript(final String scriptName, final IQuester quester, final UUID uuid);
|
boolean runDenizenScript(final String scriptName, final IQuester quester, final UUID uuid);
|
||||||
|
|
||||||
Location getNPCLocation(final int id);
|
Location getNPCLocation(final UUID uuid);
|
||||||
|
|
||||||
String getNPCName(final int id);
|
|
||||||
|
|
||||||
String getNPCName(final UUID uuid);
|
String getNPCName(final UUID uuid);
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@ package me.blackvein.quests.quests;
|
|||||||
|
|
||||||
import me.blackvein.quests.actions.IAction;
|
import me.blackvein.quests.actions.IAction;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface IQuest extends Comparable<IQuest> {
|
public interface IQuest extends Comparable<IQuest> {
|
||||||
Plugin getPlugin();
|
Plugin getPlugin();
|
||||||
@ -55,9 +55,11 @@ public interface IQuest extends Comparable<IQuest> {
|
|||||||
|
|
||||||
LinkedList<IStage> getStages();
|
LinkedList<IStage> getStages();
|
||||||
|
|
||||||
NPC getNpcStart();
|
UUID getNpcStart();
|
||||||
|
|
||||||
void setNpcStart(final NPC npcStart);
|
void setNpcStart(final UUID npcStart);
|
||||||
|
|
||||||
|
String getNpcStartName();
|
||||||
|
|
||||||
Location getBlockStart();
|
Location getBlockStart();
|
||||||
|
|
||||||
|
@ -124,6 +124,12 @@
|
|||||||
<version>3.1.6</version>
|
<version>3.1.6</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.gonalez</groupId>
|
||||||
|
<artifactId>znpc-servers</artifactId>
|
||||||
|
<version>21a0650</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.PikaMug</groupId>
|
<groupId>com.github.PikaMug</groupId>
|
||||||
<artifactId>Unite</artifactId>
|
<artifactId>Unite</artifactId>
|
||||||
|
@ -21,8 +21,10 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.herocraftonline.heroes.Heroes;
|
import com.herocraftonline.heroes.Heroes;
|
||||||
import com.herocraftonline.heroes.characters.Hero;
|
import com.herocraftonline.heroes.characters.Hero;
|
||||||
|
import io.github.znetworkw.znpcservers.ServersNPC;
|
||||||
|
import io.github.znetworkw.znpcservers.npc.NPC;
|
||||||
import me.blackvein.quests.dependencies.IDependencies;
|
import me.blackvein.quests.dependencies.IDependencies;
|
||||||
import me.blackvein.quests.listeners.NpcListener;
|
import me.blackvein.quests.listeners.CitizensListener;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
||||||
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
||||||
@ -32,6 +34,7 @@ import net.citizensnpcs.api.CitizensPlugin;
|
|||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.plugin.RegisteredListener;
|
import org.bukkit.plugin.RegisteredListener;
|
||||||
@ -39,10 +42,13 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
|||||||
import ro.nicuch.citizensbooks.CitizensBooksAPI;
|
import ro.nicuch.citizensbooks.CitizensBooksAPI;
|
||||||
import ro.nicuch.citizensbooks.CitizensBooksPlugin;
|
import ro.nicuch.citizensbooks.CitizensBooksPlugin;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Dependencies implements IDependencies {
|
public class Dependencies implements IDependencies {
|
||||||
|
|
||||||
@ -59,6 +65,7 @@ public class Dependencies implements IDependencies {
|
|||||||
public static CitizensPlugin citizens = null;
|
public static CitizensPlugin citizens = null;
|
||||||
private static DenizenAPI denizenApi = null;
|
private static DenizenAPI denizenApi = null;
|
||||||
private static CitizensBooksAPI citizensBooks = null;
|
private static CitizensBooksAPI citizensBooks = null;
|
||||||
|
private static ServersNPC znpcs = null;
|
||||||
private static PartiesAPI parties = null;
|
private static PartiesAPI parties = null;
|
||||||
|
|
||||||
public Dependencies(final Quests plugin) {
|
public Dependencies(final Quests plugin) {
|
||||||
@ -160,12 +167,12 @@ public class Dependencies implements IDependencies {
|
|||||||
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
|
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final RegisteredListener listener : HandlerList.getRegisteredListeners(plugin)) {
|
for (final RegisteredListener listener : HandlerList.getRegisteredListeners(plugin)) {
|
||||||
if (listener.getListener() instanceof NpcListener) {
|
if (listener.getListener() instanceof CitizensListener) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(plugin.getNpcListener(), plugin);
|
plugin.getServer().getPluginManager().registerEvents(plugin.getCitizensListener(), plugin);
|
||||||
if (plugin.getSettings().canNpcEffects()) {
|
if (plugin.getSettings().canNpcEffects()) {
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, plugin.getNpcEffectThread(),
|
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, plugin.getNpcEffectThread(),
|
||||||
20, 20);
|
20, 20);
|
||||||
@ -202,6 +209,22 @@ public class Dependencies implements IDependencies {
|
|||||||
return citizensBooks;
|
return citizensBooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServersNPC getZnpcs() {
|
||||||
|
if (znpcs == null) {
|
||||||
|
znpcs = (ServersNPC) plugin.getServer().getPluginManager().getPlugin("ServersNPC");
|
||||||
|
}
|
||||||
|
return znpcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<UUID> getZnpcsUuids() {
|
||||||
|
if (znpcs != null && isPluginAvailable("ServersNPC")) {
|
||||||
|
// TODO - it seems ZNPCs UUIDs do not persist restart
|
||||||
|
return io.github.znetworkw.znpcservers.npc.NPC.all().stream()
|
||||||
|
.map(io.github.znetworkw.znpcservers.npc.NPC::getUUID).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
public PartiesAPI getPartiesApi() {
|
public PartiesAPI getPartiesApi() {
|
||||||
if (parties == null && isPluginAvailable("Parties")) {
|
if (parties == null && isPluginAvailable("Parties")) {
|
||||||
try {
|
try {
|
||||||
@ -226,7 +249,6 @@ public class Dependencies implements IDependencies {
|
|||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -238,7 +260,7 @@ public class Dependencies implements IDependencies {
|
|||||||
if (rsp != null) {
|
if (rsp != null) {
|
||||||
economy = rsp.getProvider();
|
economy = rsp.getProvider();
|
||||||
}
|
}
|
||||||
return (economy != null);
|
return economy != null;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -250,7 +272,7 @@ public class Dependencies implements IDependencies {
|
|||||||
if (rsp != null) {
|
if (rsp != null) {
|
||||||
permission = rsp.getProvider();
|
permission = rsp.getProvider();
|
||||||
}
|
}
|
||||||
return (permission != null);
|
return permission != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean setupParty() {
|
private boolean setupParty() {
|
||||||
@ -265,50 +287,42 @@ public class Dependencies implements IDependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (partyProvider != null);
|
return partyProvider != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean runDenizenScript(final String scriptName, final IQuester quester, final UUID uuid) {
|
public boolean runDenizenScript(final String scriptName, final IQuester quester, final UUID uuid) {
|
||||||
return plugin.getDenizenTrigger().runDenizenScript(scriptName, quester, uuid);
|
return plugin.getDenizenTrigger().runDenizenScript(scriptName, quester, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getNPCLocation(UUID)}
|
|
||||||
*/
|
|
||||||
public Location getNPCLocation(final int id) {
|
|
||||||
if (citizens != null) {
|
|
||||||
return citizens.getNPCRegistry().getById(id).getStoredLocation();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getNPCLocation(final UUID uuid) {
|
public Location getNPCLocation(final UUID uuid) {
|
||||||
if (citizens != null) {
|
if (citizens != null && citizens.getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||||
return citizens.getNPCRegistry().getByUniqueId(uuid).getStoredLocation();
|
return citizens.getNPCRegistry().getByUniqueId(uuid).getStoredLocation();
|
||||||
} else {
|
} else if (getZnpcsUuids().contains(uuid)) {
|
||||||
|
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||||
|
if (opt.isPresent()) {
|
||||||
|
return opt.get().getLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #getNPCName(UUID)}
|
|
||||||
*/
|
|
||||||
public String getNPCName(final int id) {
|
|
||||||
if (citizens != null) {
|
|
||||||
return citizens.getNPCRegistry().getById(id).getName();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNPCName(final UUID uuid) {
|
public String getNPCName(final UUID uuid) {
|
||||||
if (citizens != null) {
|
Entity npc = null;
|
||||||
|
if (citizens != null && citizens.getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||||
return citizens.getNPCRegistry().getByUniqueId(uuid).getName();
|
return citizens.getNPCRegistry().getByUniqueId(uuid).getName();
|
||||||
|
} else if (getZnpcsUuids().contains(uuid)) {
|
||||||
|
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||||
|
if (opt.isPresent()) {
|
||||||
|
npc = (Entity) opt.get().getBukkitEntity();
|
||||||
|
if (npc.getCustomName() != null) {
|
||||||
|
return npc.getCustomName();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return opt.get().getNpcPojo().getHologramLines().get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return "NPC";
|
||||||
|
}
|
||||||
|
|
||||||
public int getMcmmoSkillLevel(final SkillType st, final String player) {
|
public int getMcmmoSkillLevel(final SkillType st, final String player) {
|
||||||
final McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
||||||
|
@ -20,8 +20,9 @@ import com.codisimus.plugins.phatloots.loot.LootBundle;
|
|||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.herocraftonline.heroes.characters.Hero;
|
import com.herocraftonline.heroes.characters.Hero;
|
||||||
import me.blackvein.quests.actions.IAction;
|
import io.github.znetworkw.znpcservers.npc.NPC;
|
||||||
import me.blackvein.quests.actions.Action;
|
import me.blackvein.quests.actions.Action;
|
||||||
|
import me.blackvein.quests.actions.IAction;
|
||||||
import me.blackvein.quests.conditions.ICondition;
|
import me.blackvein.quests.conditions.ICondition;
|
||||||
import me.blackvein.quests.dependencies.IDependencies;
|
import me.blackvein.quests.dependencies.IDependencies;
|
||||||
import me.blackvein.quests.events.quest.QuestUpdateCompassEvent;
|
import me.blackvein.quests.events.quest.QuestUpdateCompassEvent;
|
||||||
@ -50,8 +51,6 @@ import me.blackvein.quests.util.Lang;
|
|||||||
import me.blackvein.quests.util.MiscUtil;
|
import me.blackvein.quests.util.MiscUtil;
|
||||||
import me.blackvein.quests.util.RomanNumeral;
|
import me.blackvein.quests.util.RomanNumeral;
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
import me.clip.placeholderapi.PlaceholderAPI;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
@ -72,6 +71,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
@ -189,16 +189,18 @@ public class Quest implements IQuest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC getNpcStart() {
|
public UUID getNpcStart() {
|
||||||
if (plugin.getDependencies().getCitizens() != null && CitizensAPI.getNPCRegistry().getByUniqueId(npcStart) != null) {
|
return npcStart;
|
||||||
return CitizensAPI.getNPCRegistry().getByUniqueId(npcStart);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNpcStart(final NPC npcStart) {
|
public void setNpcStart(final UUID npcStart) {
|
||||||
this.npcStart = npcStart.getUniqueId();
|
this.npcStart = npcStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getNpcStartName() {
|
||||||
|
return plugin.getDependencies().getNPCName(getNpcStart());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -361,8 +363,8 @@ public class Quest implements IQuest {
|
|||||||
final StringBuilder msg = new StringBuilder("- " + Lang.get("conditionEditorRideNPC"));
|
final StringBuilder msg = new StringBuilder("- " + Lang.get("conditionEditorRideNPC"));
|
||||||
for (final UUID u : c.getNpcsWhileRiding()) {
|
for (final UUID u : c.getNpcsWhileRiding()) {
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null) {
|
||||||
msg.append(ChatColor.AQUA).append("\n \u2515 ").append(CitizensAPI.getNPCRegistry()
|
msg.append(ChatColor.AQUA).append("\n \u2515 ").append(plugin.getDependencies()
|
||||||
.getByUniqueId(u).getName());
|
.getCitizens().getNPCRegistry().getByUniqueId(u).getName());
|
||||||
} else {
|
} else {
|
||||||
msg.append(ChatColor.AQUA).append("\n \u2515 ").append(u);
|
msg.append(ChatColor.AQUA).append("\n \u2515 ").append(u);
|
||||||
}
|
}
|
||||||
@ -456,9 +458,19 @@ public class Quest implements IQuest {
|
|||||||
} else if (stage.getLocationsToReach() != null && stage.getLocationsToReach().size() > 0) {
|
} else if (stage.getLocationsToReach() != null && stage.getLocationsToReach().size() > 0) {
|
||||||
targetLocation = stage.getLocationsToReach().getFirst();
|
targetLocation = stage.getLocationsToReach().getFirst();
|
||||||
} else if (stage.getItemDeliveryTargets() != null && stage.getItemDeliveryTargets().size() > 0) {
|
} else if (stage.getItemDeliveryTargets() != null && stage.getItemDeliveryTargets().size() > 0) {
|
||||||
final NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(stage
|
final UUID uuid = stage.getItemDeliveryTargets().getFirst();
|
||||||
.getItemDeliveryTargets().getFirst());
|
if (plugin.getDependencies().getCitizens() != null
|
||||||
targetLocation = npc.getStoredLocation();
|
&& plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||||
|
targetLocation = plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid)
|
||||||
|
.getStoredLocation();
|
||||||
|
}
|
||||||
|
if (plugin.getDependencies().getZnpcs() != null
|
||||||
|
&& plugin.getDependencies().getZnpcsUuids().contains(uuid)) {
|
||||||
|
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||||
|
if (opt.isPresent()) {
|
||||||
|
targetLocation = opt.get().getLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (stage.getPlayersToKill() != null && stage.getPlayersToKill() > 0) {
|
} else if (stage.getPlayersToKill() != null && stage.getPlayersToKill() > 0) {
|
||||||
if (quester.getPlayer() == null) {
|
if (quester.getPlayer() == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -16,6 +16,7 @@ import com.alessiodp.parties.api.interfaces.Party;
|
|||||||
import com.alessiodp.parties.api.interfaces.PartyPlayer;
|
import com.alessiodp.parties.api.interfaces.PartyPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
|
import io.github.znetworkw.znpcservers.npc.NPC;
|
||||||
import me.blackvein.quests.conditions.ICondition;
|
import me.blackvein.quests.conditions.ICondition;
|
||||||
import me.blackvein.quests.config.ISettings;
|
import me.blackvein.quests.config.ISettings;
|
||||||
import me.blackvein.quests.convo.misc.QuestAbandonPrompt;
|
import me.blackvein.quests.convo.misc.QuestAbandonPrompt;
|
||||||
@ -62,6 +63,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.conversations.ConversationFactory;
|
import org.bukkit.conversations.ConversationFactory;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
@ -83,6 +85,7 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -587,20 +590,29 @@ public class Quester implements IQuester {
|
|||||||
sendMessage(ChatColor.YELLOW + msg);
|
sendMessage(ChatColor.YELLOW + msg);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (plugin.getDependencies().getCitizens() != null
|
} else if (!plugin.getSettings().canAllowCommandsForNpcQuests() && quest.getNpcStart() != null
|
||||||
&& !plugin.getSettings().canAllowCommandsForNpcQuests()
|
&& getPlayer().getLocation().getWorld() != null) {
|
||||||
&& quest.getNpcStart() != null && quest.getNpcStart().getEntity() != null
|
final UUID uuid = quest.getNpcStart();
|
||||||
&& quest.getNpcStart().getEntity().getLocation().getWorld() != null
|
|
||||||
&& getPlayer().getLocation().getWorld() != null
|
|
||||||
&& quest.getNpcStart().getEntity().getLocation().getWorld().getName().equals(
|
|
||||||
getPlayer().getLocation().getWorld().getName())
|
|
||||||
&& quest.getNpcStart().getEntity().getLocation().distance(getPlayer().getLocation()) > 6.0) {
|
|
||||||
if (giveReason) {
|
if (giveReason) {
|
||||||
final String msg = Lang.get(getPlayer(), "mustSpeakTo").replace("<npc>", ChatColor.DARK_PURPLE
|
Entity npc = null;
|
||||||
+ quest.getNpcStart().getName() + ChatColor.YELLOW);
|
if (plugin.getDependencies().getCitizens() != null
|
||||||
sendMessage(ChatColor.YELLOW + msg);
|
&& plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||||
|
npc = plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid).getEntity();
|
||||||
|
} else if (plugin.getDependencies().getZnpcs() != null
|
||||||
|
&& plugin.getDependencies().getZnpcsUuids().contains(uuid)) {
|
||||||
|
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||||
|
if (opt.isPresent()) {
|
||||||
|
npc = (Entity) opt.get().getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (npc != null && npc.getLocation().getWorld() != null && npc.getLocation().getWorld().getName()
|
||||||
|
.equals(getPlayer().getLocation().getWorld().getName())
|
||||||
|
&& npc.getLocation().distance(getPlayer().getLocation()) > 6.0) {
|
||||||
|
sendMessage(ChatColor.YELLOW + Lang.get(getPlayer(), "mustSpeakTo")
|
||||||
|
.replace("<npc>", ChatColor.DARK_PURPLE + npc.getName() + ChatColor.YELLOW));
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (quest.getBlockStart() != null) {
|
} else if (quest.getBlockStart() != null) {
|
||||||
if (giveReason) {
|
if (giveReason) {
|
||||||
final String msg = Lang.get(getPlayer(), "noCommandStart").replace("<quest>", ChatColor.DARK_PURPLE
|
final String msg = Lang.get(getPlayer(), "noCommandStart").replace("<quest>", ChatColor.DARK_PURPLE
|
||||||
|
@ -40,10 +40,11 @@ import me.blackvein.quests.listeners.BlockListener;
|
|||||||
import me.blackvein.quests.listeners.CommandManager;
|
import me.blackvein.quests.listeners.CommandManager;
|
||||||
import me.blackvein.quests.listeners.ConvoListener;
|
import me.blackvein.quests.listeners.ConvoListener;
|
||||||
import me.blackvein.quests.listeners.ItemListener;
|
import me.blackvein.quests.listeners.ItemListener;
|
||||||
import me.blackvein.quests.listeners.NpcListener;
|
import me.blackvein.quests.listeners.CitizensListener;
|
||||||
import me.blackvein.quests.listeners.PartiesListener;
|
import me.blackvein.quests.listeners.PartiesListener;
|
||||||
import me.blackvein.quests.listeners.PlayerListener;
|
import me.blackvein.quests.listeners.PlayerListener;
|
||||||
import me.blackvein.quests.listeners.UniteListener;
|
import me.blackvein.quests.listeners.UniteListener;
|
||||||
|
import me.blackvein.quests.listeners.ZnpcsListener;
|
||||||
import me.blackvein.quests.logging.QuestsLog4JFilter;
|
import me.blackvein.quests.logging.QuestsLog4JFilter;
|
||||||
import me.blackvein.quests.module.ICustomObjective;
|
import me.blackvein.quests.module.ICustomObjective;
|
||||||
import me.blackvein.quests.player.IQuester;
|
import me.blackvein.quests.player.IQuester;
|
||||||
@ -161,7 +162,8 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
private ConvoListener convoListener;
|
private ConvoListener convoListener;
|
||||||
private BlockListener blockListener;
|
private BlockListener blockListener;
|
||||||
private ItemListener itemListener;
|
private ItemListener itemListener;
|
||||||
private NpcListener npcListener;
|
private CitizensListener citizensListener;
|
||||||
|
private ZnpcsListener znpcsListener;
|
||||||
private PlayerListener playerListener;
|
private PlayerListener playerListener;
|
||||||
private NpcEffectThread effectThread;
|
private NpcEffectThread effectThread;
|
||||||
private PlayerMoveThread moveThread;
|
private PlayerMoveThread moveThread;
|
||||||
@ -189,7 +191,8 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
convoListener = new ConvoListener();
|
convoListener = new ConvoListener();
|
||||||
blockListener = new BlockListener(this);
|
blockListener = new BlockListener(this);
|
||||||
itemListener = new ItemListener(this);
|
itemListener = new ItemListener(this);
|
||||||
npcListener = new NpcListener(this);
|
citizensListener = new CitizensListener(this);
|
||||||
|
znpcsListener = new ZnpcsListener(this);
|
||||||
playerListener = new PlayerListener(this);
|
playerListener = new PlayerListener(this);
|
||||||
uniteListener = new UniteListener();
|
uniteListener = new UniteListener();
|
||||||
partiesListener = new PartiesListener();
|
partiesListener = new PartiesListener();
|
||||||
@ -258,6 +261,9 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
getServer().getPluginManager().registerEvents(getBlockListener(), this);
|
getServer().getPluginManager().registerEvents(getBlockListener(), this);
|
||||||
getServer().getPluginManager().registerEvents(getItemListener(), this);
|
getServer().getPluginManager().registerEvents(getItemListener(), this);
|
||||||
depends.linkCitizens();
|
depends.linkCitizens();
|
||||||
|
if (depends.getZnpcs() != null) {
|
||||||
|
getServer().getPluginManager().registerEvents(getZnpcsListener(), this);
|
||||||
|
}
|
||||||
getServer().getPluginManager().registerEvents(getPlayerListener(), this);
|
getServer().getPluginManager().registerEvents(getPlayerListener(), this);
|
||||||
if (settings.getStrictPlayerMovement() > 0) {
|
if (settings.getStrictPlayerMovement() > 0) {
|
||||||
final long ticks = settings.getStrictPlayerMovement() * 20L;
|
final long ticks = settings.getStrictPlayerMovement() * 20L;
|
||||||
@ -593,8 +599,12 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
return itemListener;
|
return itemListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NpcListener getNpcListener() {
|
public CitizensListener getCitizensListener() {
|
||||||
return npcListener;
|
return citizensListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZnpcsListener getZnpcsListener() {
|
||||||
|
return znpcsListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerListener getPlayerListener() {
|
public PlayerListener getPlayerListener() {
|
||||||
@ -1378,7 +1388,8 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
final int toDeliver = is.getAmount();
|
final int toDeliver = is.getAmount();
|
||||||
final UUID npc = stage.getItemDeliveryTargets().get(deliverIndex);
|
final UUID npc = stage.getItemDeliveryTargets().get(deliverIndex);
|
||||||
final ChatColor color = delivered < toDeliver ? ChatColor.GREEN : ChatColor.GRAY;
|
final ChatColor color = delivered < toDeliver ? ChatColor.GREEN : ChatColor.GRAY;
|
||||||
String message = color + "- " + Lang.get(quester.getPlayer(), "deliver").replace("<npc>", depends.getNPCName(npc));
|
String message = color + "- " + Lang.get(quester.getPlayer(), "deliver")
|
||||||
|
.replace("<npc>", depends.getNPCName(npc));
|
||||||
if (message.contains("<count>")) {
|
if (message.contains("<count>")) {
|
||||||
message = message.replace("<count>", "" + color + delivered + "/" + toDeliver);
|
message = message.replace("<count>", "" + color + delivered + "/" + toDeliver);
|
||||||
} else {
|
} else {
|
||||||
@ -1840,21 +1851,17 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
} else {
|
} else {
|
||||||
throw new QuestFormatException("finish-message is missing", questKey);
|
throw new QuestFormatException("finish-message is missing", questKey);
|
||||||
}
|
}
|
||||||
if (depends.getCitizens() != null && config.contains("quests." + questKey + ".npc-giver-uuid")) {
|
if (config.contains("quests." + questKey + ".npc-giver-uuid")) {
|
||||||
final UUID uuid = UUID.fromString(Objects.requireNonNull(config.getString("quests." + questKey
|
final UUID uuid = UUID.fromString(Objects.requireNonNull(config.getString("quests." + questKey
|
||||||
+ ".npc-giver-uuid")));
|
+ ".npc-giver-uuid")));
|
||||||
if (CitizensAPI.getNPCRegistry().getByUniqueId(uuid) != null) {
|
quest.setNpcStart(uuid);
|
||||||
quest.setNpcStart(CitizensAPI.getNPCRegistry().getByUniqueId(uuid));
|
|
||||||
questNpcUuids.add(uuid);
|
questNpcUuids.add(uuid);
|
||||||
} else {
|
|
||||||
throw new QuestFormatException("npc-giver-uuid has invalid NPC UUID " + uuid, questKey);
|
|
||||||
}
|
|
||||||
} else if (depends.getCitizens() != null && config.contains("quests." + questKey + ".npc-giver-id")) {
|
} else if (depends.getCitizens() != null && config.contains("quests." + questKey + ".npc-giver-id")) {
|
||||||
// Legacy
|
// Legacy
|
||||||
final int id = config.getInt("quests." + questKey + ".npc-giver-id");
|
final int id = config.getInt("quests." + questKey + ".npc-giver-id");
|
||||||
if (CitizensAPI.getNPCRegistry().getById(id) != null) {
|
if (CitizensAPI.getNPCRegistry().getById(id) != null) {
|
||||||
final NPC npc = CitizensAPI.getNPCRegistry().getById(id);
|
final NPC npc = CitizensAPI.getNPCRegistry().getById(id);
|
||||||
quest.setNpcStart(npc);
|
quest.setNpcStart(npc.getUniqueId());
|
||||||
questNpcUuids.add(npc.getUniqueId());
|
questNpcUuids.add(npc.getUniqueId());
|
||||||
} else {
|
} else {
|
||||||
throw new QuestFormatException("npc-giver-id has invalid NPC ID " + id, questKey);
|
throw new QuestFormatException("npc-giver-id has invalid NPC ID " + id, questKey);
|
||||||
@ -2930,19 +2937,8 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
+ ".npc-uuids-to-talk-to");
|
+ ".npc-uuids-to-talk-to");
|
||||||
for (final String s : npcUuidsToTalkTo) {
|
for (final String s : npcUuidsToTalkTo) {
|
||||||
final UUID uuid = UUID.fromString(s);
|
final UUID uuid = UUID.fromString(s);
|
||||||
if (getDependencies().getCitizens() != null) {
|
|
||||||
final NPC npc = CitizensAPI.getNPCRegistry().getByUniqueId(uuid);
|
|
||||||
if (npc != null) {
|
|
||||||
oStage.addNpcToInteract(uuid);
|
oStage.addNpcToInteract(uuid);
|
||||||
questNpcUuids.add(uuid);
|
questNpcUuids.add(uuid);
|
||||||
} else {
|
|
||||||
throw new StageFormatException("npc-uuids-to-talk-to has invalid NPC UUID of "
|
|
||||||
+ s, quest, stageNum);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new StageFormatException("Citizens not found for npc-uuids-to-talk-to", quest,
|
|
||||||
stageNum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new StageFormatException("npc-ids-to-talk-to is not a list of numbers", quest, stageNum);
|
throw new StageFormatException("npc-ids-to-talk-to is not a list of numbers", quest, stageNum);
|
||||||
@ -2994,20 +2990,9 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
? deliveryMessages.get(index)
|
? deliveryMessages.get(index)
|
||||||
: deliveryMessages.get(deliveryMessages.size() - 1);
|
: deliveryMessages.get(deliveryMessages.size() - 1);
|
||||||
index++;
|
index++;
|
||||||
if (getDependencies().getCitizens() != null) {
|
|
||||||
final NPC npc = CitizensAPI.getNPCRegistry().getByUniqueId(npcUuid);
|
|
||||||
if (npc != null) {
|
|
||||||
oStage.addItemToDeliver(stack);
|
oStage.addItemToDeliver(stack);
|
||||||
oStage.addItemDeliveryTarget(npcUuid);
|
oStage.addItemDeliveryTarget(npcUuid);
|
||||||
oStage.addDeliverMessage(msg);
|
oStage.addDeliverMessage(msg);
|
||||||
} else {
|
|
||||||
throw new StageFormatException("npc-delivery-ids has invalid NPC " +
|
|
||||||
"UUID of " + npcUuid, quest, stageNum);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new StageFormatException(
|
|
||||||
"Citizens not found for npc-delivery-uuids", quest, stageNum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -3080,8 +3065,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
+ stageNum + ".npc-kill-amounts");
|
+ stageNum + ".npc-kill-amounts");
|
||||||
for (final String s : npcUuidsToKill) {
|
for (final String s : npcUuidsToKill) {
|
||||||
final UUID npcUuid = UUID.fromString(s);
|
final UUID npcUuid = UUID.fromString(s);
|
||||||
final NPC npc = CitizensAPI.getNPCRegistry().getByUniqueId(npcUuid);
|
|
||||||
if (npc != null) {
|
|
||||||
if (npcAmountsToKill.get(npcUuidsToKill.indexOf(s)) > 0) {
|
if (npcAmountsToKill.get(npcUuidsToKill.indexOf(s)) > 0) {
|
||||||
oStage.addNpcToKill(npcUuid);
|
oStage.addNpcToKill(npcUuid);
|
||||||
oStage.addNpcNumToKill(npcAmountsToKill.get(npcUuidsToKill.indexOf(s)));
|
oStage.addNpcNumToKill(npcAmountsToKill.get(npcUuidsToKill.indexOf(s)));
|
||||||
@ -3090,10 +3073,6 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
throw new StageFormatException("npc-kill-amounts is not a positive number",
|
throw new StageFormatException("npc-kill-amounts is not a positive number",
|
||||||
quest, stageNum);
|
quest, stageNum);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new StageFormatException("npc-uuids-to-kill has invalid NPC UUID of " + s,
|
|
||||||
quest, stageNum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new StageFormatException("npc-kill-amounts is not a list of numbers", quest,
|
throw new StageFormatException("npc-kill-amounts is not a list of numbers", quest,
|
||||||
@ -3950,17 +3929,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
final LinkedList<UUID> npcList = new LinkedList<>();
|
final LinkedList<UUID> npcList = new LinkedList<>();
|
||||||
for (final String s : data.getStringList(conditionKey + "ride-npc-uuid")) {
|
for (final String s : data.getStringList(conditionKey + "ride-npc-uuid")) {
|
||||||
final UUID u = UUID.fromString(s);
|
final UUID u = UUID.fromString(s);
|
||||||
if (getDependencies().getCitizens() != null) {
|
|
||||||
final NPC npc = CitizensAPI.getNPCRegistry().getByUniqueId(u);
|
|
||||||
if (npc != null) {
|
|
||||||
npcList.add(u);
|
npcList.add(u);
|
||||||
} else {
|
|
||||||
throw new ConditionFormatException("ride-npc-uuid is not a valid NPC UUID",
|
|
||||||
conditionKey);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ConditionFormatException("Citizens not found for ride-npc-uuid", conditionKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
condition.setNpcsWhileRiding(npcList);
|
condition.setNpcsWhileRiding(npcList);
|
||||||
}
|
}
|
||||||
@ -4568,7 +4537,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
public boolean hasQuest(final NPC npc, final IQuester quester) {
|
public boolean hasQuest(final NPC npc, final IQuester quester) {
|
||||||
for (final IQuest q : quests) {
|
for (final IQuest q : quests) {
|
||||||
if (q.getNpcStart() != null && !quester.getCompletedQuestsTemp().contains(q)) {
|
if (q.getNpcStart() != null && !quester.getCompletedQuestsTemp().contains(q)) {
|
||||||
if (q.getNpcStart().getId() == npc.getId()) {
|
if (q.getNpcStart().equals(npc.getUniqueId())) {
|
||||||
final boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
final boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||||
if (!ignoreLockedQuests || q.testRequirements(quester)) {
|
if (!ignoreLockedQuests || q.testRequirements(quester)) {
|
||||||
return true;
|
return true;
|
||||||
@ -4590,7 +4559,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
public boolean hasCompletedQuest(final NPC npc, final IQuester quester) {
|
public boolean hasCompletedQuest(final NPC npc, final IQuester quester) {
|
||||||
for (final IQuest q : quests) {
|
for (final IQuest q : quests) {
|
||||||
if (q.getNpcStart() != null && quester.getCompletedQuestsTemp().contains(q)) {
|
if (q.getNpcStart() != null && quester.getCompletedQuestsTemp().contains(q)) {
|
||||||
if (q.getNpcStart().getId() == npc.getId()) {
|
if (q.getNpcStart().equals(npc.getUniqueId())) {
|
||||||
final boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
final boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||||
if (!ignoreLockedQuests || q.testRequirements(quester)) {
|
if (!ignoreLockedQuests || q.testRequirements(quester)) {
|
||||||
return true;
|
return true;
|
||||||
@ -4612,7 +4581,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
|||||||
for (final IQuest q : quests) {
|
for (final IQuest q : quests) {
|
||||||
if (q.getNpcStart() != null && quester.getCompletedQuestsTemp().contains(q)
|
if (q.getNpcStart() != null && quester.getCompletedQuestsTemp().contains(q)
|
||||||
&& q.getPlanner().getCooldown() > -1) {
|
&& q.getPlanner().getCooldown() > -1) {
|
||||||
if (q.getNpcStart().getId() == npc.getId()) {
|
if (q.getNpcStart().equals(npc.getUniqueId())) {
|
||||||
final boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
final boolean ignoreLockedQuests = settings.canIgnoreLockedQuests();
|
||||||
if (!ignoreLockedQuests || q.testRequirements(quester)) {
|
if (!ignoreLockedQuests || q.testRequirements(quester)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -116,7 +116,7 @@ public class QuestCommandHandler {
|
|||||||
cs.sendMessage(" ");
|
cs.sendMessage(" ");
|
||||||
if (q.getNpcStart() != null) {
|
if (q.getNpcStart() != null) {
|
||||||
String msg = Lang.get("speakTo");
|
String msg = Lang.get("speakTo");
|
||||||
msg = msg.replace("<npc>", q.getNpcStart().getName());
|
msg = msg.replace("<npc>", q.getNpcStartName());
|
||||||
cs.sendMessage(ChatColor.YELLOW + msg);
|
cs.sendMessage(ChatColor.YELLOW + msg);
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(ChatColor.YELLOW + q.getDescription());
|
cs.sendMessage(ChatColor.YELLOW + q.getDescription());
|
||||||
|
@ -21,7 +21,6 @@ import me.blackvein.quests.events.editor.quests.QuestsEditorPostOpenStringPrompt
|
|||||||
import me.blackvein.quests.util.CK;
|
import me.blackvein.quests.util.CK;
|
||||||
import me.blackvein.quests.util.Lang;
|
import me.blackvein.quests.util.Lang;
|
||||||
import me.blackvein.quests.util.MiscUtil;
|
import me.blackvein.quests.util.MiscUtil;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.conversations.ConversationContext;
|
import org.bukkit.conversations.ConversationContext;
|
||||||
import org.bukkit.conversations.Prompt;
|
import org.bukkit.conversations.Prompt;
|
||||||
@ -104,16 +103,16 @@ public class EntityPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return text.toString();
|
return text.toString();
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
if (context.getSessionData(CK.C_WHILE_RIDING_NPC) == null) {
|
if (context.getSessionData(CK.C_WHILE_RIDING_NPC) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
final StringBuilder text = new StringBuilder();
|
final StringBuilder text = new StringBuilder();
|
||||||
final List<Integer> whileRidingNpc = (List<Integer>) context.getSessionData(CK.C_WHILE_RIDING_NPC);
|
final List<UUID> whileRidingNpc = (List<UUID>) context.getSessionData(CK.C_WHILE_RIDING_NPC);
|
||||||
if (whileRidingNpc != null) {
|
if (whileRidingNpc != null) {
|
||||||
for (final int i : whileRidingNpc) {
|
for (final UUID u : whileRidingNpc) {
|
||||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||||
.append(CitizensAPI.getNPCRegistry().getById(i).getName());
|
.append(plugin.getDependencies().getNPCName(u));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text.toString();
|
return text.toString();
|
||||||
@ -278,21 +277,21 @@ public class EntityPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
if (!input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
|
||||||
final LinkedList<Integer> npcIds = new LinkedList<>();
|
final LinkedList<UUID> npcUuids = new LinkedList<>();
|
||||||
try {
|
try {
|
||||||
for (final String s : input.split(" ")) {
|
for (final String s : input.split(" ")) {
|
||||||
final int i = Integer.parseInt(s);
|
try {
|
||||||
if (i > -1) {
|
final UUID u = UUID.fromString(s);
|
||||||
if (CitizensAPI.getNPCRegistry().getById(i) == null) {
|
if (plugin.getDependencies().getNPCName(u) == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
||||||
return new ConditionNpcsPrompt(context);
|
return new ConditionNpcsPrompt(context);
|
||||||
}
|
}
|
||||||
npcIds.add(i);
|
npcUuids.add(u);
|
||||||
context.setSessionData(CK.C_WHILE_RIDING_NPC, npcIds);
|
context.setSessionData(CK.C_WHILE_RIDING_NPC, npcUuids);
|
||||||
} else {
|
} catch (Exception e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
||||||
return new ConditionNpcsPrompt(context);
|
|
||||||
}
|
}
|
||||||
|
return new ConditionNpcsPrompt(context);
|
||||||
}
|
}
|
||||||
} catch (final NumberFormatException e) {
|
} catch (final NumberFormatException e) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED
|
context.getForWhom().sendRawMessage(ChatColor.RED
|
||||||
|
@ -30,7 +30,6 @@ import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
|||||||
import me.blackvein.quests.util.CK;
|
import me.blackvein.quests.util.CK;
|
||||||
import me.blackvein.quests.util.ItemUtil;
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
import me.blackvein.quests.util.Lang;
|
import me.blackvein.quests.util.Lang;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -108,7 +107,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return ChatColor.GRAY;
|
return ChatColor.GRAY;
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return ChatColor.BLUE;
|
return ChatColor.BLUE;
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY;
|
return ChatColor.GRAY;
|
||||||
@ -132,7 +131,8 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
case 3:
|
case 3:
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorFinishMessage");
|
return ChatColor.YELLOW + Lang.get("questEditorFinishMessage");
|
||||||
case 4:
|
case 4:
|
||||||
if (context.getSessionData(CK.Q_START_NPC) == null || plugin.getDependencies().getCitizens() != null) {
|
if (context.getSessionData(CK.Q_START_NPC) == null || plugin.getDependencies().getCitizens() != null
|
||||||
|
|| plugin.getDependencies().getZnpcs() != null) {
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY + Lang.get("questEditorNPCStart");
|
return ChatColor.GRAY + Lang.get("questEditorNPCStart");
|
||||||
@ -150,7 +150,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return ChatColor.GRAY + Lang.get("questWGSetRegion");
|
return ChatColor.GRAY + Lang.get("questWGSetRegion");
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return ChatColor.YELLOW + Lang.get("questEditorSetGUI");
|
return ChatColor.YELLOW + Lang.get("questEditorSetGUI");
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY + Lang.get("questEditorSetGUI");
|
return ChatColor.GRAY + Lang.get("questEditorSetGUI");
|
||||||
@ -193,13 +193,14 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.Q_FINISH_MESSAGE)
|
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.Q_FINISH_MESSAGE)
|
||||||
+ ChatColor.RESET + ChatColor.GRAY + ")";
|
+ ChatColor.RESET + ChatColor.GRAY + ")";
|
||||||
case 4:
|
case 4:
|
||||||
if (context.getSessionData(CK.Q_START_NPC) == null && plugin.getDependencies().getCitizens()
|
if (context.getSessionData(CK.Q_START_NPC) == null && (plugin.getDependencies().getCitizens() != null
|
||||||
!= null) {
|
|| plugin.getDependencies().getZnpcs() != null)) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else if (plugin.getDependencies().getCitizens() != null) {
|
} else if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
final UUID uuid = UUID.fromString((String) Objects.requireNonNull(context.getSessionData(CK.Q_START_NPC)));
|
final UUID uuid = UUID.fromString((String) Objects.requireNonNull(context
|
||||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + CitizensAPI.getNPCRegistry().getByUniqueId(uuid)
|
.getSessionData(CK.Q_START_NPC)));
|
||||||
.getName() + ChatColor.RESET + ChatColor.GRAY + ")";
|
return ChatColor.GRAY + "(" + ChatColor.AQUA + plugin.getDependencies().getNPCName(uuid)
|
||||||
|
+ ChatColor.RESET + ChatColor.GRAY + ")";
|
||||||
} else {
|
} else {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
}
|
}
|
||||||
@ -225,7 +226,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
@ -269,7 +270,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
case 3:
|
case 3:
|
||||||
return new QuestFinishMessagePrompt(context);
|
return new QuestFinishMessagePrompt(context);
|
||||||
case 4:
|
case 4:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return new QuestNPCStartPrompt(context);
|
return new QuestNPCStartPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestMainPrompt(context);
|
return new QuestMainPrompt(context);
|
||||||
@ -291,7 +292,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return new QuestMainPrompt(context);
|
return new QuestMainPrompt(context);
|
||||||
}
|
}
|
||||||
case 7:
|
case 7:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return new QuestGuiDisplayPrompt(context);
|
return new QuestGuiDisplayPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
return new QuestMainPrompt(context);
|
return new QuestMainPrompt(context);
|
||||||
@ -501,13 +502,11 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (!input.equalsIgnoreCase(Lang.get("cmdCancel")) && !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
if (!input.equalsIgnoreCase(Lang.get("cmdCancel")) && !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||||
try {
|
try {
|
||||||
final UUID uuid = UUID.fromString(input);
|
final UUID uuid = UUID.fromString(input);
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getNPCName(uuid) == null) {
|
||||||
if (CitizensAPI.getNPCRegistry().getByUniqueId(uuid) == null) {
|
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorInvalidNPC"));
|
||||||
return new QuestNPCStartPrompt(context);
|
return new QuestNPCStartPrompt(context);
|
||||||
}
|
}
|
||||||
context.setSessionData(CK.Q_START_NPC, uuid.toString());
|
context.setSessionData(CK.Q_START_NPC, uuid.toString());
|
||||||
}
|
|
||||||
if (context.getForWhom() instanceof Player) {
|
if (context.getForWhom() instanceof Player) {
|
||||||
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
final Set<UUID> selectingNpcs = plugin.getQuestFactory().getSelectingNpcs();
|
||||||
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
selectingNpcs.remove(((Player) context.getForWhom()).getUniqueId());
|
||||||
|
@ -94,7 +94,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||||
switch(number) {
|
switch(number) {
|
||||||
case 1:
|
case 1:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
|
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
@ -109,8 +109,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
.append(ItemUtil.getName(items.get(i))).append(ChatColor.GRAY).append(" x ")
|
.append(ItemUtil.getName(items.get(i))).append(ChatColor.GRAY).append(" x ")
|
||||||
.append(ChatColor.AQUA).append(items.get(i).getAmount()).append(ChatColor.GRAY)
|
.append(ChatColor.AQUA).append(items.get(i).getAmount()).append(ChatColor.GRAY)
|
||||||
.append(" ").append(Lang.get("to")).append(" ").append(ChatColor.BLUE)
|
.append(" ").append(Lang.get("to")).append(" ").append(ChatColor.BLUE)
|
||||||
.append(plugin.getDependencies().getCitizens().getNPCRegistry()
|
.append(plugin.getDependencies().getNPCName(UUID.fromString(npcs.get(i))));
|
||||||
.getByUniqueId(UUID.fromString(npcs.get(i))).getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text.toString();
|
return text.toString();
|
||||||
@ -119,7 +118,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return ChatColor.GRAY + " (" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + " (" + Lang.get("notInstalled") + ")";
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) {
|
if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
@ -129,8 +128,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (npcs != null) {
|
if (npcs != null) {
|
||||||
for (final String npc : npcs) {
|
for (final String npc : npcs) {
|
||||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||||
.append(plugin.getDependencies().getCitizens().getNPCRegistry()
|
.append(plugin.getDependencies().getNPCName(UUID.fromString(npc)));
|
||||||
.getByUniqueId(UUID.fromString(npc)).getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text.toString();
|
return text.toString();
|
||||||
@ -139,7 +137,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
@ -151,9 +149,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (npcs != null && amounts != null) {
|
if (npcs != null && amounts != null) {
|
||||||
for (int i = 0; i < npcs.size(); i++) {
|
for (int i = 0; i < npcs.size(); i++) {
|
||||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||||
.append(plugin.getDependencies().getCitizens().getNPCRegistry()
|
.append(plugin.getDependencies().getNPCName(UUID.fromString(npcs.get(i))))
|
||||||
.getByUniqueId(UUID.fromString(npcs.get(i))).getName()).append(ChatColor.GRAY)
|
.append(ChatColor.GRAY).append(" x ").append(ChatColor.AQUA).append(amounts.get(i));
|
||||||
.append(" x ").append(ChatColor.AQUA).append(amounts.get(i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text.toString();
|
return text.toString();
|
||||||
@ -191,21 +188,21 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
protected Prompt acceptValidatedInput(final @NotNull ConversationContext context, final Number input) {
|
protected Prompt acceptValidatedInput(final @NotNull ConversationContext context, final Number input) {
|
||||||
switch(input.intValue()) {
|
switch(input.intValue()) {
|
||||||
case 1:
|
case 1:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return new NpcsDeliveryListPrompt(context);
|
return new NpcsDeliveryListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||||
return new StageMainPrompt(stageNum, context);
|
return new StageMainPrompt(stageNum, context);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return new NpcsIdsToTalkToPrompt(context);
|
return new NpcsIdsToTalkToPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||||
return new StageMainPrompt(stageNum, context);
|
return new StageMainPrompt(stageNum, context);
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
return new NpcsKillListPrompt(context);
|
return new NpcsKillListPrompt(context);
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||||
@ -304,9 +301,8 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
for (final String s : deliveryNpcs) {
|
for (final String s : deliveryNpcs) {
|
||||||
final UUID uuid = UUID.fromString(s);
|
final UUID uuid = UUID.fromString(s);
|
||||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA)
|
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA)
|
||||||
.append(plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid)
|
.append(plugin.getDependencies().getNPCName(uuid)).append(ChatColor.GRAY)
|
||||||
.getName()).append(ChatColor.GRAY).append(" (").append(ChatColor.BLUE).append(s)
|
.append(" (").append(ChatColor.BLUE).append(s).append(ChatColor.GRAY).append(")");
|
||||||
.append(ChatColor.GRAY).append(")");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text.toString();
|
return text.toString();
|
||||||
@ -464,8 +460,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
for (final String s : args) {
|
for (final String s : args) {
|
||||||
try {
|
try {
|
||||||
final UUID uuid = UUID.fromString(s);
|
final UUID uuid = UUID.fromString(s);
|
||||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid) != null
|
if (plugin.getDependencies().getNPCName(uuid) != null && npcs != null) {
|
||||||
&& npcs != null) {
|
|
||||||
npcs.add(uuid.toString());
|
npcs.add(uuid.toString());
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + uuid + ChatColor.RED + " "
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + uuid + ChatColor.RED + " "
|
||||||
@ -583,8 +578,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
for (final String s : args) {
|
for (final String s : args) {
|
||||||
try {
|
try {
|
||||||
final UUID uuid = UUID.fromString(s);
|
final UUID uuid = UUID.fromString(s);
|
||||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid) != null
|
if (plugin.getDependencies().getNPCName(uuid) != null && npcs != null) {
|
||||||
&& npcs != null) {
|
|
||||||
npcs.add(uuid.toString());
|
npcs.add(uuid.toString());
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + uuid + ChatColor.RED + " "
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + uuid + ChatColor.RED + " "
|
||||||
@ -664,7 +658,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||||
switch(number) {
|
switch(number) {
|
||||||
case 1:
|
case 1:
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||||
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
||||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||||
} else {
|
} else {
|
||||||
@ -673,9 +667,9 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
if (npcsToKill != null) {
|
if (npcsToKill != null) {
|
||||||
for (final String s : npcsToKill) {
|
for (final String s : npcsToKill) {
|
||||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||||
.append(plugin.getDependencies().getCitizens().getNPCRegistry()
|
.append(plugin.getDependencies().getNPCName(UUID.fromString(s)))
|
||||||
.getByUniqueId(UUID.fromString(s)).getName()).append(ChatColor.GRAY).append(" (")
|
.append(ChatColor.GRAY).append(" (").append(ChatColor.AQUA).append(s)
|
||||||
.append(ChatColor.AQUA).append(s).append(ChatColor.GRAY).append(")");
|
.append(ChatColor.GRAY).append(")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return text.toString();
|
return text.toString();
|
||||||
@ -810,8 +804,7 @@ public class NpcsPrompt extends QuestsEditorNumericPrompt {
|
|||||||
for (final String s : args) {
|
for (final String s : args) {
|
||||||
try {
|
try {
|
||||||
final UUID uuid = UUID.fromString(s);
|
final UUID uuid = UUID.fromString(s);
|
||||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid) != null
|
if (plugin.getDependencies().getNPCName(uuid) != null && npcs != null) {
|
||||||
&& npcs != null) {
|
|
||||||
npcs.add(uuid.toString());
|
npcs.add(uuid.toString());
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + uuid + ChatColor.RED + " "
|
context.getForWhom().sendRawMessage(ChatColor.LIGHT_PURPLE + "" + uuid + ChatColor.RED + " "
|
||||||
|
@ -44,11 +44,11 @@ import java.util.Map.Entry;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class NpcListener implements Listener {
|
public class CitizensListener implements Listener {
|
||||||
|
|
||||||
private final Quests plugin;
|
private final Quests plugin;
|
||||||
|
|
||||||
public NpcListener(final Quests plugin) {
|
public CitizensListener(final Quests plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ public class NpcListener implements Listener {
|
|||||||
if (quester.getCurrentQuestsTemp().containsKey(q)) {
|
if (quester.getCurrentQuestsTemp().containsKey(q)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (q.getNpcStart() != null && q.getNpcStart().getId() == evt.getNPC().getId()) {
|
if (q.getNpcStart() != null && q.getNpcStart().equals(evt.getNPC().getUniqueId())) {
|
||||||
if (plugin.getSettings().canIgnoreLockedQuests()
|
if (plugin.getSettings().canIgnoreLockedQuests()
|
||||||
&& (!quester.getCompletedQuestsTemp().contains(q)
|
&& (!quester.getCompletedQuestsTemp().contains(q)
|
||||||
|| q.getPlanner().getCooldown() > -1)) {
|
|| q.getPlanner().getCooldown() > -1)) {
|
@ -0,0 +1,264 @@
|
|||||||
|
package me.blackvein.quests.listeners;
|
||||||
|
|
||||||
|
import io.github.znetworkw.znpcservers.npc.NPC;
|
||||||
|
import io.github.znetworkw.znpcservers.npc.event.NPCInteractEvent;
|
||||||
|
import me.blackvein.quests.Quests;
|
||||||
|
import me.blackvein.quests.enums.ObjectiveType;
|
||||||
|
import me.blackvein.quests.player.IQuester;
|
||||||
|
import me.blackvein.quests.quests.IQuest;
|
||||||
|
import me.blackvein.quests.util.ItemUtil;
|
||||||
|
import me.blackvein.quests.util.Lang;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.conversations.Conversation;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class ZnpcsListener implements Listener {
|
||||||
|
|
||||||
|
private final Quests plugin;
|
||||||
|
|
||||||
|
public ZnpcsListener(final Quests plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onNPCInteract(final NPCInteractEvent evt) {
|
||||||
|
if (evt.isLeftClick()) {
|
||||||
|
if (plugin.getDependencies().getZnpcs() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getPlayer().getUniqueId())) {
|
||||||
|
if (evt.getNpc() == null) {
|
||||||
|
plugin.getLogger().severe("ZNPC was null while selecting by left-click");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evt.getPlayer().acceptConversationInput(String.valueOf(evt.getNpc().getUUID()));
|
||||||
|
}
|
||||||
|
} else if (evt.isRightClick()) {
|
||||||
|
if (plugin.getDependencies().getCitizens() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plugin.getQuestFactory().getSelectingNpcs().contains(evt.getPlayer().getUniqueId())) {
|
||||||
|
if (evt.getNpc() == null) {
|
||||||
|
plugin.getLogger().severe("ZNPC was null while selecting by right-click");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
evt.getPlayer().acceptConversationInput(String.valueOf(evt.getNpc().getUUID()));
|
||||||
|
}
|
||||||
|
if (!evt.getPlayer().isConversing()) {
|
||||||
|
final Player player = evt.getPlayer();
|
||||||
|
final IQuester quester = plugin.getQuester(player.getUniqueId());
|
||||||
|
for (final IQuest quest : quester.getCurrentQuestsTemp().keySet()) {
|
||||||
|
if (quester.getCurrentStage(quest).containsObjective(ObjectiveType.DELIVER_ITEM)) {
|
||||||
|
final ItemStack hand = player.getItemInHand();
|
||||||
|
int currentIndex = -1;
|
||||||
|
final LinkedList<Integer> matches = new LinkedList<>();
|
||||||
|
int reasonCode = 0;
|
||||||
|
for (final ItemStack is : quester.getCurrentStage(quest).getItemsToDeliver()) {
|
||||||
|
currentIndex++;
|
||||||
|
reasonCode = ItemUtil.compareItems(is, hand, true);
|
||||||
|
if (reasonCode == 0) {
|
||||||
|
matches.add(currentIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final NPC clicked = evt.getNpc();
|
||||||
|
if (!matches.isEmpty()) {
|
||||||
|
for (final Integer match : matches) {
|
||||||
|
final UUID uuid = quester.getCurrentStage(quest).getItemDeliveryTargets().get(match);
|
||||||
|
if (uuid.equals(clicked.getUUID())) {
|
||||||
|
quester.deliverToNPC(quest, uuid, hand);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!hand.getType().equals(Material.AIR)) {
|
||||||
|
for (final UUID uuid : quester.getCurrentStage(quest).getItemDeliveryTargets()) {
|
||||||
|
if (uuid.equals(clicked.getUUID())) {
|
||||||
|
String text = "";
|
||||||
|
final boolean hasMeta = hand.getItemMeta() != null;
|
||||||
|
if (hasMeta) {
|
||||||
|
text += ChatColor.LIGHT_PURPLE + "" + ChatColor.ITALIC
|
||||||
|
+ (hand.getItemMeta().hasDisplayName() ? hand.getItemMeta().getDisplayName()
|
||||||
|
+ ChatColor.GRAY + " (" : "");
|
||||||
|
}
|
||||||
|
text += ChatColor.AQUA + "<item>" + (hand.getDurability() != 0 ? (":" + ChatColor.BLUE
|
||||||
|
+ hand.getDurability()) : "") + ChatColor.GRAY;
|
||||||
|
if (hasMeta) {
|
||||||
|
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
|
||||||
|
}
|
||||||
|
text += " x " + ChatColor.DARK_AQUA + hand.getAmount() + ChatColor.GRAY;
|
||||||
|
if (plugin.getSettings().canTranslateNames() && !hasMeta
|
||||||
|
&& !hand.getItemMeta().hasDisplayName()) {
|
||||||
|
plugin.getLocaleManager().sendMessage(player, Lang
|
||||||
|
.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand
|
||||||
|
.getType(), hand.getDurability(), null);
|
||||||
|
} else {
|
||||||
|
player.sendMessage(Lang.get(player, "questInvalidDeliveryItem")
|
||||||
|
.replace("<item>", text).replace("<item>", ItemUtil.getName(hand)));
|
||||||
|
}
|
||||||
|
switch (reasonCode) {
|
||||||
|
case 1:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "one item is null"));
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "ERROR"));
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "name"));
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "amount"));
|
||||||
|
break;
|
||||||
|
case -3:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "durability"));
|
||||||
|
break;
|
||||||
|
case -4:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "display name or lore"));
|
||||||
|
break;
|
||||||
|
case -5:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "enchantments"));
|
||||||
|
break;
|
||||||
|
case -6:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "stored enchants"));
|
||||||
|
break;
|
||||||
|
case -7:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "item flags"));
|
||||||
|
break;
|
||||||
|
case -8:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "book data"));
|
||||||
|
break;
|
||||||
|
case -9:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "potion type"));
|
||||||
|
break;
|
||||||
|
case -10:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "fish variant"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference")
|
||||||
|
.replace("<data>", "unknown"));
|
||||||
|
}
|
||||||
|
if (hasMeta) {
|
||||||
|
if (hand.getType().equals(Material.ENCHANTED_BOOK)) {
|
||||||
|
final EnchantmentStorageMeta esMeta = (EnchantmentStorageMeta) hand.getItemMeta();
|
||||||
|
if (esMeta.hasStoredEnchants()) {
|
||||||
|
for (final Map.Entry<Enchantment, Integer> e : esMeta.getStoredEnchants()
|
||||||
|
.entrySet()) {
|
||||||
|
final HashMap<Enchantment, Integer> single = new HashMap<>();
|
||||||
|
single.put(e.getKey(), e.getValue());
|
||||||
|
plugin.getLocaleManager().sendMessage(player, ChatColor.GRAY + "\u2515 "
|
||||||
|
+ ChatColor.DARK_GREEN + "<enchantment> <level>\n", single);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean hasObjective = false;
|
||||||
|
for (final IQuest quest : quester.getCurrentQuestsTemp().keySet()) {
|
||||||
|
if (!quester.meetsCondition(quest, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (quester.getCurrentStage(quest).containsObjective(ObjectiveType.TALK_TO_NPC)) {
|
||||||
|
if (quester.getCurrentStage(quest).getNpcsToInteract().contains(evt.getNpc().getUUID())) {
|
||||||
|
final int npcIndex = quester.getCurrentStage(quest).getNpcsToInteract().indexOf(evt.getNpc()
|
||||||
|
.getUUID());
|
||||||
|
if (quester.getQuestData(quest) != null && npcIndex > -1
|
||||||
|
&& !quester.getQuestData(quest).npcsInteracted.get(npcIndex)) {
|
||||||
|
hasObjective = true;
|
||||||
|
}
|
||||||
|
quester.interactWithNPC(quest, evt.getNpc().getUUID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasObjective || !plugin.getQuestNpcUuids().contains(evt.getNpc().getUUID())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean hasAtLeastOneGUI = false;
|
||||||
|
final LinkedList<IQuest> npcQuests = new LinkedList<>();
|
||||||
|
for (final IQuest q : plugin.getLoadedQuests()) {
|
||||||
|
if (quester.getCurrentQuestsTemp().containsKey(q)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (q.getNpcStart() != null && q.getNpcStart().equals(evt.getNpc().getUUID())) {
|
||||||
|
if (plugin.getSettings().canIgnoreLockedQuests()
|
||||||
|
&& (!quester.getCompletedQuestsTemp().contains(q)
|
||||||
|
|| q.getPlanner().getCooldown() > -1)) {
|
||||||
|
if (q.testRequirements(quester)) {
|
||||||
|
npcQuests.add(q);
|
||||||
|
if (q.getGUIDisplay() != null) {
|
||||||
|
hasAtLeastOneGUI = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!quester.getCompletedQuestsTemp().contains(q) || q.getPlanner().getCooldown() > -1) {
|
||||||
|
npcQuests.add(q);
|
||||||
|
if (q.getGUIDisplay() != null) {
|
||||||
|
hasAtLeastOneGUI = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (npcQuests.size() == 1) {
|
||||||
|
final IQuest q = npcQuests.get(0);
|
||||||
|
if (quester.canAcceptOffer(q, true)) {
|
||||||
|
quester.setQuestIdToTake(q.getId());
|
||||||
|
if (!plugin.getSettings().canAskConfirmation()) {
|
||||||
|
quester.takeQuest(q, false);
|
||||||
|
} else {
|
||||||
|
if (q.getGUIDisplay() != null) {
|
||||||
|
quester.showGUIDisplay(evt.getNpc().getUUID(), npcQuests);
|
||||||
|
} else {
|
||||||
|
for (final String msg : extracted(quester).split("<br>")) {
|
||||||
|
player.sendMessage(msg);
|
||||||
|
}
|
||||||
|
plugin.getConversationFactory().buildConversation(player).begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (npcQuests.size() > 1) {
|
||||||
|
if (hasAtLeastOneGUI) {
|
||||||
|
quester.showGUIDisplay(evt.getNpc().getUUID(), npcQuests);
|
||||||
|
} else {
|
||||||
|
final Conversation c = plugin.getNpcConversationFactory().buildConversation(player);
|
||||||
|
c.getContext().setSessionData("npcQuests", npcQuests);
|
||||||
|
c.getContext().setSessionData("npc", evt.getNpc().getGameProfile().getName());
|
||||||
|
c.begin();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Lang.send(player, ChatColor.YELLOW + Lang.get(player, "noMoreQuest"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String extracted(final IQuester quester) {
|
||||||
|
final IQuest quest = plugin.getQuestByIdTemp(quester.getQuestIdToTake());
|
||||||
|
return MessageFormat.format("{0}- {1}{2}{3} -\n\n{4}{5}\n", ChatColor.GOLD, ChatColor.DARK_PURPLE,
|
||||||
|
quest.getName(), ChatColor.GOLD, ChatColor.RESET, quest.getDescription());
|
||||||
|
}
|
||||||
|
}
|
@ -152,7 +152,7 @@ public class BukkitQuestFactory implements QuestFactory, ConversationAbandonedLi
|
|||||||
context.setSessionData(CK.Q_FINISH_MESSAGE, q.getFinished());
|
context.setSessionData(CK.Q_FINISH_MESSAGE, q.getFinished());
|
||||||
if (plugin.getDependencies().getCitizens() != null) {
|
if (plugin.getDependencies().getCitizens() != null) {
|
||||||
if (q.getNpcStart() != null) {
|
if (q.getNpcStart() != null) {
|
||||||
context.setSessionData(CK.Q_START_NPC, q.getNpcStart().getUniqueId().toString());
|
context.setSessionData(CK.Q_START_NPC, q.getNpcStart().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.setSessionData(CK.Q_START_BLOCK, q.getBlockStart());
|
context.setSessionData(CK.Q_START_BLOCK, q.getBlockStart());
|
||||||
|
@ -105,7 +105,7 @@ public class ConfigUtil {
|
|||||||
String parsed = parseString(s);
|
String parsed = parseString(s);
|
||||||
if (parsed.contains("<npc>")) {
|
if (parsed.contains("<npc>")) {
|
||||||
if (quest.getNpcStart() != null) {
|
if (quest.getNpcStart() != null) {
|
||||||
parsed = parsed.replace("<npc>", quest.getNpcStart().getName());
|
parsed = parsed.replace("<npc>", quest.getNpcStartName());
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getLogger().warning(quest.getName() + " quest uses <npc> tag but doesn't have an NPC start set");
|
Bukkit.getLogger().warning(quest.getName() + " quest uses <npc> tag but doesn't have an NPC start set");
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ public class ConfigUtil {
|
|||||||
String parsed = parseString(s);
|
String parsed = parseString(s);
|
||||||
if (parsed.contains("<npc>")) {
|
if (parsed.contains("<npc>")) {
|
||||||
if (quest.getNpcStart() != null) {
|
if (quest.getNpcStart() != null) {
|
||||||
parsed = parsed.replace("<npc>", quest.getNpcStart().getName());
|
parsed = parsed.replace("<npc>", quest.getNpcStartName());
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getLogger().warning(quest.getName() + " quest uses <npc> tag but doesn't have an NPC start set");
|
Bukkit.getLogger().warning(quest.getName() + " quest uses <npc> tag but doesn't have an NPC start set");
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ public class ConfigUtil {
|
|||||||
String parsed = parseString(s);
|
String parsed = parseString(s);
|
||||||
if (parsed.contains("<npc>")) {
|
if (parsed.contains("<npc>")) {
|
||||||
if (quest.getNpcStart() != null) {
|
if (quest.getNpcStart() != null) {
|
||||||
parsed = parsed.replace("<npc>", quest.getNpcStart().getName());
|
parsed = parsed.replace("<npc>", quest.getNpcStartName());
|
||||||
} else {
|
} else {
|
||||||
Bukkit.getLogger().warning(quest.getName() + " quest uses <npc> tag but doesn't have an NPC start set");
|
Bukkit.getLogger().warning(quest.getName() + " quest uses <npc> tag but doesn't have an NPC start set");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user