Merge branch 'master' of github.com:mcMMO-Dev/mcMMO

This commit is contained in:
nossr50 2012-03-02 11:02:05 -08:00
commit ef17ea6231
6 changed files with 34 additions and 60 deletions

View File

@ -134,12 +134,9 @@ public class Combat
{
Wolf wolf = (Wolf) damager;
if (wolf.isTamed() && Taming.ownerOnline(wolf, pluginx))
if (wolf.isTamed() && (wolf.getOwner() instanceof Player))
{
Player master = Taming.getOwner(wolf, pluginx);
if (master == null) //Can it really happen?
return;
Player master = (Player) wolf.getOwner();
PlayerProfile PPo = Users.getProfile(master);
if(mcPermissions.getInstance().taming(master))
{
@ -177,7 +174,7 @@ public class Combat
else if(target instanceof Wolf)
{
Wolf wolf = (Wolf) target;
if(wolf.isTamed() && Taming.ownerOnline(wolf, pluginx))
if(wolf.isTamed() && (wolf.getOwner() instanceof Player))
Taming.preventDamage(event, pluginx);
}
}

View File

@ -167,7 +167,7 @@ public class mcEntityListener implements Listener
if(plugin.misc.tntTracker.containsKey(location))
{
Player player = plugin.misc.tntTracker.get(location);
BlastMining.biggerBombs(Users.getProfile(player).getSkillLevel(SkillType.MINING), event);
BlastMining.biggerBombs(player, event);
}
}
}

View File

@ -53,11 +53,12 @@ public class Axes {
if(x instanceof Wolf){
Wolf wolf = (Wolf)x;
if(Taming.getOwner(wolf, pluginx) != null)
if(wolf.getOwner() instanceof Player)
{
if(Taming.getOwner(wolf, pluginx) == attacker)
Player owner = (Player) wolf.getOwner();
if(owner == attacker)
return;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
if(Party.getInstance().inSameParty(attacker, owner))
return;
}
}
@ -167,10 +168,14 @@ public class Axes {
if(derp instanceof Wolf)
{
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
if(hurrDurr.getOwner() instanceof Player)
{
Player owner = (Player) hurrDurr.getOwner();
if(owner == attacker)
return;
if(Party.getInstance().inSameParty(attacker, owner))
return;
}
}
//Damage nearby LivingEntities

View File

@ -199,8 +199,9 @@ public class BlastMining{
* Increases radius of explosion by 3 at 750.
* Increases radius of explosion by 4 at 1000.
*/
public static void biggerBombs(int skillLevel, ExplosionPrimeEvent event)
public static void biggerBombs(Player player, ExplosionPrimeEvent event)
{
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.MINING);
float radius = event.getRadius();
if(skillLevel < 250)
return;

View File

@ -40,11 +40,12 @@ public class Swords
if(x instanceof Wolf)
{
Wolf wolf = (Wolf)x;
if(Taming.getOwner(wolf, pluginx) != null)
if(wolf.getOwner() instanceof Player)
{
if(Taming.getOwner(wolf, pluginx) == attacker)
Player owner = (Player) wolf.getOwner();
if(owner == attacker)
return;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(wolf, pluginx)))
if(Party.getInstance().inSameParty(attacker, owner))
return;
}
}
@ -97,10 +98,14 @@ public class Swords
if(derp instanceof Wolf)
{
Wolf hurrDurr = (Wolf)derp;
if(Taming.getOwner(hurrDurr, pluginx) == attacker)
continue;
if(Party.getInstance().inSameParty(attacker, Taming.getOwner(hurrDurr, pluginx)))
continue;
if(hurrDurr.getOwner() instanceof Player)
{
Player owner = (Player) hurrDurr.getOwner();
if(owner == attacker)
return;
if(Party.getInstance().inSameParty(attacker, owner))
return;
}
}
//Damage nearby LivingEntities
if(derp instanceof LivingEntity && targets >= 1)

View File

@ -16,14 +16,12 @@
*/
package com.gmail.nossr50.skills;
import org.bukkit.entity.AnimalTamer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users;
@ -99,47 +97,15 @@ public class Taming
}
}
public static boolean ownerOnline(Wolf theWolf, Plugin pluginx)
{
for(Player x : pluginx.getServer().getOnlinePlayers())
{
if(x instanceof AnimalTamer)
{
AnimalTamer tamer = (AnimalTamer)x;
if(theWolf.getOwner() == tamer)
return true;
}
}
return false;
}
public static Player getOwner(Entity wolf, Plugin pluginx)
{
if(wolf instanceof Wolf)
{
Wolf theWolf = (Wolf)wolf;
for(Player x : pluginx.getServer().getOnlinePlayers())
{
if(x instanceof AnimalTamer && x.isOnline())
{
AnimalTamer tamer = (AnimalTamer)x;
if(theWolf.getOwner() == tamer)
return x;
}
}
return null;
}
return null;
}
public static String getOwnerName(Wolf theWolf)
{
Player owner = null;
if (theWolf.getOwner() instanceof Player)
{
owner = (Player)theWolf.getOwner();
if(owner != null)
return owner.getName();
}
else
return "Offline Master";
}
@ -149,7 +115,7 @@ public class Taming
DamageCause cause = event.getCause();
Entity entity = event.getEntity();
Wolf theWolf = (Wolf)entity;
Player master = getOwner(theWolf, plugin);
Player master = (Player)theWolf.getOwner();
int skillLevel = Users.getProfile(master).getSkillLevel(SkillType.TAMING);
//Environmentally Aware
@ -157,7 +123,7 @@ public class Taming
{
if(event.getDamage() < theWolf.getHealth())
{
entity.teleport(Taming.getOwner(theWolf, plugin).getLocation());
entity.teleport(master.getLocation());
master.sendMessage(mcLocale.getString("mcEntityListener.WolfComesBack")); //$NON-NLS-1$
entity.setFireTicks(0);
}