use of com.gmail.nossr50.datatypes.player.McMMOPlayer in project Foundation by kangarko.
the class ItemsAdderHook method getActivePartyChat.
String getActivePartyChat(final Player player) {
try {
final McMMOPlayer mcplayer = UserManager.getPlayer(player);
if (mcplayer != null) {
final Party party = mcplayer.getParty();
final ChatChannel channelType = mcplayer.getChatChannel();
return channelType == ChatChannel.PARTY || channelType == ChatChannel.PARTY_OFFICER && party != null ? party.getName() : null;
}
} catch (final Throwable throwable) {
if (!errorLogged) {
Common.warning("Failed getting mcMMO party chat for " + player.getName() + " due to error. Returning null." + " Ensure you have the latest mcMMO version, if so, contact plugin authors to update the integration. Error was: " + throwable);
errorLogged = true;
}
}
return null;
}
use of com.gmail.nossr50.datatypes.player.McMMOPlayer in project GDHooks by bloodmc.
the class McMMOProvider method onRuptureDamageEvent.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onRuptureDamageEvent(McMMOEntityDamageByRuptureEvent event) {
final McMMOPlayer mcmmoPlayer = event.getMcMMODamager();
final Player player = mcmmoPlayer.getPlayer();
final World world = player.getWorld();
if (!GriefDefender.getCore().isEnabled(world.getUID())) {
return;
}
final Entity targetEntity = event.getEntity();
final Location location = targetEntity.getLocation();
final PlayerData playerData = GriefDefender.getCore().getPlayerData(world.getUID(), player.getUniqueId());
final Claim claim = GriefDefender.getCore().getClaimAt(location);
final Set<Context> contexts = new HashSet<>();
contexts.add(new Context("mcmmo:damage_amount", String.valueOf(event.getFinalDamage())));
final Tristate result = GriefDefender.getPermissionManager().getActiveFlagPermissionValue(event, location, claim, playerData.getUser(), RUPTURE_DAMAGE, player, targetEntity, contexts, null, true);
if (result == Tristate.FALSE) {
event.setCancelled(true);
}
}
use of com.gmail.nossr50.datatypes.player.McMMOPlayer in project Nexus by ProjectEdenGG.
the class McMMOResetProvider method prestige.
public void prestige(Player player, ResetSkillType skill, boolean broadcast) {
McMMOPlayer mcmmoPlayer = UserManager.getPlayer(player);
int reward = DEPOSIT;
if (mcmmoPlayer.getSkillLevel(PrimarySkillType.valueOf(skill.name())) >= TIER_TWO)
reward *= MAX_DEPOSIT_MULTIPLIER;
skill.onClick(player);
new BankerService().deposit(player, reward, ShopGroup.SURVIVAL, TransactionCause.MCMMO_RESET);
mcmmoPlayer.modifySkill(PrimarySkillType.valueOf(skill.name()), 0);
McMMOPrestige mcMMOPrestige = service.getPrestige(player.getUniqueId().toString());
mcMMOPrestige.prestige(skill.name());
service.save(mcMMOPrestige);
// TODO Koda Broadcast
if (broadcast)
Koda.say(Nickname.of(player) + " has reset their " + skill.name().toLowerCase() + " skill for the " + StringUtils.getNumberWithSuffix(mcMMOPrestige.getPrestige(skill.name())) + " time!");
}
use of com.gmail.nossr50.datatypes.player.McMMOPlayer in project Nexus by ProjectEdenGG.
the class McMMOResetProvider method init.
@Override
public void init() {
McMMOPlayer mcmmoPlayer = UserManager.getPlayer(player);
int totalPowerLevel = 0;
boolean _canPrestigeAll = true;
for (ResetSkillType skill : ResetSkillType.values()) {
int powerLevel = Math.min(TIER_ONE, mcmmoPlayer.getSkillLevel(PrimarySkillType.valueOf(skill.name())));
totalPowerLevel += powerLevel;
if (powerLevel < TIER_ONE)
_canPrestigeAll = false;
}
final boolean canPrestigeAll = _canPrestigeAll;
ItemBuilder all = new ItemBuilder(Material.BEACON).name("&eAll Skills").lore("&3Power Level: &e" + totalPowerLevel + "/" + TIER_ONE_ALL + "", "&3&lReward:", "&f- " + DEPOSIT_PRETTY + " per level " + TIER_ONE + " skill (x" + MAX_DEPOSIT_MULTIPLIER + " if level " + TIER_TWO + ")", "&f- " + DEPOSIT_ALL_PRETTY + " bonus (x" + MAX_DEPOSIT_ALL_MULTIPLIER + " if every skill is level " + TIER_TWO + ")", "&f- All normal rewards", "&f- When your health gets low, this breastplate will give you the strength of an angry barbarian!").glow(mcmmoPlayer.getPowerLevel() >= TIER_ONE_ALL);
ItemStack reset = new ItemBuilder(Material.BARRIER).name("&cReset all with &lno reward").build();
contents.set(0, 4, ClickableItem.of(all, e -> {
if (!canPrestigeAll)
return;
ConfirmationMenu.builder().title("&4Confirm Prestige All?").onConfirm(e2 -> {
player.closeInventory();
prestigeAll(player);
}).open(player);
}));
contents.set(5, 4, ClickableItem.of(reset, e -> ConfirmationMenu.builder().title("&4Confirm Reset All? (No Rewards)").onConfirm(e2 -> {
player.closeInventory();
resetAll(mcmmoPlayer);
}).open(player)));
McMMOPrestige mcMMOPrestige = service.getPrestige(player.getUniqueId().toString());
for (ResetSkillType skill : ResetSkillType.values()) {
ItemBuilder item = new ItemBuilder(skill.getMaterial()).itemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES).name("&e" + StringUtils.camelCase(skill.name())).lore("&3Level: &e" + mcmmoPlayer.getSkillLevel(PrimarySkillType.valueOf(skill.name())), "", "&3&lReward:", "&f" + DEPOSIT_PRETTY + " (x" + MAX_DEPOSIT_MULTIPLIER + " for level " + TIER_TWO + ")", "&f" + skill.getRewardDescription(), "", "&3Number of Prestieges: &e" + mcMMOPrestige.getPrestige(skill.name())).glow(mcmmoPlayer.getSkillLevel(PrimarySkillType.valueOf(skill.name())) >= TIER_ONE);
contents.set(skill.getRow(), skill.getColumn(), ClickableItem.of(item, (e) -> {
if (mcmmoPlayer.getSkillLevel(PrimarySkillType.valueOf(skill.name())) < TIER_ONE)
return;
ConfirmationMenu.builder().title("Confirm Prestige?").onConfirm((e2) -> {
player.closeInventory();
prestige(player, skill, true);
}).open(player);
}));
}
}
use of com.gmail.nossr50.datatypes.player.McMMOPlayer in project TriggerReactor by wysohn.
the class McMmoSupport method removeXp.
/**
* remove 'xp' from target player's 'skillType'
*
* @param player
* @param skillType
* @param xp
*/
public void removeXp(Player player, String skillType, int xp) {
McMMOPlayer mmoPlayer = (McMMOPlayer) player(player.getName());
if (mmoPlayer == null)
throw new RuntimeException("Could not find MCMMO info for player " + player.getName());
SkillType type = SkillType.valueOf(skillType);
mmoPlayer.removeXp(type, xp);
}
Aggregations