Merge remote-tracking branch 'origin/master'

This commit is contained in:
Jsinco 2024-10-15 14:22:52 -04:00
commit 7cf35954a4
5 changed files with 41 additions and 18 deletions

View File

@ -1,3 +1,9 @@
Version 2.2.022
Fixed a bug where Roll was always reducing damage (thanks Ineusia)
Fix COTW errors on older versions (thanks Warriorrrr)
Fixed slimes spawning from slime division not inheriting tags. (thanks Ineusia)
Version 2.2.021
Fixed issue where Roll wasn't reducing as much damage as it should have been (thanks Ineusia)
Updated locale_es (thanks Devilcasters)

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.2.021</version>
<version>2.2.023-SNAPSHOT</version>
<name>mcMMO</name>
<url>https://github.com/mcMMO-Dev/mcMMO</url>
<scm>

View File

@ -77,18 +77,18 @@ public class Roll extends AcrobaticsSubSkill {
return false;
}
// Clear out the damage from falling so that way our modified damage doesn't get re-reduced by protection/feather falling
entityDamageEvent.setDamage(0);
// Send the damage is MAGIC so that it cuts through all resistances
// This is fine because we considered protection/featherfalling in the rollCheck method
entityDamageEvent.setDamage(EntityDamageEvent.DamageModifier.MAGIC, rollResult.getModifiedDamage());
if (entityDamageEvent.getFinalDamage() == 0) {
entityDamageEvent.setCancelled(true);
}
// Roll happened, send messages and XP
// Roll happened, reduce damage, send messages and XP
if (rollResult.isRollSuccess()) {
// Clear out the damage from falling so that way our modified damage doesn't get re-reduced by protection/feather falling
entityDamageEvent.setDamage(0);
// Send the damage is MAGIC so that it cuts through all resistances
// This is fine because we considered protection/featherfalling in the rollCheck method
entityDamageEvent.setDamage(EntityDamageEvent.DamageModifier.MAGIC, rollResult.getModifiedDamage());
if (entityDamageEvent.getFinalDamage() == 0) {
entityDamageEvent.setCancelled(true);
}
final String key
= rollResult.isGraceful() ? GRACEFUL_ROLL_ACTIVATED_LOCALE_STR_KEY : ROLL_ACTIVATED_LOCALE_KEY;
sendPlayerInformation(mmoPlayer.getPlayer(), NotificationType.SUBSKILL_MESSAGE, key);

View File

@ -45,6 +45,10 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import static com.gmail.nossr50.util.MobMetadataUtils.*;
public class EntityListener implements Listener {
@ -55,6 +59,8 @@ public class EntityListener implements Listener {
* check if a {@link Player} has a {@link Trident} enchanted with "Piercing".
*/
private final NamespacedKey piercingEnchantment = NamespacedKey.minecraft("piercing");
private final static Set<EntityType> TRANSFORMABLE_ENTITIES
= Set.of(EntityType.SLIME, EntityType.MAGMA_CUBE);
public EntityListener(final mcMMO pluginRef) {
this.pluginRef = pluginRef;
@ -72,6 +78,11 @@ public class EntityListener implements Listener {
}
}
}
// Clear the original slime/magma cubes metadata - it's dead.
if (TRANSFORMABLE_ENTITIES.contains(livingEntity.getType())) {
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(livingEntity);
}
}
}
@ -652,7 +663,14 @@ public class EntityListener implements Listener {
*/
@EventHandler(priority = EventPriority.LOWEST)
public void onEntityDeathLowest(EntityDeathEvent event) {
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(event.getEntity());
LivingEntity entity = event.getEntity();
// Clear metadata for Slimes/Magma Cubes after transformation events take place, otherwise small spawned slimes will not have any tags
if (TRANSFORMABLE_ENTITIES.contains(entity.getType())) {
return;
}
mcMMO.getTransientMetadataTools().cleanLivingEntityMetadata(entity);
}
/**

View File

@ -402,6 +402,7 @@ public class TamingManager extends SkillManager {
callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", getPlayer().getName(), StringUtils.getPrettyEntityTypeString(EntityType.WOLF)));
}
@SuppressWarnings("deprecation")
private void spawnCat(Location spawnLocation, EntityType entityType) {
LivingEntity callOfWildEntity = (LivingEntity) getPlayer().getWorld().spawnEntity(spawnLocation, entityType);
@ -414,15 +415,13 @@ public class TamingManager extends SkillManager {
//Randomize the cat
if (callOfWildEntity instanceof Ocelot) {
// Ocelot.Type is deprecated, but that's fine since this only runs on 1.13
int numberOfTypes = Ocelot.Type.values().length;
((Ocelot) callOfWildEntity).setCatType(Ocelot.Type.values()[Misc.getRandom().nextInt(numberOfTypes)]);
((Ocelot) callOfWildEntity).setAdult();
} else if (callOfWildEntity instanceof Cat) {
int numberOfTypes = Cat.Type.values().length;
((Cat) callOfWildEntity).setCatType(Cat.Type.values()[Misc.getRandom().nextInt(numberOfTypes)]);
((Cat) callOfWildEntity).setAdult();
}
((Ageable) callOfWildEntity).setAdult();
callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", getPlayer().getName(), StringUtils.getPrettyEntityTypeString(entityType)));
//Particle effect