mirror of
https://github.com/TotalFreedomMC/TF-Captchafy.git
synced 2024-12-22 16:25:15 +00:00
admins no get stop
This commit is contained in:
parent
9a1cbbe3a8
commit
c269b90cbf
4 changed files with 63 additions and 4 deletions
13
pom.xml
13
pom.xml
|
@ -66,7 +66,18 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
<version>1.16.1-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.TFPatches</groupId>
|
||||||
|
<artifactId>TotalFreedomMod</artifactId>
|
||||||
|
<version>5.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.Pravian</groupId>
|
||||||
|
<artifactId>Aero</artifactId>
|
||||||
|
<version>5f82926</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -36,6 +36,8 @@ public class Captchafy extends JavaPlugin
|
||||||
|
|
||||||
public static boolean error = false;
|
public static boolean error = false;
|
||||||
|
|
||||||
|
public TFMHandler tfh;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
|
@ -43,6 +45,7 @@ public class Captchafy extends JavaPlugin
|
||||||
configs = new Configuration();
|
configs = new Configuration();
|
||||||
listeners = new Listeners();
|
listeners = new Listeners();
|
||||||
listeners.setThrottleSettings();
|
listeners.setThrottleSettings();
|
||||||
|
tfh = new TFMHandler();
|
||||||
Bukkit.getPluginManager().registerEvents(listeners, this);
|
Bukkit.getPluginManager().registerEvents(listeners, this);
|
||||||
getCommand("captchafy").setExecutor(new CaptchafyCommand());
|
getCommand("captchafy").setExecutor(new CaptchafyCommand());
|
||||||
try
|
try
|
||||||
|
|
|
@ -62,9 +62,12 @@ public class Listeners implements Listener
|
||||||
{
|
{
|
||||||
setURLMessage();
|
setURLMessage();
|
||||||
}
|
}
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.RED + "" + ChatColor.BOLD + "Yikes, we're under attack! Please solve the captcha.\n" +
|
if (!Captchafy.plugin.tfh.isAdmin(event.getPlayer()))
|
||||||
ChatColor.WHITE + "Please go to " + ChatColor.GOLD + url + ChatColor.WHITE + " in your web browser and solve the captcha.\n" +
|
{
|
||||||
"Once solved successfully, you will be able to join.");
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.RED + "" + ChatColor.BOLD + "Yikes, we're under attack! Please solve the captcha.\n" +
|
||||||
|
ChatColor.WHITE + "Please go to " + ChatColor.GOLD + url + ChatColor.WHITE + " in your web browser and solve the captcha.\n" +
|
||||||
|
"Once solved successfully, you will be able to join.");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Captchafy.securityLevel == 3)
|
if (Captchafy.securityLevel == 3)
|
||||||
|
|
42
src/main/java/me/hockey/captchafy/TFMHandler.java
Normal file
42
src/main/java/me/hockey/captchafy/TFMHandler.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package me.hockey.captchafy;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
public class TFMHandler
|
||||||
|
{
|
||||||
|
private Captchafy plugin;
|
||||||
|
private TotalFreedomMod tfmPlugin;
|
||||||
|
|
||||||
|
public TFMHandler()
|
||||||
|
{
|
||||||
|
this.plugin = Captchafy.plugin;
|
||||||
|
this.tfmPlugin = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TotalFreedomMod getTFM()
|
||||||
|
{
|
||||||
|
if (tfmPlugin == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Plugin tfm = plugin.getServer().getPluginManager().getPlugin("TotalFreedomMod");
|
||||||
|
if (tfm != null && tfm instanceof TotalFreedomMod)
|
||||||
|
{
|
||||||
|
tfmPlugin = (TotalFreedomMod) tfm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tfmPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin(Player player)
|
||||||
|
{
|
||||||
|
return getTFM().al.isAdmin(player);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue