Catch instance where enderman's head is in a block, also handle having no ban broadcast string gracefully

This commit is contained in:
h31ix committed 2012-10-07 10:50:08 -04:00
1 parent 308062aebb
commit 8f47edd61e
3 files changed
+18 -3

No files matched your search

@@ -545,10 +545,17 @@ public class Backend
// Check to make sure the entity's head is not surrounded // Check to make sure the entity's head is not surrounded
Block head = entity.getWorld().getBlockAt((int)entity.getLocation().getX(), (int)((CraftEntity)entity).getHandle().getHeadHeight(), (int)entity.getLocation().getZ()); Block head = entity.getWorld().getBlockAt((int)entity.getLocation().getX(), (int)((CraftEntity)entity).getHandle().getHeadHeight(), (int)entity.getLocation().getZ());
boolean solid = false; boolean solid = false;
if(head.getTypeId() != 0)
{
solid = net.minecraft.server.Block.byId[head.getTypeId()].material.isSolid();
}
if(!solid)
{
if(head.getRelative(BlockFace.NORTH).getTypeId() != 0) if(head.getRelative(BlockFace.NORTH).getTypeId() != 0)
{ {
solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.NORTH).getTypeId()].material.isSolid(); solid = net.minecraft.server.Block.byId[head.getRelative(BlockFace.NORTH).getTypeId()].material.isSolid();
} }
}
if(!solid) if(!solid)
{ {
if(head.getRelative(BlockFace.SOUTH).getTypeId() != 0) if(head.getRelative(BlockFace.SOUTH).getTypeId() != 0)
@@ -171,7 +171,11 @@ public class UserManager
else if (result.equalsIgnoreCase("KICK")) else if (result.equalsIgnoreCase("KICK"))
{ {
user.getPlayer().kickPlayer(RED + lang.getKickReason()); user.getPlayer().kickPlayer(RED + lang.getKickReason());
Bukkit.broadcastMessage(RED + lang.getKickBroadcast().replaceAll("&player", name)); String msg = RED + lang.getKickBroadcast().replaceAll("&player", name);
if(!msg.equals(""))
{
Bukkit.broadcastMessage(msg);
}
} }
else if (result.equalsIgnoreCase("WARN")) else if (result.equalsIgnoreCase("WARN"))
{ {
@@ -185,7 +189,11 @@ public class UserManager
{ {
user.getPlayer().setBanned(true); user.getPlayer().setBanned(true);
user.getPlayer().kickPlayer(RED + lang.getBanReason()); user.getPlayer().kickPlayer(RED + lang.getBanReason());
user.getPlayer().getServer().broadcastMessage(RED + lang.getBanBroadcast().replaceAll("&player", name)); String msg = RED + lang.getBanBroadcast().replaceAll("&player", name);
if(!msg.equals(""))
{
Bukkit.broadcastMessage(msg);
}
} }
} }
+1 -1
View File
@@ -6,7 +6,7 @@ name: AntiCheat
softdepend: [AntiCheat] softdepend: [AntiCheat]
startup: postworld startup: postworld
url: http://gravitydevelopment.net url: http://gravitydevelopment.net
version: ${project.version} version: ${project.version}-{build.number}-DEV
commands: commands:
anticheat: anticheat:
description: Control and view info about AntiCheat description: Control and view info about AntiCheat