mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-21 18:15:32 +01:00
Experimental support for ZNPCsPlus
This commit is contained in:
parent
ab0879d5a3
commit
60368fddd9
24
api/pom.xml
24
api/pom.xml
@ -16,7 +16,7 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<!-- DungeonsXL, mcMMO Classic, PhatLoots, Unite, ZNPCs -->
|
||||
<!-- DungeonsXL, mcMMO Classic, PhatLoots, Unite -->
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
@ -54,6 +54,16 @@
|
||||
<id>repsy-release</id>
|
||||
<url>https://repo.repsy.io/mvn/niconeko/release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- PacketEvents for ZNPCsPlus -->
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- ZNPCsPlus -->
|
||||
<id>znpcsplus-repo</id>
|
||||
<url>https://repo.pyr.lol/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -130,9 +140,15 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gonalez</groupId>
|
||||
<artifactId>znpc-servers</artifactId>
|
||||
<version>21a0650</version>
|
||||
<groupId>com.github.retrooper.packetevents</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>lol.pyr</groupId>
|
||||
<artifactId>ZNPCsPlus</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -17,7 +17,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import io.github.znetworkw.znpcservers.ServersNPC;
|
||||
import lol.pyr.znpcsplus.ZNPCsPlus;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.reflect.denizen.DenizenAPI;
|
||||
import me.blackvein.quests.reflect.worldguard.WorldGuardAPI;
|
||||
@ -59,7 +59,7 @@ public interface IDependencies {
|
||||
|
||||
AstralBooksAPI getAstralBooksApi();
|
||||
|
||||
ServersNPC getZnpcs();
|
||||
ZNPCsPlus getZnpcsPlus();
|
||||
|
||||
PartiesAPI getPartiesApi();
|
||||
|
||||
@ -67,9 +67,9 @@ public interface IDependencies {
|
||||
|
||||
boolean runDenizenScript(final String scriptName, final IQuester quester, final UUID uuid);
|
||||
|
||||
Location getNPCLocation(final UUID uuid);
|
||||
Location getNpcLocation(final UUID uuid);
|
||||
|
||||
String getNPCName(final UUID uuid);
|
||||
String getNpcName(final UUID uuid);
|
||||
|
||||
int getMcmmoSkillLevel(final SkillType st, final String player);
|
||||
|
||||
|
24
core/pom.xml
24
core/pom.xml
@ -16,7 +16,7 @@
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<!-- DungeonsXL, LocaleLib, mcMMO Classic, PhatLoots, Unite, ZNPCs -->
|
||||
<!-- DungeonsXL, LocaleLib, mcMMO Classic, PhatLoots, Unite -->
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
@ -54,6 +54,16 @@
|
||||
<id>repsy-release</id>
|
||||
<url>https://repo.repsy.io/mvn/niconeko/release</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- PacketEvents for ZNPCsPlus -->
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- ZNPCsPlus -->
|
||||
<id>znpcsplus-repo</id>
|
||||
<url>https://repo.pyr.lol/releases</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -124,9 +134,15 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gonalez</groupId>
|
||||
<artifactId>znpc-servers</artifactId>
|
||||
<version>21a0650</version>
|
||||
<groupId>com.github.retrooper.packetevents</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>lol.pyr</groupId>
|
||||
<artifactId>ZNPCsPlus</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -20,8 +20,8 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import io.github.znetworkw.znpcservers.ServersNPC;
|
||||
import io.github.znetworkw.znpcservers.npc.NPC;
|
||||
import lol.pyr.znpcsplus.ZNPCsPlus;
|
||||
import me.blackvein.quests.dependencies.IDependencies;
|
||||
import me.blackvein.quests.listeners.CitizensListener;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
@ -40,8 +40,8 @@ import org.bukkit.plugin.RegisteredListener;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import ro.niconeko.astralbooks.api.AstralBooksAPI;
|
||||
import ro.niconeko.astralbooks.api.AstralBooks;
|
||||
import ro.niconeko.astralbooks.api.AstralBooksAPI;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@ -65,8 +65,9 @@ public class Dependencies implements IDependencies {
|
||||
public static CitizensPlugin citizens = null;
|
||||
private static DenizenAPI denizen = null;
|
||||
private static AstralBooksAPI astralBooks = null;
|
||||
private static ServersNPC znpcs = null;
|
||||
private static ZNPCsPlus znpcs = null;
|
||||
private static PartiesAPI parties = null;
|
||||
private int npcEffectThread = -1;
|
||||
|
||||
public Dependencies(final Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
@ -160,10 +161,7 @@ public class Dependencies implements IDependencies {
|
||||
}
|
||||
if (!found) {
|
||||
plugin.getServer().getPluginManager().registerEvents(plugin.getCitizensListener(), plugin);
|
||||
if (plugin.getSettings().canNpcEffects()) {
|
||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, plugin.getNpcEffectThread(),
|
||||
20, 20);
|
||||
}
|
||||
startNpcEffectThread();
|
||||
plugin.getLogger().info("Successfully linked Quests with Citizens "
|
||||
+ citizens.getDescription().getVersion());
|
||||
}
|
||||
@ -196,16 +194,16 @@ public class Dependencies implements IDependencies {
|
||||
return astralBooks;
|
||||
}
|
||||
|
||||
public ServersNPC getZnpcs() {
|
||||
public ZNPCsPlus getZnpcsPlus() {
|
||||
if (znpcs == null) {
|
||||
znpcs = (ServersNPC) plugin.getServer().getPluginManager().getPlugin("ServersNPC");
|
||||
znpcs = (ZNPCsPlus) plugin.getServer().getPluginManager().getPlugin("ZNPCsPlus");
|
||||
startNpcEffectThread();
|
||||
}
|
||||
return znpcs;
|
||||
}
|
||||
|
||||
public Set<UUID> getZnpcsUuids() {
|
||||
if (znpcs != null && isPluginAvailable("ServersNPC")) {
|
||||
// TODO - it seems ZNPCs UUIDs do not persist restart
|
||||
public Set<UUID> getZnpcsPlusUuids() {
|
||||
if (znpcs != null && isPluginAvailable("ZNPCsPlus")) {
|
||||
return io.github.znetworkw.znpcservers.npc.NPC.all().stream()
|
||||
.map(io.github.znetworkw.znpcservers.npc.NPC::getUUID).collect(Collectors.toSet());
|
||||
}
|
||||
@ -281,10 +279,10 @@ public class Dependencies implements IDependencies {
|
||||
return plugin.getDenizenTrigger().runDenizenScript(scriptName, quester, uuid);
|
||||
}
|
||||
|
||||
public @Nullable Location getNPCLocation(final UUID uuid) {
|
||||
public @Nullable Location getNpcLocation(final UUID uuid) {
|
||||
if (citizens != null && citizens.getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||
return citizens.getNPCRegistry().getByUniqueId(uuid).getStoredLocation();
|
||||
} else if (getZnpcsUuids().contains(uuid)) {
|
||||
} else if (znpcs != null && getZnpcsPlusUuids().contains(uuid)) {
|
||||
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||
if (opt.isPresent()) {
|
||||
return opt.get().getLocation();
|
||||
@ -293,10 +291,10 @@ public class Dependencies implements IDependencies {
|
||||
return null;
|
||||
}
|
||||
|
||||
public @Nullable Entity getNPCEntity(final UUID uuid) {
|
||||
public @Nullable Entity getNpcEntity(final UUID uuid) {
|
||||
if (citizens != null && citizens.getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||
return citizens.getNPCRegistry().getByUniqueId(uuid).getEntity();
|
||||
} else if (getZnpcsUuids().contains(uuid)) {
|
||||
} else if (znpcs != null && getZnpcsPlusUuids().contains(uuid)) {
|
||||
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||
if (opt.isPresent()) {
|
||||
return (Entity) opt.get().getBukkitEntity();
|
||||
@ -305,11 +303,11 @@ public class Dependencies implements IDependencies {
|
||||
return null;
|
||||
}
|
||||
|
||||
public @NotNull String getNPCName(final UUID uuid) {
|
||||
Entity npc = null;
|
||||
public @NotNull String getNpcName(final UUID uuid) {
|
||||
Entity npc;
|
||||
if (citizens != null && citizens.getNPCRegistry().getByUniqueId(uuid) != null) {
|
||||
return citizens.getNPCRegistry().getByUniqueId(uuid).getName();
|
||||
} else if (getZnpcsUuids().contains(uuid)) {
|
||||
} else if (znpcs != null && getZnpcsPlusUuids().contains(uuid)) {
|
||||
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||
if (opt.isPresent()) {
|
||||
npc = (Entity) opt.get().getBukkitEntity();
|
||||
@ -323,10 +321,10 @@ public class Dependencies implements IDependencies {
|
||||
return "NPC";
|
||||
}
|
||||
|
||||
public @Nullable UUID getUUIDFromNPC(final Entity entity) {
|
||||
public @Nullable UUID getUuidFromNpc(final Entity entity) {
|
||||
if (citizens != null && citizens.getNPCRegistry().isNPC(entity)) {
|
||||
return citizens.getNPCRegistry().getNPC(entity).getUniqueId();
|
||||
} else if (getZnpcsUuids().contains(entity.getUniqueId())) {
|
||||
} else if (znpcs != null && getZnpcsPlusUuids().contains(entity.getUniqueId())) {
|
||||
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(entity.getUniqueId())).findAny();
|
||||
if (opt.isPresent()) {
|
||||
return opt.get().getUUID();
|
||||
@ -334,6 +332,18 @@ public class Dependencies implements IDependencies {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void startNpcEffectThread() {
|
||||
if (npcEffectThread == -1 && plugin.getSettings().canNpcEffects()) {
|
||||
npcEffectThread = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin,
|
||||
plugin.getNpcEffectThread(), 20, 20);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void stopNpcEffectThread() {
|
||||
plugin.getServer().getScheduler().cancelTask(npcEffectThread);
|
||||
}
|
||||
|
||||
public int getMcmmoSkillLevel(final SkillType st, final String player) {
|
||||
final McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
||||
|
@ -199,7 +199,7 @@ public class Quest implements IQuest {
|
||||
|
||||
@Override
|
||||
public String getNpcStartName() {
|
||||
return plugin.getDependencies().getNPCName(getNpcStart());
|
||||
return plugin.getDependencies().getNpcName(getNpcStart());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -386,9 +386,9 @@ public class Quest implements IQuest {
|
||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||
Location targetLocation = null;
|
||||
if (stage.getNpcsToInteract() != null && stage.getNpcsToInteract().size() > 0) {
|
||||
targetLocation = plugin.getDependencies().getNPCLocation(stage.getNpcsToInteract().getFirst());
|
||||
targetLocation = plugin.getDependencies().getNpcLocation(stage.getNpcsToInteract().getFirst());
|
||||
} else if (stage.getNpcsToKill() != null && stage.getNpcsToKill().size() > 0) {
|
||||
targetLocation = plugin.getDependencies().getNPCLocation(stage.getNpcsToKill().getFirst());
|
||||
targetLocation = plugin.getDependencies().getNpcLocation(stage.getNpcsToKill().getFirst());
|
||||
} else if (stage.getLocationsToReach() != null && stage.getLocationsToReach().size() > 0) {
|
||||
targetLocation = stage.getLocationsToReach().getFirst();
|
||||
} else if (stage.getItemDeliveryTargets() != null && stage.getItemDeliveryTargets().size() > 0) {
|
||||
@ -398,8 +398,8 @@ public class Quest implements IQuest {
|
||||
targetLocation = plugin.getDependencies().getCitizens().getNPCRegistry().getByUniqueId(uuid)
|
||||
.getStoredLocation();
|
||||
}
|
||||
if (plugin.getDependencies().getZnpcs() != null
|
||||
&& plugin.getDependencies().getZnpcsUuids().contains(uuid)) {
|
||||
if (plugin.getDependencies().getZnpcsPlus() != null
|
||||
&& plugin.getDependencies().getZnpcsPlusUuids().contains(uuid)) {
|
||||
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||
if (opt.isPresent()) {
|
||||
targetLocation = opt.get().getLocation();
|
||||
|
@ -574,8 +574,8 @@ public class Quester implements IQuester {
|
||||
if (plugin.getDependencies().getCitizens() != null
|
||||
&& 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)) {
|
||||
} else if (plugin.getDependencies().getZnpcsPlus() != null
|
||||
&& plugin.getDependencies().getZnpcsPlusUuids().contains(uuid)) {
|
||||
final Optional<NPC> opt = NPC.all().stream().filter(npc1 -> npc1.getUUID().equals(uuid)).findAny();
|
||||
if (opt.isPresent()) {
|
||||
npc = (Entity) opt.get().getBukkitEntity();
|
||||
@ -1400,7 +1400,7 @@ public class Quester implements IQuester {
|
||||
final int toDeliver = is.getAmount();
|
||||
final UUID npc = stage.getItemDeliveryTargets().get(deliverIndex);
|
||||
final ChatColor color = delivered < toDeliver ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "deliver").replace("<npc>", depends.getNPCName(npc));
|
||||
String message = color + Lang.get(getPlayer(), "deliver").replace("<npc>", depends.getNpcName(npc));
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + delivered + "/" + toDeliver);
|
||||
} else {
|
||||
@ -1421,7 +1421,7 @@ public class Quester implements IQuester {
|
||||
}
|
||||
final ChatColor color = !interacted ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "talkTo")
|
||||
.replace("<npc>", depends.getNPCName(n));
|
||||
.replace("<npc>", depends.getNpcName(n));
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
@ -1438,9 +1438,9 @@ public class Quester implements IQuester {
|
||||
final ChatColor color = npcKilled < toNpcKill ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "kill");
|
||||
if (message.contains("<mob>")) {
|
||||
message = message.replace("<mob>", depends.getNPCName(n));
|
||||
message = message.replace("<mob>", depends.getNpcName(n));
|
||||
} else {
|
||||
message += " " + depends.getNPCName(n);
|
||||
message += " " + depends.getNpcName(n);
|
||||
}
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + npcKilled + "/" + toNpcKill);
|
||||
@ -1909,7 +1909,7 @@ public class Quester implements IQuester {
|
||||
final int toDeliver = goal.getAmount();
|
||||
final UUID npc = stage.getItemDeliveryTargets().get(deliverIndex);
|
||||
final ChatColor color = delivered < toDeliver ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "deliver").replace("<npc>", depends.getNPCName(npc));
|
||||
String message = color + Lang.get(getPlayer(), "deliver").replace("<npc>", depends.getNpcName(npc));
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + delivered + "/" + toDeliver);
|
||||
} else {
|
||||
@ -1932,7 +1932,7 @@ public class Quester implements IQuester {
|
||||
boolean interacted = data.npcsInteracted.get(interactIndex);
|
||||
final ChatColor color = !interacted ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "talkTo")
|
||||
.replace("<npc>", depends.getNPCName(n));
|
||||
.replace("<npc>", depends.getNpcName(n));
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
@ -1950,9 +1950,9 @@ public class Quester implements IQuester {
|
||||
final ChatColor color = npcKilled < toNpcKill ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "kill");
|
||||
if (message.contains("<mob>")) {
|
||||
message = message.replace("<mob>", depends.getNPCName(n));
|
||||
message = message.replace("<mob>", depends.getNpcName(n));
|
||||
} else {
|
||||
message += " " + depends.getNPCName(n);
|
||||
message += " " + depends.getNpcName(n);
|
||||
}
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + npcKilled + "/" + toNpcKill);
|
||||
@ -4158,7 +4158,7 @@ public class Quester implements IQuester {
|
||||
final ItemStack is = getCurrentStage(quest).getItemsToDeliver().get(getCurrentStage(quest)
|
||||
.getItemsToDeliver().indexOf(goal));
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "deliver")
|
||||
.replace("<npc>", plugin.getDependencies().getNPCName(getCurrentStage(quest)
|
||||
.replace("<npc>", plugin.getDependencies().getNpcName(getCurrentStage(quest)
|
||||
.getItemDeliveryTargets().get(getCurrentStage(quest).getItemsToDeliver().indexOf(goal))));
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + ChatColor.GREEN + is.getAmount() + "/" + is.getAmount());
|
||||
@ -4219,7 +4219,7 @@ public class Quester implements IQuester {
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.TALK_TO_NPC)) {
|
||||
final String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "talkTo")
|
||||
.replace("<npc>", plugin.getDependencies().getNPCName(npc));
|
||||
.replace("<npc>", plugin.getDependencies().getNpcName(npc));
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.KILL_NPC)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill");
|
||||
@ -4230,7 +4230,7 @@ public class Quester implements IQuester {
|
||||
message += ChatColor.AQUA + " <mob>" + ChatColor.GREEN + ": " + goal.getAmount() + "/"
|
||||
+ goal.getAmount();
|
||||
}
|
||||
sendMessage(message.replace("<mob>", plugin.getDependencies().getNPCName(npc)));
|
||||
sendMessage(message.replace("<mob>", plugin.getDependencies().getNpcName(npc)));
|
||||
} else if (type.equals(ObjectiveType.TAME_MOB)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "tame");
|
||||
if (!message.contains("<mob>")) {
|
||||
@ -4833,7 +4833,7 @@ public class Quester implements IQuester {
|
||||
if (plugin.getDependencies().getCitizens() == null) {
|
||||
return;
|
||||
}
|
||||
final String name = plugin.getDependencies().getNPCName(npc);
|
||||
final String name = plugin.getDependencies().getNpcName(npc);
|
||||
final LinkedList<Quest> qs = new LinkedList<>();
|
||||
for (IQuest q : quests) {
|
||||
qs.add((Quest) q);
|
||||
|
@ -267,7 +267,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
getServer().getPluginManager().registerEvents(getBlockListener(), this);
|
||||
getServer().getPluginManager().registerEvents(getItemListener(), this);
|
||||
depends.linkCitizens();
|
||||
if (depends.getZnpcs() != null) {
|
||||
if (depends.getZnpcsPlus() != null) {
|
||||
getServer().getPluginManager().registerEvents(getZnpcsListener(), this);
|
||||
}
|
||||
getServer().getPluginManager().registerEvents(getPlayerListener(), this);
|
||||
@ -1424,7 +1424,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
continue;
|
||||
}
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "deliver")
|
||||
.replace("<npc>", depends.getNPCName(npc));
|
||||
.replace("<npc>", depends.getNpcName(npc));
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + delivered + "/" + toDeliver);
|
||||
} else {
|
||||
@ -1454,7 +1454,7 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
continue;
|
||||
}
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "talkTo")
|
||||
.replace("<npc>", depends.getNPCName(uuid));
|
||||
.replace("<npc>", depends.getNpcName(uuid));
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
@ -1475,9 +1475,9 @@ public class Quests extends JavaPlugin implements QuestsAPI {
|
||||
}
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "kill");
|
||||
if (message.contains("<mob>")) {
|
||||
message = message.replace("<mob>", depends.getNPCName(uuid));
|
||||
message = message.replace("<mob>", depends.getNpcName(uuid));
|
||||
} else {
|
||||
message += " " + depends.getNPCName(uuid);
|
||||
message += " " + depends.getNpcName(uuid);
|
||||
}
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + npcKilled + "/" + toNpcKill);
|
||||
|
@ -16,7 +16,6 @@ import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorNumericPrompt;
|
||||
import me.blackvein.quests.convo.conditions.ConditionsEditorStringPrompt;
|
||||
import me.blackvein.quests.convo.conditions.main.ConditionMainPrompt;
|
||||
import me.blackvein.quests.convo.quests.objectives.QuestNpcsPrompt;
|
||||
import me.blackvein.quests.events.editor.conditions.ConditionsEditorPostOpenNumericPromptEvent;
|
||||
import me.blackvein.quests.events.editor.conditions.ConditionsEditorPostOpenStringPromptEvent;
|
||||
import me.blackvein.quests.util.CK;
|
||||
@ -104,7 +103,7 @@ public class ConditionEntityPrompt extends ConditionsEditorNumericPrompt {
|
||||
return text.toString();
|
||||
}
|
||||
case 2:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
if (context.getSessionData(CK.C_WHILE_RIDING_NPC) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -113,7 +112,7 @@ public class ConditionEntityPrompt extends ConditionsEditorNumericPrompt {
|
||||
if (whileRidingNpc != null) {
|
||||
for (final UUID u : whileRidingNpc) {
|
||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||
.append(plugin.getDependencies().getNPCName(u));
|
||||
.append(plugin.getDependencies().getNpcName(u));
|
||||
}
|
||||
}
|
||||
return text.toString();
|
||||
@ -278,7 +277,7 @@ public class ConditionEntityPrompt extends ConditionsEditorNumericPrompt {
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
if (plugin.getDependencies().getNPCEntity(uuid) != null && npcs != null) {
|
||||
if (plugin.getDependencies().getNpcEntity(uuid) != null && npcs != null) {
|
||||
npcs.add(uuid.toString());
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidNPC")
|
||||
|
@ -107,7 +107,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY;
|
||||
}
|
||||
case 7:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return ChatColor.BLUE;
|
||||
} else {
|
||||
return ChatColor.GRAY;
|
||||
@ -132,7 +132,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.YELLOW + Lang.get("questEditorFinishMessage");
|
||||
case 4:
|
||||
if (context.getSessionData(CK.Q_START_NPC) == null || plugin.getDependencies().getCitizens() != null
|
||||
|| plugin.getDependencies().getZnpcs() != null) {
|
||||
|| plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return ChatColor.YELLOW + Lang.get("questEditorNPCStart");
|
||||
} else {
|
||||
return ChatColor.GRAY + Lang.get("questEditorNPCStart");
|
||||
@ -150,7 +150,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + Lang.get("questWGSetRegion");
|
||||
}
|
||||
case 7:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return ChatColor.YELLOW + Lang.get("questEditorSetGUI");
|
||||
} else {
|
||||
return ChatColor.GRAY + Lang.get("questEditorSetGUI");
|
||||
@ -194,12 +194,12 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
+ ChatColor.RESET + ChatColor.GRAY + ")";
|
||||
case 4:
|
||||
if (context.getSessionData(CK.Q_START_NPC) == null && (plugin.getDependencies().getCitizens() != null
|
||||
|| plugin.getDependencies().getZnpcs() != null)) {
|
||||
|| plugin.getDependencies().getZnpcsPlus() != null)) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
} else if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
final UUID uuid = UUID.fromString((String) Objects.requireNonNull(context
|
||||
.getSessionData(CK.Q_START_NPC)));
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + plugin.getDependencies().getNPCName(uuid)
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + plugin.getDependencies().getNpcName(uuid)
|
||||
+ ChatColor.RESET + ChatColor.GRAY + ")";
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||
@ -226,7 +226,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||
}
|
||||
case 7:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
if (context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -270,7 +270,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
case 3:
|
||||
return new QuestFinishMessagePrompt(context);
|
||||
case 4:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return new QuestNPCStartPrompt(context);
|
||||
} else {
|
||||
return new QuestMainPrompt(context);
|
||||
@ -292,7 +292,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
return new QuestMainPrompt(context);
|
||||
}
|
||||
case 7:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return new QuestGuiDisplayPrompt(context);
|
||||
} else {
|
||||
return new QuestMainPrompt(context);
|
||||
@ -503,7 +503,7 @@ public class QuestMainPrompt extends QuestsEditorNumericPrompt {
|
||||
if (!input.equalsIgnoreCase(Lang.get("cmdCancel")) && !input.equalsIgnoreCase(Lang.get("cmdClear"))) {
|
||||
try {
|
||||
final UUID uuid = UUID.fromString(input);
|
||||
if (plugin.getDependencies().getNPCEntity(uuid) == null) {
|
||||
if (plugin.getDependencies().getNpcEntity(uuid) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidNPC")
|
||||
.replace("<input>", input));
|
||||
return new QuestNPCStartPrompt(context);
|
||||
|
@ -95,7 +95,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
if (context.getSessionData(pref + CK.S_DELIVERY_ITEMS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -110,7 +110,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
.append(ItemUtil.getName(items.get(i))).append(ChatColor.GRAY).append(" x ")
|
||||
.append(ChatColor.AQUA).append(items.get(i).getAmount()).append(ChatColor.GRAY)
|
||||
.append(" ").append(Lang.get("to")).append(" ").append(ChatColor.BLUE)
|
||||
.append(plugin.getDependencies().getNPCName(UUID.fromString(npcs.get(i))));
|
||||
.append(plugin.getDependencies().getNpcName(UUID.fromString(npcs.get(i))));
|
||||
}
|
||||
}
|
||||
return text.toString();
|
||||
@ -119,7 +119,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + " (" + Lang.get("notInstalled") + ")";
|
||||
}
|
||||
case 2:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
if (context.getSessionData(pref + CK.S_NPCS_TO_TALK_TO) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -129,7 +129,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (npcs != null) {
|
||||
for (final String npc : npcs) {
|
||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||
.append(plugin.getDependencies().getNPCName(UUID.fromString(npc)));
|
||||
.append(plugin.getDependencies().getNpcName(UUID.fromString(npc)));
|
||||
}
|
||||
}
|
||||
return text.toString();
|
||||
@ -138,7 +138,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||
}
|
||||
case 3:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -150,7 +150,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (npcs != null && amounts != null) {
|
||||
for (int i = 0; i < npcs.size(); i++) {
|
||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||
.append(plugin.getDependencies().getNPCName(UUID.fromString(npcs.get(i))))
|
||||
.append(plugin.getDependencies().getNpcName(UUID.fromString(npcs.get(i))))
|
||||
.append(ChatColor.GRAY).append(" x ").append(ChatColor.AQUA).append(amounts.get(i));
|
||||
}
|
||||
}
|
||||
@ -187,21 +187,21 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
protected Prompt acceptValidatedInput(final @NotNull ConversationContext context, final Number input) {
|
||||
switch(input.intValue()) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return new QuestNpcsDeliveryListPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new QuestStageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 2:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return new QuestNpcsIdsToTalkToPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
return new QuestStageMainPrompt(stageNum, context);
|
||||
}
|
||||
case 3:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
return new QuestNpcsKillListPrompt(context);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorNoCitizens"));
|
||||
@ -300,7 +300,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
for (final String s : deliveryNpcs) {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.AQUA)
|
||||
.append(plugin.getDependencies().getNPCName(uuid)).append(ChatColor.GRAY)
|
||||
.append(plugin.getDependencies().getNpcName(uuid)).append(ChatColor.GRAY)
|
||||
.append(" (").append(ChatColor.BLUE).append(s).append(ChatColor.GRAY).append(")");
|
||||
}
|
||||
}
|
||||
@ -454,7 +454,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
for (final String s : input.split(" ")) {
|
||||
try {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
if (plugin.getDependencies().getNPCEntity(uuid) != null && npcs != null) {
|
||||
if (plugin.getDependencies().getNpcEntity(uuid) != null && npcs != null) {
|
||||
npcs.add(uuid.toString());
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidNPC")
|
||||
@ -570,7 +570,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
for (final String s : args) {
|
||||
try {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
if (plugin.getDependencies().getNPCEntity(uuid) != null && npcs != null) {
|
||||
if (plugin.getDependencies().getNpcEntity(uuid) != null && npcs != null) {
|
||||
npcs.add(uuid.toString());
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidNPC")
|
||||
@ -650,7 +650,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
public String getAdditionalText(final ConversationContext context, final int number) {
|
||||
switch(number) {
|
||||
case 1:
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcs() != null) {
|
||||
if (plugin.getDependencies().getCitizens() != null || plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
if (context.getSessionData(pref + CK.S_NPCS_TO_KILL) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -659,7 +659,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
if (npcsToKill != null) {
|
||||
for (final String s : npcsToKill) {
|
||||
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
|
||||
.append(plugin.getDependencies().getNPCName(UUID.fromString(s)))
|
||||
.append(plugin.getDependencies().getNpcName(UUID.fromString(s)))
|
||||
.append(ChatColor.GRAY).append(" (").append(ChatColor.AQUA).append(s)
|
||||
.append(ChatColor.GRAY).append(")");
|
||||
}
|
||||
@ -792,7 +792,7 @@ public class QuestNpcsPrompt extends QuestsEditorNumericPrompt {
|
||||
for (final String s : args) {
|
||||
try {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
if (plugin.getDependencies().getNPCEntity(uuid) != null && npcs != null) {
|
||||
if (plugin.getDependencies().getNpcEntity(uuid) != null && npcs != null) {
|
||||
npcs.add(uuid.toString());
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("stageEditorInvalidNPC")
|
||||
|
@ -1,7 +1,7 @@
|
||||
package me.blackvein.quests.listeners;
|
||||
|
||||
import io.github.znetworkw.znpcservers.npc.NPC;
|
||||
import io.github.znetworkw.znpcservers.npc.event.NPCInteractEvent;
|
||||
import io.github.znetworkw.znpcservers.npc.interaction.NPCInteractEvent;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
@ -12,6 +12,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -34,7 +35,7 @@ public class ZnpcsListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onNPCInteract(final NPCInteractEvent event) {
|
||||
if (plugin.getDependencies().getZnpcs() == null) {
|
||||
if (plugin.getDependencies().getZnpcsPlus() == null) {
|
||||
return;
|
||||
}
|
||||
if (event.isLeftClick()) {
|
||||
@ -44,9 +45,6 @@ public class ZnpcsListener implements Listener {
|
||||
return;
|
||||
}
|
||||
event.getPlayer().acceptConversationInput(String.valueOf(event.getNpc().getUUID()));
|
||||
event.getPlayer().sendMessage(ChatColor.RED + "Warning: " + ChatColor.RESET
|
||||
+ "ZNPCs is not fully supported and will break after server restart. Please ask its developer "
|
||||
+ "to fix this at https://github.com/gonalez/znpc-servers/issues/36");
|
||||
}
|
||||
} else if (event.isRightClick()) {
|
||||
if (plugin.getQuestFactory().getSelectingNpcs().contains(event.getPlayer().getUniqueId())) {
|
||||
@ -55,9 +53,6 @@ public class ZnpcsListener implements Listener {
|
||||
return;
|
||||
}
|
||||
event.getPlayer().acceptConversationInput(String.valueOf(event.getNpc().getUUID()));
|
||||
event.getPlayer().sendMessage(ChatColor.RED + "Warning: " + ChatColor.RESET
|
||||
+ "ZNPCs is not fully supported and will break after server restart. Please ask its developer "
|
||||
+ "to fix this at https://github.com/gonalez/znpc-servers/issues/36");
|
||||
}
|
||||
if (!event.getPlayer().isConversing()) {
|
||||
final Player player = event.getPlayer();
|
||||
@ -249,7 +244,8 @@ public class ZnpcsListener implements Listener {
|
||||
} else {
|
||||
final Conversation c = plugin.getNpcConversationFactory().buildConversation(player);
|
||||
c.getContext().setSessionData("npcQuests", npcQuests);
|
||||
c.getContext().setSessionData("npc", event.getNpc().getGameProfile().getName());
|
||||
//c.getContext().setSessionData("npc", event.getNpc().getGameProfile().getName());
|
||||
c.getContext().setSessionData("npc", ((Entity)event.getNpc().getBukkitEntity()).getCustomName());
|
||||
c.begin();
|
||||
}
|
||||
} else {
|
||||
|
@ -35,34 +35,56 @@ public class NpcEffectThread implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
for (final Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
final List<Entity> nearby = player.getNearbyEntities(32.0, 16.0, 32.0);
|
||||
if (!nearby.isEmpty()) {
|
||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
for (final Entity entity : nearby) {
|
||||
UUID uuid = plugin.getDependencies().getUUIDFromNPC(entity);
|
||||
if (uuid != null) {
|
||||
final QuesterPostViewEffectEvent event;
|
||||
if (plugin.hasQuest(uuid, quester)) {
|
||||
showEffect(player, entity, plugin.getSettings().getEffect());
|
||||
|
||||
event = new QuesterPostViewEffectEvent(quester, entity,
|
||||
plugin.getSettings().getEffect(), false);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
} else if (plugin.hasCompletedRedoableQuest(uuid, quester)) {
|
||||
showEffect(player, entity, plugin.getSettings().getRedoEffect());
|
||||
|
||||
event = new QuesterPostViewEffectEvent(quester, entity,
|
||||
plugin.getSettings().getEffect(), true);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
if (plugin.getDependencies().getCitizens() != null) {
|
||||
final List<Entity> nearby = player.getNearbyEntities(32.0, 16.0, 32.0);
|
||||
if (!nearby.isEmpty()) {
|
||||
for (final Entity entity : nearby) {
|
||||
showConfigEffect(plugin.getQuester(player.getUniqueId()), entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getDependencies().getZnpcsPlus() != null) {
|
||||
for (io.github.znetworkw.znpcservers.npc.NPC npc : io.github.znetworkw.znpcservers.npc.NPC.all()) {
|
||||
if (npc.getLocation().getWorld() == null || player.getLocation().getWorld() == null) {
|
||||
return;
|
||||
}
|
||||
if (npc.getLocation().getWorld().getName().equals(player.getLocation().getWorld().getName())) {
|
||||
if (npc.getLocation().distanceSquared(player.getLocation()) < 24) {
|
||||
showConfigEffect(plugin.getQuester(player.getUniqueId()), (Entity) npc.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display config setting particle effect above an entity one time
|
||||
* @param quester Target quester to let view the effect
|
||||
* @param entity Target entity to place the effect above
|
||||
*/
|
||||
public void showConfigEffect(final Quester quester, final Entity entity) {
|
||||
UUID uuid = plugin.getDependencies().getUuidFromNpc(entity);
|
||||
if (uuid != null) {
|
||||
final QuesterPostViewEffectEvent event;
|
||||
if (plugin.hasQuest(uuid, quester)) {
|
||||
showEffect(quester.getPlayer(), entity, plugin.getSettings().getEffect());
|
||||
|
||||
event = new QuesterPostViewEffectEvent(quester, entity,
|
||||
plugin.getSettings().getEffect(), false);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
} else if (plugin.hasCompletedRedoableQuest(uuid, quester)) {
|
||||
showEffect(quester.getPlayer(), entity, plugin.getSettings().getRedoEffect());
|
||||
|
||||
event = new QuesterPostViewEffectEvent(quester, entity,
|
||||
plugin.getSettings().getEffect(), true);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a particle effect above a Citizens NPC one time
|
||||
* Display specified particle effect above a Citizens NPC one time
|
||||
* @param player Target player to let view the effect
|
||||
* @param npc Target NPC to place the effect above
|
||||
* @param effectType Value of EnumParticle such as NOTE or SMOKE
|
||||
@ -84,7 +106,7 @@ public class NpcEffectThread implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a particle effect above an entity one time
|
||||
* Display specified particle effect above an entity one time
|
||||
* @param player Target player to let view the effect
|
||||
* @param entity Target entity to place the effect above
|
||||
* @param effectType Value of {@link org.bukkit.Particle} or {@link me.blackvein.quests.nms.PreBuiltParticle}
|
||||
|
Loading…
Reference in New Issue
Block a user