mirror of https://github.com/MilkBowl/Vault.git
Cleanup code
This commit is contained in:
parent
76d6ab9098
commit
fe7c85b2b4
|
@ -53,7 +53,7 @@
|
|||
verbose="false"
|
||||
author="true"
|
||||
version="true">
|
||||
<link href="http://docs.oracle.com/javase/7/docs/api/" />
|
||||
<link href="https://docs.oracle.com/javase/7/docs/api/" />
|
||||
<link href="http://jd.bukkit.org/apidocs/" />
|
||||
|
||||
<classpath>
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -1,5 +1,5 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<properties>
|
||||
|
@ -42,12 +42,12 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
|
|||
<repository>
|
||||
<id>pub-repo</id>
|
||||
<name>Public Releases</name>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
<url>https://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>pub-repo</id>
|
||||
<name>Public Snapshots</name>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_snapshots/</url>
|
||||
<url>https://nexus.hc.to/content/repositories/pub_snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
|
@ -55,7 +55,7 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
|
|||
<repository>
|
||||
<id>pub-repo</id>
|
||||
<name>Public Releases</name>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
<url>https://nexus.hc.to/content/repositories/pub_releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
|
|
|
@ -15,16 +15,7 @@
|
|||
*/
|
||||
package net.milkbowl.vault;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.nijikokun.register.payment.Methods;
|
||||
import net.milkbowl.vault.chat.Chat;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_DroxPerms;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_GroupManager;
|
||||
|
@ -32,6 +23,7 @@ import net.milkbowl.vault.chat.plugins.Chat_OverPermissions;
|
|||
import net.milkbowl.vault.chat.plugins.Chat_Permissions3;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_PermissionsEx;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_Privileges;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_TotalPermissions;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_bPermissions;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_bPermissions2;
|
||||
import net.milkbowl.vault.chat.plugins.Chat_iChat;
|
||||
|
@ -51,17 +43,19 @@ import net.milkbowl.vault.economy.plugins.Economy_GoldIsMoney2;
|
|||
import net.milkbowl.vault.economy.plugins.Economy_GoldenChestEconomy;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_Gringotts;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_McMoney;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_MiConomy;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_MineConomy;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_Minefaconomy;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_MultiCurrency;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_SDFEconomy;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_TAEcon;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_XPBank;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_eWallet;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_iConomy6;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_SDFEconomy;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_Minefaconomy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_DroxPerms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_GroupManager;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_KPerms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_OverPermissions;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_Permissions3;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_PermissionsBukkit;
|
||||
|
@ -70,13 +64,11 @@ import net.milkbowl.vault.permission.plugins.Permission_Privileges;
|
|||
import net.milkbowl.vault.permission.plugins.Permission_SimplyPerms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_Starburst;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_SuperPerms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_TotalPermissions;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_Xperms;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_bPermissions;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_bPermissions2;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_TotalPermissions;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_rscPermissions;
|
||||
import net.milkbowl.vault.permission.plugins.Permission_KPerms;
|
||||
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -98,10 +90,15 @@ import org.json.simple.JSONArray;
|
|||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import com.nijikokun.register.payment.Methods;
|
||||
|
||||
import net.milkbowl.vault.chat.plugins.Chat_TotalPermissions;
|
||||
import net.milkbowl.vault.economy.plugins.Economy_MiConomy;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class Vault extends JavaPlugin {
|
||||
|
||||
|
@ -127,7 +124,7 @@ public class Vault extends JavaPlugin {
|
|||
plugin = this;
|
||||
log = this.getLogger();
|
||||
currentVersionTitle = getDescription().getVersion().split("-")[0];
|
||||
currentVersion = Double.valueOf(currentVersionTitle.replaceFirst("\\.", ""));
|
||||
currentVersion = Double.parseDouble(currentVersionTitle.replaceFirst("\\.", ""));
|
||||
sm = getServer().getServicesManager();
|
||||
// set defaults
|
||||
getConfig().addDefault("update-check", true);
|
||||
|
@ -143,44 +140,35 @@ public class Vault extends JavaPlugin {
|
|||
getServer().getPluginManager().registerEvents(new VaultListener(), this);
|
||||
// Schedule to check the version every 30 minutes for an update. This is to update the most recent
|
||||
// version so if an admin reconnects they will be warned about newer versions.
|
||||
this.getServer().getScheduler().runTask(this, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// Programmatically set the default permission value cause Bukkit doesn't handle plugin.yml properly for Load order STARTUP plugins
|
||||
org.bukkit.permissions.Permission perm = getServer().getPluginManager().getPermission("vault.update");
|
||||
if (perm == null)
|
||||
{
|
||||
perm = new org.bukkit.permissions.Permission("vault.update");
|
||||
perm.setDefault(PermissionDefault.OP);
|
||||
plugin.getServer().getPluginManager().addPermission(perm);
|
||||
}
|
||||
perm.setDescription("Allows a user or the console to check for vault updates");
|
||||
|
||||
getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (getServer().getConsoleSender().hasPermission("vault.update") && getConfig().getBoolean("update-check", true)) {
|
||||
try {
|
||||
log.info("Checking for Updates ... ");
|
||||
newVersion = updateCheck(currentVersion);
|
||||
if (newVersion > currentVersion) {
|
||||
log.warning("Stable Version: " + newVersionTitle + " is out!" + " You are still running version: " + currentVersionTitle);
|
||||
log.warning("Update at: https://dev.bukkit.org/projects/vault");
|
||||
} else if (currentVersion > newVersion) {
|
||||
log.info("Stable Version: " + newVersionTitle + " | Current Version: " + currentVersionTitle);
|
||||
} else {
|
||||
log.info("No new version available");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore exceptions
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, 432000);
|
||||
|
||||
this.getServer().getScheduler().runTask(this, () -> {
|
||||
// Programmatically set the default permission value cause Bukkit doesn't handle plugin.yml properly for Load order STARTUP plugins
|
||||
org.bukkit.permissions.Permission perm = getServer().getPluginManager().getPermission("vault.update");
|
||||
if (perm == null)
|
||||
{
|
||||
perm = new org.bukkit.permissions.Permission("vault.update");
|
||||
perm.setDefault(PermissionDefault.OP);
|
||||
plugin.getServer().getPluginManager().addPermission(perm);
|
||||
}
|
||||
perm.setDescription("Allows a user or the console to check for vault updates");
|
||||
|
||||
getServer().getScheduler().runTaskTimerAsynchronously(plugin, () -> {
|
||||
if (getServer().getConsoleSender().hasPermission("vault.update") && getConfig().getBoolean("update-check", true)) {
|
||||
try {
|
||||
log.info("Checking for Updates ... ");
|
||||
newVersion = updateCheck(currentVersion);
|
||||
if (newVersion > currentVersion) {
|
||||
log.warning("Stable Version: " + newVersionTitle + " is out!" + " You are still running version: " + currentVersionTitle);
|
||||
log.warning("Update at: https://dev.bukkit.org/projects/vault");
|
||||
} else if (currentVersion > newVersion) {
|
||||
log.info("Stable Version: " + newVersionTitle + " | Current Version: " + currentVersionTitle);
|
||||
} else {
|
||||
log.info("No new version available");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore exceptions
|
||||
}
|
||||
}
|
||||
}, 0, 432000);
|
||||
|
||||
});
|
||||
|
||||
|
@ -354,7 +342,7 @@ public class Vault extends JavaPlugin {
|
|||
|
||||
Permission perms = new Permission_SuperPerms(this);
|
||||
sm.register(Permission.class, perms, this, ServicePriority.Lowest);
|
||||
log.info(String.format("[Permission] SuperPermissions loaded as backup permission system."));
|
||||
log.info("[Permission] SuperPermissions loaded as backup permission system.");
|
||||
|
||||
this.perms = sm.getRegistration(Permission.class).getProvider();
|
||||
}
|
||||
|
@ -428,7 +416,7 @@ public class Vault extends JavaPlugin {
|
|||
}
|
||||
Economy econ1 = null;
|
||||
Economy econ2 = null;
|
||||
String economies = "";
|
||||
StringBuilder economies = new StringBuilder();
|
||||
for (RegisteredServiceProvider<Economy> econ : econs) {
|
||||
String econName = econ.getProvider().getName().replace(" ", "");
|
||||
if (econName.equalsIgnoreCase(args[0])) {
|
||||
|
@ -437,9 +425,9 @@ public class Vault extends JavaPlugin {
|
|||
econ2 = econ.getProvider();
|
||||
}
|
||||
if (economies.length() > 0) {
|
||||
economies += ", ";
|
||||
economies.append(", ");
|
||||
}
|
||||
economies += econName;
|
||||
economies.append(econName);
|
||||
}
|
||||
|
||||
if (econ1 == null) {
|
||||
|
@ -468,42 +456,42 @@ public class Vault extends JavaPlugin {
|
|||
|
||||
}
|
||||
}
|
||||
sender.sendMessage("Converson complete, please verify the data before using it.");
|
||||
sender.sendMessage("Conversion complete, please verify the data before using it.");
|
||||
}
|
||||
|
||||
private void infoCommand(CommandSender sender) {
|
||||
// Get String of Registered Economy Services
|
||||
String registeredEcons = null;
|
||||
StringBuilder registeredEcons = new StringBuilder();
|
||||
Collection<RegisteredServiceProvider<Economy>> econs = this.getServer().getServicesManager().getRegistrations(Economy.class);
|
||||
for (RegisteredServiceProvider<Economy> econ : econs) {
|
||||
Economy e = econ.getProvider();
|
||||
if (registeredEcons == null) {
|
||||
registeredEcons = e.getName();
|
||||
if (registeredEcons.length() == 0) {
|
||||
registeredEcons.append(e.getName());
|
||||
} else {
|
||||
registeredEcons += ", " + e.getName();
|
||||
registeredEcons.append(", ").append(e.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// Get String of Registered Permission Services
|
||||
String registeredPerms = null;
|
||||
StringBuilder registeredPerms = new StringBuilder();
|
||||
Collection<RegisteredServiceProvider<Permission>> perms = this.getServer().getServicesManager().getRegistrations(Permission.class);
|
||||
for (RegisteredServiceProvider<Permission> perm : perms) {
|
||||
Permission p = perm.getProvider();
|
||||
if (registeredPerms == null) {
|
||||
registeredPerms = p.getName();
|
||||
if (registeredPerms.length() == 0) {
|
||||
registeredPerms.append(p.getName());
|
||||
} else {
|
||||
registeredPerms += ", " + p.getName();
|
||||
registeredPerms.append(", ").append(p.getName());
|
||||
}
|
||||
}
|
||||
|
||||
String registeredChats = null;
|
||||
StringBuilder registeredChats = new StringBuilder();
|
||||
Collection<RegisteredServiceProvider<Chat>> chats = this.getServer().getServicesManager().getRegistrations(Chat.class);
|
||||
for (RegisteredServiceProvider<Chat> chat : chats) {
|
||||
Chat c = chat.getProvider();
|
||||
if (registeredChats == null) {
|
||||
registeredChats = c.getName();
|
||||
if (registeredChats.length() == 0) {
|
||||
registeredChats.append(c.getName());
|
||||
} else {
|
||||
registeredChats += ", " + c.getName();
|
||||
registeredChats.append(", ").append(c.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -566,7 +554,7 @@ public class Vault extends JavaPlugin {
|
|||
}
|
||||
// Pull the last version from the JSON
|
||||
newVersionTitle = ((String) ((JSONObject) array.get(array.size() - 1)).get("name")).replace("Vault", "").trim();
|
||||
return Double.valueOf(newVersionTitle.replaceFirst("\\.", "").trim());
|
||||
return Double.parseDouble(newVersionTitle.replaceFirst("\\.", "").trim());
|
||||
} catch (Exception e) {
|
||||
log.info("There was an issue attempting to check for the latest version.");
|
||||
}
|
||||
|
@ -581,21 +569,11 @@ public class Vault extends JavaPlugin {
|
|||
econ = rspEcon.getProvider();
|
||||
}
|
||||
final String econName = econ != null ? econ.getName() : "No Economy";
|
||||
metrics.addCustomChart(new Metrics.SimplePie("economy", new Callable<String>() {
|
||||
@Override
|
||||
public String call() {
|
||||
return econName;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("economy", () -> econName));
|
||||
|
||||
// Create our Permission Graph and Add our permission Plotters
|
||||
final String permName = Bukkit.getServer().getServicesManager().getRegistration(Permission.class).getProvider().getName();
|
||||
metrics.addCustomChart(new Metrics.SimplePie("permission", new Callable<String>() {
|
||||
@Override
|
||||
public String call() {
|
||||
return permName;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("permission", () -> permName));
|
||||
|
||||
// Create our Chat Graph and Add our chat Plotters
|
||||
RegisteredServiceProvider<Chat> rspChat = Bukkit.getServer().getServicesManager().getRegistration(Chat.class);
|
||||
|
@ -604,12 +582,7 @@ public class Vault extends JavaPlugin {
|
|||
chat = rspChat.getProvider();
|
||||
}
|
||||
final String chatName = chat != null ? chat.getName() : "No Chat";
|
||||
metrics.addCustomChart(new Metrics.SimplePie("chat", new Callable<String>() {
|
||||
@Override
|
||||
public String call() {
|
||||
return chatName;
|
||||
}
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("chat", () -> chatName));
|
||||
}
|
||||
|
||||
public class VaultListener implements Listener {
|
||||
|
@ -618,13 +591,9 @@ public class Vault extends JavaPlugin {
|
|||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (perms.has(player, "vault.update")) {
|
||||
try {
|
||||
if (newVersion > currentVersion) {
|
||||
player.sendMessage("Vault " + newVersionTitle + " is out! You are running " + currentVersionTitle);
|
||||
player.sendMessage("Update Vault at: " + VAULT_BUKKIT_URL);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Ignore exceptions
|
||||
if (newVersion > currentVersion) {
|
||||
player.sendMessage("Vault " + newVersionTitle + " is out! You are running " + currentVersionTitle);
|
||||
player.sendMessage("Update Vault at: " + VAULT_BUKKIT_URL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Chat_GroupManager extends Chat {
|
|||
|
||||
private final Logger log;
|
||||
private final String name = "GroupManager - Chat";
|
||||
private Plugin plugin = null;
|
||||
private final Plugin plugin;
|
||||
private GroupManager groupManager;
|
||||
|
||||
public Chat_GroupManager(Plugin plugin, Permission perms) {
|
||||
|
@ -60,7 +60,7 @@ public class Chat_GroupManager extends Chat {
|
|||
|
||||
public class PermissionServerListener implements Listener {
|
||||
|
||||
Chat_GroupManager chat = null;
|
||||
Chat_GroupManager chat;
|
||||
|
||||
public PermissionServerListener(Chat_GroupManager chat) {
|
||||
this.chat = chat;
|
||||
|
@ -114,8 +114,7 @@ public class Chat_GroupManager extends Chat {
|
|||
if (handler == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
Integer val = handler.getUserPermissionInteger(playerName, node);
|
||||
return val != null ? val : defaultValue;
|
||||
return handler.getUserPermissionInteger(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -134,8 +133,7 @@ public class Chat_GroupManager extends Chat {
|
|||
if (handler == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
Integer val = handler.getGroupPermissionInteger(groupName, node);
|
||||
return val != null ? val : defaultValue;
|
||||
return handler.getGroupPermissionInteger(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,8 +152,7 @@ public class Chat_GroupManager extends Chat {
|
|||
if (handler == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
Double val = handler.getUserPermissionDouble(playerName, node);
|
||||
return val != null ? val : defaultValue;
|
||||
return handler.getUserPermissionDouble(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,8 +171,7 @@ public class Chat_GroupManager extends Chat {
|
|||
if (handler == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
Double val = handler.getGroupPermissionDouble(groupName, node);
|
||||
return val != null ? val : defaultValue;
|
||||
return handler.getGroupPermissionDouble(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -194,8 +190,7 @@ public class Chat_GroupManager extends Chat {
|
|||
if (handler == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
Boolean val = handler.getUserPermissionBoolean(playerName, node);
|
||||
return val != null ? val : defaultValue;
|
||||
return handler.getUserPermissionBoolean(playerName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,8 +209,7 @@ public class Chat_GroupManager extends Chat {
|
|||
if (handler == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
Boolean val = handler.getGroupPermissionBoolean(groupName, node);
|
||||
return val != null ? val : defaultValue;
|
||||
return handler.getGroupPermissionBoolean(groupName, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Chat_PermissionsEx extends Chat {
|
|||
private final Logger log;
|
||||
private final String name = "PermissionsEx_Chat";
|
||||
|
||||
private Plugin plugin = null;
|
||||
private Plugin plugin;
|
||||
private PermissionsEx chat = null;
|
||||
|
||||
public Chat_PermissionsEx(Plugin plugin, Permission perms) {
|
||||
|
@ -60,7 +60,7 @@ public class Chat_PermissionsEx extends Chat {
|
|||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Chat_PermissionsEx chat = null;
|
||||
Chat_PermissionsEx chat;
|
||||
|
||||
public PermissionServerListener(Chat_PermissionsEx chat) {
|
||||
this.chat = chat;
|
||||
|
@ -221,9 +221,7 @@ public class Chat_PermissionsEx extends Chat {
|
|||
@Override
|
||||
public void setGroupInfoInteger(String world, String groupName, String node, int value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
if (group != null) {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
@ -241,9 +239,7 @@ public class Chat_PermissionsEx extends Chat {
|
|||
@Override
|
||||
public void setGroupInfoDouble(String world, String groupName, String node, double value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
if (group != null) {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
@ -261,9 +257,7 @@ public class Chat_PermissionsEx extends Chat {
|
|||
@Override
|
||||
public void setGroupInfoBoolean(String world, String groupName, String node, boolean value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
if (group != null) {
|
||||
group.setOption(node, world, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
|
@ -281,9 +275,7 @@ public class Chat_PermissionsEx extends Chat {
|
|||
@Override
|
||||
public void setGroupInfoString(String world, String groupName, String node, String value) {
|
||||
PermissionGroup group = PermissionsEx.getPermissionManager().getGroup(groupName);
|
||||
if (group == null) {
|
||||
return;
|
||||
} else {
|
||||
if (group != null) {
|
||||
group.setOption(node, world, value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import de.bananaco.bpermissions.api.CalculableType;
|
|||
public class Chat_bPermissions2 extends Chat {
|
||||
private final Logger log;
|
||||
private final String name = "bInfo";
|
||||
private Plugin plugin = null;
|
||||
private final Plugin plugin;
|
||||
private boolean hooked = false;
|
||||
|
||||
public Chat_bPermissions2(Plugin plugin, Permission perms) {
|
||||
|
@ -55,7 +55,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Chat_bPermissions2 chat = null;
|
||||
Chat_bPermissions2 chat;
|
||||
|
||||
public PermissionServerListener(Chat_bPermissions2 chat) {
|
||||
this.chat = chat;
|
||||
|
@ -140,8 +140,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
int i = Integer.valueOf(s);
|
||||
return i;
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -159,8 +158,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
int i = Integer.valueOf(s);
|
||||
return i;
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -178,8 +176,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
double d = Double.valueOf(s);
|
||||
return d;
|
||||
return Double.parseDouble(s);
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -197,8 +194,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
return defaultValue;
|
||||
}
|
||||
try {
|
||||
double d = Double.valueOf(s);
|
||||
return d;
|
||||
return Double.parseDouble(s);
|
||||
} catch (NumberFormatException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -215,8 +211,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
if (s == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
Boolean val = Boolean.valueOf(s);
|
||||
return val != null ? val : defaultValue;
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,20 +226,19 @@ public class Chat_bPermissions2 extends Chat {
|
|||
if (s == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
Boolean val = Boolean.valueOf(s);
|
||||
return val != null ? val : defaultValue;
|
||||
return Boolean.parseBoolean(s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGroupInfoBoolean(String world, String group, String node, boolean value) {
|
||||
ApiLayer.setValue(world, CalculableType.GROUP, group, node, String.valueOf(value));;
|
||||
ApiLayer.setValue(world, CalculableType.GROUP, group, node, String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
|
||||
String val = ApiLayer.getValue(world, CalculableType.USER, player, node);
|
||||
return (val == null || val == "BLANKWORLD" || val == "") ? defaultValue : val;
|
||||
return (val == null || val.equals("BLANKWORLD") || val.equals("")) ? defaultValue : val;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -255,7 +249,7 @@ public class Chat_bPermissions2 extends Chat {
|
|||
@Override
|
||||
public String getGroupInfoString(String world, String group, String node, String defaultValue) {
|
||||
String val = ApiLayer.getValue(world, CalculableType.GROUP, group, node);
|
||||
return (val == null || val == "BLANKWORLD" || val == "") ? defaultValue : val;
|
||||
return (val == null || val.equals("BLANKWORLD") || val.equals("")) ? defaultValue : val;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -56,7 +56,7 @@ public class Permission_GroupManager extends Permission {
|
|||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Permission_GroupManager permission = null;
|
||||
Permission_GroupManager permission;
|
||||
|
||||
public PermissionServerListener(Permission_GroupManager permission) {
|
||||
this.permission = permission;
|
||||
|
@ -332,7 +332,7 @@ public class Permission_GroupManager extends Permission {
|
|||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
Set<String> groupNames = new HashSet<String>();
|
||||
Set<String> groupNames = new HashSet<>();
|
||||
for (World world : Bukkit.getServer().getWorlds()) {
|
||||
OverloadedWorldHolder owh = groupManager.getWorldsHolder().getWorldData(world.getName());
|
||||
if (owh == null) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class Permission_PermissionsEx extends Permission {
|
|||
if (perms != null) {
|
||||
if (perms.isEnabled()) {
|
||||
try {
|
||||
if (Double.valueOf(perms.getDescription().getVersion()) < 1.16) {
|
||||
if (Double.parseDouble(perms.getDescription().getVersion()) < 1.16) {
|
||||
log.info(String.format("[%s][Permission] %s below 1.16 is not compatible with Vault! Falling back to SuperPerms only mode. PLEASE UPDATE!", plugin.getDescription().getName(), name));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -71,7 +71,7 @@ public class Permission_PermissionsEx extends Permission {
|
|||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
Permission_PermissionsEx permission = null;
|
||||
Permission_PermissionsEx permission;
|
||||
|
||||
public PermissionServerListener(Permission_PermissionsEx permission) {
|
||||
this.permission = permission;
|
||||
|
@ -83,7 +83,7 @@ public class Permission_PermissionsEx extends Permission {
|
|||
Plugin perms = event.getPlugin();
|
||||
if (perms.getDescription().getName().equals("PermissionsEx")) {
|
||||
try {
|
||||
if (Double.valueOf(perms.getDescription().getVersion()) < 1.16) {
|
||||
if (Double.parseDouble(perms.getDescription().getVersion()) < 1.16) {
|
||||
log.info(String.format("[%s][Permission] %s below 1.16 is not compatible with Vault! Falling back to SuperPerms only mode. PLEASE UPDATE!", plugin.getDescription().getName(), name));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Permission_SuperPerms extends Permission {
|
|||
@Override
|
||||
public boolean playerHas(String world, String player, String permission) {
|
||||
Player p = plugin.getServer().getPlayer(player);
|
||||
return p != null ? p.hasPermission(permission) : false;
|
||||
return p != null && p.hasPermission(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -180,8 +180,8 @@ public class Permission_bPermissions2 extends Permission {
|
|||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
String[] groups = null;
|
||||
Set<String> gSet = new HashSet<String>();
|
||||
String[] groups;
|
||||
Set<String> gSet = new HashSet<>();
|
||||
for(World world : WorldManager.getInstance().getAllWorlds()) {
|
||||
Set<Calculable> gr = world.getAll(CalculableType.GROUP);
|
||||
for(Calculable c : gr) {
|
||||
|
@ -189,7 +189,7 @@ public class Permission_bPermissions2 extends Permission {
|
|||
}
|
||||
}
|
||||
// Convert to String
|
||||
groups = gSet.toArray(new String[gSet.size()]);
|
||||
groups = gSet.toArray(new String[0]);
|
||||
return groups;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue