A few more

This commit is contained in:
Telesphoreo 2022-04-09 00:08:18 -05:00
parent e35d70bc3c
commit d55eaf0d3d
3 changed files with 33 additions and 18 deletions

View File

@ -118,7 +118,8 @@ public class Plex extends JavaPlugin
{
PlexUtils.testConnections();
PlexLog.log("Connected to " + storageType.name().toUpperCase());
} catch (Exception e)
}
catch (Exception e)
{
PlexLog.error("Failed to connect to " + storageType.name().toUpperCase());
e.printStackTrace();
@ -135,7 +136,8 @@ public class Plex extends JavaPlugin
{
redisConnection.getJedis();
PlexLog.log("Connected to Redis!");
} else
}
else
{
PlexLog.log("Redis is disabled in the configuration file, not connecting.");
}
@ -143,7 +145,8 @@ public class Plex extends JavaPlugin
if (storageType == StorageType.MONGODB)
{
mongoPlayerData = new MongoPlayerData();
} else
}
else
{
sqlPlayerData = new SQLPlayerData();
sqlPunishment = new SQLPunishment();
@ -191,7 +194,8 @@ public class Plex extends JavaPlugin
if (mongoPlayerData != null) //back to mongo checking
{
mongoPlayerData.update(plexPlayer); //update the player's document
} else if (sqlPlayerData != null) //sql checking
}
else if (sqlPlayerData != null) //sql checking
{
sqlPlayerData.update(plexPlayer);
}
@ -254,7 +258,8 @@ public class Plex extends JavaPlugin
author = props.getProperty("buildAuthor", "unknown");
date = props.getProperty("buildDate", "unknown");
head = props.getProperty("buildHead", "unknown");
} catch (Exception ex)
}
catch (Exception ex)
{
PlexLog.error("Could not load build properties! Did you compile with NetBeans/Maven?");
}

View File

@ -125,7 +125,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
send(sender, messageComponent("noPermissionRank", ChatColor.stripColor(getLevel().getLoginMessage())));
return true;
} else
}
else
{
if (getLevel().isAtLeast(Rank.ADMIN) && !plexPlayer.isAdminActive())
{
@ -133,14 +134,16 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
return true;
}
}
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission(perms.permission()))
{
send(sender, messageComponent("noPermissionNode", perms.permission()));
return true;
}
} else
}
else
{
PlexLog.error("Neither permissions or ranks were selected to be used in the configuration file!");
send(sender, "There is a server misconfiguration. Please alert a developer or the owner");
@ -149,12 +152,13 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
}
try
{
Component component = this.execute(sender, isConsole(sender) ? null : (Player) sender, args);
Component component = this.execute(sender, isConsole(sender) ? null : (Player)sender, args);
if (component != null)
{
send(sender, component);
}
} catch (PlayerNotFoundException | CommandFailException | ConsoleOnlyException | ConsoleMustDefinePlayerException | PlayerNotBannedException ex)
}
catch (PlayerNotFoundException | CommandFailException | ConsoleOnlyException | ConsoleMustDefinePlayerException | PlayerNotBannedException ex)
{
send(sender, MiniMessage.miniMessage().deserialize(ex.getMessage()));
}
@ -178,7 +182,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
return true;
}
}
} else if (params.aliases().split(",").length < 1)
}
else if (params.aliases().split(",").length < 1)
{
return getName().equalsIgnoreCase(label);
}
@ -232,7 +237,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
if (!isConsole(sender))
{
return checkRank((Player) sender, rank, permission);
return checkRank((Player)sender, rank, permission);
}
return true;
}
@ -263,7 +268,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
throw new CommandFailException(PlexUtils.messageString("noPermissionRank", ChatColor.stripColor(rank.getLoginMessage())));
}
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission(permission))
{
@ -283,7 +289,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
if (plugin.getSystem().equalsIgnoreCase("ranks"))
{
return rank.isAtLeast(Rank.ADMIN) ? plexPlayer.isAdminActive() && plexPlayer.getRankFromString().isAtLeast(rank) : plexPlayer.getRankFromString().isAtLeast(rank);
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
return player.hasPermission(permission);
}
@ -303,7 +310,7 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
if (!isConsole(sender))
{
return checkTab((Player) sender, rank, permission);
return checkTab((Player)sender, rank, permission);
}
return true;
}
@ -323,7 +330,8 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
if (plugin.getSystem().equalsIgnoreCase("ranks"))
{
return rank.isAtLeast(Rank.ADMIN) ? plexPlayer.isAdminActive() && plexPlayer.getRankFromString().isAtLeast(rank) : plexPlayer.getRankFromString().isAtLeast(rank);
} else if (plugin.getSystem().equalsIgnoreCase("permissions"))
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
return player.hasPermission(permission);
}

View File

@ -21,7 +21,9 @@ public class AdminListener extends PlexListener
if (!target.getRank().isEmpty())
{
PlexUtils.broadcast(messageComponent("adminReadded", userSender, target.getName(), target.getRankFromString().getReadable()));
} else {
}
else
{
target.setRank(Rank.ADMIN.name());
PlexUtils.broadcast(messageComponent("newAdminAdded", userSender, target.getName()));
}