Skip to content

Commit

Permalink
🔀 Merge pull request #336 from SkytAsul/develop
Browse files Browse the repository at this point in the history
release/1.0.4
  • Loading branch information
SkytAsul authored Oct 2, 2024
2 parents 50d7f64 + f792a43 commit 91e5a61
Show file tree
Hide file tree
Showing 56 changed files with 1,162 additions and 607 deletions.
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ What is **BeautyQuests**?
* BeautyQuests is a Minecraft quest plugin based on a simple-to-use graphical interface.
* It's an absolutely free plugin with a full technical documentation.
* It's also a collaborative work, where everyone can improve and add new features. If you have ideas, submit them and I or somebody else will try to implement them.
* It's compatible with a large number of other plugins (like MythicMobs, Jobs, Vault, ...).

***

## Overview
BeautyQuests is a plugin that allows you to create and manage quests very easy with a GUI created with the in-game inventories.
This plugin is elaborate to look pretty and to simplify the quests for the players.
* It's compatible with a large number of other plugins (like MythicMobs, Jobs, Citizens, ...).

***

Expand All @@ -27,18 +21,12 @@ Plugin releases can be downloaded from **[SpigotMC](https://www.spigotmc.org/res

Development builds are available on **[Jenkins](https://ci.codemc.org/job/SkytAsul/job/BeautyQuests/)**.

***

## Wiki
You can find the **wiki [here](https://github.com/SkytAsul/BeautyQuests/wiki)**.

***
You can find the **wiki [here](https://github.com/SkytAsul/BeautyQuests/wiki)**. It contains a lot of useful informations.

## Crowdin
If you want to help us translate BeautyQuests into your native language, join the [official BeautyQuests Crowdin project](https://crowdin.com/project/beautyquests) and let players in-game see your translations (read the project description for more informations).

***

## Discord
If you need help, found a bug, or want to share an idea, you can join the official [Plugin Support Discord server by SkytAsul](https://discord.gg/H8fXrkD).

Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>XSeries</artifactId>
<version>9.10.0</version>
<version>11.2.0</version>
</dependency>

<dependency>
Expand Down
14 changes: 10 additions & 4 deletions api/src/main/java/fr/skytasul/quests/api/gui/ItemUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.skytasul.quests.api.gui;

import com.cryptomorin.xseries.XEnchantment;
import com.cryptomorin.xseries.XMaterial;
import fr.skytasul.quests.api.QuestsPlugin;
import fr.skytasul.quests.api.options.QuestOption;
Expand Down Expand Up @@ -40,6 +41,8 @@ public static ItemStack item(XMaterial type, String name, String... lore) {
.warning("Trying to create an item for an unsupported material " + type.name());
type = XMaterial.SPONGE;
}
if (MinecraftVersion.MAJOR >= 13 && !type.parseMaterial().isItem())
type = XMaterial.SPONGE;
ItemStack is = type.parseItem();
ItemMeta im = is.getItemMeta();
addSpecificFlags(im, is.getType());
Expand All @@ -60,6 +63,8 @@ public static ItemStack item(XMaterial type, String name, List<String> lore) {
.warning("Trying to create an item for an unsupported material " + type.name());
type = XMaterial.SPONGE;
}
if (MinecraftVersion.MAJOR >= 13 && !type.parseMaterial().isItem())
type = XMaterial.SPONGE;
ItemStack is = type.parseItem();
ItemMeta im = is.getItemMeta();
addSpecificFlags(im, is.getType());
Expand Down Expand Up @@ -339,10 +344,11 @@ public static void setGlittering(ItemStack is, boolean glitter) {
if (MinecraftVersion.isHigherThan(20, 6)) {
im.setEnchantmentGlintOverride(glitter ? Boolean.TRUE : null);
} else {
if (glitter)
im.addEnchant(Enchantment.getByName("DURABILITY"), 0, true);
else
im.removeEnchant(Enchantment.getByName("DURABILITY"));
if (glitter) {
im.addEnchant(XEnchantment.UNBREAKING.getEnchant(), 0, true);
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
} else
im.removeEnchant(XEnchantment.UNBREAKING.getEnchant());
}
is.setItemMeta(im);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package fr.skytasul.quests.api.localization;

import java.util.Objects;
import fr.skytasul.quests.api.utils.messaging.MessageType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import fr.skytasul.quests.api.utils.messaging.MessageType;
import java.util.Objects;

/**
* Stores all string paths and methods to format and send them to players.
Expand Down Expand Up @@ -134,6 +134,7 @@ public enum Lang implements Locale {
POOL_RESET_FULL("msg.command.resetPlayerPool.full"), // 0: pool ID, 1: player
POOL_START_ERROR("msg.command.startPlayerPool.error", ErrorPrefix), // 0: pool ID, 1: player
POOL_START_SUCCESS("msg.command.startPlayerPool.success", SuccessPrefix), // 0: pool ID, 1: player, 2: result
POOL_COMPLETELY_RESET("msg.command.resetPool", SuccessPrefix), // 0: amount of players

COMMAND_SCOREBOARD_LINESET("msg.command.scoreboard.lineSet"), // 0: line id
COMMAND_SCOREBOARD_LINERESET("msg.command.scoreboard.lineReset"), // 0: line id
Expand Down
15 changes: 7 additions & 8 deletions api/src/main/java/fr/skytasul/quests/api/pools/QuestPool.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package fr.skytasul.quests.api.pools;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import fr.skytasul.quests.api.players.PlayerAccount;
import fr.skytasul.quests.api.players.PlayerPoolDatas;
import fr.skytasul.quests.api.quests.Quest;
import fr.skytasul.quests.api.requirements.RequirementList;
import fr.skytasul.quests.api.utils.messaging.HasPlaceholders;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.concurrent.CompletableFuture;

public interface QuestPool extends HasPlaceholders {

Expand Down Expand Up @@ -46,7 +45,7 @@ public interface QuestPool extends HasPlaceholders {
ItemStack getItemStack(@NotNull String action);

@NotNull
CompletableFuture<PlayerPoolDatas> resetPlayer(@NotNull PlayerAccount acc);
CompletableFuture<Boolean> resetPlayer(@NotNull PlayerAccount acc);

void resetPlayerTimer(@NotNull PlayerAccount acc);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
package fr.skytasul.quests.api.stages.types;

import org.jetbrains.annotations.Nullable;
import fr.skytasul.quests.api.npcs.BqNpc;
import fr.skytasul.quests.api.npcs.dialogs.Dialog;
import fr.skytasul.quests.api.npcs.dialogs.DialogRunner;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public interface Dialogable {

@Nullable
Dialog getDialog();

@Nullable
DialogRunner getDialogRunner();

@Nullable
BqNpc getNPC();

default boolean hasDialog() {
return getNPC() != null && getDialog() != null && !getDialog().getMessages().isEmpty();
}


default @NotNull String getNpcName() {
if (getNPC() == null)
return "§c§lunknown NPC";
if (getDialog() != null && getDialog().getNpcName() != null)
return getDialog().getNpcName();
return getNPC().getNpc().getName();
}

}
24 changes: 15 additions & 9 deletions api/src/main/java/fr/skytasul/quests/api/utils/MinecraftNames.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class MinecraftNames {
Expand All @@ -24,6 +25,8 @@ public class MinecraftNames {
private static Map<EntityType, String> cachedEntities = new HashMap<>();
private static Map<XMaterial, String> cachedMaterials = new HashMap<>();

private static final boolean POTIONS_ENABLED = MinecraftVersion.isHigherThan(20, 5);

public static boolean intialize(@NotNull Path path) {
try {
if (!Files.exists(path)) {
Expand All @@ -44,16 +47,19 @@ public static boolean intialize(@NotNull Path path) {
}else if (key.startsWith("item.minecraft.")) {
String item = key.substring(15);
if (item.startsWith("potion.effect.")) {
PotionMapping.matchFromTranslationKey(item.substring(14))
.forEachRemaining(potion -> potion.setNormalName(value));
}else if (item.startsWith("splash_potion.effect.")) {
PotionMapping.matchFromTranslationKey(item.substring(21))
if (POTIONS_ENABLED)
PotionMapping.matchFromTranslationKey(item.substring(14))
.forEachRemaining(potion -> potion.setNormalName(value));
} else if (item.startsWith("splash_potion.effect.")) {
if (POTIONS_ENABLED)
PotionMapping.matchFromTranslationKey(item.substring(21))
.forEachRemaining(potion -> potion.setSplashName(value));
}else if (item.startsWith("lingering_potion.effect.")) {
PotionMapping.matchFromTranslationKey(item.substring(24))
} else if (item.startsWith("lingering_potion.effect.")) {
if (POTIONS_ENABLED)
PotionMapping.matchFromTranslationKey(item.substring(24))
.forEachRemaining(potion -> potion.setLingeringName(value));
} else
cachedMaterials.put(XMaterial.matchXMaterial(item).orElse(null), value);
XMaterial.matchXMaterial(item).ifPresent(material -> cachedMaterials.put(material, value));
}
}
}catch (Exception e) {
Expand All @@ -77,7 +83,7 @@ public static boolean intialize(@NotNull Path path) {

public static @NotNull String getMaterialName(ItemStack item) {
XMaterial type = XMaterial.matchXMaterial(item);
if (MinecraftVersion.isHigherThan(20, 2)
if (POTIONS_ENABLED
&& (type == XMaterial.POTION || type == XMaterial.LINGERING_POTION || type == XMaterial.SPLASH_POTION)) {
PotionMeta meta = (PotionMeta) item.getItemMeta();
if (meta.getBasePotionType() != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,58 @@
import com.cryptomorin.xseries.XMaterial;
import fr.skytasul.quests.api.QuestsConfiguration;
import fr.skytasul.quests.api.localization.Lang;
import fr.skytasul.quests.api.localization.Locale;
import org.bukkit.DyeColor;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public enum PlayerListCategory {

FINISHED(
1,
XMaterial.BOOK,
Lang.finisheds.toString(),
DyeColor.GREEN),
Lang.finisheds),
IN_PROGRESS(
2,
XMaterial.WRITABLE_BOOK,
Lang.inProgress.toString(),
DyeColor.YELLOW),
Lang.inProgress),
NOT_STARTED(
3,
XMaterial.PAPER,
Lang.notStarteds.toString(),
DyeColor.RED);
Lang.notStarteds);

private final int slot;
private final @NotNull XMaterial material;
private final @NotNull String name;
private final @Nullable DyeColor color;
private final @NotNull Locale name;
private @NotNull ItemStack icon = XMaterial.BARRIER.parseItem();
private @Nullable DyeColor color = DyeColor.RED;

private PlayerListCategory(int slot, @NotNull XMaterial material, @NotNull String name, @Nullable DyeColor color) {
private PlayerListCategory(int slot, @NotNull Locale name) {
this.slot = slot;
this.material = material;
this.name = name;
this.color = color;
}

public int getSlot() {
return slot;
}

public @NotNull XMaterial getMaterial() {
return material;
public @NotNull String getName() {
return name.getValue();
}

public @NotNull String getName() {
return name;
public @NotNull ItemStack getIcon() {
return icon;
}

public void setIcon(@NotNull ItemStack icon) {
this.icon = icon;
}

public @Nullable DyeColor getColor() {
return color;
}

public void setColor(@NotNull DyeColor color) {
this.color = color;
}

public boolean isEnabled() {
return QuestsConfiguration.getConfig().getQuestsMenuConfig().getEnabledTabs().contains(this);
}
Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
</repository>
<repository>
<id>jeff-media-public</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-public/</url>
<url>https://repo.jeff-media.com/public/</url>
</repository>
<repository>
<id>codemc-repo</id>
Expand Down Expand Up @@ -170,7 +170,7 @@
<dependency>
<groupId>com.jeff_media</groupId>
<artifactId>SpigotUpdateChecker</artifactId>
<version>3.0.0</version>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
Loading

0 comments on commit 91e5a61

Please sign in to comment.