-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MythicDungeons support and some wild ComandDispatcher integrations
- Loading branch information
Showing
11 changed files
with
111 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/gg/auroramc/quests/api/quest/task/DifficultyTaskEvaluator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package gg.auroramc.quests.api.quest.task; | ||
|
||
import gg.auroramc.quests.config.quest.TaskConfig; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.Map; | ||
|
||
public class DifficultyTaskEvaluator extends TypedTaskEvaluator { | ||
@Override | ||
public boolean evaluate(Player player, TaskConfig config, Map<String, Object> params) { | ||
var res = super.evaluate(player, config, params); | ||
if (!res) return false; | ||
|
||
if (params.containsKey("difficulty") && params.get("difficulty") instanceof String difficulty) { | ||
var concreteDifficulty = config.getArgs().getString("difficulty"); | ||
if (concreteDifficulty == null) { | ||
return true; | ||
} | ||
return difficulty.equals(concreteDifficulty); | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/gg/auroramc/quests/hooks/mythicdungeons/DungeonsHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package gg.auroramc.quests.hooks.mythicdungeons; | ||
|
||
import gg.auroramc.aurora.api.item.TypeId; | ||
import gg.auroramc.quests.AuroraQuests; | ||
import gg.auroramc.quests.api.quest.TaskType; | ||
import gg.auroramc.quests.hooks.Hook; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import net.playavalon.mythicdungeons.api.events.dungeon.PlayerFinishDungeonEvent; | ||
|
||
import java.util.Map; | ||
|
||
public class DungeonsHook implements Hook, Listener { | ||
private AuroraQuests plugin; | ||
|
||
@Override | ||
public void hook(AuroraQuests plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onDungeonComplete(PlayerFinishDungeonEvent event) { | ||
var player = event.getPlayer(); | ||
var dungeon = event.getDungeon(); | ||
var instance = event.getInstance().asPlayInstance(); | ||
|
||
Map<String, Object> params = instance != null && instance.getDifficulty() != null ? Map.of( | ||
"type", new TypeId("mythicdungeons", dungeon.getFolder().getName()), | ||
"difficulty", instance.getDifficulty().getNamespace() | ||
) : Map.of( | ||
"type", new TypeId("mythicdungeons", dungeon.getFolder().getName()) | ||
); | ||
|
||
plugin.getQuestManager().progress(player, TaskType.COMPLETE_DUNGEON, 1, params); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters