mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-26 20:55:54 +01:00
Begin particle task alongside Citizens post-enable
This commit is contained in:
parent
941e06b115
commit
be41d61441
@ -124,17 +124,27 @@ public class Dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CitizensPlugin getCitizens() {
|
public CitizensPlugin getCitizens() {
|
||||||
if (citizens == null && isPluginAvailable("Citizens")) {
|
if (citizens == null) {
|
||||||
|
enableCitizens();
|
||||||
|
}
|
||||||
|
return citizens;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableCitizens() {
|
||||||
|
if (isPluginAvailable("Citizens")) {
|
||||||
try {
|
try {
|
||||||
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
|
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
|
||||||
plugin.getServer().getPluginManager().registerEvents(plugin.getNpcListener(), plugin);
|
plugin.getServer().getPluginManager().registerEvents(plugin.getNpcListener(), plugin);
|
||||||
|
if (plugin.getSettings().canNpcEffects()) {
|
||||||
|
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, plugin.getNpcEffectThread(),
|
||||||
|
20, 20);
|
||||||
|
}
|
||||||
plugin.getLogger().info("Successfully linked Quests with Citizens "
|
plugin.getLogger().info("Successfully linked Quests with Citizens "
|
||||||
+ citizens.getDescription().getVersion());
|
+ citizens.getDescription().getVersion());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled.");
|
plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return citizens;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableCitizens() {
|
public void disableCitizens() {
|
||||||
|
@ -133,7 +133,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
private ItemListener itemListener;
|
private ItemListener itemListener;
|
||||||
private NpcListener npcListener;
|
private NpcListener npcListener;
|
||||||
private PlayerListener playerListener;
|
private PlayerListener playerListener;
|
||||||
private NpcEffectThread effThread;
|
private NpcEffectThread effectThread;
|
||||||
private PlayerMoveThread moveThread;
|
private PlayerMoveThread moveThread;
|
||||||
private DungeonsListener dungeonsListener;
|
private DungeonsListener dungeonsListener;
|
||||||
private PartiesListener partiesListener;
|
private PartiesListener partiesListener;
|
||||||
@ -155,7 +155,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
playerListener = new PlayerListener(this);
|
playerListener = new PlayerListener(this);
|
||||||
dungeonsListener = new DungeonsListener();
|
dungeonsListener = new DungeonsListener();
|
||||||
partiesListener = new PartiesListener();
|
partiesListener = new PartiesListener();
|
||||||
effThread = new NpcEffectThread(this);
|
effectThread = new NpcEffectThread(this);
|
||||||
moveThread = new PlayerMoveThread(this);
|
moveThread = new PlayerMoveThread(this);
|
||||||
questFactory = new QuestFactory(this);
|
questFactory = new QuestFactory(this);
|
||||||
actionFactory = new ActionFactory(this);
|
actionFactory = new ActionFactory(this);
|
||||||
@ -215,11 +215,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
// 10 - Register listeners
|
// 10 - Register listeners
|
||||||
getServer().getPluginManager().registerEvents(blockListener, this);
|
getServer().getPluginManager().registerEvents(blockListener, this);
|
||||||
getServer().getPluginManager().registerEvents(itemListener, this);
|
getServer().getPluginManager().registerEvents(itemListener, this);
|
||||||
if (depends.getCitizens() != null) { // #getCitizens takes care of registering npcListener
|
depends.enableCitizens();
|
||||||
if (settings.canNpcEffects()) {
|
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, effThread, 20, 20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getServer().getPluginManager().registerEvents(playerListener, this);
|
getServer().getPluginManager().registerEvents(playerListener, this);
|
||||||
if (settings.getStrictPlayerMovement() > 0) {
|
if (settings.getStrictPlayerMovement() > 0) {
|
||||||
final long ticks = settings.getStrictPlayerMovement() * 20;
|
final long ticks = settings.getStrictPlayerMovement() * 20;
|
||||||
@ -466,6 +462,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
return partiesListener;
|
return partiesListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NpcEffectThread getNpcEffectThread() {
|
||||||
|
return effectThread;
|
||||||
|
}
|
||||||
|
|
||||||
public DenizenTrigger getDenizenTrigger() {
|
public DenizenTrigger getDenizenTrigger() {
|
||||||
return trigger;
|
return trigger;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user