Weather plugin

Discussion in 'Spigot Plugin Help' started by xotriks, Jul 19, 2021 at 3:15 PM.

  1. Hello, I would like to make a weather change plug .. but I don't understand WeatherEvent. It would be - /pog sloneczna (/sun)

    sloneczna (args)
    Code (Java):

    package me.purplesky.WeatherCommand.Subcommand;

    import me.purplesky.xinfo;
    import org.bukkit.command.CommandSender;

    import java.util.List;

    public class SLONECZNA implements Subcommand {
        @Override
        public void parseSubcommand(xinfo main, CommandSender sender, String label, String[] args) {
            if (sender.hasPermission("pogoda.pog.sloneczna")) {
                if (args.length == 1) {

                } else {

                }
            } else {
                xinfo.noPerm(sender);
            }
        }

        @Override
        public List<String> parseTabCompletions(xinfo main, CommandSender sender, String[] args) {
            return null;
        }
    }
     
    /pogoda (weather)
    Code (Java):
    package me.purplesky.WeatherCommand;

    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;

    public class POGODA implements CommandExecutor {
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (sender.hasPermission("pogoda.pog")) {
                if (args.length == 0) {

                } else {
                    switch (args[0].toLowerCase()) {
                        case "noc":
                            break;
                        case "dzien":
                            break;
                        case "sloneczna":
                            break;
                        case "deszczowa":
                            break;
                    }
                }
            }
            return false;
        }
    }
     
    subcommand -
    Code (Java):

    package me.purplesky.WeatherCommand.Subcommand;

    import me.purplesky.xinfo;
    import org.bukkit.command.CommandSender;

    import java.util.List;

    public interface Subcommand {
        void parseSubcommand(final xinfo main, final CommandSender sender, final String label, final String[] args);

        List<String> parseTabCompletions(final xinfo main, final CommandSender sender, final String[] args);
    }
     
     
  2. Spigot/Vanilla already has these commands like "/time set day" "/time set night" "/toggledownfall" so u can run it with p.performCommand("time set day"); else if u wanna control the time of weather there are many plugins can do that.
     
    #2 iTz_3ZoOz99, Jul 19, 2021 at 3:56 PM
    Last edited: Jul 19, 2021 at 4:07 PM
    • Like Like x 1