Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.michael.tutorial;
- import java.util.logging.Logger;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.plugin.PluginDescriptionFile;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin {
- public final Logger logger = Logger.getLogger("Minecraft");
- public static Main plugin;
- public final MyPlayerListener pl = new MyPlayerListener();
- public String day1 = this.getConfig().getString("day1week1");
- public String day1week1reward = this.getConfig().getString("day1week1reward");
- @Override
- public void onDisable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion()
- + " Has been deactivated");
- }
- @Override
- public void onEnable() {
- PluginDescriptionFile pdfFile = this.getDescription();
- this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion()
- + " Has been activated");
- getConfig().options().copyDefaults(true);
- saveConfig();
- PluginManager pm = getServer().getPluginManager();
- pm.registerEvents(this.pl, this);
- }
- public boolean onCommand(CommandSender sender, Command cmd,
- String commandLabel, String[] args) {
- Player player = (Player) sender;
- World world = player.getWorld();
- if (commandLabel.equalsIgnoreCase("ping")) {
- if (player.hasPermission("fissionplugin.ping")) {
- player.sendMessage("Pong");
- }
- } else if (commandLabel.equalsIgnoreCase("heal")) {
- if (player.hasPermission("fissionplugin.heal")) {
- player.setHealth(20);
- player.sendMessage(ChatColor.DARK_GREEN
- + "You have been healed!");
- } else {
- player.sendMessage(ChatColor.DARK_RED
- + "You don't have permission!");
- }
- } else if (commandLabel.equalsIgnoreCase("fullheal")) {
- if (player.hasPermission("fissionplugin.heal.full")) {
- player.setFoodLevel(20);
- player.setHealth(20);
- player.setFireTicks(0);
- player.sendMessage(ChatColor.DARK_GREEN
- + "You have been healed!");
- }
- } else if (commandLabel.equalsIgnoreCase("fly")) {
- if (args.length == 0) {
- if (player.hasPermission("fissionplugin.fly")) {
- player.setAllowFlight(true);
- player.setFlying(true);
- }
- } else if (args.length == 1) {
- player.setAllowFlight(false);
- player.setFlying(false);
- }
- } else if (commandLabel.equalsIgnoreCase("flyoff")) {
- if (player.hasPermission("fissionplugin.fly")) {
- player.setAllowFlight(false);
- player.setFlying(false);
- }
- } else if (commandLabel.equalsIgnoreCase("gb")) {
- if (player.hasPermission("fissionplugin.group1")) {
- player.sendMessage(ChatColor.GRAY
- + "You are in the regular player group!");
- } else if (player.hasPermission("fissionplugin.admin")) {
- player.sendMessage(ChatColor.RED
- + "You are in the administrative group!");
- }
- } else if (commandLabel.equalsIgnoreCase("survival")) {
- if (player.hasPermission("fissionplugin.survival")) {
- Bukkit.broadcastMessage(ChatColor.BLUE
- + player.getDisplayName()
- + " Has changed their game-mode!");
- player.setGameMode(GameMode.SURVIVAL);
- player.sendMessage(ChatColor.GOLD + "You are now in survival!");
- }
- } else if (commandLabel.equalsIgnoreCase("creative")) {
- if (player.hasPermission("fissionplugin.creative")) {
- Bukkit.broadcastMessage(ChatColor.BLUE
- + player.getDisplayName()
- + " Has changed their game-mode!");
- player.setGameMode(GameMode.CREATIVE);
- player.sendMessage(ChatColor.BLUE + "You are now in creative!");
- }
- } else if (commandLabel.equalsIgnoreCase("adventure")) {
- if (player.hasPermission("fissionplugin.adventure")) {
- Bukkit.broadcastMessage(ChatColor.BLUE
- + player.getDisplayName()
- + " Has changed their gamemode!");
- player.setGameMode(GameMode.ADVENTURE);
- player.sendMessage(ChatColor.BLUE
- + "You have changed your gamemode to adventure mode!");
- }
- } else if (commandLabel.equalsIgnoreCase("staff")) {
- if (player.hasPermission("fissionplugin.stafflist")) {
- player.sendMessage(getConfig().getString("Staff"));
- }
- } else if (commandLabel.equalsIgnoreCase("tp")) {
- if (player.hasPermission("fissionplugin.teleport")) {
- if (args.length == 0) {
- player.sendMessage(ChatColor.DARK_RED + "No permission");
- } else if (args.length == 1) {
- Player targetPlayer = player.getServer().getPlayer(args[0]);
- Location location = targetPlayer.getLocation();
- player.teleport(location);
- } else if (args.length == 2) {
- Player targetPlayer = player.getServer().getPlayer(args[0]);
- Player targetPlayer1 = player.getServer()
- .getPlayer(args[1]);
- Location targetPlayerLocation = targetPlayer.getLocation();
- Location targetPlayer1Location = targetPlayer.getLocation();
- targetPlayer.teleport(targetPlayer1Location);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("/m")) {
- if (player.hasPermission("fissionplugin.message")) {
- if (args.length == 0) {
- player.sendMessage(ChatColor.DARK_RED
- + "Not enough arguments");
- }
- if (args.length == 1) {
- player.sendMessage(ChatColor.DARK_RED
- + "Not enough arguments");
- }
- if (args.length == 2) {
- Player targetMessagePlayer = player.getServer().getPlayer(
- args[0]);
- targetMessagePlayer.sendMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "] " + args[1]);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("time")) {
- if (player.hasPermission("fissionplugin.world.time")) {
- if (args[0].equalsIgnoreCase("day")) {
- world.setTime(12000);
- player.sendMessage(ChatColor.YELLOW
- + "You have changed the time to day");
- }
- if (args[0].equalsIgnoreCase("night")) {
- world.setTime(18000);
- player.sendMessage(ChatColor.YELLOW
- + "You have changed the time to night");
- }
- if (args.length == 0) {
- player.sendMessage(ChatColor.DARK_RED
- + "Correct use: /time <day/night>");
- }
- }
- } else if (commandLabel.equalsIgnoreCase("broadcast")) {
- if (player.hasPermission("fissionplugin.broadcast")) {
- if (args.length == 0) {
- player.sendMessage(ChatColor.DARK_RED + "NO arguments");
- }
- if (args.length == 1) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0]);
- }
- if (args.length == 2) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]);
- }
- if (args.length == 3) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2]);
- }
- if (args.length == 4) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3]);
- }
- if (args.length == 5) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]);
- }
- if (args.length == 6) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5]);
- }
- if (args.length == 7) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6]);
- }
- if (args.length == 8) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]);
- }
- if (args.length == 9) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8]);
- }
- if (args.length == 10) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9]);
- }
- if (args.length == 11) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]);
- }
- if (args.length == 12) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]
- + " " + args[11]);
- }
- if (args.length == 13) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]
- + " " + args[11] + " " + args[12]);
- }
- if (args.length == 14) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]
- + " " + args[11] + " " + args[12] + " " + args[13]);
- }
- if (args.length == 15) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]
- + " " + args[11] + " " + args[12] + " " + args[13]
- + "" + args[14]);
- }
- if (args.length == 16) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]
- + " " + args[11] + " " + args[12] + " " + args[13]
- + "" + args[14] + " " + args[15]);
- }
- if (args.length == 17) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "["
- + player.getDisplayName() + "]" + "[Console]"
- + ChatColor.GREEN + " " + args[0] + " " + args[1]
- + " " + args[2] + " " + args[3] + " " + args[4]
- + " " + args[5] + " " + args[6] + " " + args[7]
- + " " + args[8] + " " + args[9] + " " + args[10]
- + " " + args[11] + " " + args[12] + " " + args[13]
- + "" + args[14] + " " + args[15] + " " + args[16]);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("wt")) {
- if (player.hasPermission("fissionplugin.weather")) {
- if (args[0].equalsIgnoreCase("sun")) {
- world.setStorm(false);
- }
- if (args[0].equalsIgnoreCase("storm")) {
- world.setStorm(true);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("nick")) {
- if (player.hasPermission("fissionplugin.namechange")) {
- if (args.length == 1) {
- player.setDisplayName(args[0]);
- player.sendMessage(ChatColor.BLUE
- + "Your nickname is now: " + args[0]);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("nickother")) {
- if (player.hasPermission("fissionplugin.namechange.other")) {
- if (args.length == 2) {
- Player targetNamePlayer = getServer().getPlayer(args[0]);
- targetNamePlayer.setDisplayName(args[1]);
- targetNamePlayer.sendMessage(ChatColor.BLUE
- + "Your nickname is now: " + args[1]);
- player.sendMessage(ChatColor.DARK_BLUE
- + "You have changed " + args[0] + " Nickname to: "
- + args[1]);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("gmc")) {
- if (player.hasPermission("fissionplugin.gamemode")) {
- if (player.getGameMode() == GameMode.CREATIVE) {
- player.setGameMode(GameMode.SURVIVAL);
- player.sendMessage(ChatColor.BLUE
- + "Your gamemode is now: " + player.getGameMode());
- }
- if (player.getGameMode() == GameMode.SURVIVAL) {
- player.setGameMode(GameMode.CREATIVE);
- player.sendMessage(ChatColor.BLUE
- + "Your gamemode is now: " + player.getGameMode());
- }
- }
- } else if (commandLabel.equalsIgnoreCase("/ban")) {
- if (player.hasPermission("fissionplugin.admin.ban")) {
- if (args.length == 2) {
- Player targetBanPlayer = getServer().getPlayer(args[0]);
- targetBanPlayer.kickPlayer(args[1]);
- targetBanPlayer.setBanned(true);
- }
- if (args[0] == player.getName()) {
- player.sendMessage(ChatColor.DARK_RED
- + "You can't ban yourself!");
- }
- }
- } else if (commandLabel.equalsIgnoreCase("/kick")) {
- if (player.hasPermission("fissionplugin.admin.kick")) {
- if (args.length == 2) {
- Player targetKickPlayer = getServer()
- .getPlayer(args[0]);
- targetKickPlayer.kickPlayer(args[1]);
- }
- }
- } else if (commandLabel.equalsIgnoreCase("/msg")) {
- if (player.hasPermission("fissionplugin.message")) {
- if (args.length == 0) {
- player.sendMessage(ChatColor.DARK_RED
- + "Not enough arguments");
- }
- if (args.length == 1) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0]);
- }
- if (args.length == 2) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1]);
- }
- if (args.length == 3) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2]);
- }
- if (args.length == 4) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3]);
- }
- if (args.length == 5) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4]);
- }
- if (args.length == 6) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5]);
- }
- if (args.length == 7) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6]);
- }
- if (args.length == 8) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7]);
- }
- if (args.length == 9) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8]);
- }
- if (args.length == 10) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9]);
- }
- if (args.length == 11) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10]);
- }
- if (args.length == 12) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10] + " " + args[11]);
- }
- if (args.length == 13) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10] + " " + args[11] + " " + args[12]);
- }
- if (args.length == 14) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10] + " " + args[11] + " " + args[12]
- + " " + args[13]);
- }
- if (args.length == 15) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10] + " " + args[11] + " " + args[12]
- + " " + args[13] + "" + args[14]);
- }
- if (args.length == 16) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10] + " " + args[11] + " " + args[12]
- + " " + args[13] + "" + args[14] + " "
- + args[15]);
- }
- if (args.length == 17) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "["
- + player.getDisplayName() + "]"
- + ChatColor.GREEN + " " + args[0] + " "
- + args[1] + " " + args[2] + " " + args[3] + " "
- + args[4] + " " + args[5] + " " + args[6] + " "
- + args[7] + " " + args[8] + " " + args[9] + " "
- + args[10] + " " + args[11] + " " + args[12]
- + " " + args[13] + "" + args[14] + " "
- + args[15] + " " + args[16]);
- }
- }
- }
- return false;
- }
- {
- }
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement