From 139f50c5d1697d3bba8b52dd7ddb9d0e63ca89f9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 30 Apr 2011 18:33:25 -0700 Subject: [PATCH] mcMMO 1.0.05 --- mcMMO/Changelog.txt | 7 ++ mcMMO/com/gmail/nossr50/Combat.java | 84 ++++++++++--------- mcMMO/com/gmail/nossr50/mcEntityListener.java | 11 ++- mcMMO/plugin.yml | 2 +- 4 files changed, 62 insertions(+), 42 deletions(-) diff --git a/mcMMO/Changelog.txt b/mcMMO/Changelog.txt index 9d874f854..18b0949fc 100644 --- a/mcMMO/Changelog.txt +++ b/mcMMO/Changelog.txt @@ -1,5 +1,12 @@ Changelog: #Versions without changelogs probably had very small misc fixes, like tweaks to the source code + +Version 1.0.05 +PVP interactions now check for permissions before handing out any experience +Many skill abilities now check for permissions correctly +All interactions with Taming now check for permissions +mcMMO now checks for its pvp flag being true before handling pvp interactions + Version 1.0.04 Fixed bug where players would be informed incorrectly when their cooldowns refreshed Fixed exploit where players could reconnect to reset their cooldowns diff --git a/mcMMO/com/gmail/nossr50/Combat.java b/mcMMO/com/gmail/nossr50/Combat.java index 35de66e91..7a3d2578b 100644 --- a/mcMMO/com/gmail/nossr50/Combat.java +++ b/mcMMO/com/gmail/nossr50/Combat.java @@ -60,10 +60,11 @@ public class Combat { combatAbilityChecks(attacker, PPa, pluginx); //Check for offensive procs - Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Criticals + if(mcPermissions.getInstance().axes(attacker)) + Axes.axeCriticalCheck(attacker, eventb, pluginx); //Axe Criticals if(!Config.getInstance().isBleedTracked(event.getEntity())) //Swords Bleed Swords.bleedCheck(attacker, event.getEntity(), pluginx); - if(event.getEntity() instanceof Player){ + if(event.getEntity() instanceof Player && mcPermissions.getInstance().unarmed(attacker)){ Player defender = (Player)event.getEntity(); Unarmed.disarmProcCheck(attacker, defender); } @@ -88,11 +89,11 @@ public class Combat { { if(System.currentTimeMillis() >= PPd.getRespawnATS() + 5000 && defender.getHealth() >= 1) { - if(m.isAxes(attacker.getItemInHand())) + if(m.isAxes(attacker.getItemInHand()) && mcPermissions.getInstance().axes(attacker)) PPa.addAxesXP((event.getDamage() * 3) * LoadProperties.pvpxprewardmodifier); - if(m.isSwords(attacker.getItemInHand())) + if(m.isSwords(attacker.getItemInHand()) && mcPermissions.getInstance().swords(attacker)) PPa.addSwordsXP((event.getDamage() * 3) * LoadProperties.pvpxprewardmodifier); - if(attacker.getItemInHand().getTypeId() == 0) + if(attacker.getItemInHand().getTypeId() == 0 && mcPermissions.getInstance().unarmed(attacker)) PPa.addUnarmedXP((event.getDamage() * 3) * LoadProperties.pvpxprewardmodifier); } } @@ -148,28 +149,29 @@ public class Combat { { Player master = Taming.getOwner(eventb.getDamager(), pluginx); PlayerProfile PPo = Users.getProfile(master); - - //Sharpened Claws - if(PPo.getTamingInt() >= 750) - { - event.setDamage(event.getDamage() + 2); - } - - //Gore - if(Math.random() * 1000 <= PPo.getTamingInt()) - { - event.setDamage(event.getDamage() * 2); - - if(event.getEntity() instanceof Player) + if(mcPermissions.getInstance().taming(master)){ + //Sharpened Claws + if(PPo.getTamingInt() >= 750) { - Player target = (Player)event.getEntity(); - target.sendMessage(ChatColor.RED+"**STRUCK BY GORE**"); - Users.getProfile(target).setBleedTicks(2); + event.setDamage(event.getDamage() + 2); } - else - Config.getInstance().addToBleedQue(event.getEntity()); - master.sendMessage(ChatColor.GREEN+"**GORE**"); + //Gore + if(Math.random() * 1000 <= PPo.getTamingInt()) + { + event.setDamage(event.getDamage() * 2); + + if(event.getEntity() instanceof Player) + { + Player target = (Player)event.getEntity(); + target.sendMessage(ChatColor.RED+"**STRUCK BY GORE**"); + Users.getProfile(target).setBleedTicks(2); + } + else + Config.getInstance().addToBleedQue(event.getEntity()); + + master.sendMessage(ChatColor.GREEN+"**GORE**"); + } } } } @@ -195,24 +197,26 @@ public class Combat { { Player master = Taming.getOwner(event.getEntity(), pluginx); PlayerProfile PPo = Users.getProfile(master); - - /* - * TEMPORARY FIX AS WOLVES AREN'T TRIGGERING DAMAGE EVENTS WHEN ATTACKING NON PLAYERS AT THE TIME OF WRITING - */ - if(!event.isCancelled() && event.getCause() != DamageCause.LIGHTNING){ - PPo.addTamingXP(event.getDamage() * 3); - Skills.XpCheck(master); - } - - //Shock-Proof - if((event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION) && PPo.getTamingInt() >= 500) + if(mcPermissions.getInstance().taming(master)) { - event.setDamage(2); + /* + * TEMPORARY FIX AS WOLVES AREN'T TRIGGERING DAMAGE EVENTS WHEN ATTACKING NON PLAYERS AT THE TIME OF WRITING + */ + if(!event.isCancelled() && event.getCause() != DamageCause.LIGHTNING){ + PPo.addTamingXP(event.getDamage() * 3); + Skills.XpCheck(master); + } + + //Shock-Proof + if((event.getCause() == DamageCause.ENTITY_EXPLOSION || event.getCause() == DamageCause.BLOCK_EXPLOSION) && PPo.getTamingInt() >= 500) + { + event.setDamage(2); + } + + //Thick Fur + if(PPo.getTamingInt() >= 250) + event.setDamage(event.getDamage() / 2); } - - //Thick Fur - if(PPo.getTamingInt() >= 250) - event.setDamage(event.getDamage() / 2); } } } diff --git a/mcMMO/com/gmail/nossr50/mcEntityListener.java b/mcMMO/com/gmail/nossr50/mcEntityListener.java index 0a98ee9e6..428745d8c 100644 --- a/mcMMO/com/gmail/nossr50/mcEntityListener.java +++ b/mcMMO/com/gmail/nossr50/mcEntityListener.java @@ -49,7 +49,16 @@ public class mcEntityListener extends EntityListener { } public void onEntityDamage(EntityDamageEvent event) { if(event.isCancelled()) - return; + return; + /* + * CHECK FOR mcMMO PVP FLAG + */ + if(event instanceof EntityDamageByEntityEvent) + { + EntityDamageByEntityEvent eventb = (EntityDamageByEntityEvent)event; + if(eventb.getEntity() instanceof Player && eventb.getDamager() instanceof Player && !LoadProperties.pvp) + return; + } /* * CHECK FOR INVULNERABILITY */ diff --git a/mcMMO/plugin.yml b/mcMMO/plugin.yml index 2a451c0f7..568bbf091 100644 --- a/mcMMO/plugin.yml +++ b/mcMMO/plugin.yml @@ -1,3 +1,3 @@ name: mcMMO main: com.gmail.nossr50.mcMMO -version: 1.0.04 \ No newline at end of file +version: 1.0.05 \ No newline at end of file