mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Merge pull request #187 from bm01/replace-getdistance
Replacement of m.getDistance()
This commit is contained in:
commit
fae5693db8
@ -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))
|
||||||
|
@ -189,13 +189,19 @@ 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)
|
||||||
{
|
{
|
||||||
switch(block.getType()){
|
switch(block.getType()){
|
||||||
|
@ -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