mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-13 09:45:27 +02:00
Merge branch 'master' of https://github.com/mcMMO-Dev/mcMMO into tridentsxbows
This commit is contained in:
@@ -71,22 +71,10 @@ public class MmoInfoCommand implements TabExecutor {
|
||||
|
||||
private void displayInfo(Player player, String subSkillName)
|
||||
{
|
||||
//Check to see if the skill exists in the new system
|
||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
|
||||
if(abstractSubSkill != null)
|
||||
{
|
||||
/* New System Skills are programmable */
|
||||
abstractSubSkill.printInfo(player);
|
||||
//TextComponentFactory.sendPlayerUrlHeader(player);
|
||||
} else {
|
||||
/*
|
||||
* Skill is only in the old system
|
||||
*/
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
||||
}
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
||||
|
||||
for(SubSkillType subSkillType : SubSkillType.values())
|
||||
{
|
||||
|
@@ -43,7 +43,7 @@ public class SalvageConfig extends ConfigLoader {
|
||||
if(mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
||||
mcMMO.p.getLogger().info("Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
||||
for(String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
||||
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4);
|
||||
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4); //TODO: Doesn't make sense to default to 4 for everything
|
||||
}
|
||||
|
||||
try {
|
||||
|
@@ -164,7 +164,7 @@ public class FishingTreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
if (dropLevel < 0) {
|
||||
reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
|
||||
reason.add("Fishing Config: " + treasureName + " has an invalid Drop_Level: " + dropLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -3,6 +3,7 @@ package com.gmail.nossr50.config.treasure;
|
||||
import com.gmail.nossr50.config.ConfigLoader;
|
||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.text.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@@ -14,6 +15,7 @@ import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionData;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -21,6 +23,9 @@ import java.util.List;
|
||||
public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
public static final String FILENAME = "treasures.yml";
|
||||
public static final String LEVEL_REQUIREMENT_RETRO_MODE = ".Level_Requirement.Retro_Mode";
|
||||
public static final String LEVEL_REQUIREMENT_STANDARD_MODE = ".Level_Requirement.Standard_Mode";
|
||||
public static final String LEGACY_DROP_LEVEL = ".Drop_Level";
|
||||
private static TreasureConfig instance;
|
||||
|
||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
|
||||
@@ -60,6 +65,7 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
private void loadTreasures(String type) {
|
||||
boolean updatedFile = false;
|
||||
boolean isExcavation = type.equals("Excavation");
|
||||
boolean isHylian = type.equals("Hylian_Luck");
|
||||
|
||||
@@ -103,7 +109,29 @@ public class TreasureConfig extends ConfigLoader {
|
||||
|
||||
int xp = config.getInt(type + "." + treasureName + ".XP");
|
||||
double dropChance = config.getDouble(type + "." + treasureName + ".Drop_Chance");
|
||||
int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level");
|
||||
int legacyDropLevel = config.getInt(type + "." + treasureName + LEGACY_DROP_LEVEL, -1);
|
||||
int dropLevel = -1;
|
||||
|
||||
if(legacyDropLevel >= 0) {
|
||||
//Config needs to be updated to be more specific
|
||||
mcMMO.p.getLogger().info("(" + treasureName + ") Updating Drop_Level in treasures.yml for treasure to match new expected format");
|
||||
config.set(type + "." + treasureName + LEGACY_DROP_LEVEL, null);
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, legacyDropLevel * 10);
|
||||
config.set(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, legacyDropLevel);
|
||||
updatedFile = true;
|
||||
}
|
||||
|
||||
if(mcMMO.isRetroModeEnabled()) {
|
||||
dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_RETRO_MODE, 0);
|
||||
} else {
|
||||
dropLevel = config.getInt(type + "." + treasureName + LEVEL_REQUIREMENT_STANDARD_MODE, 0);
|
||||
}
|
||||
|
||||
if(dropLevel < 0) {
|
||||
mcMMO.p.getLogger().info("Treasure drop level wasn't valid, using a default value.");
|
||||
//Set it to the "max" if we don't have a drop level
|
||||
dropLevel = 0;
|
||||
}
|
||||
|
||||
if (xp < 0) {
|
||||
reason.add(treasureName + " has an invalid XP value: " + xp);
|
||||
@@ -113,9 +141,6 @@ public class TreasureConfig extends ConfigLoader {
|
||||
reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance);
|
||||
}
|
||||
|
||||
if (dropLevel < 0) {
|
||||
reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
|
||||
}
|
||||
|
||||
/*
|
||||
* Itemstack
|
||||
@@ -219,6 +244,15 @@ public class TreasureConfig extends ConfigLoader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Apply our fix
|
||||
if(updatedFile) {
|
||||
try {
|
||||
config.save(getFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||
|
@@ -12,7 +12,6 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.experience.MMOExperienceBarManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
@@ -80,6 +80,8 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
|
||||
private final @NotNull SuperSkillManagerImpl superSkillManagerImpl;
|
||||
private final @NotNull AbilityActivationProcessor abilityActivationProcessor;
|
||||
|
||||
private PrimarySkillType lastSkillShownScoreboard = PrimarySkillType.values()[0];
|
||||
|
||||
/**
|
||||
* Create a new {@link OnlineMMOPlayer} with default values for a {@link Player}
|
||||
* @param player target player
|
||||
@@ -176,6 +178,14 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
|
||||
}
|
||||
}
|
||||
|
||||
public @NotNull PrimarySkillType getLastSkillShownScoreboard() {
|
||||
return lastSkillShownScoreboard;
|
||||
}
|
||||
|
||||
public void setLastSkillShownScoreboard(PrimarySkillType primarySkillType) {
|
||||
this.lastSkillShownScoreboard = primarySkillType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the last login to the current system time
|
||||
*/
|
||||
|
@@ -3,6 +3,9 @@ package com.gmail.nossr50.datatypes.skills.subskills.acrobatics;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@@ -80,6 +83,9 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
entityDamageEvent.setCancelled(true);
|
||||
return true;
|
||||
}
|
||||
} else if(Permissions.skillEnabled(player, PrimarySkillType.ACROBATICS)) {
|
||||
//Give XP Anyways
|
||||
SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, ((EntityDamageEvent) event).getFinalDamage(), false), XPGainReason.PVE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,31 +373,34 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
MaxBonusLevel: 100
|
||||
DamageThreshold: 7.0
|
||||
*/
|
||||
double rollChanceHalfMax, graceChanceHalfMax, damageThreshold, chancePerLevel;
|
||||
|
||||
//Chance to roll at half max skill
|
||||
RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(null, subSkillType);
|
||||
int halfMaxSkillValue = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL)/2;
|
||||
rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue);
|
||||
|
||||
//Chance to graceful roll at full skill
|
||||
RandomChanceSkill rollGraceHalfMaxSkill = new RandomChanceSkill(null, subSkillType);
|
||||
rollGraceHalfMaxSkill.setSkillLevel(halfMaxSkillValue * 2); //Double the effective odds
|
||||
|
||||
//Chance to roll per level
|
||||
RandomChanceSkill rollOneSkillLevel = new RandomChanceSkill(null, subSkillType);
|
||||
rollGraceHalfMaxSkill.setSkillLevel(1); //Level 1 skill
|
||||
|
||||
//Chance Stat Calculations
|
||||
rollChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollHalfMaxSkill);
|
||||
graceChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollGraceHalfMaxSkill);
|
||||
damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||
|
||||
chancePerLevel = RandomChanceUtil.getRandomChanceExecutionChance(rollOneSkillLevel);
|
||||
|
||||
double maxLevel = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
return LocaleLoader.getString("Acrobatics.SubSkill.Roll.Mechanics", rollChanceHalfMax, graceChanceHalfMax, maxLevel, chancePerLevel, damageThreshold, damageThreshold * 2,halfMaxSkillValue);
|
||||
return "Under Construction: This will work in a future update.";
|
||||
//
|
||||
// double rollChanceHalfMax, graceChanceHalfMax, damageThreshold, chancePerLevel;
|
||||
//
|
||||
// //Chance to roll at half max skill
|
||||
// RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(null, subSkillType);
|
||||
// int halfMaxSkillValue = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL)/2;
|
||||
// rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue);
|
||||
//
|
||||
// //Chance to graceful roll at full skill
|
||||
// RandomChanceSkill rollGraceHalfMaxSkill = new RandomChanceSkill(null, subSkillType);
|
||||
// rollGraceHalfMaxSkill.setSkillLevel(halfMaxSkillValue * 2); //Double the effective odds
|
||||
//
|
||||
// //Chance to roll per level
|
||||
// RandomChanceSkill rollOneSkillLevel = new RandomChanceSkill(null, subSkillType);
|
||||
// rollGraceHalfMaxSkill.setSkillLevel(1); //Level 1 skill
|
||||
//
|
||||
// //Chance Stat Calculations
|
||||
// rollChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollHalfMaxSkill);
|
||||
// graceChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollGraceHalfMaxSkill);
|
||||
// damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||
//
|
||||
// chancePerLevel = RandomChanceUtil.getRandomChanceExecutionChance(rollOneSkillLevel);
|
||||
//
|
||||
// double maxLevel = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL);
|
||||
//
|
||||
// return LocaleLoader.getString("Acrobatics.SubSkill.Roll.Mechanics", rollChanceHalfMax, graceChanceHalfMax, maxLevel, chancePerLevel, damageThreshold, damageThreshold * 2,halfMaxSkillValue);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.datatypes.treasure;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public abstract class Treasure {
|
||||
@@ -41,10 +40,6 @@ public abstract class Treasure {
|
||||
}
|
||||
|
||||
public int getDropLevel() {
|
||||
//If they are in retro mode all requirements are scaled up by 10
|
||||
if(Config.getInstance().getIsRetroMode())
|
||||
return dropLevel * 10;
|
||||
|
||||
return dropLevel;
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,6 @@ import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -68,6 +67,30 @@ public class EntityListener implements Listener {
|
||||
persistentDataLayer = mcMMO.getCompatibilityManager().getPersistentDataLayer();
|
||||
}
|
||||
|
||||
// @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
// public void onBlockDropItemEvent(EntityDropItemEvent event) {
|
||||
// if(event.getEntity() instanceof Block) {
|
||||
// Block itemDispensingBlock = (Block) event.getEntity();
|
||||
//
|
||||
// //Is it a berry bush?
|
||||
// if(itemDispensingBlock.getType().toString().equalsIgnoreCase("sweet_berry_bush")) {
|
||||
// //Berry Bush Time!
|
||||
// if (event.getEntity().getMetadata(mcMMO.BONUS_DROPS_METAKEY).size() > 0) {
|
||||
// Bukkit.broadcastMessage("Pop pop!");
|
||||
// BonusDropMeta bonusDropMeta = (BonusDropMeta) event.getEntity().getMetadata(mcMMO.BONUS_DROPS_METAKEY).get(0);
|
||||
// int bonusCount = bonusDropMeta.asInt();
|
||||
//
|
||||
// for (int i = 0; i < bonusCount; i++) {
|
||||
// Misc.spawnItemNaturally(event.getEntity().getLocation(), event.getItemDrop().getItemStack(), ItemSpawnReason.BONUS_DROPS);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(event.getEntity().hasMetadata(mcMMO.BONUS_DROPS_METAKEY))
|
||||
// event.getEntity().removeMetadata(mcMMO.BONUS_DROPS_METAKEY, pluginRef);
|
||||
// }
|
||||
// }
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEntityTransform(EntityTransformEvent event) {
|
||||
if(event.getEntity() instanceof LivingEntity) {
|
||||
|
@@ -195,6 +195,7 @@ public class PlayerListener implements Listener {
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerWorldChange(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
@@ -204,19 +205,15 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.queryPlayer(player) == null)
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mmoPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
mmoPlayer.validateGodMode();
|
||||
mmoPlayer.validateParty();
|
||||
mcMMOPlayer.checkGodMode();
|
||||
mcMMOPlayer.checkParty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -781,7 +778,134 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
mmoPlayer.getAbilityActivationProcessor().processAbilityAndToolActivations(playerInteractEvent);
|
||||
switch (event.getAction()) {
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
|
||||
//Hmm
|
||||
if(event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
BlockState blockState = block.getState();
|
||||
|
||||
/* ACTIVATION & ITEM CHECKS */
|
||||
if (BlockUtils.canActivateTools(blockState)) {
|
||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
||||
if (BlockUtils.canActivateHerbalism(blockState)) {
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
}
|
||||
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
ChimaeraWing.activationCheck(player);
|
||||
}
|
||||
|
||||
/* GREEN THUMB CHECK */
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
if (heldItem.getType() == Material.BONE_MEAL) {
|
||||
switch (blockState.getType()) {
|
||||
case BEETROOTS:
|
||||
case CARROT:
|
||||
case COCOA:
|
||||
case WHEAT:
|
||||
case NETHER_WART_BLOCK:
|
||||
case POTATO:
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat
|
||||
if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
|
||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
||||
//call event for Green Thumb Block
|
||||
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {
|
||||
Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||
player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1);
|
||||
player.updateInventory();
|
||||
if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* SHROOM THUMB CHECK */
|
||||
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
||||
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) {
|
||||
Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||
event.setCancelled(true);
|
||||
if (herbalismManager.processShroomThumb(blockState)
|
||||
&& EventUtils.simulateBlockBreak(block, player, false)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
herbalismManager.processBerryBushHarvesting(blockState);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RIGHT_CLICK_AIR:
|
||||
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* ACTIVATION CHECKS */
|
||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED);
|
||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
/* ITEM CHECKS */
|
||||
ChimaeraWing.activationCheck(player);
|
||||
|
||||
/* BLAST MINING CHECK */
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
if (miningManager.canDetonate()) {
|
||||
miningManager.remoteDetonation();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LEFT_CLICK_AIR:
|
||||
case LEFT_CLICK_BLOCK:
|
||||
|
||||
if (!player.isSneaking()) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* CALL OF THE WILD CHECKS */
|
||||
Material type = heldItem.getType();
|
||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||
|
||||
if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) {
|
||||
tamingManager.summonWolf();
|
||||
}
|
||||
else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
|
||||
tamingManager.summonOcelot();
|
||||
}
|
||||
else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
|
||||
tamingManager.summonHorse();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -163,6 +163,9 @@ public class mcMMO extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
try {
|
||||
//Store this value so other plugins can check it
|
||||
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
|
||||
|
||||
//Platform Manager
|
||||
platformManager = new PlatformManager();
|
||||
|
||||
@@ -190,9 +193,6 @@ public class mcMMO extends JavaPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
//Store this value so other plugins can check it
|
||||
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
|
||||
|
||||
if(projectKorraEnabled) {
|
||||
getLogger().info("ProjectKorra was detected, this can cause some issues with weakness potions and combat skills for mcMMO");
|
||||
}
|
||||
@@ -268,12 +268,6 @@ public class mcMMO extends JavaPlugin {
|
||||
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
||||
}
|
||||
|
||||
//Can't confirm this bug myself as the plugin is premium
|
||||
// //TODO: Remove this when ChatControlRed fixes itself
|
||||
// if(pluginManager.getPlugin("ChatControlRed") != null) {
|
||||
// getLogger().severe("mcMMO has detected ChatControlRed on your server, users have reported a severe plugin conflict between these two plugins which degrades server performance and wastes many server resources.");
|
||||
// getLogger().severe("It is HIGHLY RECOMMENDED that you do --NOT-- use ChatControlRed until this issue is resolved!");
|
||||
// }
|
||||
if(pluginManager.getPlugin(ULTRA_PERMISSONS) != null) {
|
||||
Bukkit.getScheduler().runTaskTimer(this, () -> {
|
||||
getLogger().severe(UP_WARNING_1);
|
||||
@@ -286,6 +280,7 @@ public class mcMMO extends JavaPlugin {
|
||||
}, 0L, 1200L);
|
||||
}
|
||||
}
|
||||
|
||||
catch (Throwable t) {
|
||||
getLogger().severe("There was an error while enabling mcMMO!");
|
||||
|
||||
|
@@ -38,6 +38,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -60,6 +61,10 @@ public class HerbalismManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseShroomThumb(BlockState blockState) {
|
||||
if(!BlockUtils.canMakeShroomy(blockState)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.HERBALISM_SHROOM_THUMB))
|
||||
return false;
|
||||
|
||||
@@ -67,7 +72,57 @@ public class HerbalismManager extends SkillManager {
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
Material itemType = inventory.getItemInMainHand().getType();
|
||||
|
||||
return (itemType == Material.BROWN_MUSHROOM || itemType == Material.RED_MUSHROOM) && inventory.contains(Material.BROWN_MUSHROOM, 1) && inventory.contains(Material.RED_MUSHROOM, 1) && BlockUtils.canMakeShroomy(blockState) && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
return (itemType == Material.BROWN_MUSHROOM
|
||||
|| itemType == Material.RED_MUSHROOM)
|
||||
&& inventory.contains(Material.BROWN_MUSHROOM, 1)
|
||||
&& inventory.contains(Material.RED_MUSHROOM, 1)
|
||||
&& Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
public void processBerryBushHarvesting(@NotNull BlockState blockState) {
|
||||
/* Check if the player is harvesting a berry bush */
|
||||
if(blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) {
|
||||
if(mmoPlayer.isDebugMode()) {
|
||||
mmoPlayer.getPlayer().sendMessage("Processing sweet berry bush rewards");
|
||||
}
|
||||
//Check the age
|
||||
if(blockState.getBlockData() instanceof Ageable) {
|
||||
int rewardByAge = 0;
|
||||
|
||||
Ageable ageable = (Ageable) blockState.getBlockData();
|
||||
|
||||
if(ageable.getAge() == 2) {
|
||||
rewardByAge = 1; //Normal XP
|
||||
} else if(ageable.getAge() == 3) {
|
||||
rewardByAge = 2; //Double XP
|
||||
} else {
|
||||
return; //Not old enough, back out of processing
|
||||
}
|
||||
|
||||
if(mmoPlayer.isDebugMode()) {
|
||||
mmoPlayer.getPlayer().sendMessage("Bush Reward Multiplier: " + rewardByAge);
|
||||
}
|
||||
|
||||
int xpReward = ExperienceConfig.getInstance().getXp(PrimarySkillType.HERBALISM, blockState) * rewardByAge;
|
||||
|
||||
if(mmoPlayer.isDebugMode()) {
|
||||
mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward);
|
||||
}
|
||||
|
||||
// //Check for double drops
|
||||
// if(checkDoubleDrop(blockState)) {
|
||||
//
|
||||
// if(mmoPlayer.isDebugMode()) {
|
||||
// mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush");
|
||||
// }
|
||||
//
|
||||
// //Add metadata to mark this block for double or triple drops
|
||||
// markForBonusDrops(blockState);
|
||||
// }
|
||||
|
||||
applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canUseHylianLuck() {
|
||||
|
@@ -28,6 +28,7 @@ import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -248,13 +249,18 @@ public class TamingManager extends SkillManager {
|
||||
|
||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));
|
||||
|
||||
if (beast instanceof Horse) {
|
||||
Horse horse = (Horse) beast;
|
||||
double jumpStrength = horse.getAttribute(Attribute.HORSE_JUMP_STRENGTH).getValue();
|
||||
// Taken from https://minecraft.gamepedia.com/Horse#Jump_strength
|
||||
jumpStrength = -0.1817584952 * Math.pow(jumpStrength, 3) + 3.689713992 * Math.pow(jumpStrength, 2) + 2.128599134 * jumpStrength - 0.343930367;
|
||||
message = message.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseSpeed", horse.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getValue() * 43))
|
||||
.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseJumpStrength", jumpStrength));
|
||||
// Bred mules & donkeys can actually have horse-like stats, but llamas cannot.
|
||||
if (beast instanceof AbstractHorse && !(beast instanceof Llama)) {
|
||||
AbstractHorse horseLikeCreature = (AbstractHorse) beast;
|
||||
AttributeInstance jumpAttribute = horseLikeCreature.getAttribute(Attribute.HORSE_JUMP_STRENGTH);
|
||||
|
||||
if(jumpAttribute != null) {
|
||||
double jumpStrength = jumpAttribute.getValue();
|
||||
// Taken from https://minecraft.gamepedia.com/Horse#Jump_strength
|
||||
jumpStrength = -0.1817584952 * Math.pow(jumpStrength, 3) + 3.689713992 * Math.pow(jumpStrength, 2) + 2.128599134 * jumpStrength - 0.343930367;
|
||||
message = message.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseSpeed", horseLikeCreature.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getValue() * 43))
|
||||
.concat("\n" + LocaleLoader.getString("Combat.BeastLoreHorseJumpStrength", jumpStrength));
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(message);
|
||||
|
@@ -1265,6 +1265,7 @@ public class MaterialMapStore {
|
||||
toolBlackList.add("stonecutter");
|
||||
toolBlackList.add("lodestone");
|
||||
toolBlackList.add("respawn_anchor");
|
||||
toolBlackList.add("sweet_berry_bush");
|
||||
}
|
||||
|
||||
public boolean isIntendedToolPickaxe(Material material) {
|
||||
|
@@ -120,16 +120,39 @@ public final class Permissions {
|
||||
public static boolean lucky(Permissible permissible, PrimarySkillType primarySkillType) { return permissible.hasPermission("mcmmo.perks.lucky." + primarySkillType.getRawSkillName().toLowerCase(Locale.ENGLISH)); }
|
||||
|
||||
/* XP PERKS */
|
||||
public static boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean tripleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean doubleXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH)); }
|
||||
public static boolean quadrupleXp(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.quadruple.all")
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.quadruple." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static boolean tripleXp(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.triple.all")
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.triple." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static boolean doubleAndOneHalfXp(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.150percentboost.all")
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.150percentboost." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static boolean doubleXp(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.double.all")
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.double." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static boolean oneAndOneHalfXp(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.50percentboost.all")
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.50percentboost." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static boolean oneAndOneTenthXp(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.10percentboost.all")
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.10percentboost." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
public static boolean customXpBoost(Permissible permissible, PrimarySkillType skill) {
|
||||
return permissible.hasPermission("mcmmo.perks.xp.customboost.all")
|
||||
||permissible.hasPermission("mcmmo.perks.xp.customboost." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
|| permissible.hasPermission("mcmmo.perks.xp.customboost." + skill.toString().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -284,6 +284,9 @@ public class ScoreboardManager {
|
||||
// **** Setup methods **** //
|
||||
|
||||
public static void enablePlayerSkillScoreboard(Player player, PrimarySkillType skill) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
mmoPlayer.setLastSkillShownScoreboard(skill);
|
||||
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
@@ -299,6 +302,25 @@ public class ScoreboardManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void retryLastSkillBoard(Player player) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
PrimarySkillType primarySkillType = mmoPlayer.getLastSkillShownScoreboard();
|
||||
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
if(wrapper == null) {
|
||||
setupPlayer(player);
|
||||
wrapper = getWrapper(player);
|
||||
}
|
||||
|
||||
if(wrapper != null) {
|
||||
wrapper.setOldScoreboard();
|
||||
wrapper.setTypeSkill(primarySkillType);
|
||||
|
||||
changeScoreboard(wrapper, Config.getInstance().getSkillScoreboardTime());
|
||||
}
|
||||
}
|
||||
|
||||
public static void enablePlayerSkillLevelUpScoreboard(Player player, PrimarySkillType skill) {
|
||||
ScoreboardWrapper wrapper = getWrapper(player);
|
||||
|
||||
@@ -527,8 +549,7 @@ public class ScoreboardManager {
|
||||
return mcMMO.p.getServer().getScoreboardManager();
|
||||
}
|
||||
|
||||
|
||||
private static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
|
||||
public static void changeScoreboard(ScoreboardWrapper wrapper, int displayTime) {
|
||||
if (displayTime == -1) {
|
||||
wrapper.showBoardWithNoRevert();
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.gmail.nossr50.util.scoreboards;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||
@@ -13,9 +14,11 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager.SidebarType;
|
||||
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -42,7 +45,7 @@ public class ScoreboardWrapper {
|
||||
// Internal usage variables (should exist)
|
||||
private SidebarType sidebarType;
|
||||
private Objective sidebarObjective;
|
||||
private final Objective powerObjective;
|
||||
private Objective powerObjective;
|
||||
|
||||
// Parameter variables (May be null / invalid)
|
||||
private Scoreboard oldBoard = null;
|
||||
@@ -50,21 +53,34 @@ public class ScoreboardWrapper {
|
||||
public PrimarySkillType targetSkill = null;
|
||||
private PlayerProfile targetProfile = null;
|
||||
public int leaderboardPage = -1;
|
||||
private boolean registered = false;
|
||||
|
||||
public ScoreboardWrapper(Player player, Scoreboard scoreboard) {
|
||||
this.player = player;
|
||||
this.playerName = player.getName();
|
||||
this.scoreboard = scoreboard;
|
||||
initBoard();
|
||||
}
|
||||
|
||||
private void initBoard() {
|
||||
sidebarType = SidebarType.NONE;
|
||||
sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy", SIDE_OBJECTIVE);
|
||||
powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy", POWER_OBJECTIVE);
|
||||
if(registered) {
|
||||
//Make sure our references are pointed at the right things
|
||||
sidebarObjective = scoreboard.getObjective(ScoreboardManager.SIDEBAR_OBJECTIVE);
|
||||
powerObjective = scoreboard.getObjective(ScoreboardManager.POWER_OBJECTIVE);
|
||||
} else {
|
||||
//Register Objectives
|
||||
sidebarObjective = this.scoreboard.registerNewObjective(ScoreboardManager.SIDEBAR_OBJECTIVE, "dummy", SIDE_OBJECTIVE);
|
||||
powerObjective = this.scoreboard.registerNewObjective(ScoreboardManager.POWER_OBJECTIVE, "dummy", POWER_OBJECTIVE);
|
||||
registered = true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getPowerLevelTagsEnabled()) {
|
||||
powerObjective.setDisplayName(ScoreboardManager.TAG_POWER_LEVEL);
|
||||
powerObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
|
||||
for (OnlineMMOPlayer mmoPlayer : UserManager.getPlayers()) {
|
||||
powerObjective.getScore(mmoPlayer.getPlayerName()).setScore(mmoPlayer.getExperienceHandler().getPowerLevel());
|
||||
for (McMMOPlayer mcMMOPlayer : UserManager.getPlayers()) {
|
||||
powerObjective.getScore(mcMMOPlayer.getProfile().getPlayerName()).setScore(mcMMOPlayer.getPowerLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,7 +223,7 @@ public class ScoreboardWrapper {
|
||||
if(UserManager.getPlayer(playerName) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile profile = UserManager.queryPlayer(player);
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
|
||||
if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) {
|
||||
return;
|
||||
@@ -244,7 +260,7 @@ public class ScoreboardWrapper {
|
||||
oldBoard = null;
|
||||
}
|
||||
else {
|
||||
mcMMO.p.getLogger().info("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
||||
mcMMO.p.debug("Not reverting targetBoard for " + playerName + " - targetBoard was changed by another plugin (Consider disabling the mcMMO scoreboards if you don't want them!)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,7 +414,19 @@ public class ScoreboardWrapper {
|
||||
//Unregister objective
|
||||
McMMOScoreboardObjectiveEvent unregisterEvent = callObjectiveEvent(ScoreboardObjectiveEventReason.UNREGISTER_THIS_OBJECTIVE);
|
||||
if(!unregisterEvent.isCancelled()) {
|
||||
sidebarObjective.unregister();
|
||||
try {
|
||||
sidebarObjective.unregister();
|
||||
} catch (IllegalStateException e) {
|
||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||
|
||||
mcMMO.p.debug("Recovering scoreboard for player: " + player.getName());
|
||||
|
||||
if(mmoPlayer.isDebugMode())
|
||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(player, "Scoreboard.Recovery");
|
||||
|
||||
initBoard(); //Start over
|
||||
Bukkit.getScheduler().runTaskLater(mcMMO.p, () -> ScoreboardManager.retryLastSkillBoard(player), 0);
|
||||
}
|
||||
}
|
||||
|
||||
//Register objective
|
||||
@@ -427,14 +455,16 @@ public class ScoreboardWrapper {
|
||||
* Load new values into the sidebar.
|
||||
*/
|
||||
private void updateSidebar() {
|
||||
try {
|
||||
updateTask.cancel();
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if(updateTask != null) {
|
||||
try {
|
||||
updateTask.cancel();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
updateTask = null;
|
||||
}
|
||||
|
||||
updateTask = null;
|
||||
|
||||
if (sidebarType == SidebarType.NONE) {
|
||||
return;
|
||||
@@ -447,9 +477,9 @@ public class ScoreboardWrapper {
|
||||
return;
|
||||
}
|
||||
|
||||
OnlineMMOPlayer mmoPlayer = UserManager.queryPlayer(player);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mmoPlayer == null)
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
switch (sidebarType) {
|
||||
@@ -460,28 +490,28 @@ public class ScoreboardWrapper {
|
||||
Validate.notNull(targetSkill);
|
||||
|
||||
if (!targetSkill.isChildSkill()) {
|
||||
int currentXP = mmoPlayer.getExperienceHandler().getSkillXpValue(targetSkill);
|
||||
int currentXP = mcMMOPlayer.getSkillXpLevel(targetSkill);
|
||||
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_CURRENT_XP).setScore(currentXP);
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mmoPlayer.getExperienceHandler().getExperienceToNextLevel(targetSkill) - currentXP);
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_REMAINING_XP).setScore(mcMMOPlayer.getXpToLevel(targetSkill) - currentXP);
|
||||
}
|
||||
else {
|
||||
for (PrimarySkillType parentSkill : FamilyTree.getParents(targetSkill)) {
|
||||
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mmoPlayer.getExperienceHandler().getSkillLevel(parentSkill));
|
||||
sidebarObjective.getScore(ScoreboardManager.skillLabels.get(parentSkill)).setScore(mcMMOPlayer.getSkillLevel(parentSkill));
|
||||
}
|
||||
}
|
||||
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mmoPlayer.getExperienceHandler().getSkillLevel(targetSkill));
|
||||
sidebarObjective.getScore(ScoreboardManager.LABEL_LEVEL).setScore(mcMMOPlayer.getSkillLevel(targetSkill));
|
||||
|
||||
if (targetSkill.getSuperAbilityType() != null) {
|
||||
if (targetSkill.getAbility() != null) {
|
||||
boolean stopUpdating;
|
||||
|
||||
if (targetSkill == PrimarySkillType.MINING) {
|
||||
// Special-Case: Mining has two abilities, both with cooldowns
|
||||
Score cooldownSB = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(SuperAbilityType.SUPER_BREAKER));
|
||||
Score cooldownBM = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(SuperAbilityType.BLAST_MINING));
|
||||
int secondsSB = Math.max(mmoPlayer.getCooldownSeconds(SuperAbilityType.SUPER_BREAKER), 0);
|
||||
int secondsBM = Math.max(mmoPlayer.getCooldownSeconds(SuperAbilityType.BLAST_MINING), 0);
|
||||
int secondsSB = Math.max(mcMMOPlayer.calculateTimeRemaining(SuperAbilityType.SUPER_BREAKER), 0);
|
||||
int secondsBM = Math.max(mcMMOPlayer.calculateTimeRemaining(SuperAbilityType.BLAST_MINING), 0);
|
||||
|
||||
cooldownSB.setScore(secondsSB);
|
||||
cooldownBM.setScore(secondsBM);
|
||||
@@ -489,9 +519,9 @@ public class ScoreboardWrapper {
|
||||
stopUpdating = (secondsSB == 0 && secondsBM == 0);
|
||||
}
|
||||
else {
|
||||
SuperAbilityType ability = targetSkill.getSuperAbilityType();
|
||||
SuperAbilityType ability = targetSkill.getAbility();
|
||||
Score cooldown = sidebarObjective.getScore(ScoreboardManager.abilityLabelsSkill.get(ability));
|
||||
int seconds = Math.max(mmoPlayer.getCooldownSeconds(ability), 0);
|
||||
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
|
||||
|
||||
cooldown.setScore(seconds);
|
||||
|
||||
@@ -511,7 +541,7 @@ public class ScoreboardWrapper {
|
||||
boolean anyCooldownsActive = false;
|
||||
|
||||
for (SuperAbilityType ability : SuperAbilityType.values()) {
|
||||
int seconds = Math.max(mmoPlayer.getCooldownSeconds(ability), 0);
|
||||
int seconds = Math.max(mcMMOPlayer.calculateTimeRemaining(ability), 0);
|
||||
|
||||
if (seconds != 0) {
|
||||
anyCooldownsActive = true;
|
||||
@@ -536,16 +566,16 @@ public class ScoreboardWrapper {
|
||||
newProfile = targetProfile; // offline
|
||||
}
|
||||
else if (targetPlayer == null) {
|
||||
newProfile = mmoPlayer; // self
|
||||
newProfile = mcMMOPlayer.getProfile(); // self
|
||||
}
|
||||
else {
|
||||
newProfile = UserManager.getPlayer(targetPlayer); // online
|
||||
newProfile = UserManager.getPlayer(targetPlayer).getProfile(); // online
|
||||
}
|
||||
|
||||
// Calculate power level here
|
||||
int powerLevel = 0;
|
||||
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) { // Don't include child skills, makes the list too long
|
||||
int level = newProfile.getExperienceHandler().getSkillLevel(skill);
|
||||
int level = newProfile.getSkillLevel(skill);
|
||||
|
||||
powerLevel += level;
|
||||
|
||||
@@ -562,10 +592,10 @@ public class ScoreboardWrapper {
|
||||
|
||||
case RANK_BOARD:
|
||||
case TOP_BOARD:
|
||||
/*
|
||||
* @see #acceptRankData(Map<PrimarySkillType, Integer> rank)
|
||||
* @see #acceptLeaderboardData(List<PlayerStat> stats)
|
||||
*/
|
||||
/*
|
||||
* @see #acceptRankData(Map<PrimarySkillType, Integer> rank)
|
||||
* @see #acceptLeaderboardData(List<PlayerStat> stats)
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user