2.1.24 - Critical Exploit Fix

This commit is contained in:
nossr50 2019-03-25 15:12:17 -07:00
parent 363ea66335
commit 55fb3ed74f
4 changed files with 14 additions and 2 deletions

View File

@ -7,6 +7,9 @@ Key:
! Change ! Change
- Removal - Removal
Version 2.1.24
Fixed an exploit where you could clone inventories
Version 2.1.23 Version 2.1.23
Fixed a bug with Double Drops for Mining (Update your configs instructions below) Fixed a bug with Double Drops for Mining (Update your configs instructions below)
Fixed a 7 year old bug where damage in mcMMO from Skills was potentially getting reduced by damage reduction TWICE Fixed a 7 year old bug where damage in mcMMO from Skills was potentially getting reduced by damage reduction TWICE

View File

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

View File

@ -65,10 +65,19 @@ public class BlockListener implements Listener {
if(is.getAmount() <= 0) if(is.getAmount() <= 0)
continue; continue;
//Extra Protection
if(event.getBlock().getState() instanceof Container)
return;
if(event.getBlock().getState().getMetadata(mcMMO.doubleDropKey).size() > 0) if(event.getBlock().getState().getMetadata(mcMMO.doubleDropKey).size() > 0)
{
event.getBlock().getState().removeMetadata(mcMMO.doubleDropKey, plugin);
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is); event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
}
else if(event.getBlock().getState().getMetadata(mcMMO.tripleDropKey).size() > 0) else if(event.getBlock().getState().getMetadata(mcMMO.tripleDropKey).size() > 0)
{ {
event.getBlock().getState().removeMetadata(mcMMO.tripleDropKey, plugin);
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is); event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is); event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
} }

View File

@ -222,10 +222,10 @@ public class EntityListener implements Listener {
if(defender.getMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY).size() > 0) if(defender.getMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY).size() > 0)
{ {
defender.removeMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, plugin); defender.removeMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, plugin);
LivingEntity defLive = (LivingEntity) defender;
if(defender instanceof Player) if(defender instanceof Player)
{ {
LivingEntity defLive = (LivingEntity) defender;
defLive.setHealth(defLive.getHealth() - event.getFinalDamage()); defLive.setHealth(defLive.getHealth() - event.getFinalDamage());
event.setCancelled(true); event.setCancelled(true);
} }