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

v4.0.5 -- 1.8.3 Support (Bukkit, Spigot), Language File #13

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
/.settings/*
/bin/*
/.classpath
/.project
/.project
/target/

*.jar

*.jar

dl/GeoIP.dat.gz
Empty file modified dl/GeoIP.dat.gz
100644 → 100755
Empty file.
Empty file modified dl/update.txt
100644 → 100755
Empty file.
Empty file modified lib/AntiCheat.jar
100644 → 100755
Empty file.
155 changes: 76 additions & 79 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,84 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>


<groupId>com.superspytx.ab</groupId>
<artifactId>AntiBot</artifactId>
<packaging>jar</packaging>
<name>AntiBot</name>
<version>4.0.4</version>
<url>http://dev.bukkit.org/server-mods/antibot</url>
<description>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>


<groupId>com.superspytx.ab</groupId>
<artifactId>AntiBot</artifactId>
<packaging>jar</packaging>
<name>AntiBot</name>
<version>4.0.5</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 and Paradigm.
</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<scm>
<connection>scm:git:git://github.com/SuperSpyTX/AntiBot.git</connection>
<developerConnection>scm:git:ssh://[email protected]:SuperSpyTX/AntiBot.git</developerConnection>
<url>http://github.com/SuperSpyTX/AntiBot</url>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/SuperSpyTX/AntiBot/issues</url>
</issueManagement>

<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<finalName>${project.artifactId}-${project.version}-SNAPSHOT</finalName>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>

</plugins>

<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}/</directory>
<includes>
<include>plugin.yml</include>
</includes>
</resource>
</resources>

</build>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.7-R1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.h31ix.anticheat</groupId>
<artifactId>AntiCheat</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/AntiCheat.jar</systemPath>
</dependency>
</dependencies>

<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public</url>
</repository>
</repositories>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<scm>
<connection>scm:git:git://github.com/SuperSpyTX/AntiBot.git</connection>
<developerConnection>scm:git:ssh://[email protected]:SuperSpyTX/AntiBot.git</developerConnection>
<url>http://github.com/SuperSpyTX/AntiBot</url>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/SuperSpyTX/AntiBot/issues</url>
</issueManagement>

<build>
<sourceDirectory>${basedir}/src</sourceDirectory>
<finalName>${project.artifactId}-${project.version}-SNAPSHOT</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>

</build>

<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8-R0.1-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.gravitydevelopment.anticheat</groupId>
<artifactId>AntiCheat</artifactId>
<version>2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>anticheat</id>
<url>http://repo.gravitydevelopment.net/</url>
</repository>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public</url>
</repository>
</repositories>

</project>
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified src/com/superspytx/ab/AB.java
100644 → 100755
Empty file.
78 changes: 75 additions & 3 deletions src/com/superspytx/ab/AntiBot.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package com.superspytx.ab;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;

import com.superspytx.ab.Metrics.Graph;
import com.superspytx.ab.abs.CommandEvent;
import com.superspytx.ab.callunits.CallUnit;
import com.superspytx.ab.handlers.Handlers;
import com.superspytx.ab.settings.Language;
import com.superspytx.ab.settings.Lang;
import com.superspytx.ab.settings.Permissions;
import com.superspytx.ab.settings.Settings;
import com.superspytx.ab.settings.SettingsCore;
Expand All @@ -28,13 +34,16 @@ public class AntiBot extends JavaPlugin {
private static boolean development;
private Updates updates;

public static YamlConfiguration LANG;
public static File LANG_FILE;

public void onDisable() {
Bukkit.getScheduler().cancelTasks(this);
}

public void onEnable() {
instance = this;

loadLang();
/* Make plugin directory if it doesn't exist.*
* This should fix the GeoIP problem */
if (!getDataFolder().exists()) getDataFolder().mkdir();
Expand Down Expand Up @@ -126,7 +135,7 @@ public int getValue() {
public void run() {
AB.log("System has been enabled!");
for (Player pl : Bukkit.getOnlinePlayers()) {
if (Permissions.ADMIN_NOTIFY.getPermission(pl)) pl.sendMessage(Language.prefix + ChatColor.GREEN + "System has been enabled!");
if (Permissions.ADMIN_NOTIFY.getPermission(pl)) pl.sendMessage(Lang.PREFIX.toString() + ChatColor.GREEN + "System has been enabled!");
}
Settings.enabled = true;
Settings.delayedStart = false;
Expand Down Expand Up @@ -209,6 +218,9 @@ public static void reload() {
for (Player pl : AB.getInstance().getServer().getOnlinePlayers()) {
GD.getPI(pl).ab_alreadyin = true;
}

// maybe reload lang?

}

public static void debug(String e) {
Expand All @@ -231,4 +243,64 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
return false;
}

/**
* Load the lang.yml file.
* @return The lang.yml config.
*/
public void loadLang() {
File lang = new File(getDataFolder(), "language.yml");
if (!lang.exists()) {
try {
getDataFolder().mkdir();
lang.createNewFile();
InputStream defConfigStream = this.getResource("language.yml");
if (defConfigStream != null) {
@SuppressWarnings("deprecation")
YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
defConfig.save(lang);
Lang.setFile(defConfig);
return;
}
} catch(IOException e) {
e.printStackTrace(); // So they notice
getLogger().severe("[PluginName] Couldn't create language file.");
getLogger().severe("[PluginName] This is a fatal error. Now disabling");
Bukkit.getPluginManager().disablePlugin(this);
}
}
YamlConfiguration conf = YamlConfiguration.loadConfiguration(lang);
for(Lang item:Lang.values()) {
if (conf.getString(item.getPath()) == null) {
conf.set(item.getPath(), item.getDefault());
}
}
Lang.setFile(conf);
AntiBot.LANG = conf;
AntiBot.LANG_FILE = lang;
try {
conf.save(getLangFile());
} catch(IOException e) {
getLogger().log(Level.WARNING, "PluginName: Failed to save lang.yml.");
getLogger().log(Level.WARNING, "PluginName: Report this stack trace to <your name>.");
e.printStackTrace();
Bukkit.getPluginManager().disablePlugin(this);
}
}

/**
* Gets the lang.yml config.
* @return The lang.yml config.
*/
public YamlConfiguration getLang() {
return LANG;
}

/**
* Get the lang.yml file.
* @return The lang.yml file.
*/
public File getLangFile() {
return LANG_FILE;
}

}
2 changes: 1 addition & 1 deletion src/com/superspytx/ab/Metrics.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ private void postPlugin(final boolean isPing) throws IOException {
data.append(encode("guid")).append('=').append(encode(guid));
encodeDataPair(data, "version", description.getVersion());
encodeDataPair(data, "server", Bukkit.getVersion());
encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length));
encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().size()));
encodeDataPair(data, "revision", String.valueOf(REVISION));

