Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanBH committed Nov 16, 2019
1 parent 0bceefa commit 751de18
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/AntiBot_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.noodles.antibot</groupId>
<artifactId>AntiBotMain</artifactId>
<version>1.1</version>
<version>1.2</version>
<packaging>jar</packaging>

<name>AntiBot</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package net.noodles.antibot.antibotmain;

import net.noodles.antibot.antibotmain.Utils.Logger;
import net.noodles.antibot.antibotmain.Utils.MetricsLite;
import net.noodles.antibot.antibotmain.Utils.Settings;
import net.noodles.antibot.antibotmain.Utils.UpdateChecker;
import org.bukkit.plugin.java.*;
import org.bukkit.event.*;
import java.io.File;

public class AntiBotMain extends JavaPlugin implements Listener
public class AntiBot extends JavaPlugin implements Listener
{
public static AntiBotMain plugin;
private UpdateCheckerAntiBot checker;
private static AntiBotMain instance;
public static AntiBot plugin;
private UpdateChecker checker;
private static AntiBot instance;


public void onEnable() {
Expand All @@ -21,12 +25,12 @@ public void onEnable() {
Logger.log(Logger.LogLevel.OUTLINE, "********************");
Logger.log(Logger.LogLevel.INFO, "Plugin Loading...");
Logger.log(Logger.LogLevel.INFO, "Registering Managers...");
AntiBotMain.plugin = this;
AntiBot.plugin = this;
instance = this;
MetricsLite metrics = new MetricsLite(this);
Logger.log(Logger.LogLevel.INFO, "Managers Registered!");
Logger.log(Logger.LogLevel.INFO, "Registering Listeners...");
getServer().getPluginManager().registerEvents(new AntiBotEvents(), this);
getServer().getPluginManager().registerEvents(new Events(), this);
Logger.log(Logger.LogLevel.INFO, "Listeners Registered!");
Logger.log(Logger.LogLevel.INFO, "Loading Config's...");
this.createConfig();
Expand All @@ -36,7 +40,7 @@ public void onEnable() {
Logger.log(Logger.LogLevel.OUTLINE, "********************");
this.setEnabled(true);
Logger.log(Logger.LogLevel.INFO, "Checking for updates...");
this.checker = new UpdateCheckerAntiBot(this);
this.checker = new UpdateChecker(this);
if (this.checker.isConnected()) {
if (this.checker.hasUpdate()) {
Logger.log(Logger.LogLevel.OUTLINE, "********************");
Expand All @@ -56,8 +60,8 @@ public void onEnable() {
public void onDisable() {
}

public static AntiBotMain getPlugin() {
return (AntiBotMain) getPlugin((Class) AntiBotMain.class);
public static AntiBot getPlugin() {
return (AntiBot) getPlugin((Class) AntiBot.class);
}

private void createConfig(){
Expand All @@ -75,7 +79,7 @@ private void createConfig(){
}


public static AntiBotMain getInstance() {
public static AntiBot getInstance() {
return instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

import java.util.ArrayList;

public class AntiBotEvents implements Listener
public class Events implements Listener
{
private ArrayList<String> move;


private AntiBotMain main;
private AntiBot main;

public AntiBotEvents() {
public Events() {
this.move = new ArrayList<>();

}
Expand All @@ -41,15 +41,15 @@ public void onMove(PlayerMoveEvent e) {
public void onCommand(PlayerCommandPreprocessEvent e) {
if (this.move.contains(e.getPlayer().getName())) {
e.setCancelled(true);
e.getPlayer().sendMessage(AntiBotMain.getPlugin().getConfig().getString("Messages.antiBotCommand").replace("&", "§"));
e.getPlayer().sendMessage(AntiBot.getPlugin().getConfig().getString("Messages.antiBotCommand").replace("&", "§"));
}
}

@EventHandler
public void onTalk(AsyncPlayerChatEvent e) {
if (this.move.contains(e.getPlayer().getName())) {
e.setCancelled(true);
e.getPlayer().sendMessage(AntiBotMain.getPlugin().getConfig().getString("Messages.antiBotMessage").replace("&", "§"));
e.getPlayer().sendMessage(AntiBot.getPlugin().getConfig().getString("Messages.antiBotMessage").replace("&", "§"));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.noodles.antibot.antibotmain;
package net.noodles.antibot.antibotmain.Utils;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.noodles.antibot.antibotmain;
package net.noodles.antibot.antibotmain.Utils;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.noodles.antibot.antibotmain;
package net.noodles.antibot.antibotmain.Utils;

public class Settings {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package net.noodles.antibot.antibotmain;
package net.noodles.antibot.antibotmain.Utils;

import net.noodles.antibot.antibotmain.AntiBot;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class UpdateCheckerAntiBot
public class UpdateChecker
{
public AntiBotMain plugin;
public AntiBot plugin;
public String version;


public UpdateCheckerAntiBot(AntiBotMain plugin) {
public UpdateChecker(AntiBot plugin) {
this.plugin = plugin;
this.version = this.getLatestVersion();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
package net.noodles.antibot.antibotmain;
package net.noodles.antibot.antibotmain.Utils;

import net.noodles.antibot.antibotmain.AntiBot;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;

public class UpdateJoinEventAntiBot implements Listener
public class UpdateJoin implements Listener
{

public UpdateCheckerAntiBot checker;
private AntiBotMain main;
public UpdateChecker checker;
private AntiBot main;

public UpdateJoinEventAntiBot(AntiBotMain main) {
public UpdateJoin(AntiBot main) {
this.main = main;
main.getServer().getPluginManager().registerEvents(this, main);
}



@EventHandler
public void onDevJoin(PlayerJoinEvent e) { //THIS EVENT IS USED FOR DEBUG REASONS ONLY!
Player p = e.getPlayer();
if (p.getName().equals("Noodles_YT")) {
p.sendMessage(ChatColor.RED + "BGHDDevelopment Debug Message");
p.sendMessage(" ");
p.sendMessage(ChatColor.GREEN + "This server is using AntiBot" + " version " + Settings.VERSION);
p.sendMessage(ChatColor.GREEN + "The newest version is " + this.checker.getLatestVersion());
p.sendMessage(" ");

} else {
return;
}
}

@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
if (p.hasPermission("antibot.update")) {
if (AntiBotMain.getPlugin().getConfig().getBoolean("Update.Enabled") == true){
this.checker = new UpdateCheckerAntiBot(AntiBotMain.plugin);
if (AntiBot.getPlugin().getConfig().getBoolean("Update.Enabled") == true){
this.checker = new UpdateChecker(AntiBot.plugin);
if (this.checker.isConnected()) {
if (this.checker.hasUpdate()) {
p.sendMessage(ChatColor.GRAY + "=========================");
Expand Down

0 comments on commit 751de18

Please sign in to comment.