mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-27 02:58:03 +01:00
Replaced m.getDistance()
This commit is contained in:
parent
a41fc22899
commit
093f368545
@ -929,7 +929,7 @@ public class PlayerProfile
|
||||
if(x.isOnline() && !x.getName().equals(thisplayer.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty()))
|
||||
{
|
||||
//leaderName = x.getName();
|
||||
if(m.getDistance(thisplayer.getLocation(), x.getLocation()) < 25)
|
||||
if(m.isNear(thisplayer.getLocation(), x.getLocation(), 25))
|
||||
{
|
||||
PlayerProfile PartyLeader = Users.getProfile(x);
|
||||
if(PartyLeader.getSkillLevel(skillType) >= this.getSkillLevel(skillType))
|
||||
|
@ -189,13 +189,19 @@ public class m
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static double getDistance(Location loca, Location locb)
|
||||
{
|
||||
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
|
||||
+ Math.pow(loca.getZ() - locb.getZ(), 2));
|
||||
|
||||
public static boolean isNear(Location first, Location second, int maxDistance) {
|
||||
double relX = first.getX() - second.getX();
|
||||
double relY = first.getY() - second.getY();
|
||||
double relZ = first.getZ() - second.getZ();
|
||||
double dist = relX * relX + relY * relY + relZ * relZ;
|
||||
|
||||
if (dist < maxDistance * maxDistance)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean abilityBlockCheck(Block block)
|
||||
{
|
||||
switch(block.getType()){
|
||||
|
@ -274,7 +274,7 @@ public class Skills
|
||||
player.sendMessage(ability.getAbilityOn());
|
||||
for(Player y : player.getWorld().getPlayers())
|
||||
{
|
||||
if(y != player && m.getDistance(player.getLocation(), y.getLocation()) < 10)
|
||||
if(y != player && m.isNear(player.getLocation(), y.getLocation(), 10))
|
||||
y.sendMessage(ability.getAbilityPlayer(player));
|
||||
}
|
||||
PP.setSkillDATS(ability, System.currentTimeMillis()+(ticks*1000));
|
||||
|
Loading…
Reference in New Issue
Block a user