mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-23 00:05:52 +01:00
Messages for combat level restriction
This commit is contained in:
parent
5c9b73e3ec
commit
b8624733da
@ -786,7 +786,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
}
|
||||
|
||||
// Splitting exp through party members
|
||||
AbstractParty party;
|
||||
final AbstractParty party;
|
||||
if (splitExp && (party = getParty()) != null && MMOCore.plugin.configManager.splitMainExp) {
|
||||
final List<PlayerData> nearbyMembers = party.getOnlineMembers().stream()
|
||||
.filter(pd -> {
|
||||
@ -841,7 +841,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
||||
if (level > oldLevel) {
|
||||
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(this, null, oldLevel, level));
|
||||
if (isOnline()) {
|
||||
new ConfigMessage("level-up").addPlaceholders("level", "" + level).send(getPlayer());
|
||||
new ConfigMessage("level-up").addPlaceholders("level", String.valueOf(level)).send(getPlayer());
|
||||
MMOCore.plugin.soundManager.getSound(SoundEvent.LEVEL_UP).playTo(getPlayer());
|
||||
new SmallParticleEffect(getPlayer(), Particle.SPELL_INSTANT);
|
||||
}
|
||||
|
@ -48,9 +48,21 @@ public class PvPModeListener implements Listener {
|
||||
final Player target = (Player) event.getEntity();
|
||||
final PlayerData targetData = PlayerData.get(target), sourceData = PlayerData.get(source);
|
||||
final int minLevel = MMOCore.plugin.configManager.minCombatLevel;
|
||||
if (minLevel > 0 && (targetData.getLevel() < minLevel || sourceData.getLevel() < minLevel)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
if (minLevel > 0) {
|
||||
|
||||
if (targetData.getLevel() < minLevel) {
|
||||
event.setCancelled(true);
|
||||
if (event.getDamage() > 0)
|
||||
MMOCore.plugin.configManager.getSimpleMessage("pvp-mode.cannot-hit.low-level-target").send(source);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sourceData.getLevel() < minLevel) {
|
||||
event.setCancelled(true);
|
||||
if (event.getDamage() > 0)
|
||||
MMOCore.plugin.configManager.getSimpleMessage("pvp-mode.cannot-hit.low-level-self").send(source);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -312,7 +312,7 @@ pvp_mode:
|
||||
# When enabled, leaving a no-PVP zone and entering a
|
||||
# PVP zone will apply the SAME invulnerability time.
|
||||
# Requires /reload when changed
|
||||
apply_to_pvp_flag: false
|
||||
apply_to_pvp_flag: true
|
||||
|
||||
cooldown:
|
||||
|
||||
|
@ -35,6 +35,8 @@ pvp-mode:
|
||||
|
||||
# When you cannot hit another player
|
||||
cannot-hit:
|
||||
low-level-target: '&cYou cannot fight this player as their level is too low.'
|
||||
low-level-self: '&cYour level is too low to fight other players.'
|
||||
pvp-mode-disabled-target: '&cThis player has not toggled on PvP.'
|
||||
pvp-mode-disabled-self: '&cYou have not toggled on PvP.'
|
||||
invulnerable-self: '&cYou are still out of combat for {left} seconds.'
|
||||
|
Loading…
Reference in New Issue
Block a user