Navigation Menu

Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
Package rename, AntiBot 3.0 snapshot switch, added Login Delay.
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSpyTX committed Aug 6, 2012
1 parent aa08994 commit 10d5087
Show file tree
Hide file tree
Showing 34 changed files with 410 additions and 324 deletions.
6 changes: 5 additions & 1 deletion plugin.yml
@@ -1,11 +1,12 @@
name: AntiBot
main: me.freebuild.superspytx.AntiBot
main: me.freebuild.superspytx.ab.AntiBot
version: ${project.version}
description: The ultimate spam protection for Minecraft.
softdepend: [AntiCheat]
commands:
antibot:
description: Usable Antibot Commands
aliases: [ab]
usage: |
/<command> help - Help menu on the AntiBot system.
permissions:
Expand All @@ -24,6 +25,9 @@ permissions:
antibot.countryban:
default: false
description: Users with this permission can join the server if their home country is banned from the server.
antibot.logindelay:
default: false
description: Should users be able to log back into the server rapidly?
antibot.admin:
default: false
description: Basic Permissions to the Antibot system.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -8,7 +8,7 @@
<packaging>jar</packaging>
<name>AntiBot</name>
<!--<version>2.9</version>-->
<version>2.9.1</version>
<version>3.0-SNAPSHOT</version>
<url>http://dev.bukkit.org/server-mods/antibot</url>
<description>
The Ultimate Anti Spam protection plugin for Minecraft. It trolls users who use login spam tools like PWN4G3.
Expand Down Expand Up @@ -68,7 +68,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.2.5-R4.0</version>
<version>1.3.1-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.h31ix.anticheat</groupId>
Expand Down
@@ -1,21 +1,21 @@
package me.freebuild.superspytx;
package me.freebuild.superspytx.ab;

import java.io.File;
import java.io.IOException;
import java.util.Date;

import me.freebuild.superspytx.Metrics.Graph;
import me.freebuild.superspytx.datatrack.DataTrackCore;
import me.freebuild.superspytx.handlers.HandlerCore;
import me.freebuild.superspytx.listeners.BotListener;
import me.freebuild.superspytx.listeners.ChatListener;
import me.freebuild.superspytx.listeners.CountryListener;
import me.freebuild.superspytx.listeners.KickListener;
import me.freebuild.superspytx.listeners.UpdateListener;
import me.freebuild.superspytx.settings.Permissions;
import me.freebuild.superspytx.settings.Settings;
import me.freebuild.superspytx.settings.SettingsCore;
import me.freebuild.superspytx.toolbox.UtilityCore;
import me.freebuild.superspytx.ab.Metrics.Graph;
import me.freebuild.superspytx.ab.datatrack.DataTrackCore;
import me.freebuild.superspytx.ab.handlers.HandlerCore;
import me.freebuild.superspytx.ab.listeners.BotListener;
import me.freebuild.superspytx.ab.listeners.ChatListener;
import me.freebuild.superspytx.ab.listeners.LoginListener;
import me.freebuild.superspytx.ab.listeners.KickListener;
import me.freebuild.superspytx.ab.listeners.UpdateListener;
import me.freebuild.superspytx.ab.settings.Permissions;
import me.freebuild.superspytx.ab.settings.Settings;
import me.freebuild.superspytx.ab.settings.SettingsCore;
import me.freebuild.superspytx.ab.toolbox.UtilityCore;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
Expand All @@ -29,7 +29,7 @@ public class AntiBot extends JavaPlugin
// listeners
private BotListener botlistener = null;
private ChatListener chatlistener = null;
private CountryListener countrylistener = null;
private LoginListener loginlistener = null;
private KickListener kicklistener = null;
private UpdateListener updatelistener = null;

Expand Down Expand Up @@ -73,7 +73,7 @@ public void onEnable()
// listeners
botlistener = new BotListener(this);
chatlistener = new ChatListener(this);
countrylistener = new CountryListener(this);
loginlistener = new LoginListener(this);
kicklistener = new KickListener(this);
updatelistener = new UpdateListener(this);

Expand All @@ -97,7 +97,7 @@ public void onEnable()
@Override
public int getValue()
{
return getDataTrack().getBotTracker().spambotsblocked;
return getDataTrack().getLoginTracker().spambotsblocked;
}

});
Expand Down Expand Up @@ -130,7 +130,7 @@ public int getValue()
@Override
public int getValue()
{
return getDataTrack().getCountryTracker().countryusersblocked;
return getDataTrack().getLoginTracker().countryusersblocked;
}

});
Expand Down Expand Up @@ -183,13 +183,13 @@ public void run()
updates.run();
}
}
}, 60L, 12000L);
}, 140L, 12000L);
}

