mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 22:16:03 +00:00
Compliance with Java standards via Sonar plus a few xray fixes.
This commit is contained in:
1 parent
46ec0d736d
commit
55eb3738f7
23 files changed
+463
-483
No files matched your search
@@ -2,16 +2,15 @@ package net.h31ix.anticheat.manage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AnimationManager {
|
||||
public Map<Player,Boolean> animations = new HashMap<Player,Boolean>();
|
||||
Anticheat plugin;
|
||||
private Map<Player,Boolean> animations = new HashMap<Player,Boolean>();
|
||||
|
||||
public AnimationManager(Anticheat plugin)
|
||||
public AnimationManager()
|
||||
{
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
public void logAnimation(final Player player)
|
||||
@@ -21,13 +20,13 @@ public class AnimationManager {
|
||||
|
||||
public boolean swungArm(Player player)
|
||||
{
|
||||
if(animations.get(player) == null || animations.get(player) == false)
|
||||
if(animations.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return animations.get(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,13 @@ package net.h31ix.anticheat.manage;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
public class BlockManager
|
||||
{
|
||||
public Map<Player, Boolean> place = new HashMap();
|
||||
public Map<Player, Boolean> broke = new HashMap();
|
||||
Anticheat plugin;
|
||||
private Map<Player, Boolean> place = new HashMap();
|
||||
private Map<Player, Boolean> broke = new HashMap();
|
||||
private Anticheat plugin;
|
||||
|
||||
public BlockManager(Anticheat plugin)
|
||||
{
|
||||
@@ -26,7 +24,7 @@ public class BlockManager
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
place.put(player, Boolean.valueOf(false));
|
||||
place.put(player, false);
|
||||
}
|
||||
}, 1/2L);
|
||||
}
|
||||
@@ -39,32 +37,32 @@ public class BlockManager
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
broke.put(player, Boolean.valueOf(false));
|
||||
broke.put(player, false);
|
||||
}
|
||||
}, 2L);
|
||||
}
|
||||
|
||||
public boolean justBroke(Player player)
|
||||
{
|
||||
if(broke.get(player) == null || broke.get(player) == false)
|
||||
if(broke.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return broke.get(player);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean justPlaced(Player player)
|
||||
{
|
||||
if(place.get(player) == null || place.get(player) == false)
|
||||
if(place.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return place.get(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BowManager {
|
||||
public Map<Player,Boolean> shot = new HashMap<Player,Boolean>();
|
||||
public Map<Player,Boolean> wind = new HashMap<Player,Boolean>();
|
||||
Anticheat plugin;
|
||||
private Map<Player,Boolean> shot = new HashMap<Player,Boolean>();
|
||||
private Map<Player,Boolean> wind = new HashMap<Player,Boolean>();
|
||||
private Anticheat plugin;
|
||||
|
||||
public BowManager(Anticheat plugin)
|
||||
{
|
||||
@@ -44,13 +44,13 @@ public class BowManager {
|
||||
public boolean hasShot(Player player)
|
||||
{
|
||||
//If the player has shot in the last .5 seconds
|
||||
if(shot.get(player) == null || shot.get(player) == false)
|
||||
if(shot.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return shot.get(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,17 +7,19 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ChatManager {
|
||||
Anticheat plugin;
|
||||
ChatColor red = ChatColor.RED;
|
||||
private Anticheat plugin;
|
||||
private static final ChatColor red = ChatColor.RED;
|
||||
private Map<Player,Integer> chatLevel = new HashMap<Player,Integer>();
|
||||
private Map<Player,Integer> kicks = new HashMap<Player,Integer>();
|
||||
private static final int CHAT_WARN_LEVEL = 7;
|
||||
private static final int CHAT_KICK_LEVEL = 10;
|
||||
private static final int CHAT_BAN_LEVEL = 3;
|
||||
|
||||
public ChatManager(Anticheat plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
private Map<Player,Integer> chatLevel = new HashMap<Player,Integer>();
|
||||
private Map<Player,Integer> kicks = new HashMap<Player,Integer>();
|
||||
|
||||
public void addChat(final Player player)
|
||||
{
|
||||
if(chatLevel.get(player) == null || chatLevel.get(player) == 0)
|
||||
@@ -25,6 +27,7 @@ public class ChatManager {
|
||||
chatLevel.put(player, 1);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
clear(player);
|
||||
@@ -46,11 +49,11 @@ public class ChatManager {
|
||||
|
||||
public void check(Player player, int amount)
|
||||
{
|
||||
if(amount >= 7)
|
||||
if(amount >= CHAT_WARN_LEVEL)
|
||||
{
|
||||
player.sendMessage(red+"Please stop flooding the server!");
|
||||
}
|
||||
if (amount >= 10)
|
||||
if (amount >= CHAT_KICK_LEVEL)
|
||||
{
|
||||
int kick = 0;
|
||||
if(kicks.get(player) == null || kicks.get(player) == 0)
|
||||
@@ -64,7 +67,7 @@ public class ChatManager {
|
||||
kicks.put(player, kick);
|
||||
}
|
||||
|
||||
if(kicks.get(player) <=3)
|
||||
if(kicks.get(player) <= CHAT_BAN_LEVEL)
|
||||
{
|
||||
player.kickPlayer(red+"Spamming, kick "+kick+"/3");
|
||||
plugin.getServer().broadcastMessage(red+player.getName()+" was kicked for spamming.");
|
||||
|
||||
@@ -6,9 +6,9 @@ import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ExemptManager {
|
||||
public Map<Player,Boolean> enter = new HashMap<Player,Boolean>();
|
||||
public Map<Player,Boolean> hit = new HashMap<Player,Boolean>();
|
||||
Anticheat plugin;
|
||||
private Map<Player,Boolean> enter = new HashMap<Player,Boolean>();
|
||||
private Map<Player,Boolean> hit = new HashMap<Player,Boolean>();
|
||||
private Anticheat plugin;
|
||||
|
||||
public ExemptManager(Anticheat plugin)
|
||||
{
|
||||
@@ -31,13 +31,13 @@ public class ExemptManager {
|
||||
|
||||
public boolean isEntering(Player player)
|
||||
{
|
||||
if(enter.get(player) == null || enter.get(player) == false)
|
||||
if(enter.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return enter.get(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,13 +56,13 @@ public class ExemptManager {
|
||||
|
||||
public boolean isHit(Player player)
|
||||
{
|
||||
if(hit.get(player) == null || hit.get(player) == false)
|
||||
if(hit.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return hit.get(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,12 @@ import java.util.Map;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FlyManager {
|
||||
public Map<Player,Integer> y = new HashMap<Player,Integer>();
|
||||
public Map<Player,Integer> yvl = new HashMap<Player,Integer>();
|
||||
private Map<Player,Integer> yvl = new HashMap<Player,Integer>();
|
||||
private static final int FLY_LIMIT = 4;
|
||||
|
||||
public FlyManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean checkFly(Player player)
|
||||
@@ -24,7 +25,7 @@ public class FlyManager {
|
||||
{
|
||||
yvl.put(player,yvl.get(player)+1);
|
||||
}
|
||||
if(yvl.get(player) >= 4)
|
||||
if(yvl.get(player) >= FLY_LIMIT)
|
||||
{
|
||||
yvl.put(player,1);
|
||||
return true;
|
||||
|
||||
@@ -6,8 +6,8 @@ import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FoodManager {
|
||||
public Map<Player,Boolean> start = new HashMap<Player,Boolean>();
|
||||
Anticheat plugin;
|
||||
private Map<Player,Boolean> start = new HashMap<Player,Boolean>();
|
||||
private Anticheat plugin;
|
||||
|
||||
public FoodManager(Anticheat plugin)
|
||||
{
|
||||
@@ -29,13 +29,13 @@ public class FoodManager {
|
||||
|
||||
public boolean justStarted(Player player)
|
||||
{
|
||||
if(start.get(player) == null || start.get(player) == false)
|
||||
if(start.get(player) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
return start.get(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,11 @@ import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class HealthManager {
|
||||
Anticheat plugin;
|
||||
|
||||
public Map<Player,Float> fall = new HashMap<Player,Float>();
|
||||
public Map<Player,Boolean> healed = new HashMap<Player,Boolean>();
|
||||
public Map<Player,Integer> health = new HashMap<Player,Integer>();
|
||||
public Map<Player,Integer> fallvl = new HashMap<Player,Integer>();
|
||||
private Anticheat plugin;
|
||||
private Map<Player,Float> fall = new HashMap<Player,Float>();
|
||||
private Map<Player,Boolean> healed = new HashMap<Player,Boolean>();
|
||||
private Map<Player,Integer> health = new HashMap<Player,Integer>();
|
||||
private Map<Player,Integer> fallvl = new HashMap<Player,Integer>();
|
||||
|
||||
public HealthManager(Anticheat plugin)
|
||||
{
|
||||
|
||||
@@ -6,8 +6,8 @@ import net.h31ix.anticheat.Anticheat;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ItemManager {
|
||||
public Map<Player,Boolean> drop = new HashMap<Player,Boolean>();
|
||||
Anticheat plugin;
|
||||
private Map<Player,Boolean> drop = new HashMap<Player,Boolean>();
|
||||
private Anticheat plugin;
|
||||
|
||||
public ItemManager(Anticheat plugin)
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@ package net.h31ix.anticheat.manage;
|
||||
import net.h31ix.anticheat.Anticheat;
|
||||
|
||||
public class LoginManager {
|
||||
Anticheat plugin;
|
||||
public boolean join;
|
||||
private Anticheat plugin;
|
||||
private boolean join;
|
||||
|
||||
public LoginManager(Anticheat plugin)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user