mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Why overcomplicating things is a horrifically bad idea (#55)
The longer I look into this plugin's code, the angrier I will become. This fixes 2 bugs in the /potion command: - Fixes non-admins being able to clear other players - Fixes NPE caused when trying to add potion effects to players who are not on the server as a non-admin. Both of these issues are caused by overcomplicating seemingly simple solutions, hence the name of this commit. Co-authored-by: Ryan <Wild1145@users.noreply.github.com> Co-authored-by: Nathan Curran <30569566+Focusvity@users.noreply.github.com>
This commit is contained in:
parent
7258d7f1bf
commit
bdf4ca84e0
@ -65,7 +65,7 @@ public class Command_potion extends FreedomCommand
|
||||
Player target = playerSender;
|
||||
if (args.length == 2)
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender) && !target.equals(getPlayer(sender.getName())))
|
||||
if (!plugin.al.isAdmin(sender) && !args[1].equalsIgnoreCase(sender.getName()))
|
||||
{
|
||||
msg(ChatColor.RED + "Only admins can clear potion effects from other players.");
|
||||
return true;
|
||||
@ -104,7 +104,7 @@ public class Command_potion extends FreedomCommand
|
||||
|
||||
if (args.length == 5)
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender) && !getPlayer(args[4]).equals(getPlayer(sender.getName())))
|
||||
if (!plugin.al.isAdmin(sender) && !args[4].equalsIgnoreCase(sender.getName()))
|
||||
{
|
||||
msg("Only admins can apply potion effects to other players.", ChatColor.RED);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user