mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
Removed anvil text input
This commit is contained in:
parent
bfe2b27ab5
commit
cb2da5abb2
@ -12,6 +12,7 @@ import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@ -22,19 +23,28 @@ import java.util.logging.Level;
|
||||
|
||||
public class PlayerQuests implements Closable {
|
||||
private final PlayerData playerData;
|
||||
private final Map<String, Long> finished = new HashMap<>();
|
||||
|
||||
@Nullable
|
||||
private final BossBar bossbar;
|
||||
private final NamespacedKey bossbarNamespacedKey;
|
||||
private final Map<String, Long> finished = new HashMap<>();
|
||||
|
||||
private QuestProgress current;
|
||||
|
||||
public PlayerQuests(PlayerData playerData) {
|
||||
this.playerData = playerData;
|
||||
|
||||
bossbarNamespacedKey = new NamespacedKey(MMOCore.plugin, "mmocore_quest_progress_" + playerData.getUniqueId().toString());
|
||||
bossbar = Bukkit.createBossBar(bossbarNamespacedKey, "", BarColor.PURPLE, BarStyle.SEGMENTED_20);
|
||||
if (playerData.isOnline())
|
||||
bossbar.addPlayer(playerData.getPlayer());
|
||||
if (MMOCore.plugin.configManager.questBossBar) {
|
||||
bossbarNamespacedKey = new NamespacedKey(MMOCore.plugin, "mmocore_quest_progress_" + playerData.getUniqueId().toString());
|
||||
bossbar = Bukkit.createBossBar(bossbarNamespacedKey, "", BarColor.PURPLE, BarStyle.SEGMENTED_20);
|
||||
if (playerData.isOnline())
|
||||
bossbar.addPlayer(playerData.getPlayer());
|
||||
|
||||
// Bossbar is disabled
|
||||
} else {
|
||||
bossbarNamespacedKey = null;
|
||||
bossbar = null;
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerQuests load(ConfigurationSection config) {
|
||||
@ -50,7 +60,7 @@ public class PlayerQuests implements Closable {
|
||||
finished.put(key, config.getLong("finished." + key));
|
||||
|
||||
/*
|
||||
* must update the boss bar once the instance is loaded, otherwise it
|
||||
* Must update the boss bar once the instance is loaded, otherwise it
|
||||
* won't detect the current quest. THE BOSS BAR UPDATE is in the player
|
||||
* data class, this way it is still set invisible even if the player has
|
||||
* no quest data
|
||||
@ -187,6 +197,11 @@ public class PlayerQuests implements Closable {
|
||||
}
|
||||
|
||||
public void updateBossBar() {
|
||||
|
||||
// Bossbar is disabled
|
||||
if (bossbar == null)
|
||||
return;
|
||||
|
||||
if (!hasCurrent() || !current.getProgress().getObjective().hasLore()) {
|
||||
bossbar.setVisible(false);
|
||||
return;
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.util.Consumer;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
||||
@Deprecated
|
||||
public class AnvilGUI extends PlayerInput {
|
||||
private final int containerId;
|
||||
private final Inventory inventory;
|
||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmocore.gui.social.friend;
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerActivity;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType;
|
||||
import net.Indyuce.mmocore.api.util.math.format.DelayFormat;
|
||||
import net.Indyuce.mmocore.gui.api.EditableInventory;
|
||||
@ -191,7 +192,7 @@ public class EditableFriendList extends EditableInventory {
|
||||
return;
|
||||
}
|
||||
|
||||
MMOCore.plugin.configManager.newPlayerInput(player, InputType.FRIEND_REQUEST, (input) -> {
|
||||
new ChatInput(player, InputType.FRIEND_REQUEST, (input) -> {
|
||||
Player target = Bukkit.getPlayer(input);
|
||||
if (target == null) {
|
||||
MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.Indyuce.mmocore.gui.social.guild;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
@ -151,7 +152,7 @@ public class EditableGuildAdmin extends EditableInventory {
|
||||
return;
|
||||
}
|
||||
|
||||
MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_INVITE, (input) -> {
|
||||
new ChatInput(player, PlayerInput.InputType.GUILD_INVITE, (input) -> {
|
||||
Player target = Bukkit.getPlayer(input);
|
||||
if (target == null) {
|
||||
MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.Indyuce.mmocore.gui.social.guild;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
@ -39,14 +40,14 @@ public class EditableGuildCreation extends EditableInventory {
|
||||
return;
|
||||
|
||||
if (item.getFunction().equals("create")) {
|
||||
MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_CREATION_TAG, (input) -> {
|
||||
new ChatInput(player, PlayerInput.InputType.GUILD_CREATION_TAG, (input) -> {
|
||||
if(MMOCore.plugin.dataProvider.getGuildManager().getConfig().shouldUppercaseTags())
|
||||
input = input.toUpperCase();
|
||||
|
||||
if(check(player, input, MMOCore.plugin.dataProvider.getGuildManager().getConfig().getTagRules())) {
|
||||
String tag = input;
|
||||
|
||||
MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_CREATION_NAME, (name) -> {
|
||||
new ChatInput(player, PlayerInput.InputType.GUILD_CREATION_NAME, (name) -> {
|
||||
if(check(player, name, MMOCore.plugin.dataProvider.getGuildManager().getConfig().getNameRules())) {
|
||||
MMOCore.plugin.dataProvider.getGuildManager().newRegisteredGuild(playerData.getUniqueId(), name, tag);
|
||||
MMOCore.plugin.dataProvider.getGuildManager().getGuild(tag.toLowerCase()).addMember(playerData.getUniqueId());
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.Indyuce.mmocore.gui.social.guild;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||
import net.Indyuce.mmocore.gui.api.GeneratedInventory;
|
||||
import net.Indyuce.mmocore.gui.api.item.InventoryItem;
|
||||
@ -200,7 +201,7 @@ public class EditableGuildView extends EditableInventory {
|
||||
* Sound.ENTITY_VILLAGER_NO, 1, 1); return; }
|
||||
*/
|
||||
|
||||
MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.GUILD_INVITE, (input) -> {
|
||||
new ChatInput(player, PlayerInput.InputType.GUILD_INVITE, (input) -> {
|
||||
Player target = Bukkit.getPlayer(input);
|
||||
if (target == null) {
|
||||
MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player);
|
||||
|
@ -2,6 +2,7 @@ package net.Indyuce.mmocore.gui.social.party;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||
import net.Indyuce.mmocore.api.util.math.format.DelayFormat;
|
||||
import net.Indyuce.mmocore.gui.api.EditableInventory;
|
||||
@ -148,7 +149,7 @@ public class EditablePartyView extends EditableInventory {
|
||||
return;
|
||||
}
|
||||
|
||||
MMOCore.plugin.configManager.newPlayerInput(player, PlayerInput.InputType.PARTY_INVITE, input -> {
|
||||
new ChatInput(player, PlayerInput.InputType.PARTY_INVITE, input -> {
|
||||
Player target = Bukkit.getPlayer(input);
|
||||
if (target == null) {
|
||||
MMOCore.plugin.configManager.getSimpleMessage("not-online-player", "player", input).send(player);
|
||||
|
@ -23,7 +23,7 @@ import java.util.logging.Level;
|
||||
public class ConfigManager {
|
||||
public final CommandVerbose commandVerbose = new CommandVerbose();
|
||||
|
||||
public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp;
|
||||
public boolean overrideVanillaExp, canCreativeCast, cobbleGeneratorXP, saveDefaultClassInfo, attributesAsClassInfo, splitProfessionExp, questBossBar;
|
||||
public String partyChatPrefix, noSkillBoundPlaceholder;
|
||||
public ChatColor staminaFull, staminaHalf, staminaEmpty;
|
||||
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
|
||||
@ -31,7 +31,6 @@ public class ConfigManager {
|
||||
public int maxPartyLevelDifference;
|
||||
|
||||
private final FileConfiguration messages;
|
||||
private final boolean chatInput;
|
||||
|
||||
/*
|
||||
* the instance must be created after the other managers since all it does
|
||||
@ -95,7 +94,6 @@ public class ConfigManager {
|
||||
commandVerbose.reload(MMOCore.plugin.getConfig().getConfigurationSection("command-verbose"));
|
||||
|
||||
messages = new ConfigFile("messages").getConfig();
|
||||
chatInput = true; // MMOCore.plugin.getConfig().getBoolean("use-chat-input")
|
||||
partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix");
|
||||
combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer") * 1000L;
|
||||
lootChestExpireTime = Math.max(MMOCore.plugin.getConfig().getInt("loot-chests.chest-expire-time"), 1) * 20;
|
||||
@ -106,6 +104,7 @@ public class ConfigManager {
|
||||
fishingDropsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.fishing-drops");
|
||||
maxPartyLevelDifference = MMOCore.plugin.getConfig().getInt("party.max-level-difference");
|
||||
splitProfessionExp = MMOCore.plugin.getConfig().getBoolean("party.profession-exp-split");
|
||||
questBossBar = MMOCore.plugin.getConfig().getBoolean("mmocore-quests.disable-boss-bar");
|
||||
|
||||
staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN);
|
||||
staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN);
|
||||
@ -125,8 +124,9 @@ public class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public PlayerInput newPlayerInput(Player player, InputType type, Consumer<String> output) {
|
||||
return chatInput ? new ChatInput(player, type, output) : new AnvilGUI(player, type, output);
|
||||
return new ChatInput(player, type, output) ;
|
||||
}
|
||||
|
||||
public void loadDefaultFile(String name) {
|
||||
|
@ -162,6 +162,12 @@ party:
|
||||
# When enabled, being in a party also splits profession exp
|
||||
profession-exp-split: false
|
||||
|
||||
# Not relevant when not using MMOCore as quest plugin
|
||||
mmocore-quests:
|
||||
|
||||
# Disable boss bar indicating the current objective
|
||||
disable-boss-bar: false
|
||||
|
||||
# Redirects vanilla experience obtained to MMOCore
|
||||
# class experience. You can define the % of the vanilla
|
||||
# experience that is being transfered as MMOCore exp.
|
||||
@ -207,10 +213,6 @@ hotbar-swapping:
|
||||
# in creative mode to enter casting mode
|
||||
can-creative-cast: false
|
||||
|
||||
# Use this option if you're having issue with Anvil GUIs.
|
||||
# This replaces anvil inputs by chat inputs.
|
||||
use-chat-input: true
|
||||
|
||||
ability-targeting-options:
|
||||
|
||||
# Prevent heals/buffs on players in a different guild
|
||||
@ -222,7 +224,6 @@ ability-targeting-options:
|
||||
# Prevents mobs spawned from spawners from giving MMO XP points.
|
||||
prevent-spawner-xp: true
|
||||
|
||||
|
||||
# Timer for combat log to expire (in seconds)
|
||||
combat-log:
|
||||
timer: 10
|
||||
|
Loading…
Reference in New Issue
Block a user