better naming conventions

This commit is contained in:
2017-05-04 10:26:15 +02:00
committed by GitHub
parent 9b5f568675
commit c8676637ed
@@ -10,21 +10,21 @@ import org.bukkit.configuration.file.FileConfiguration;
public class StaffChatCommand implements CommandExecutor public class StaffChatCommand implements CommandExecutor
{ {
private Main main; private Main plugin;
private FileConfiguration config; private FileConfiguration config;
public StaffChatCommand(Main main) public StaffChatCommand(Main plugin)
{ {
this.main = main; this.plugin = plugin;
config = main.getConfig(); config = plugin.getConfig();
} }
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{ {
String noPerm = clr(config.getString("messages.prefix") + config.getString("messages.nopermission")); if (!sender.hasPermission(plugin.commandPerm))
if (!sender.hasPermission(main.commandPerm))
{ {
String noPerm = clr(config.getString("messages.prefix") + config.getString("messages.nopermission"));
sender.sendMessage(noPerm); sender.sendMessage(noPerm);
return true; return true;
} }
@@ -35,7 +35,7 @@ public class StaffChatCommand implements CommandExecutor
} }
if (args[0].equalsIgnoreCase("reload")) if (args[0].equalsIgnoreCase("reload"))
{ {
if (sender.hasPermission(main.reloadPerm)) if (sender.hasPermission(plugin.reloadPerm))
{ {
reload(sender); reload(sender);
} }
@@ -52,8 +52,8 @@ public class StaffChatCommand implements CommandExecutor
private void help(CommandSender sender, String label) private void help(CommandSender sender, String label)
{ {
String prefix = clr(config.getString("messages.prefix")); String prefix = clr(config.getString("messages.prefix"));
sender.sendMessage(prefix + "Version " + main.getDescription().getVersion() + ", made by oskar3123"); sender.sendMessage(prefix + "Version " + plugin.getDescription().getVersion() + ", made by oskar3123");
if (sender.hasPermission(main.reloadPerm)) if (sender.hasPermission(plugin.reloadPerm))
{ {
sender.sendMessage(prefix + "/" + label + " reload - Reloads the config file"); sender.sendMessage(prefix + "/" + label + " reload - Reloads the config file");
} }
@@ -61,8 +61,8 @@ public class StaffChatCommand implements CommandExecutor
private void reload(CommandSender sender) private void reload(CommandSender sender)
{ {
main.reloadConfig(); plugin.reloadConfig();
config = main.getConfig(); config = plugin.getConfig();
sender.sendMessage(clr(config.getString("messages.prefix") + config.getString("messages.reloaded"))); sender.sendMessage(clr(config.getString("messages.prefix") + config.getString("messages.reloaded")));
} }