mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-03-01 15:51:06 +01:00
Option to prevent high party level difference
This commit is contained in:
parent
0b344e7704
commit
1aa7d96347
@ -172,6 +172,13 @@ public class EditablePartyView extends EditableInventory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Math.abs(targetData.getLevel() - party.getLevel()) > MMOCore.plugin.configManager.maxPartyLevelDifference) {
|
||||||
|
MMOCore.plugin.configManager.getSimpleMessage("high-level-difference", "player", target.getName()).send(player);
|
||||||
|
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
|
||||||
|
open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
party.sendInvite(playerData, targetData);
|
party.sendInvite(playerData, targetData);
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("sent-party-invite", "player", target.getName()).send(player);
|
MMOCore.plugin.configManager.getSimpleMessage("sent-party-invite", "player", target.getName()).send(player);
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||||
|
@ -99,7 +99,6 @@ public class ConfigManager {
|
|||||||
globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50;
|
globalSkillCooldown = MMOCore.plugin.getConfig().getLong("global-skill-cooldown") * 50;
|
||||||
noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message();
|
noSkillBoundPlaceholder = getSimpleMessage("no-skill-placeholder").message();
|
||||||
lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests");
|
lootChestsChanceWeight = MMOCore.plugin.getConfig().getDouble("chance-stat-weight.loot-chests");
|
||||||
attributesAsClassInfo = MMOCore.plugin.getConfig().getBoolean("attributes-as-class-info");
|
|
||||||
|
|
||||||
staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN);
|
staminaFull = getColorOrDefault("stamina-whole", ChatColor.GREEN);
|
||||||
staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN);
|
staminaHalf = getColorOrDefault("stamina-half", ChatColor.DARK_GREEN);
|
||||||
|
@ -9,6 +9,7 @@ import net.Indyuce.mmocore.gui.social.party.EditablePartyView.PartyViewInventory
|
|||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.party.AbstractParty;
|
import net.Indyuce.mmocore.party.AbstractParty;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
@ -25,13 +26,21 @@ public class Party implements AbstractParty {
|
|||||||
/**
|
/**
|
||||||
* Owner has to change when previous owner leaves party
|
* Owner has to change when previous owner leaves party
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
private PlayerData owner;
|
private PlayerData owner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the difference between a player level and the party
|
||||||
|
* level is too high then players cannot join the party.
|
||||||
|
*/
|
||||||
|
private final int partyLevel;
|
||||||
|
|
||||||
private final MMOCorePartyModule module;
|
private final MMOCorePartyModule module;
|
||||||
|
|
||||||
public Party(MMOCorePartyModule module, PlayerData owner) {
|
public Party(MMOCorePartyModule module, PlayerData owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.module = module;
|
this.module = module;
|
||||||
|
this.partyLevel = owner.getLevel();
|
||||||
|
|
||||||
addMember(owner);
|
addMember(owner);
|
||||||
}
|
}
|
||||||
@ -59,6 +68,10 @@ public class Party implements AbstractParty {
|
|||||||
return online;
|
return online;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return partyLevel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countMembers() {
|
public int countMembers() {
|
||||||
return members.size();
|
return members.size();
|
||||||
|
@ -143,10 +143,21 @@ party:
|
|||||||
# to talk in the party chat.
|
# to talk in the party chat.
|
||||||
chat-prefix: '@'
|
chat-prefix: '@'
|
||||||
|
|
||||||
# The max players that can be in
|
# The max amount of players in a party
|
||||||
# any given party. Between 2-8.
|
# Has to be higher than 2
|
||||||
max-players: 8
|
max-players: 8
|
||||||
|
|
||||||
|
# If the difference between a player's level and the
|
||||||
|
# initial party owner's level is higher that this
|
||||||
|
# value, then that player can't join the party.
|
||||||
|
#
|
||||||
|
# This prevents low level players from joining
|
||||||
|
# high level players and earning tons of EXP.
|
||||||
|
#
|
||||||
|
# Set to the max level possible if you want to disable
|
||||||
|
# that feature.
|
||||||
|
max-level-difference: 3
|
||||||
|
|
||||||
# Redirects vanilla experience obtained to MMOCore
|
# Redirects vanilla experience obtained to MMOCore
|
||||||
# class experience. You can define the % of the vanilla
|
# class experience. You can define the % of the vanilla
|
||||||
# experience that is being transfered as MMOCore exp.
|
# experience that is being transfered as MMOCore exp.
|
||||||
|
@ -118,6 +118,7 @@ party-joined-other: '&6{player}&e joined your party!'
|
|||||||
transfer-party-ownership: '&eYou were transfered the party ownership.'
|
transfer-party-ownership: '&eYou were transfered the party ownership.'
|
||||||
kick-from-party: '&eYou successfully kicked &6{player}&e.'
|
kick-from-party: '&eYou successfully kicked &6{player}&e.'
|
||||||
party-invite-cooldown: '&cPlease wait {cooldown} before inviting {player}.'
|
party-invite-cooldown: '&cPlease wait {cooldown} before inviting {player}.'
|
||||||
|
high-level-difference: '&cYou cannot invite {player} as the level difference is too high.'
|
||||||
|
|
||||||
# Guilds
|
# Guilds
|
||||||
guild-chat: '&a[{tag}] {player}: {message}'
|
guild-chat: '&a[{tag}] {player}: {message}'
|
||||||
|
Loading…
Reference in New Issue
Block a user