commit
ff7c374a7a
3 changed files with 74 additions and 0 deletions
@ -0,0 +1,46 @@ |
||||
package erik.masik.ecocraftVehicles; |
||||
|
||||
import org.bukkit.command.Command; |
||||
import org.bukkit.command.CommandExecutor; |
||||
import org.bukkit.command.CommandSender; |
||||
import org.bukkit.command.TabCompleter; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class CommandManager implements CommandExecutor, TabCompleter { |
||||
|
||||
private final EcocraftVehicles plugin; |
||||
|
||||
public CommandManager(EcocraftVehicles plugin) { |
||||
this.plugin = plugin; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { |
||||
if (args.length == 0) { |
||||
sender.sendMessage("§eEcocraftVehicles §7- Use §f/ev reload §7to reload the plugin."); |
||||
return true; |
||||
} |
||||
|
||||
if (args[0].equalsIgnoreCase("reload")) { |
||||
if (!sender.hasPermission("ecocraftvehicles.reload")) { |
||||
sender.sendMessage("§cYou don't have permission to do that."); |
||||
return true; |
||||
} |
||||
plugin.reload(); |
||||
sender.sendMessage("§aEcocraftVehicles reloaded successfully."); |
||||
return true; |
||||
} |
||||
|
||||
sender.sendMessage("§cUnknown subcommand. Use §f/ev reload§c."); |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { |
||||
if (args.length == 1) { |
||||
return List.of("reload"); |
||||
} |
||||
return List.of(); |
||||
} |
||||
} |
||||
@ -0,0 +1,27 @@ |
||||
package erik.masik.ecocraftVehicles; |
||||
|
||||
public class ConfigManager { |
||||
|
||||
private final EcocraftVehicles plugin; |
||||
|
||||
public ConfigManager(EcocraftVehicles plugin) { |
||||
this.plugin = plugin; |
||||
plugin.saveDefaultConfig(); |
||||
} |
||||
|
||||
public void reload() { |
||||
plugin.reloadConfig(); |
||||
} |
||||
|
||||
public String getString(String path, String def) { |
||||
return plugin.getConfig().getString(path, def); |
||||
} |
||||
|
||||
public int getInt(String path, int def) { |
||||
return plugin.getConfig().getInt(path, def); |
||||
} |
||||
|
||||
public boolean getBoolean(String path, boolean def) { |
||||
return plugin.getConfig().getBoolean(path, def); |
||||
} |
||||
} |
||||
@ -0,0 +1 @@ |
||||
# EcocraftVehicles default configuration |
||||
Loading…
Reference in new issue