// register listeners
getServer().getPluginManager().registerEvents(botlistener, this);
getServer().getPluginManager().registerEvents(chatlistener, this);
getServer().getPluginManager().registerEvents(countrylistener, this);
getServer().getPluginManager().registerEvents(loginlistener, this);
getServer().getPluginManager().registerEvents(kicklistener, this);
getServer().getPluginManager().registerEvents(updatelistener, this);

Expand All @@ -198,11 +198,6 @@ public void run()
version = pdfFile.getVersion();
System.out.println(pdfFile.getName() + " version " + getVersion() + " is enabled!");
boolean development = (version.contains("-SNAPSHOT"));
if ((new File(getDataFolder() + "c.properties")).exists())
{
System.out.println("[SEVERE] AntiBot has received a new (assfuck) overhaul in the configuration. You are currently now on defaults.");
System.out.println("[SEVERE] You will continue seeing this message until you remove c.properties in the AntiBot plugin folder.");
}

if (development)
{
Expand All @@ -217,14 +212,7 @@ public void run()

public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if (sender instanceof Player)
{
return getHandler().getCommands().handle(sender, cmd, commandLabel, args);
}
else
{
return getHandler().getCommands().handle(sender, cmd, commandLabel, args);
}
return getHandler().getCommands().handle(sender, cmd, commandLabel, args);
}

public void sendToAllAdminsWithNotify(String msg)
Expand Down
@@ -1,4 +1,4 @@
package me.freebuild.superspytx;
package me.freebuild.superspytx.ab;