// If we're pinging, append it
Expand Down
Empty file modified src/com/superspytx/ab/Updates.java
100644 → 100755
Empty file.
Empty file modified src/com/superspytx/ab/abs/CommandEvent.java
100644 → 100755
Empty file.
Empty file modified src/com/superspytx/ab/abs/EventAction.java
100644 → 100755
Empty file.
Empty file modified src/com/superspytx/ab/abs/Handler.java
100644 → 100755
Empty file.
5 changes: 5 additions & 0 deletions src/com/superspytx/ab/abs/PI.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import com.superspytx.ab.handlers.Handlers;

public class PI {
Expand Down Expand Up @@ -40,18 +42,21 @@ public PI(Player pl) {
this.pl = pl;
}

@SuppressWarnings("deprecation")
public PI(String pl) {
this.b_connectfor = System.currentTimeMillis();
this.p_name = pl;
this.pl = Bukkit.getPlayerExact(pl);
}

@SuppressWarnings("deprecation")
public boolean updateOnlineStatus() {
pl = Bukkit.getPlayerExact(p_name);
if (pl != null) this.clean();
return (pl != null);
}

@SuppressWarnings("deprecation")
public void updateStatus() {
if (pl == null) pl = Bukkit.getPlayerExact(p_name);
}
Expand Down
Empty file modified src/com/superspytx/ab/abs/Puzzle.java
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions src/com/superspytx/ab/api/AntiBotAPI.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import com.superspytx.ab.AB;
import com.superspytx.ab.abs.PI;
import com.superspytx.ab.handlers.Handlers;
import com.superspytx.ab.settings.Language;
import com.superspytx.ab.settings.Lang;
import com.superspytx.ab.tils.CaptchaTils;
import com.superspytx.ab.workflow.GD;

Expand Down Expand Up @@ -164,7 +165,7 @@ public static void autoSolvePuzzle(Player player) throws AntiBotAPIException {
pli.cp_haspuzzle = false;
Bukkit.broadcastMessage("<" + pli.pl.getDisplayName() + "> " + pli.cs_lsm);
pli.resetSpamData();
pli.pl.sendMessage(Language.prefix + '\247' + "a" + "Correct! Thanks for not being a bot. You can now speak again.");
pli.pl.sendMessage(Lang.PREFIX.toString() + '\247' + "a" + "Correct! Thanks for not being a bot. You can now speak again.");
}

/**
Expand Down
Empty file modified src/com/superspytx/ab/api/AntiBotAPIException.java
100644 → 100755
Empty file.
Empty file modified src/com/superspytx/ab/callunits/CallUnit.java
100644 → 100755
Empty file.
Empty file modified src/com/superspytx/ab/callunits/ChatUnit.java
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions src/com/superspytx/ab/callunits/GarbageUnit.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.superspytx.ab.settings.Language;

import com.superspytx.ab.settings.Lang;
import com.superspytx.ab.workflow.GD;

public class GarbageUnit extends CallUnit {

@EventHandler
public void kick(PlayerKickEvent e) {
if (e.getReason().equalsIgnoreCase(Language.kickMsg)) e.setLeaveMessage(null);
if (e.getReason().equalsIgnoreCase(Lang.KICKMSG.toString())) e.setLeaveMessage(null);

GD.unregisterPI(e.getPlayer());
}
Expand Down
Loading