Fixed issue #897 about a bug in max party players placeholder.

This commit is contained in:
Ka0rX 2023-07-09 20:54:37 +01:00
parent 4a22e0a357
commit 65d6047017
3 changed files with 8 additions and 11 deletions

View File

@ -122,18 +122,15 @@ public class EditablePartyView extends EditableInventory {
}
public class PartyViewInventory extends GeneratedInventory {
private final int max;
public PartyViewInventory(PlayerData playerData, EditableInventory editable) {
super(playerData, editable);
max = editable.getByFunction("member").getSlots().size();
}
@Override
public String calculateName() {
Party party = (Party) getPlayerData().getParty();
return getName().replace("{max}", "" + max).replace("{players}", "" + party.getMembers().size());
return getName().replace("{max}", "" + MMOCore.plugin.configManager.maxPartyPlayers).replace("{players}", "" + party.getMembers().size());
}
@Override
@ -149,7 +146,7 @@ public class EditablePartyView extends EditableInventory {
if (item.getFunction().equals("invite")) {
if (party.getMembers().size() >= max) {
if (party.getMembers().size() >= MMOCore.plugin.configManager.maxPartyPlayers) {
MMOCore.plugin.configManager.getSimpleMessage("party-is-full").send(player);
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
return;

View File

@ -28,13 +28,13 @@ public class ConfigManager {
public final CommandVerbose commandVerbose = new CommandVerbose();
public boolean overrideVanillaExp, canCreativeCast, passiveSkillNeedBound, cobbleGeneratorXP, saveDefaultClassInfo, splitMainExp, splitProfessionExp, disableQuestBossBar,
pvpModeEnabled, pvpModeInvulnerabilityCanDamage, forceClassSelection,enableGlobalSkillTreeGUI,enableSpecificSkillTreeGUI;
pvpModeEnabled, pvpModeInvulnerabilityCanDamage, forceClassSelection, enableGlobalSkillTreeGUI, enableSpecificSkillTreeGUI;
public String partyChatPrefix, noSkillBoundPlaceholder;
public ChatColor staminaFull, staminaHalf, staminaEmpty;
public long combatLogTimer, lootChestExpireTime, lootChestPlayerCooldown, globalSkillCooldown;
public double lootChestsChanceWeight, dropItemsChanceWeight, fishingDropsChanceWeight, partyMaxExpSplitRange, pvpModeToggleOnCooldown, pvpModeToggleOffCooldown, pvpModeCombatCooldown,
pvpModeCombatTimeout, pvpModeInvulnerabilityTimeRegionChange, pvpModeInvulnerabilityTimeCommand, pvpModeRegionEnterCooldown, pvpModeRegionLeaveCooldown;
public int maxPartyLevelDifference, maxSkillSlots, minCombatLevel, maxCombatLevelDifference, skillTreeScrollStepX, skillTreeScrollStepY;
public int maxPartyLevelDifference, maxPartyPlayers, maxSkillSlots, minCombatLevel, maxCombatLevelDifference, skillTreeScrollStepX, skillTreeScrollStepY;
public final List<EntityDamageEvent.DamageCause> combatLogDamageCauses = new ArrayList<>();
private final FileConfiguration messages;
@ -110,7 +110,7 @@ public class ConfigManager {
messages = new ConfigFile("messages").getConfig();
partyChatPrefix = MMOCore.plugin.getConfig().getString("party.chat-prefix");
maxPartyPlayers = Math.max(2, MMOCore.plugin.getConfig().getInt("party.max-players", 8));
// Combat log
combatLogTimer = MMOCore.plugin.getConfig().getInt("combat-log.timer") * 1000L;
combatLogDamageCauses.clear();
@ -149,8 +149,8 @@ public class ConfigManager {
pvpModeInvulnerabilityCanDamage = config.getBoolean("pvp_mode.invulnerability.can_damage");
minCombatLevel = config.getInt("pvp_mode.min_level");
maxCombatLevelDifference = config.getInt("pvp_mode.max_level_difference");
skillTreeScrollStepX = config.getInt("skill-tree-scroll-step-x",1);
skillTreeScrollStepY = config.getInt("skill-tree-scroll-step-y",1);
skillTreeScrollStepX = config.getInt("skill-tree-scroll-step-x", 1);
skillTreeScrollStepY = config.getInt("skill-tree-scroll-step-y", 1);
// Resources
staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN);
staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN);

View File

@ -25,7 +25,7 @@ public class PartyInvite extends Request {
@Override
public void whenAccepted() {
if (party.getMembers().size() >= Math.max(2, MMOCore.plugin.getConfig().getInt("party.max-players", 8))) {
if (party.getMembers().size() >= MMOCore.plugin.configManager.maxPartyPlayers) {
MMOCore.plugin.configManager.getSimpleMessage("party-is-full").send(getTarget().getPlayer());
return;
}