/*
* Copyright 2011 Tyler Blair. All rights reserved.
Expand Down
@@ -1,11 +1,11 @@
package me.freebuild.superspytx;
package me.freebuild.superspytx.ab;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import me.freebuild.superspytx.settings.Settings;
import me.freebuild.superspytx.ab.settings.Settings;

public class Updates implements Runnable
{
Expand Down
@@ -1,9 +1,13 @@
package me.freebuild.superspytx.datatrack;
package me.freebuild.superspytx.ab.datatrack;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;

import me.freebuild.superspytx.AntiBot;
import org.bukkit.entity.Player;

import me.freebuild.superspytx.ab.AntiBot;

public class ChatDataTrack
{
Expand All @@ -26,6 +30,9 @@ public ChatDataTrack(AntiBot instance)
public int chatflowscurrent = 0;
public Long lasttime = 0L;
public boolean chatLockedDown = false;

public Map<Player, Puzzle> puzzles = new HashMap<Player, Puzzle>();
public List<String> solvedplayers = new CopyOnWriteArrayList<String>();

public boolean checkConnection(String usr)
{
Expand Down
@@ -1,29 +1,25 @@
package me.freebuild.superspytx.datatrack;
package me.freebuild.superspytx.ab.datatrack;

import org.bukkit.entity.Player;

import me.freebuild.superspytx.AntiBot;
import me.freebuild.superspytx.handlers.BotHandler;
import me.freebuild.superspytx.handlers.chat.ChatSpamHandler;
import me.freebuild.superspytx.ab.AntiBot;
import me.freebuild.superspytx.handlers.ab.chat.ChatSpamHandler;
import me.freebuild.superspytx.handlers.ab.login.BotHandler;

public class DataTrackCore
{

private AntiBot antibot = null;

// trackers
private BotDataTrack botdata = null;
private LoginDataTrack botdata = null;
private ChatDataTrack chatdata = null;
private CountryDataTrack countrydata = null;
private CaptchaDataTrack captchadata = null;

public DataTrackCore(AntiBot instance)
{
antibot = instance;
botdata = new BotDataTrack(instance);
botdata = new LoginDataTrack(instance);
chatdata = new ChatDataTrack(instance);
countrydata = new CountryDataTrack(instance);
captchadata = new CaptchaDataTrack(instance);
}

public PlayerData getPlayer(String username, ChatSpamHandler thi)
Expand All @@ -41,7 +37,7 @@ public Puzzle getPuzzle(Player player)
return new Puzzle(antibot, player);
}

public BotDataTrack getBotTracker()
public LoginDataTrack getLoginTracker()
{
return botdata;
}
Expand All @@ -51,14 +47,4 @@ public ChatDataTrack getChatTracker()
return chatdata;
}

public CountryDataTrack getCountryTracker()
{
return countrydata;
}

public CaptchaDataTrack getCaptchaTracker()
{
return captchadata;
}

}
@@ -1,22 +1,23 @@
package me.freebuild.superspytx.datatrack;
package me.freebuild.superspytx.ab.datatrack;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;

import me.freebuild.superspytx.AntiBot;
import me.freebuild.superspytx.settings.Permissions;
import me.freebuild.superspytx.settings.Settings;
import me.freebuild.superspytx.ab.AntiBot;
import me.freebuild.superspytx.ab.settings.Permissions;
import me.freebuild.superspytx.ab.settings.Settings;

import org.bukkit.entity.Player;

public class BotDataTrack
public class LoginDataTrack
{

public AntiBot botclass = null;

public BotDataTrack(AntiBot instance)
public LoginDataTrack(AntiBot instance)
{
botclass = instance;
}
Expand All @@ -33,6 +34,17 @@ public BotDataTrack(AntiBot instance)
public int botcts = 0;
public boolean reanibo = false;

// Countrybans
public int countryusersblocked = 0;

// Countrybans
public List<String> countryBans = new CopyOnWriteArrayList<String>();

// Login Delay
public Map<String, Long> lastlogin = new HashMap<String, Long>();
public Map<String, Long> loginholds = new HashMap<String, Long>();
public Map<String, Integer> loginsets = new HashMap<String, Integer>();

public void trackPlayer(Player e, String IP)
{
if (Permissions.JOIN.getPermission(e))
Expand Down Expand Up @@ -123,17 +135,17 @@ public void removeConnected(String playerName)
public void kickConnected()
{
// int kicked = 0;
botclass.getUtility().getDebug().debug("Kicking players with method #1 Size: " + botclass.getDataTrack().getBotTracker().connected.size());
for (String pl : botclass.getDataTrack().getBotTracker().connected)
botclass.getUtility().getDebug().debug("Kicking players with method #1 Size: " + botclass.getDataTrack().getLoginTracker().connected.size());
for (String pl : botclass.getDataTrack().getLoginTracker().connected)
{
try
{
botclass.getUtility().getDebug().debug("Checking if kick possible for player..." + pl);
Player p2 = botclass.getServer().getPlayerExact(pl);
if(p2 == null)

if (p2 == null)
continue;

if (!botclass.getDataTrack().getChatTracker().checkConnection(pl))
{
if (!Settings.forceCaptchaOnBotSpam)
Expand All @@ -147,20 +159,20 @@ public void kickConnected()
botclass.getHandler().getCaptchaHandler().playerNeedsPuzzling(p2);
}

botclass.getDataTrack().getBotTracker().spambotsblocked += 1;
botclass.getDataTrack().getLoginTracker().spambotsblocked += 1;
if (Settings.banUsers && (!Settings.forceCaptchaOnBotSpam || !Settings.captchaEnabled))
{
botclass.getDataTrack().getBotTracker().autoipkick.add(p2.getAddress().toString().split(":")[0]);
botclass.getDataTrack().getBotTracker().autokick.add(pl);
botclass.getDataTrack().getLoginTracker().autoipkick.add(p2.getAddress().toString().split(":")[0]);
botclass.getDataTrack().getLoginTracker().autokick.add(pl);
}
// kicked += 1;
botclass.getUtility().getDebug().debug("Kicked player with method #1");
botclass.getUtility().getDebug().debug("We now have autokick: " + botclass.getDataTrack().getBotTracker().autokick.size() + " ip: " + botclass.getDataTrack().getBotTracker().autoipkick.size());
botclass.getUtility().getDebug().debug("We now have autokick: " + botclass.getDataTrack().getLoginTracker().autokick.size() + " ip: " + botclass.getDataTrack().getLoginTracker().autoipkick.size());
}
else
{
botclass.getUtility().getDebug().debug("Not possible for player ...." + pl);
botclass.getDataTrack().getBotTracker().connected.remove(pl);
botclass.getDataTrack().getLoginTracker().connected.remove(pl);
}
}
catch (Exception e)
Expand All @@ -170,7 +182,7 @@ public void kickConnected()
botclass.getUtility().getDebug().debug("Failed to kick: " + pl);
}
}
botclass.getDataTrack().getBotTracker().connected.clear();
botclass.getDataTrack().getLoginTracker().connected.clear();

// kick players if the above method doesn't work :|
/*
Expand Down
@@ -1,8 +1,8 @@
package me.freebuild.superspytx.datatrack;
package me.freebuild.superspytx.ab.datatrack;

import me.freebuild.superspytx.AntiBot;
import me.freebuild.superspytx.listeners.BotListener;
import me.freebuild.superspytx.settings.Settings;
import me.freebuild.superspytx.ab.AntiBot;
import me.freebuild.superspytx.ab.listeners.BotListener;
import me.freebuild.superspytx.ab.settings.Settings;

public class PlayerData
{
Expand Down
@@ -1,11 +1,11 @@
package me.freebuild.superspytx.datatrack;
package me.freebuild.superspytx.ab.datatrack;

import java.util.Random;

import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

import me.freebuild.superspytx.AntiBot;
import me.freebuild.superspytx.ab.AntiBot;

public class Puzzle
{
Expand Down

0 comments on commit 10d5087

Please sign in to comment.