Skip to content

Commit

Permalink
Merge pull request #89 from Th3Shadowbroker/fix/quests
Browse files Browse the repository at this point in the history
Add support for quests by LMBishop
  • Loading branch information
Th3Shadowbroker authored Apr 5, 2023
2 parents e5a735b + 0b9e7f8 commit 2bd1c49
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 8 deletions.
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>dev.th3shadowbroker.spigot</groupId>
<artifactId>OuroborosMines</artifactId>
<version>1.12.1-SNAPSHOT</version>
<version>1.12.2-SNAPSHOT</version>

<properties>
<plugin.name>${project.artifactId}</plugin.name>
Expand Down Expand Up @@ -46,7 +46,7 @@
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>

<!-- Quests -->
<!-- Quests by PikaMug -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
Expand All @@ -57,6 +57,13 @@
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>

<!-- Quests by LMBishop -->
<repository>
<id>leonardobishop-releases</id>
<name>LMBishop's Maven Repository</name>
<url>https://repo.leonardobishop.com/releases</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -87,13 +94,21 @@
<version>1.0.1-SNAPSHOT</version>
</dependency>

<!-- Quests (Autogenerated through jitpack!) -->
<!-- Quests by PikaMug (Autogenerated through jitpack!) -->
<dependency>
<groupId>com.github.PikaMug.Quests</groupId>
<artifactId>quests-dist</artifactId>
<version>4.4.2</version>
</dependency>

<!-- Quests by LMBishop -->
<dependency>
<groupId>com.leonardobishop</groupId>
<artifactId>quests</artifactId>
<version>3.12</version>
<scope>provided</scope>
</dependency>

<!-- BeautyQuests -->
<dependency>
<groupId>fr.skytasul</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,24 @@ private void updateConfig() {
}

private void checkForSupportedPlugins() {
boolean questsInstalled = getServer().getPluginManager().isPluginEnabled(QuestsSupport.PLUGIN_NAME);
boolean questsInstalled = getServer().getPluginManager().isPluginEnabled(QuestsPikaMugSupport.PLUGIN_NAME) ||
getServer().getPluginManager().isPluginEnabled(QuestsLMBishopSupport.PLUGIN_NAME);
if (questsInstalled) {
getLogger().info("Quests support is enabled!");
new QuestsSupport();
var pikaMugPlugin = Optional.ofNullable(getServer().getPluginManager().getPlugin(QuestsPikaMugSupport.PLUGIN_NAME));
pikaMugPlugin.ifPresent(pl -> {
if (pl.getDescription().getAuthors().contains(QuestsPikaMugSupport.PLUGIN_AUTHOR)) {
getLogger().info(String.format("Quests (by %s) support is enabled!", QuestsPikaMugSupport.PLUGIN_AUTHOR));
new QuestsPikaMugSupport();
}
});

var lmbishopPlugin = Optional.ofNullable(getServer().getPluginManager().getPlugin(QuestsLMBishopSupport.PLUGIN_NAME));
lmbishopPlugin.ifPresent(pl -> {
if (pl.getDescription().getAuthors().contains(QuestsLMBishopSupport.PLUGIN_AUTHOR)) {
getLogger().info(String.format("Quests (by %s) support is enabled!", QuestsLMBishopSupport.PLUGIN_AUTHOR));
new QuestsLMBishopSupport();
}
});
}

boolean beautyQuestInstalled = getServer().getPluginManager().isPluginEnabled(BeautyQuestsSupport.PLUGIN_NAME);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright 2023 Jens Fischer
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
* the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package dev.th3shadowbroker.ouroboros.mines.thirdparty;

import com.leonardobishop.quests.bukkit.BukkitQuestsPlugin;
import com.leonardobishop.quests.bukkit.tasktype.BukkitTaskTypeManager;
import com.leonardobishop.quests.bukkit.tasktype.type.MiningTaskType;
import dev.th3shadowbroker.ouroboros.mines.OuroborosMines;
import dev.th3shadowbroker.ouroboros.mines.events.MaterialMinedEvent;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public class QuestsLMBishopSupport implements Listener {

public static final String PLUGIN_NAME = "Quests";

public static final String PLUGIN_AUTHOR = "LMBishop & contributors";

private final BukkitTaskTypeManager typeManager;

public QuestsLMBishopSupport() {
var plugin = (BukkitQuestsPlugin) Bukkit.getPluginManager().getPlugin(PLUGIN_NAME);
this.typeManager = (BukkitTaskTypeManager) plugin.getTaskTypeManager();
Bukkit.getServer().getPluginManager().registerEvents(this, OuroborosMines.INSTANCE);
}

@EventHandler
public void onMaterialMined(MaterialMinedEvent event) {
var task = (MiningTaskType) typeManager.getTaskType("blockbreak");
task.onBlockBreak(event.getOriginalEvent());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;

public class QuestsSupport implements Listener {
public class QuestsPikaMugSupport implements Listener {

public static final String PLUGIN_NAME = "Quests";

public QuestsSupport() {
public static final String PLUGIN_AUTHOR = "PikaMug";

public QuestsPikaMugSupport() {
Bukkit.getPluginManager().registerEvents(this, OuroborosMines.INSTANCE);
}

Expand Down

0 comments on commit 2bd1c49

Please sign in to comment.