mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 02:55:46 +01:00
Players not in the right world will now get banned for life!
This commit is contained in:
parent
f808b24464
commit
69ad343e16
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: MobArena
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.94.3.10
|
||||
version: 0.94.3.11
|
||||
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells]
|
||||
commands:
|
||||
ma:
|
||||
|
@ -488,7 +488,8 @@ public class Arena
|
||||
if (e == null) continue;
|
||||
|
||||
Creature c = (Creature) e;
|
||||
if (c.getTarget() != null && e.getLocation().distanceSquared(c.getTarget().getLocation()) < 8)
|
||||
LivingEntity target = c.getTarget();
|
||||
if (target != null && target instanceof Player && MAUtils.distanceSquared((Player) target, e.getLocation()) < 8D)
|
||||
{
|
||||
CraftEntity ce = (CraftEntity) e;
|
||||
CraftWorld cw = (CraftWorld) e.getWorld();
|
||||
|
@ -1087,8 +1087,8 @@ public class MAUtils
|
||||
continue;
|
||||
}
|
||||
|
||||
double dist = p.getLocation().distanceSquared(e.getLocation());
|
||||
if (dist < current && dist < 256)
|
||||
double dist = distanceSquared(p, e.getLocation());
|
||||
if (dist < current && dist < 256D)
|
||||
{
|
||||
current = dist;
|
||||
result = p;
|
||||
@ -1097,6 +1097,20 @@ public class MAUtils
|
||||
return result;
|
||||
}
|
||||
|
||||
public static double distanceSquared(Player p, Location l)
|
||||
{
|
||||
try
|
||||
{
|
||||
return p.getLocation().distanceSquared(l);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
p.kickPlayer("Banned for life! No, but stop trying to cheat in MobArena!");
|
||||
MobArena.warning(p.getName() + " tried to cheat in MobArena and has been kicked.");
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a proper arena name to a config-file name.
|
||||
* All spaces are replaced by underscores, and the whole String is
|
||||
|
@ -46,8 +46,8 @@ public class MobArena extends JavaPlugin
|
||||
// Global variables
|
||||
public static PluginDescriptionFile desc;
|
||||
public static File dir, arenaDir;
|
||||
public static final double MIN_PLAYER_DISTANCE = 15.0;
|
||||
public static final double MIN_PLAYER_DISTANCE_SQUARED = MIN_PLAYER_DISTANCE * MIN_PLAYER_DISTANCE;
|
||||
public static final double MIN_PLAYER_DISTANCE = 15D;
|
||||
public static final double MIN_PLAYER_DISTANCE_SQUARED = 225D;
|
||||
public static final int ECONOMY_MONEY_ID = -29;
|
||||
public static Random random = new Random();
|
||||
|
||||
|
@ -30,19 +30,11 @@ public class WaveUtils
|
||||
{
|
||||
for (Player p : players)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (l.distanceSquared(p.getLocation()) >= MobArena.MIN_PLAYER_DISTANCE_SQUARED)
|
||||
continue;
|
||||
|
||||
result.add(l);
|
||||
break;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
p.kickPlayer("Banned for life! No, but stop trying to cheat in MobArena!");
|
||||
MobArena.warning(p.getName() + " tried to cheat in MobArena and has been kicked.");
|
||||
}
|
||||
if (MAUtils.distanceSquared(p, l) >= MobArena.MIN_PLAYER_DISTANCE_SQUARED)
|
||||
continue;
|
||||
|
||||
result.add(l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.garbagemule.MobArena.Arena;
|
||||
import com.garbagemule.MobArena.MAUtils;
|
||||
import com.garbagemule.MobArena.MobArena;
|
||||
import com.garbagemule.MobArena.util.WaveUtils;
|
||||
|
||||
@ -334,7 +335,7 @@ public enum BossAbility
|
||||
{
|
||||
List<Player> result = new LinkedList<Player>();
|
||||
for (Player p : arena.getLivingPlayers())
|
||||
if (p.getLocation().distanceSquared(boss.getLocation()) > x*x)
|
||||
if (MAUtils.distanceSquared(p, boss.getLocation()) > (double) (x*x))
|
||||
result.add(p);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user