Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2015-08-14 21:14:41 -05:00
commit e89961380b
4 changed files with 77 additions and 17 deletions

View File

@ -4,21 +4,24 @@ import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_7_R4.EntityBat; import net.minecraft.server.v1_7_R4.EntityBat;
import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.EntityEnderDragon; import net.minecraft.server.v1_7_R4.EntityEnderDragon;
import net.minecraft.server.v1_7_R4.EntityHuman; import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R4.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R4.EntityLiving; import net.minecraft.server.v1_7_R4.EntityLiving;
import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
import net.minecraft.server.v1_7_R4.Navigation; import net.minecraft.server.v1_7_R4.Navigation;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation;
import net.minecraft.server.v1_7_R4.PathfinderGoal; import net.minecraft.server.v1_7_R4.PathfinderGoal;
import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer; import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction; import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround; import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector; import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
import net.minecraft.server.v1_7_R4.WorldServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -32,6 +35,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
@ -582,6 +586,36 @@ public class UtilEnt
return false; return false;
} }
public static boolean CreatureLook(Entity ent, Entity target)
{
return CreatureLook(ent, target instanceof LivingEntity ? ((LivingEntity) target).getEyeLocation() : target.getLocation());
}
public static boolean CreatureLook(Entity ent, Location target)
{
Vector vec = UtilAlg.getTrajectory(ent.getLocation(), target);
return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec));
}
public static boolean CreatureLook(Entity ent, float pitch, float yaw)
{
if (!(ent instanceof LivingEntity))
return false;
EntityLiving ec = ((CraftLivingEntity) ent).getHandle();
Location loc = ent.getLocation();
ec.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), yaw, pitch);
ec.al = true;
EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.world).tracker.trackedEntities.get(ec.getId());
entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, (byte) (ec.yaw * 256.0F / 360.0F)));
return true;
}
public static void CreatureMove(Entity ent, Location target, float speed) public static void CreatureMove(Entity ent, Location target, float speed)
{ {
if (!(ent instanceof Creature)) if (!(ent instanceof Creature))

View File

@ -26,14 +26,34 @@ public class PetRepository extends RepositoryBase
_webAddress = webAddress; _webAddress = webAddress;
} }
public void AddPet(PetChangeToken token) public void AddPet(final PetChangeToken token)
{ {
new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token); new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token);
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable()
{
public void run()
{
executeInsert("INSERT INTO accountPets(petName, petId, accountId) VALUES (?, ?, ?);", null, new ColumnVarChar("petName", 32, token.PetName)
, new ColumnInt("petId", token.PetId)
, new ColumnInt("accountId", token.AccountId));
}
});
} }
public void RemovePet(PetChangeToken token) public void RemovePet(final PetChangeToken token)
{ {
new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token); new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token);
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable()
{
public void run()
{
executeUpdate("DELETE FROM accountPets WHERE petId = ? AND accountId = ?;"
, new ColumnInt("petId", token.PetId)
, new ColumnInt("accountId", token.AccountId));
}
});
} }
public List<PetExtraToken> GetPetExtras(List<PetExtraToken> petExtraTokens) public List<PetExtraToken> GetPetExtras(List<PetExtraToken> petExtraTokens)
@ -41,10 +61,14 @@ public class PetRepository extends RepositoryBase
return new JsonWebCall(_webAddress + "Pets/GetPetExtras").Execute(new TypeToken<List<PetExtraToken>>(){}.getType(), petExtraTokens); return new JsonWebCall(_webAddress + "Pets/GetPetExtras").Execute(new TypeToken<List<PetExtraToken>>(){}.getType(), petExtraTokens);
} }
public void UpdatePet(PetChangeToken token) public void UpdatePet(final PetChangeToken token)
{ {
new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token); new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token);
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable()
{
public void run()
{
int rowsChanged = executeUpdate("UPDATE accountPets SET petName = ? WHERE petId = ? AND accountId = ?;", new ColumnVarChar("petName", 32, token.PetName) int rowsChanged = executeUpdate("UPDATE accountPets SET petName = ? WHERE petId = ? AND accountId = ?;", new ColumnVarChar("petName", 32, token.PetName)
, new ColumnInt("petId", token.PetId) , new ColumnInt("petId", token.PetId)
, new ColumnInt("accountId", token.AccountId)); , new ColumnInt("accountId", token.AccountId));
@ -56,6 +80,8 @@ public class PetRepository extends RepositoryBase
, new ColumnInt("accountId", token.AccountId)); , new ColumnInt("accountId", token.AccountId));
} }
} }
});
}
@Override @Override
protected void initialize() protected void initialize()

View File

@ -14,7 +14,7 @@ public class PerkMammoth extends Perk
{ {
super("Mammoth", new String[] super("Mammoth", new String[]
{ {
C.cGray + "Take 50% knockback and deal 150% knockback", C.cGray + "Take 75% knockback and deal 125% knockback",
}); });
} }
@ -30,7 +30,7 @@ public class PerkMammoth extends Perk
if (!Kit.HasKit(damager)) if (!Kit.HasKit(damager))
return; return;
event.AddKnockback(GetName(), 1.5d); event.AddKnockback(GetName(), 1.25d);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -45,6 +45,6 @@ public class PerkMammoth extends Perk
if (!Kit.HasKit(damagee)) if (!Kit.HasKit(damagee))
return; return;
event.AddKnockback(GetName(), 0.5d); event.AddKnockback(GetName(), 0.75d);
} }
} }

View File

@ -131,7 +131,7 @@ public class PerkNeedler extends SmashPerk
DamageCause.THORNS, 1.1, true, true, false, DamageCause.THORNS, 1.1, true, true, false,
damager.getName(), GetName()); damager.getName(), GetName());
if(Manager.GetGame().GetTeam(event.GetDamageePlayer()) != Manager.GetGame().GetTeam(damager)) if(!Manager.GetGame().GetTeam(event.GetDamageePlayer()).equals(Manager.GetGame().GetTeam(damager)))
{ {
Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false); Manager.GetCondition().Factory().Poison(GetName(), event.GetDamageeEntity(), damager, 2, 0, false, false, false);
} }