mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 21:56:28 +01:00
Change view effect event again
This commit is contained in:
parent
328aba4bc3
commit
2b2fdc69b0
@ -13,31 +13,30 @@
|
||||
package me.blackvein.quests.events.quester;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class QuesterPostViewEffectEvent extends QuesterEvent {
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
private final UUID id;
|
||||
private final Entity entity;
|
||||
private final String effect;
|
||||
private final boolean redoable;
|
||||
|
||||
public QuesterPostViewEffectEvent(final Quester quester, UUID id, String effect, boolean redoable) {
|
||||
public QuesterPostViewEffectEvent(final Quester quester, Entity entity, String effect, boolean redoable) {
|
||||
super(quester);
|
||||
this.id = id;
|
||||
this.entity = entity;
|
||||
this.effect = effect;
|
||||
this.redoable = redoable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the UUID of the entity involved in this event
|
||||
* Returns the entity involved in this event
|
||||
*
|
||||
* @return UUID of entity who is involved in this event
|
||||
* @return entity who is involved in this event
|
||||
*/
|
||||
public UUID getEntityId() {
|
||||
return id;
|
||||
public Entity getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,22 +37,22 @@ public class NpcEffectThread implements Runnable {
|
||||
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 e : nearby) {
|
||||
for (final Entity entity : nearby) {
|
||||
if (plugin.getDependencies().getCitizens() != null
|
||||
&& plugin.getDependencies().getCitizens().getNPCRegistry() != null) {
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(e)) {
|
||||
final NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(e);
|
||||
if (plugin.getDependencies().getCitizens().getNPCRegistry().isNPC(entity)) {
|
||||
final NPC npc = plugin.getDependencies().getCitizens().getNPCRegistry().getNPC(entity);
|
||||
final QuesterPostViewEffectEvent event;
|
||||
if (plugin.hasQuest(npc, quester)) {
|
||||
showEffect(player, npc.getEntity(), plugin.getSettings().getEffect());
|
||||
|
||||
event = new QuesterPostViewEffectEvent(quester, npc.getUniqueId(),
|
||||
event = new QuesterPostViewEffectEvent(quester, entity,
|
||||
plugin.getSettings().getEffect(), false);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
} else if (plugin.hasCompletedRedoableQuest(npc, quester)) {
|
||||
showEffect(player, npc.getEntity(), plugin.getSettings().getRedoEffect());
|
||||
|
||||
event = new QuesterPostViewEffectEvent(quester, npc.getUniqueId(),
|
||||
event = new QuesterPostViewEffectEvent(quester, entity,
|
||||
plugin.getSettings().getEffect(), true);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user