Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.funnyfraq;
- import java.util.logging.Logger;
- import org.bukkit.ChatColor;
- import org.bukkit.GameMode;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin {
- public final Logger logger = Logger.getLogger("Minecraft");
- public void onEnable() {
- this.getServer().getConsoleSender().sendMessage(ChatColor.WHITE + "================================");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " Utils - Enable!");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GOLD + " By FunnyFraq");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.WHITE + "================================");
- this.getCommand("heal");
- this.getCommand("feed");
- this.getCommand("all");
- this.getCommand("gmc");
- this.getCommand("gms");
- this.getCommand("fly");
- this.getCommand("utils");
- this.getCommand("clean");
- this.getCommand("day");
- this.getConfig().options().copyDefaults(true);
- this.saveConfig();
- }
- public void onDisable() {
- this.getServer().getConsoleSender().sendMessage(ChatColor.WHITE + "================================");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.RED + " Utils - Disable!");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GOLD + " By FunnyFraq");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + " ");
- this.getServer().getConsoleSender().sendMessage(ChatColor.WHITE + "================================");
- }
- public String replacecolors(String string) {
- return string.replaceAll("(&([a-fk-or0-9]))", "?$2");
- }
- public boolean onCommand(CommandSender s, Command cmd, String label, String[] args) {
- if (!(s instanceof Player)) {
- s.sendMessage(ChatColor.RED + "This command is only for players!");
- }
- Player player = (Player) s;
- if (cmd.getName().equalsIgnoreCase("heal") && player.hasPermission("utils.heal")) {
- player.setHealth(20.0D);
- player.sendMessage("§cUtils: §fВы себя полечили!");
- }
- if (cmd.getName().equalsIgnoreCase("feed") && player.hasPermission("utils.feed")) {
- player.setFoodLevel(20);
- player.sendMessage("§cUtils: §fВы себя покормили!");
- }
- if (cmd.getName().equalsIgnoreCase("all") && player.hasPermission("utils.all")) {
- player.setFoodLevel(20);
- player.setHealth(20.0D);
- player.sendMessage("§cUtils: §fТеперь вы здоровы!");
- }
- if (cmd.getName().equalsIgnoreCase("gmc") && player.hasPermission("utils.gmc")) {
- player.setGameMode(GameMode.CREATIVE);
- player.sendMessage("§cUtils: §fТеперь ваш режим Креатив!");
- }
- if (cmd.getName().equalsIgnoreCase("gms") && player.hasPermission("utils.gms")) {
- player.setGameMode(GameMode.SURVIVAL);
- player.sendMessage("§cUtils: §fТеперь ваш режим Выжевание!");
- }
- if (cmd.getName().equalsIgnoreCase("clean") && player.hasPermission("utils.clean")) {
- player.getInventory().clear();
- player.sendMessage("§cUtils: §fВаш ивентарь очищен!");
- }
- if (cmd.getName().equalsIgnoreCase("day") && player.hasPermission("utils.day")) {
- player.getWorld().setTime(6000L);
- player.sendMessage("§cUtils: §fНа сервере установлен день!");
- }
- if (cmd.getName().equalsIgnoreCase("night") && player.hasPermission("utils.night")) {
- player.getWorld().setTime(13000L);
- player.sendMessage("§cUtils: §fНа сервере установлена ночь!");
- }
- if (cmd.getName().equalsIgnoreCase("fly") && player.hasPermission("utils.fly")) {
- if (args.length == 0) {
- player.sendMessage("§cUtils: §f/fly - Режим");
- player.sendMessage("§cUtils: §f/fly 1 - Включить полёт");
- player.sendMessage("§cUtils: §f/fly 0 - Выключить полёт");
- } else if (args.length == 1) {
- if (args[0].equalsIgnoreCase("1")) {
- player.setAllowFlight(true);
- player.sendMessage("§cUtils: §fПолёт включен!");
- } else if (args[0].equalsIgnoreCase("0")) {
- player.setAllowFlight(false);
- player.sendMessage("§cUtils: §fПолёт выключен!");
- }
- }
- }
- if (cmd.getName().equalsIgnoreCase("utils")) {
- player.sendMessage("");
- player.sendMessage("§a§l================================================================");
- player.sendMessage("");
- player.sendMessage(" §e§lUtils");
- player.sendMessage("");
- player.sendMessage(" §c/heal §r- Полечить себя ");
- player.sendMessage(" §c/feed §r- Покормить себя ");
- player.sendMessage(" §c/all §r- Покормить,Полечить себя ");
- player.sendMessage(" §c/gmc §r- Режим креатив ");
- player.sendMessage(" §c/gms §r- Режим выжевание ");
- player.sendMessage(" §c/fly §r- Режим полёта ");
- player.sendMessage(" §c/clean §r- Очистеть инвентарь ");
- player.sendMessage(" §c/day §r- Установить день ");
- player.sendMessage(" §c/night §r- Установить ночь ");
- player.sendMessage("");
- player.sendMessage("§a§l================================================================");
- player.sendMessage("");
- }
- return false;
- }
- }
Add Comment
Please, Sign In to add comment