Permalink
Browse files

Ready to go for a release. ./pun

  • Loading branch information...
1 parent 00c2404 commit 501942e74488bf24927fdcb2b9deeb91b58faee3 @SuperSpyTX committed May 13, 2012
View
@@ -29,7 +29,7 @@
<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
- <finalName>${project.artifactId}-${project.version}</finalName>
+ <finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
@@ -4,6 +4,7 @@
import java.io.IOException;
import java.util.Date;
+import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -18,6 +19,7 @@
import somebody.is.madbro.listeners.CountryListener;
import somebody.is.madbro.listeners.KickListener;
import somebody.is.madbro.listeners.UpdateListener;
+import somebody.is.madbro.settings.Permissions;
import somebody.is.madbro.settings.Settings;
import somebody.is.madbro.settings.SettingsCore;
import somebody.is.madbro.toolbox.UtilityCore;
@@ -130,7 +132,9 @@ public int getValue() {
public void run() {
System.out.println("System has been enabled!");
+ sendToAllAdminsWithNotify(ChatColor.GREEN + "System has been enabled!");
Settings.enabled = true;
+ Settings.delayedStart = false;
}
}, Settings.startdelay * 20L);
System.out.println("System is now having a delayed start!");
@@ -175,6 +179,14 @@ public boolean onCommand(CommandSender sender, Command cmd,
args);
}
}
+
+ public void sendToAllAdminsWithNotify(String msg) {
+ for(Player pl : getServer().getOnlinePlayers()) {
+ if(Permissions.ADMIN_NOTIFY.getPermission(pl)) {
+ pl.sendMessage(Settings.prefix + msg);
+ }
+ }
+ }
public void debug(String msg, CommandSender sender) {
sender.sendMessage(Settings.prefix + msg);
@@ -1,5 +1,9 @@
package somebody.is.madbro.handlers;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -26,14 +30,13 @@ public boolean handle(CommandSender sender, Command cmd,
} catch (Exception e) {
// console!
}
-
if (args.length < 1) {
- antibot.getUtility().getBot().returnMotd(sender);
+ returnMotd(sender);
return true;
}
if (player != null) {
- if (!Permissions.ADMIN_BASIC.getPermission(player, sender)) {
+ if (!Permissions.ADMIN.getPermission(player, sender)) {
return true;
}
}
@@ -90,11 +93,11 @@ public boolean handle(CommandSender sender, Command cmd,
}
if (args[0].compareToIgnoreCase("run") == 0) {
if (Permissions.ADMIN_ATTACK.getPermission(player, sender)) {
- if (!antibot.getDataTrack().getBotTracker().reanibo) {
+ if (!antibot.getDataTrack().getBotTracker().reanibo && Settings.whiteList) {
if (Settings.notify) {
antibot.getServer()
.broadcastMessage(
- "\247f[\247bAntiBot\247f] \247cOh no! A minecraft bot invasion has began. Connection Throttling: \247aEnabled");
+ Settings.prefix + "\247cOh no! A minecraft bot invasion has began. Connection Throttling: \247aEnabled");
}
antibot.getDataTrack().getBotTracker().reanibo = true;
antibot.getUtility().getDebug().debug("Tripswitched!");
@@ -294,11 +297,149 @@ public boolean handle(CommandSender sender, Command cmd,
}
if (args[0].compareToIgnoreCase("version") == 0) {
- antibot.getUtility().getBot().returnMotd(sender);
+ returnMotd(sender);
return true;
}
sender.sendMessage(Settings.prefix + "Unknown system command.");
return false;
}
+
+ public String returnStatus() {
+ if(!Settings.enabled) {
+ if(Settings.delayedStart) {
+ return ChatColor.RED + "Disabled" + " (" + ChatColor.YELLOW + "Delayed Start" + ChatColor.WHITE + ")";
+ } else {
+ return ChatColor.RED + "Disabled";
+ }
+ } else {
+ return ChatColor.GREEN + "Enabled";
+ }
+ }
+
+ public void returnMotd(CommandSender sender) {
+ antibot.setInstall(new Date(antibot.getInstalldate()));
+ SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
+ sender.sendMessage(Settings.prefix + "AntiBot " + antibot.getVersion()
+ + " - Coded By .SuPaH sPii");
+ sender.sendMessage(Settings.prefix + "Inspired by Wolflink289 <3");
+ sender.sendMessage(Settings.prefix
+ + "Continued inspiration by Evenprime & Fafaffy <3");
+ //return status if player has admin permissions.
+ Player player = null;
+ try {
+ player = (Player) sender;
+ } catch (Exception e) {
+ // console!
+ }
+ if(Permissions.ADMIN_NOTIFY.getPermission(player)) {
+ sender.sendMessage(Settings.prefix + "System Status: " + returnStatus());
+ }
+ Random random = new Random();
+ switch (random.nextInt(20)) {
+ case 0:
+ sender.sendMessage(Settings.prefix + "System Installed on "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 1:
+ sender.sendMessage(Settings.prefix
+ + "Keeping Pwnage out of game since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 2:
+ sender.sendMessage(Settings.prefix + "Combatting spam since "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 3:
+ sender.sendMessage(Settings.prefix
+ + "Supporting PWN4G3 Bots since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 4:
+ sender.sendMessage(Settings.prefix
+ + "Running PWN4G3 Bots to the void since "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 5:
+ sender.sendMessage(Settings.prefix + "Making people mad since "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 6:
+ sender.sendMessage(Settings.prefix + "Trolling spammers since "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 7:
+ sender.sendMessage(Settings.prefix
+ + "Supporting Wolflink289's idea since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 8:
+ sender.sendMessage(Settings.prefix
+ + "Protecting this server since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 9:
+ sender.sendMessage(Settings.prefix
+ + "All lights turned green since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 10:
+ sender.sendMessage(Settings.prefix
+ + "Corrupting ability to spam since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 11:
+ sender.sendMessage(Settings.prefix
+ + "Minecraft PWN4G3 Dun goof on " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 12:
+ sender.sendMessage(Settings.prefix
+ + "Making .SuPaH sPii proud since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 13:
+ sender.sendMessage(Settings.prefix + "Injected the Vaccine on "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 14:
+ sender.sendMessage(Settings.prefix
+ + "Giving AIDS to spammers since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 15:
+ sender.sendMessage(Settings.prefix
+ + "Turning spammer users to WTF faces since "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 16:
+ sender.sendMessage(Settings.prefix + "Chinese secret happened on "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ case 17:
+ sender.sendMessage(Settings.prefix
+ + "Been in Slim Shady's world since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 18:
+ sender.sendMessage(Settings.prefix
+ + "Making other communities jelly since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 19:
+ sender.sendMessage(Settings.prefix
+ + "Didn't have to buy anything since " + ChatColor.GREEN
+ + sdf.format(antibot.getInstall()));
+ break;
+ case 20:
+ sender.sendMessage(Settings.prefix
+ + "Making Reanimation shit his pants since "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ default:
+ sender.sendMessage(Settings.prefix + "System Installed on "
+ + ChatColor.GREEN + sdf.format(antibot.getInstall()));
+ break;
+ }
+ }
}
@@ -3,6 +3,7 @@
import org.bukkit.event.player.PlayerJoinEvent;
import somebody.is.madbro.AntiBot;
+import somebody.is.madbro.settings.Permissions;
import somebody.is.madbro.settings.Settings;
public class CountryBanHandler {
@@ -14,6 +15,10 @@ public CountryBanHandler(AntiBot instance) {
}
public void handle(PlayerJoinEvent event) {
+ // add countrybans bypass permissions.
+ if(Permissions.COUNTRYBAN.getPermission(event.getPlayer())) {
+ return;
+ }
String IP = event.getPlayer().getAddress().toString().split(":")[0].replace("/", "");
// check against countrybans!
antibot.getUtility().getDebug().debug("Countrybans size " + antibot.getDataTrack().getCountryTracker().countryBans.size());
@@ -16,7 +16,7 @@ public CountryListener(AntiBot instance) {
antibot = instance;
}
- @EventHandler(priority = EventPriority.MONITOR)
+ @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent event) {
if (!Settings.enabled || antibot.getDataTrack().getCountryTracker().countryBans.size() < 1 || !Settings.geoIP) {
return;
@@ -39,6 +39,12 @@ public void handle(PlayerJoinEvent event) {
+ "\247a"
+ "Check at http://goo.gl/FuMrd");
}
+ // priority delayed start message
+ if(Settings.delayedStart && !Settings.enabled) {
+ if(Permissions.ADMIN_NOTIFY.getPermission(event.getPlayer())) {
+ event.getPlayer().sendMessage(Settings.prefix + "\247c" + "System is currently having a " + "\247e" + "delayed start.");
+ }
+ }
}
}
@@ -14,9 +14,8 @@
COUNTRYBAN("countryban", 1),
//admin level permissions
- ADMIN_ROOT("admin.root" , 3),
- ADMIN_PLUS("admin.plus", 2),
- ADMIN_BASIC("admin.basic", 1),
+ ADMIN_PLUS("admin.plus" , 3),
+ ADMIN("admin", 2),
//individual permissions.
ADMIN_RELOAD("admin.reload", 3),
@@ -25,11 +24,7 @@
ADMIN_NOTIFY("admin.notify", 2),
ADMIN_FLUSH("admin.flush", 2),
ADMIN_CHANGECONF("admin.changeconf", 3),
- ADMIN_TOGGLE("admin.toggle", 3),
- @Deprecated
- ADMIN_REMKICKPLAYER("admin.remkickplayer", -1),
- @Deprecated
- ADMIN("admin", -1);
+ ADMIN_TOGGLE("admin.toggle", 3);
String perm = "";
String baseperm = "";
@@ -42,7 +37,7 @@
}
public boolean isLevelPermission() {
- return baseperm == ADMIN_ROOT.baseperm || baseperm == ADMIN_PLUS.baseperm || baseperm == ADMIN_BASIC.baseperm;
+ return baseperm == ADMIN.baseperm || baseperm == ADMIN_PLUS.baseperm;
}
public boolean getPermission(Player pl, CommandSender sender) {
@@ -74,18 +69,14 @@ public boolean getPermission(Player pl) {
return false;
}
- if(ADMIN_ROOT.getPermission(pl) && level >= 3) {
+ if(ADMIN.getPermission(pl) && level >= 3) {
return true;
}
if(ADMIN_PLUS.getPermission(pl) && level < 3) {
return true;
}
- if(ADMIN_BASIC.getPermission(pl) && level < 2) {
- return true;
- }
-
return false;
} else {
return true; // console.
Oops, something went wrong.

0 comments on commit 501942e

Please sign in to comment.