mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-11-18 06:24:17 +01:00
Fixed Quests support
This commit is contained in:
parent
42775c6646
commit
fed1555a32
@ -94,17 +94,18 @@
|
||||
<url>https://maven.enginehub.org/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>dmulloy2-repo</id>
|
||||
<url>https://repo.dmulloy2.net/repository/public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Party and Friends Repository -->
|
||||
<repository>
|
||||
<id>simonsators Repo</id>
|
||||
<url>https://simonsator.de/repo</url>
|
||||
</repository>
|
||||
|
||||
<!-- Quests (plugin) -->
|
||||
<repository>
|
||||
<id>codemc-repo</id>
|
||||
<url>https://repo.codemc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<!-- Heroes Repository
|
||||
<repository>
|
||||
<id>herocraft</id>
|
||||
@ -227,9 +228,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.comphenix.protocol</groupId>
|
||||
<groupId>net.dmulloy2</groupId>
|
||||
<artifactId>ProtocolLib</artifactId>
|
||||
<version>4.8.0</version>
|
||||
<version>5.4.0</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
@ -325,9 +326,9 @@
|
||||
|
||||
<!-- Quest Plugins -->
|
||||
<dependency>
|
||||
<groupId>me.blackvein</groupId>
|
||||
<artifactId>Quests</artifactId>
|
||||
<version>4.4.1-b340</version>
|
||||
<groupId>me.pikamug.quests</groupId>
|
||||
<artifactId>quests-core</artifactId>
|
||||
<version>5.2.7</version>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package net.Indyuce.mmocore.quest;
|
||||
|
||||
import net.Indyuce.mmocore.quest.compat.BeautyQuestModule;
|
||||
import net.Indyuce.mmocore.quest.compat.BlackVeinQuestsModule;
|
||||
import net.Indyuce.mmocore.quest.compat.QuestsModule;
|
||||
import net.Indyuce.mmocore.quest.compat.QuestCreatorModule;
|
||||
import net.Indyuce.mmocore.quest.compat.QuestModule;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -10,7 +10,7 @@ import javax.inject.Provider;
|
||||
|
||||
public enum QuestModuleType {
|
||||
MMOCORE("MMOCore", MMOCoreQuestModule::new),
|
||||
QUESTS("Quests", BlackVeinQuestsModule::new),
|
||||
QUESTS("Quests", QuestsModule::new),
|
||||
BEAUTY_QUEST("BeautyQuests", BeautyQuestModule::new),
|
||||
QUEST_CREATOR("QuestCreator", QuestCreatorModule::new);
|
||||
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
package net.Indyuce.mmocore.quest.compat;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import net.Indyuce.mmocore.quest.AbstractQuest;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class BlackVeinQuestsModule implements QuestModule<BlackVeinQuestsModule.BlackVeinQuestQuest> {
|
||||
private final Quests plugin = (Quests) Bukkit.getPluginManager().getPlugin("Quests");
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public BlackVeinQuestQuest getQuestOrThrow(String id) {
|
||||
Quests plugin = (Quests) Bukkit.getPluginManager().getPlugin("Quests");
|
||||
return plugin.getQuestById(id)==null?null:new BlackVeinQuestQuest(plugin.getQuestById(id));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCompletedQuest(String questId, Player player) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if(quester==null)
|
||||
return false;
|
||||
for(Quest quest:quester.getCompletedQuests()) {
|
||||
if(quest.getId().equals(questId))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public class BlackVeinQuestQuest implements AbstractQuest {
|
||||
private final Quest quest;
|
||||
|
||||
public BlackVeinQuestQuest(Quest quest) {
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return quest.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return quest.getId();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package net.Indyuce.mmocore.quest.compat;
|
||||
|
||||
import me.pikamug.quests.BukkitQuestsPlugin;
|
||||
import me.pikamug.quests.player.Quester;
|
||||
import me.pikamug.quests.quests.Quest;
|
||||
import net.Indyuce.mmocore.quest.AbstractQuest;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class QuestsModule implements QuestModule<QuestsModule.QuestImpl> {
|
||||
private final BukkitQuestsPlugin plugin;
|
||||
|
||||
public QuestsModule() {
|
||||
plugin = (BukkitQuestsPlugin) Bukkit.getPluginManager().getPlugin("Quests");
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestImpl getQuestOrThrow(String id) {
|
||||
final var found = plugin.getQuest(id);
|
||||
return found == null ? null : new QuestImpl(found);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasCompletedQuest(String questId, Player player) {
|
||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||
if (quester == null) return false;
|
||||
|
||||
for (var quest : quester.getCompletedQuests())
|
||||
if (quest.getId().equals(questId)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class QuestImpl implements AbstractQuest {
|
||||
private final Quest quest;
|
||||
|
||||
public QuestImpl(Quest quest) {
|
||||
this.quest = quest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return quest.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return quest.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user