Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (!(sender instanceof Player)) {
- log.info(ANSI_RED + "» You cannot run this command from system console!");
- } else if (sender.hasPermission("simpleparticles.enable")) {
- Player player = (Player) sender;
- switch (args.length) {
- case 0:
- player.sendMessage(chat("&7» &b&lSimpleParticles &7help page:"));
- player.sendMessage(chat("&7» &3/particles enable &a<particle>"));
- player.sendMessage(chat("&7» &3/particles disable"));
- player.sendMessage(chat("&7» &3/particles reload"));
- break;
- case 1:
- switch (args[0].toLowerCase()) {
- case "reload":
- if (player.hasPermission("simpleparticles.reload")) {
- updateConfig(plugin, player);
- } else {
- player.sendMessage(chat(plugin.getConfig().getString("main.messages.no-permission")));
- }
- break;
- case "rl":
- updateConfig(plugin, player);
- break;
- case "disable":
- if (player.hasPermission("simpleparticles.remove") && player_runnables.containsKey(player)) {
- player.sendMessage(chat(plugin.getConfig().getString("main.messages.disable-particles")));
- player_runnables.get(player).cancel();
- player_runnables.remove(player);
- }
- break;
- case "list":
- player.sendMessage(chat(plugin.getConfig().getString("main.messages.particles-list")));
- for (Map.Entry entry : particles2.entrySet()) {
- player.sendMessage(chat("&8» &a" + entry.getKey()));
- }
- break;
- default:
- player.sendMessage(chat(plugin.getConfig().getString("main.messages.invalid-argument")));
- break;
- }
- case 2:
- switch (args[0].toLowerCase()) {
- case "enable":
- if (player.hasPermission("simpleparticles." + args[1].toLowerCase()) && !player_runnables.containsKey(player)) {
- if (particles2.containsKey(args[1].toLowerCase())) {
- player.sendMessage(chat(plugin.getConfig().getString("main.messages.enabled-particles").replace("%pname%", args[1].toUpperCase())));
- AtomicReference<Double> k = new AtomicReference<>(0.00);
- BukkitRunnable runnable_player = new BukkitRunnable() {
- public void run() {
- drawparticle(player, k, Simpleparticles.particles2.get(args[1]).toUpperCase());
- k.updateAndGet(v -> v + plugin.getConfig().getDouble("main.value.runnable2"));
- if (k.get() > plugin.getConfig().getDouble("main.value.runnable3max")) {
- k.set((double) 0);
- }
- }
- };
- runnable_player.runTaskTimer(plugin, 0, Simpleparticles.plugin.getConfig().getLong("main.value.runnable") * 20);
- player_runnables.put(player, runnable_player);
- }
- } else {
- player.sendMessage(chat(plugin.getConfig().getString("main.messages.no-permission")));
- }
- break;
- }
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement