mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2026-07-16 02:25:13 +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 <[email protected]> Co-authored-by: Nathan Curran <[email protected]>
This commit is contained in:
committed by
Ryan
co-authored by
Ryan
Nathan Curran
parent
879a524bb4
commit
6fb9507a4c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user