mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Downloads updates from dev.bukkit.org, also switched back to ChatEvent to keep compatibility with most servers.
This commit is contained in:
1 parent
c74bd5633e
commit
377ef0f624
2 files changed
+36
-4
No files matched your search
@@ -46,6 +46,7 @@ public class Anticheat extends JavaPlugin
|
|||||||
private static AnticheatManager manager;
|
private static AnticheatManager manager;
|
||||||
private static List<Listener> eventList = new ArrayList<Listener>();
|
private static List<Listener> eventList = new ArrayList<Listener>();
|
||||||
private static boolean update = false;
|
private static boolean update = false;
|
||||||
|
private static String updateUrl = null;
|
||||||
private static final int BYTE_SIZE = 1024;
|
private static final int BYTE_SIZE = 1024;
|
||||||
private static Logger logger;
|
private static Logger logger;
|
||||||
private static Configuration config;
|
private static Configuration config;
|
||||||
@@ -138,6 +139,7 @@ public class Anticheat extends JavaPlugin
|
|||||||
{
|
{
|
||||||
logger.log(Level.INFO, "Downloading the new update...");
|
logger.log(Level.INFO, "Downloading the new update...");
|
||||||
}
|
}
|
||||||
|
getUrl();
|
||||||
File file = new File("plugins/" + updateFolder);
|
File file = new File("plugins/" + updateFolder);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
{
|
{
|
||||||
@@ -151,7 +153,7 @@ public class Anticheat extends JavaPlugin
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
saveFile(file.getCanonicalPath() + "/AntiCheat.jar", "http://dl.dropbox.com/u/38228324/AntiCheat.jar");
|
saveFile(file.getCanonicalPath() + "/AntiCheat.jar", updateUrl);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
@@ -209,7 +211,7 @@ public class Anticheat extends JavaPlugin
|
|||||||
logger.log(Level.INFO, "Data for " + player.getName() + " re-applied from flatfile");
|
logger.log(Level.INFO, "Data for " + player.getName() + " re-applied from flatfile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try
|
/*try
|
||||||
{
|
{
|
||||||
if(this.getServer().getVersion().split("-").length >= 7)
|
if(this.getServer().getVersion().split("-").length >= 7)
|
||||||
{
|
{
|
||||||
@@ -229,7 +231,7 @@ public class Anticheat extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex){ }
|
catch(Exception ex){ }*/
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
logger.log(Level.INFO, "Finished loading.");
|
logger.log(Level.INFO, "Finished loading.");
|
||||||
@@ -378,6 +380,36 @@ public class Anticheat extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getUrl()
|
||||||
|
{
|
||||||
|
URL url;
|
||||||
|
URLConnection urlConn;
|
||||||
|
InputStreamReader inStream = null;
|
||||||
|
BufferedReader buff;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
url = new URL("http://dl.dropbox.com/u/38228324/anticheatUrl.txt");
|
||||||
|
urlConn = url.openConnection();
|
||||||
|
inStream = new InputStreamReader(urlConn.getInputStream());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
buff = new BufferedReader(inStream);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updateUrl = "http://dev.bukkit.org/media/files/"+buff.readLine();
|
||||||
|
urlConn = null;
|
||||||
|
inStream = null;
|
||||||
|
buff.close();
|
||||||
|
buff = null;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
System.out.println(updateUrl);
|
||||||
|
}
|
||||||
|
|
||||||
public static Anticheat getPlugin()
|
public static Anticheat getPlugin()
|
||||||
{
|
{
|
||||||
return manager.getPlugin();
|
return manager.getPlugin();
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class PlayerListener extends EventListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if (checkManager.willCheck(player, CheckType.SPAM) && config.chatSpam())
|
if (checkManager.willCheck(player, CheckType.SPAM) && config.chatSpam())
|
||||||
|
|||||||
Reference in new issue
Block a user