Merge branch 'master' of github.com:h31ix/AntiCheat into development

Conflicts:
	src/main/java/net/h31ix/anticheat/manage/AnticheatManager.java
	src/main/java/net/h31ix/anticheat/manage/CheckType.java
This commit is contained in:
Super Spy committed 2012-06-12 12:06:30 -05:00
commit b411e92f44
19 files changed
+570 -209

No files matched your search

@@ -1,3 +1,21 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012 H31IX http://h31ix.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.h31ix.anticheat.util;
import java.util.logging.Formatter;
@@ -6,10 +24,9 @@ import java.util.logging.LogRecord;
public class ConsoleFormatter extends Formatter {
@Override
public String format(LogRecord record) {
StringBuilder output = new StringBuilder()
.append(record.getMessage()).append(' ');
public String format(LogRecord record)
{
StringBuilder output = new StringBuilder().append(record.getMessage()).append(' ');
return output.toString();
}
}
@@ -1,3 +1,21 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012 H31IX http://h31ix.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.h31ix.anticheat.util;
import java.text.DateFormat;
@@ -13,14 +31,20 @@ public class FileFormatter extends Formatter {
@Override
public String format(LogRecord record) {
StringBuilder output = new StringBuilder()
.append("[")
.append(record.getLevel()).append('|')
.append(format.format(new Date(record.getMillis())))
.append("]: ")
.append(record.getMessage()).append(' ')
.append(lineSep);
return output.toString();
if(record.getMessage().startsWith("[AntiCheat]"))
{
StringBuilder output = new StringBuilder()
.append("[")
.append(record.getLevel()).append('|')
.append(format.format(new Date(record.getMillis())))
.append("]: ")
.append(record.getMessage()).append(' ')
.append(lineSep);
return output.toString();
}
else
{
return "";
}
}
}
@@ -42,16 +42,10 @@ public final class Utilities
}
public static void alert(String [] message)
{
for(Player p : Bukkit.getServer().getOnlinePlayers())
for(String msg : message)
{
if(p.hasPermission("anticheat.alert") || p.hasPermission("anticheat.admin") || p.hasPermission("anticheat.mod") || p.isOp())
{
for(String msg : message)
{
p.sendMessage(msg);
}
}
}
Bukkit.broadcast(msg, "anticheat.alert");
}
if(Anticheat.getManager().getConfiguration().logConsole())
{
for(String msg : message)
@@ -103,7 +97,7 @@ public final class Utilities
boolean b = false;
if(player.getServer().getPluginManager().getPlugin("mcMMO") != null)
{
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK))
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BLAST_MINING))
{
b = true;
}
@@ -181,6 +175,14 @@ public final class Utilities
{
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
}
public static boolean isInWater(Player player)
{
return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
}
public static boolean isOnLadder(Player player)
{
return player.getLocation().getBlock().getType() == Material.VINE || player.getLocation().getBlock().getType() == Material.LADDER;
}
public static boolean isInt(String string)
{
boolean x = false;