@Override
 public void run() {
   Permission permission = Bukkit.getPluginManager().getPermission("crazy*.*");
   for (CrazyPlugin plugin : CrazyCore.getCrazyPlugins())
     permission.getChildren().put(plugin.getName().toLowerCase() + ".*", true);
   permission.recalculatePermissibles();
 }
Example #2
0
 @Override
 public void onEnable() {
   plugin = this;
   registerHooks();
   super.onEnable();
 }
Example #3
0
 @Override
 public void load() {
   super.load();
   final ConfigurationSection config = getConfig();
   if (config.getBoolean("autoLogout", false)) autoLogout = 0;
   else autoLogout = config.getInt("autoLogout", 60 * 60);
   alwaysNeedPassword = config.getBoolean("alwaysNeedPassword", true);
   autoKick = Math.max(config.getInt("autoKick", -1), -1);
   autoKickUnregistered = Math.max(config.getInt("kickUnregistered", -1), -1);
   autoKickLoginFailer = Math.max(config.getInt("autoKickLoginFailer", 3), -1);
   autoKickCommandUsers = config.getBoolean("autoKickCommandUsers", false);
   blockGuestCommands = config.getBoolean("blockGuestCommands", false);
   resetGuestLocations = config.getBoolean("resetGuestLocations", true);
   loginFailures.clear();
   doNotSpamRequests = config.getBoolean("doNotSpamRequests", false);
   commandWhiteList = config.getStringList("commandWhitelist");
   if (commandWhiteList.size() == 0) {
     commandWhiteList.add("/login");
     commandWhiteList.add("/register");
     commandWhiteList.add("/crazylogin password");
   }
   forceSingleSession = config.getBoolean("forceSingleSession", true);
   forceSingleSessionSameIPBypass = config.getBoolean("forceSingleSessionSameIPBypass", true);
   maxRegistrationsPerIP = config.getInt("maxRegistrationsPerIP", 3);
   autoDelete = Math.max(config.getInt("autoDelete", -1), -1);
   if (autoDelete != -1)
     getServer()
         .getScheduler()
         .scheduleAsyncRepeatingTask(
             this, new DropInactiveAccountsTask(this), 20 * 60 * 60, 20 * 60 * 60 * 6);
   moveRange = config.getInt("moveRange", 5);
   minNameLength = Math.min(Math.max(config.getInt("minNameLength", 3), 1), 16);
   maxNameLength = Math.min(Math.max(config.getInt("maxNameLength", 16), minNameLength), 16);
   uniqueIDKey = config.getString("uniqueIDKey");
   pluginCommunicationEnabled = config.getBoolean("pluginCommunicationEnabled", false);
   final String algorithm = config.getString("algorithm", "CrazyCrypt1");
   if (algorithm.equalsIgnoreCase("CrazyCrypt1")) {
     encryptor = new CrazyCrypt1();
   } else if (algorithm.equalsIgnoreCase("Whirlpool")) {
     encryptor = new WhirlPoolCrypt();
   } else if (algorithm.equalsIgnoreCase("Plaintext")) {
     encryptor = new PlainCrypt();
   } else if (algorithm.equalsIgnoreCase("AuthMe")) {
     encryptor = new AuthMeCrypt();
   } else if (algorithm.equalsIgnoreCase("Custom")) {
     final String encryption = config.getString("customEncryptor.class");
     encryptor =
         ObjectSaveLoadHelper.load(encryption, CustomEncryptor.class, new Class[0], new Object[0]);
   } else {
     try {
       encryptor = new DefaultCrypt(algorithm);
     } catch (final NoSuchAlgorithmException e) {
       broadcastLocaleMessage(true, "crazylogin.warnalgorithm", "ALGORITHM.MISSING", algorithm);
       encryptor = new CrazyCrypt1();
     }
   }
   setupDatabase();
   datas.clear();
   if (database != null)
     for (final LoginPlayerData data : database.getAllEntries())
       datas.put(data.getName().toLowerCase(), data);
   dropInactiveAccounts();
   for (final Player player : getServer().getOnlinePlayers()) requestLogin(player);
 }