Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.vandesdelca32.websitespam;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.configuration.file.FileConfiguration;
- import org.bukkit.configuration.file.FileConfigurationOptions;
- public final class WebsiteSpam extends org.bukkit.plugin.java.JavaPlugin
- {
- public WebsiteSpam() {}
- public void onDisable() {}
- public void onEnable()
- {
- saveDefaultConfig();
- getConfig().options().copyDefaults(true);
- }
- public void onLoad() {}
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
- {
- if (cmd.getName().equalsIgnoreCase("website")) {
- if (args.length == 1) {
- if (("donations".equalsIgnoreCase(args[0])) || ("2".equalsIgnoreCase(args[0])))
- {
- SendLink(sender, "donate");
- return true;
- }
- if (("register".equalsIgnoreCase(args[0])) || ("3".equalsIgnoreCase(args[0])))
- {
- SendLink(sender, "register");
- return true;
- }
- if (("vote".equalsIgnoreCase(args[0])) || ("4".equalsIgnoreCase(args[0])))
- {
- SendLink(sender, "vote");
- return true;
- }
- if ("reload".equalsIgnoreCase(args[0]))
- {
- if (sender.hasPermission("websitespam.reload"))
- {
- reloadConfig();
- SendLink(sender, "reload");
- return true;
- }
- sender.sendMessage("§cYou don't have permission to do that.");
- return false;
- }
- }
- else
- {
- SendLink(sender, "main");
- return true;
- }
- }
- return false;
- }
- private void SendLink(CommandSender target, String linktype) {
- String message = "§a§o";
- if ("donate".equalsIgnoreCase(linktype)) {
- message = message + "Donations§r: §6" + getDonationLink();
- } else if ("main".equalsIgnoreCase(linktype)) {
- message = message + "Main Website§r: §6" + getMainLink();
- } else if ("register".equalsIgnoreCase(linktype)) {
- message = message + "Register§r: §6" + getRegisterLink();
- } else if ("vote".equalsIgnoreCase(linktype)) {
- message = message + "Vote§r: §6" + getVoteLink();
- } else if ("reload".equalsIgnoreCase(linktype)) {
- message = message + ChatColor.GREEN + "Config reloaded";
- } else {
- message = message + ChatColor.RED + "I don't know what to say to you...";
- }
- target.sendMessage("§3§o[WebsiteSpammer]§r " + message);
- }
- private String getDonationLink()
- {
- return getConfig().getString("links.donations");
- }
- private String getRegisterLink()
- {
- return getConfig().getString("links.register");
- }
- private String getVoteLink() {
- return getConfig().getString("links.vote");
- }
- private String getMainLink()
- {
- return getConfig().getString("links.main");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement