mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +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()))
|
if(x.isOnline() && !x.getName().equals(thisplayer.getName()) && Party.getInstance().isPartyLeader(x.getName(), this.getParty()))
|
||||||
{
|
{
|
||||||
//leaderName = x.getName();
|
//leaderName = x.getName();
|
||||||
if(m.getDistance(thisplayer.getLocation(), x.getLocation()) < 25)
|
if(m.isNear(thisplayer.getLocation(), x.getLocation(), 25))
|
||||||
{
|
{
|
||||||
PlayerProfile PartyLeader = Users.getProfile(x);
|
PlayerProfile PartyLeader = Users.getProfile(x);
|
||||||
if(PartyLeader.getSkillLevel(skillType) >= this.getSkillLevel(skillType))
|
if(PartyLeader.getSkillLevel(skillType) >= this.getSkillLevel(skillType))
|
||||||
|
@ -190,10 +190,16 @@ public class m
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getDistance(Location loca, Location locb)
|
public static boolean isNear(Location first, Location second, int maxDistance) {
|
||||||
{
|
double relX = first.getX() - second.getX();
|
||||||
return Math.sqrt(Math.pow(loca.getX() - locb.getX(), 2) + Math.pow(loca.getY() - locb.getY(), 2)
|
double relY = first.getY() - second.getY();
|
||||||
+ Math.pow(loca.getZ() - locb.getZ(), 2));
|
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)
|
public static boolean abilityBlockCheck(Block block)
|
||||||
|
@ -274,7 +274,7 @@ public class Skills
|
|||||||
player.sendMessage(ability.getAbilityOn());
|
player.sendMessage(ability.getAbilityOn());
|
||||||
for(Player y : player.getWorld().getPlayers())
|
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));
|
y.sendMessage(ability.getAbilityPlayer(player));
|
||||||
}
|
}
|
||||||
PP.setSkillDATS(ability, System.currentTimeMillis()+(ticks*1000));
|
PP.setSkillDATS(ability, System.currentTimeMillis()+(ticks*1000));
|
||||||
|
Loading…
Reference in New Issue
Block a user