mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 21:24:43 +02:00
Added party levels
Parties now have XP and Levels. Party features such as party teleport and party chat have to be unlocked before they can be used by the party members
This commit is contained in:
@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
@ -24,7 +25,9 @@ import com.gmail.nossr50.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.events.fake.FakePlayerFishEvent;
|
||||
import com.gmail.nossr50.events.hardcore.McMMOPlayerDeathPenaltyEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyLevelUpEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyTeleportEvent;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyXpGainEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||
import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent;
|
||||
@ -108,6 +111,34 @@ public class EventUtils {
|
||||
mcMMOPlayer.getPartyTeleportRecord().actualizeLastUse();
|
||||
}
|
||||
|
||||
public static boolean handlePartyXpGainEvent(Party party, float xpGained) {
|
||||
McMMOPartyXpGainEvent event = new McMMOPartyXpGainEvent(party, xpGained);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
boolean isCancelled = event.isCancelled();
|
||||
|
||||
if (!isCancelled) {
|
||||
party.addXp(event.getRawXpGained());
|
||||
}
|
||||
|
||||
return !isCancelled;
|
||||
}
|
||||
|
||||
public static boolean handlePartyLevelChangeEvent(Party party, int levelsChanged, float xpRemoved) {
|
||||
McMMOPartyLevelUpEvent event = new McMMOPartyLevelUpEvent(party, levelsChanged);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
boolean isCancelled = event.isCancelled();
|
||||
|
||||
if (isCancelled) {
|
||||
|
||||
party.setLevel(party.getLevel() + levelsChanged);
|
||||
party.addXp(xpRemoved);
|
||||
}
|
||||
|
||||
return !isCancelled;
|
||||
}
|
||||
|
||||
public static boolean handleXpGainEvent(Player player, SkillType skill, float xpGained) {
|
||||
McMMOPlayerXpGainEvent event = new McMMOPlayerXpGainEvent(player, skill, xpGained);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
Reference in New Issue
Block a user