Merge branch 'master' into configurable

This commit is contained in:
Shane Freeder 2020-01-16 04:49:58 +00:00
commit 40802e6bae
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
17 changed files with 153 additions and 22 deletions

11
1 Normal file
View File

@ -0,0 +1,11 @@
SkillShot tweaks
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# modified: src/main/java/com/gmail/nossr50/skills/archery/Archery.java
# modified: src/main/java/com/gmail/nossr50/util/skills/CombatUtils.java
#

View File

@ -200,6 +200,34 @@ Version 2.2.0
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
Added API method to check if a skill was being level capped
Added 'UndefinedSkillBehaviour' for trying to use a method that has no behaviour defined for the provided skill
Version 2.1.112
Correct locale usage for enum access, now enforces using the english locale to prevent issues with oddball locales for configs/commands
Fixed a NPE that can occur if a player engages in combat with specific skills before their profile is loaded
mcMMO is now more compatible with certain mob stacking plugins
Improved behaviour for mob health bars
Archery's Skill Shot bonus damage is now multiplicative instead of additive (nerfing early game skill shot ranks)
Sweet Berry Bush's default Herbalism XP is now 50 instead of 300 (Update your experience.yml or delete it to generate a new one)
Version 2.1.111
mcMMO is compatible with the following versions of MC: 1.15 / 1.14.4 / 1.14.3 / 1.14.2 / 1.14.1 / 1.14 / 1.13.2
Further prevent nesting of bleed damage calls
Warn about reparable/salvage configs with missing sections
Added Bee combat experience modifier to experience.yml (Update your experience.yml file, see notes)
Breaking a Bee Nest will result in Herbalism XP (Update your experience.yml file, see notes)
Breeding bees will now result in Taming XP (Update your experience.yml file, see notes)
NOTES:
You will need to update your experience.yml by hand or delete it to get XP from new things in 1.15
The default version of mcMMO's experience.yml looks like this: https://paste.gg/p/anonymous/15c34df6e60d45d9a3508b379a5e6514
You'll want to add Bee to combat XP section, and Bee_Nest to Herbalism XP, and Bee to Taming XP section.
Version 2.1.110
Fixed a dupe bug
Actually fixed Block Cracker
You can now crack Infested Stone Bricks with Block Cracker
Added Lithuanian locale (thanks Vyciokazz)
Version 2.1.109
Block Cracker will now correctly crack stone_bricks during Berserk again
Added Lily_Of_The_Valley to the Bonus Drops list in config.yml (you'll probably want to add this manually) which enables it to double drop

View File

@ -11,6 +11,8 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.Locale;
public class PartyItemShareCommand implements CommandExecutor {
private final mcMMO pluginRef;
@ -35,7 +37,7 @@ public class PartyItemShareCommand implements CommandExecutor {
switch (args.length) {
case 2:
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase());
ShareMode mode = ShareMode.getShareMode(args[1].toUpperCase(Locale.ENGLISH));
if (mode == null) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<NONE | EQUAL | RANDOM>"));
@ -58,7 +60,7 @@ public class PartyItemShareCommand implements CommandExecutor {
}
try {
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle);
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase(Locale.ENGLISH)), toggle);
} catch (IllegalArgumentException ex) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
}

View File

