mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-02-01 20:41:28 +01:00
Add Blindness effect (configurable)
This commit is contained in:
parent
fd9010dc59
commit
535c96738d
@ -17,11 +17,12 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -513,6 +514,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, m._("reg_msg"), interval)));
|
||||
if (Settings.applyBlindEffect)
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
m._(target, "unregistered");
|
||||
} else {
|
||||
// Player isn't online, do nothing else
|
||||
|
@ -7,6 +7,8 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -104,6 +106,8 @@ public class LogoutCommand implements CommandExecutor {
|
||||
player.getVehicle().eject();
|
||||
} catch (NullPointerException npe) {
|
||||
}
|
||||
if (Settings.applyBlindEffect)
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
m._(player, "logout");
|
||||
ConsoleLogger.info(player.getDisplayName() + " logged out");
|
||||
if(plugin.notifications != null) {
|
||||
|
@ -10,6 +10,8 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -108,6 +110,8 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
if(playerCache.doesCacheExist(name)) {
|
||||
playerCache.removeCache(name);
|
||||
}
|
||||
if (Settings.applyBlindEffect)
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
m._(player, "unregistered");
|
||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
||||
if(plugin.notifications != null) {
|
||||
|
@ -34,6 +34,8 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -711,6 +713,8 @@ public class AuthMePlayerListener implements Listener {
|
||||
player.setNoDamageTicks(Settings.getRegistrationTimeout * 20);
|
||||
if (Settings.useEssentialsMotd)
|
||||
player.performCommand("motd");
|
||||
if (Settings.applyBlindEffect)
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
|
||||
|
||||
// Remove the join message while the player isn't logging in
|
||||
if (Settings.enableProtection || Settings.delayJoinMessage) {
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.Utils;
|
||||
@ -172,6 +173,9 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
|
||||
AuthMePlayerListener.joinMessage.remove(name);
|
||||
}
|
||||
|
||||
if (Settings.applyBlindEffect)
|
||||
player.removePotionEffect(PotionEffectType.BLINDNESS);
|
||||
|
||||
// The Loginevent now fires (as intended) after everything is processed
|
||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||
player.saveData();
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
@ -61,6 +62,8 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
}
|
||||
if (Settings.applyBlindEffect)
|
||||
player.removePotionEffect(PotionEffectType.BLINDNESS);
|
||||
player.saveData();
|
||||
if (!Settings.noConsoleSpam)
|
||||
ConsoleLogger.info(player.getName() + " registered "+plugin.getIP(player));
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
@ -104,6 +105,8 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
}
|
||||
if (Settings.applyBlindEffect)
|
||||
player.removePotionEffect(PotionEffectType.BLINDNESS);
|
||||
// The Loginevent now fires (as intended) after everything is processed
|
||||
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
|
||||
player.saveData();
|
||||
|
@ -60,7 +60,7 @@ public final class Settings extends YamlConfiguration {
|
||||
usePurge, purgePlayerDat, purgeEssentialsFile, supportOldPassword, purgeLimitedCreative,
|
||||
purgeAntiXray, purgePermissions, enableProtection, enableAntiBot, recallEmail, useWelcomeMessage,
|
||||
broadcastWelcomeMessage, forceRegKick, forceRegLogin, checkVeryGames, delayJoinMessage,
|
||||
noTeleport;
|
||||
noTeleport, applyBlindEffect;
|
||||
|
||||
public static String getNickRegex, getUnloggedinGroup, getMySQLHost, getMySQLPort,
|
||||
getMySQLUsername, getMySQLPassword, getMySQLDatabase, getMySQLTablename,
|
||||
@ -248,6 +248,7 @@ public void loadConfigOptions() {
|
||||
noTeleport = configFile.getBoolean("settings.restrictions.noTeleport", false);
|
||||
crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db");
|
||||
getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters","[a-zA-Z0-9_?!@+&-]*");
|
||||
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
||||
|
||||
// Load the welcome message
|
||||
getWelcomeMessage(plugin);
|
||||
@ -410,6 +411,7 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
noTeleport = configFile.getBoolean("settings.restrictions.noTeleport", false);
|
||||
crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db");
|
||||
getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters","[a-zA-Z0-9_?!@+&-]*");
|
||||
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
||||
|
||||
// Reload the welcome message
|
||||
getWelcomeMessage(AuthMe.getInstance());
|
||||
@ -528,6 +530,11 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
}
|
||||
if(!contains("settings.restrictions.allowedPasswordCharacters")) {
|
||||
set("settings.restrictions.allowedPasswordCharacters", "[a-zA-Z0-9_?!@+&-]*");
|
||||
changes = true;
|
||||
}
|
||||
if(!contains("settings.applyBlindEffect")) {
|
||||
set("settings.applyBlindEffect", false);
|
||||
changes = true;
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
|
@ -260,6 +260,8 @@ settings:
|
||||
broadcastWelcomeMessage: false
|
||||
# Do we need to delay the X has joined the game after /login ?
|
||||
delayJoinMessage: false
|
||||
# Do we need to add potion effect Blinding before login/register ?
|
||||
applyBlindEffect: false
|
||||
ExternalBoardOptions:
|
||||
# MySQL column for the salt , needed for some forum/cms support
|
||||
mySQLColumnSalt: ''
|
||||
|
Loading…
Reference in New Issue
Block a user