@ -7,6 +7,8 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.google.common.collect.ImmutableList;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -159,6 +161,22 @@ public class PtpCommand implements TabExecutor {
McMMOPlayer mcMMOTarget = pluginRef.getUserManager().getPlayer(targetName);
Player target = mcMMOTarget.getPlayer();
if (pluginRef.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
World targetWorld = target.getWorld();
World playerWorld = player.getWorld();
if (!pluginRef.getPermissionTools().partyTeleportAllWorlds(player)) {
if (!pluginRef.getPermissionTools().partyTeleportWorld(target, targetWorld)) {
player.sendMessage(pluginRef.getLocaleManager().formatString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return;
}
else if (targetWorld != playerWorld && !pluginRef.getPermissionTools().partyTeleportWorld(player, targetWorld)) {
player.sendMessage(pluginRef.getLocaleManager().formatString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return;
}
}
}
PartyTeleportRecord ptpRecord = mcMMOTarget.getPartyTeleportRecord();
if (!ptpRecord.isConfirmRequired()) {

View File

@ -2,6 +2,8 @@ package com.gmail.nossr50.config;
import com.gmail.nossr50.util.StringUtils;
import java.util.Locale;
public final class HOCONUtil {
public static String serializeENUMName(String hyphenedString) {
@ -24,7 +26,7 @@ public final class HOCONUtil {
for (int x = 0; x < split.length; x++) {
if (x + 1 >= split.length)
formattedString.append(split[x].toUpperCase());
formattedString.append(split[x].toUpperCase(Locale.ENGLISH));
else
formattedString.append(split[x]).append('_');
}

View File

@ -15,7 +15,7 @@ public class ConfigExperienceCombat {
static {
COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();
// TODO: namespace
COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0);
@ -74,6 +74,7 @@ public class ConfigExperienceCombat {
COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0);
COMBAT_EXPERIENCE_DEFAULT.put("wandering_trader", 1.0);
COMBAT_EXPERIENCE_DEFAULT.put("bee", 1.5);
//SPECIAL
SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>();

View File

@ -84,8 +84,9 @@ public class ConfigExperienceHerbalism {
HERBALISM_EXPERIENCE_DEFAULT.put("minecraft:dead_bush", 30);
/* MISC */
HERBALISM_EXPERIENCE_DEFAULT.put("minecraft:bee_nest", 200);
HERBALISM_EXPERIENCE_DEFAULT.put("minecraft:lily_pad", 100);
HERBALISM_EXPERIENCE_DEFAULT.put("minecraft:sweet_berry_bush", 300);
HERBALISM_EXPERIENCE_DEFAULT.put("minecraft:sweet_berry_bush", 50);
/* MUSHROOMS */
HERBALISM_EXPERIENCE_DEFAULT.put("minecraft:red_mushroom", 150);

View File

@ -12,7 +12,7 @@ public class ConfigExperienceTaming {
static {
TAMING_EXPERIENCE_DEFAULT = new HashMap<>();
// TODO: namespace
TAMING_EXPERIENCE_DEFAULT.put("wolf", 250);
TAMING_EXPERIENCE_DEFAULT.put("ocelot", 500);
TAMING_EXPERIENCE_DEFAULT.put("cat", 500);
@ -25,6 +25,7 @@ public class ConfigExperienceTaming {
TAMING_EXPERIENCE_DEFAULT.put("parrot", 1100);
TAMING_EXPERIENCE_DEFAULT.put("fox", 1000);
TAMING_EXPERIENCE_DEFAULT.put("panda", 1000);
TAMING_EXPERIENCE_DEFAULT.put("bee", 100);
}
@Setting(value = "Taming-XP-Values")

View File

@ -48,11 +48,11 @@ public class ArcheryBehaviour {
public double getSkillShotBonusDamage(Player player, double oldDamage) {
double damageBonusPercent = getSkillShotDamageBonusPercent(player);
double newDamage = oldDamage + (oldDamage * damageBonusPercent);
return Math.min(newDamage, getSkillShotDamageCap());
return Math.min(newDamage, (oldDamage + getSkillShotDamageCap()));
}
public double getSkillShotDamageBonusPercent(Player player) {
return ((pluginRef.getRankTools().getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D;
return ((pluginRef.getRankTools().getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * (pluginRef.getConfigManager().getConfigArchery().getSkillShotDamageMultiplier()) / 100.0D);
}
public double getSkillShotDamageCap() {

View File

@ -551,7 +551,7 @@ public class BlockListener implements Listener {
if (mcMMOPlayer.getHerbalismManager().processGreenTerraBlockConversion(blockState)) {
blockState.update(true);
}
} else if (mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
} else if (mcMMOPlayer.getSuperAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || pluginRef.getConfigManager().getConfigUnarmed().doItemsCountAsUnarmed())) {
if (pluginRef.getSkillTools().superAbilityBlockCheck(SuperAbilityType.BERSERK, block.getState())
&& pluginRef.getEventManager().simulateBlockBreak(block, player, true)) {
event.setInstaBreak(true);

View File

@ -291,6 +291,10 @@ public class EntityListener implements Listener {
return;
}
if (pluginRef.getCombatTools().isProcessingNoInvulnDamage()) {
return;
}
if (event.getEntity() instanceof ArmorStand) {
return;
}

View File

@ -2,31 +2,28 @@ package com.gmail.nossr50.runnables;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.mcMMO;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
public class MobHealthDisplayUpdaterTask extends BukkitRunnable {
private final mcMMO pluginRef;
private LivingEntity target;
private String oldName;
private boolean oldNameVisible;
public MobHealthDisplayUpdaterTask(mcMMO pluginRef, LivingEntity target) {
this.pluginRef = pluginRef;
if (target.isValid()) {
this.target = target;
this.oldName = target.getMetadata(MetadataConstants.CUSTOM_NAME_METAKEY).get(0).asString();
this.oldNameVisible = target.getMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY).get(0).asBoolean();
}
}
@Override
public void run() {
if (target != null && target.isValid()) {
target.setCustomNameVisible(oldNameVisible);
target.setCustomName(oldName);
if (target.hasMetadata(MetadataConstants.CUSTOM_NAME_METAKEY)) {
target.setCustomName(target.getMetadata(MetadataConstants.CUSTOM_NAME_METAKEY).get(0).asString());
target.removeMetadata(MetadataConstants.CUSTOM_NAME_METAKEY, pluginRef);
}
if (target.hasMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY)) {
target.setCustomNameVisible(target.getMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY).get(0).asBoolean());
target.removeMetadata(MetadataConstants.NAME_VISIBILITY_METAKEY, pluginRef);
}
}

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.runnables.items;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -48,6 +49,23 @@ public class TeleportationWarmup extends BukkitRunnable {
}
}
if (pluginRef.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
World targetWorld = targetPlayer.getWorld();
World playerWorld = teleportingPlayer.getWorld();
if (!pluginRef.getPermissionTools().partyTeleportAllWorlds(teleportingPlayer)) {
if (!pluginRef.getPermissionTools().partyTeleportWorld(targetPlayer, targetWorld)) {
teleportingPlayer.sendMessage(pluginRef.getLocaleManager().formatString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return;
}
else if (targetWorld != playerWorld && !pluginRef.getPermissionTools().partyTeleportWorld(teleportingPlayer, targetWorld)) {
teleportingPlayer.sendMessage(pluginRef.getLocaleManager().formatString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
return;
}
}
}
pluginRef.getEventManager().handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
}
}

View File

@ -80,6 +80,7 @@ public class UnarmedManager extends SkillManager {
switch (blockState.getType()) {
case STONE_BRICKS:
// TODO: REREF? https://github.com/mcMMO-Dev/mcMMO/blame/421a394f68fc714899f167dc3faf53114b8469ce/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java#L95
/*if (!Unarmed.blockCrackerSmoothBrick) {
return false;
}*/

View File

@ -48,6 +48,11 @@ public final class MobHealthBarManager {
return;
}
// Don't mangle invalid entities, they're not going to be rendered anyways
if (!target.isValid()) {
return;
}
String originalName = target.getName();
String oldName = target.getCustomName();
@ -61,6 +66,7 @@ public final class MobHealthBarManager {
oldName = "";
}
boolean oldNameVisible = target.isCustomNameVisible();
String newName = createHealthDisplay(pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType(), target, damage);

View File

@ -48,6 +48,12 @@ public final class CombatTools {
}
McMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer(player);
//Make sure the profiles been loaded
if(mcMMOPlayer == null) {
return;
}
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
double initialDamage = event.getDamage();
double finalDamage = initialDamage;
@ -92,6 +98,12 @@ public final class CombatTools {
Map<DamageModifier, Double> modifiers = getModifiers(event);
McMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer(player);
//Make sure the profiles been loaded
if(mcMMOPlayer == null) {
return;
}
AxesManager axesManager = mcMMOPlayer.getAxesManager();
if (axesManager.canActivateAbility()) {
@ -134,6 +146,12 @@ public final class CombatTools {
double finalDamage = initialDamage;
McMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer(player);
//Make sure the profiles been loaded
if(mcMMOPlayer == null) {
return;
}
UnarmedManager unarmedManager = mcMMOPlayer.getUnarmedManager();
if (unarmedManager.canActivateAbility()) {
@ -208,6 +226,12 @@ public final class CombatTools {
double initialDamage = event.getDamage();
McMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer(player);
//Make sure the profiles been loaded
if(mcMMOPlayer == null) {
return;
}
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
double finalDamage = event.getDamage();
@ -226,7 +250,8 @@ public final class CombatTools {
}
if (archeryManager.canSkillShot()) {
finalDamage += archeryManager.skillShot(initialDamage);
//Not Additive
finalDamage = archeryManager.skillShot(initialDamage);
}
if (archeryManager.canDaze(target)) {
@ -578,6 +603,12 @@ public final class CombatTools {
target.damage(damage);
}
private boolean processingNoInvulnDamage;
public boolean isProcessingNoInvulnDamage() {
return processingNoInvulnDamage;
}
public void dealNoInvulnerabilityTickDamage(LivingEntity target, double damage, Entity attacker) {
if (target.isDead()) {
return;
@ -588,14 +619,21 @@ public final class CombatTools {
// potentially mis-attributing the death cause; calling a fake event would partially fix this, but this and setting the last damage
// cause do have issues around plugin observability. This is not a perfect solution, but it appears to be the best one here
// We also set no damage ticks to 0, to ensure that damage is applied for this case, and reset it back to the original value
// Snapshot current state so we can pop up properly
boolean wasMetaSet = target.getMetadata(MetadataConstants.CUSTOM_DAMAGE_METAKEY).size() != 0;
target.setMetadata(MetadataConstants.CUSTOM_DAMAGE_METAKEY, MetadataConstants.metadataValue);
boolean wasProcessing = processingNoInvulnDamage;
// set markers
processingNoInvulnDamage = true;
target.setMetadata(MetadataConstants.CUSTOM_DAMAGE_METAKEY, MetadataConstants.metadataValue);
int noDamageTicks = target.getNoDamageTicks();
target.setNoDamageTicks(0);
target.damage(damage, attacker);
target.setNoDamageTicks(noDamageTicks);
if (!wasMetaSet)
target.removeMetadata(MetadataConstants.CUSTOM_DAMAGE_METAKEY, pluginRef);
if (!wasProcessing)
processingNoInvulnDamage = false;
}
public void dealNoInvulnerabilityTickDamageRupture(LivingEntity target, double damage, Entity attacker, int toolTier) {

View File

@ -274,7 +274,8 @@ Experience_Values:
Brown_Mushroom_Block: 70
Mushroom_Stem: 80
Herbalism:
Sweet_Berry_Bush: 300
Bee_Nest: 200
Sweet_Berry_Bush: 50
Seagrass: 10
Tall_Seagrass: 10
Kelp: 3
@ -440,6 +441,7 @@ Experience_Values:
Cat: 500
Fox: 1000
Panda: 1000
Bee: 100
Combat:
Multiplier:
Animals: 1.0
@ -501,4 +503,5 @@ Experience_Values:
Ravager: 4.0
Trader_Llama: 1.0
Wandering_trader: 1.0
Bee: 1.5