Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gaah.moonmanutencao;
- import com.gaah.JSON.JSONChatClickEventType;
- import com.gaah.JSON.JSONChatExtra;
- import com.gaah.JSON.JSONChatHoverEventType;
- import com.gaah.JSON.JSONChatMessage;
- import org.bukkit.Bukkit;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class MoonManutencao extends JavaPlugin {
- public void onEnable() {
- this.getCommand("utilidades").setExecutor((CommandExecutor) this);
- }
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
- Player p = (Player) sender;
- JSONChatMessage line1 = new JSONChatMessage(" ", null, null);
- JSONChatExtra manutencao = new JSONChatExtra("§e✳§c Manutenção");
- manutencao.setHoverEvent(JSONChatHoverEventType.SHOW_TEXT, "Clique aqui para iniciar o contador para a Manutenção");
- manutencao.setClickEvent(JSONChatClickEventType.SUGGEST_COMMAND, "/utilidades manutencao start");
- line1.addExtra(manutencao);
- JSONChatMessage line2 = new JSONChatMessage(" ", null, null);
- JSONChatExtra kickall = new JSONChatExtra("§e✳§c Kickall");
- kickall.setHoverEvent(JSONChatHoverEventType.SHOW_TEXT, "Clique aqui para Kickar todos os jogadores");
- kickall.setClickEvent(JSONChatClickEventType.SUGGEST_COMMAND, "/utilidades kickall");
- line2.addExtra(kickall);
- JSONChatMessage line3 = new JSONChatMessage(" ", null, null);
- JSONChatExtra kickallmaiswithelist = new JSONChatExtra("§e✳§c Kickall + Whitelist on");
- kickallmaiswithelist.setHoverEvent(JSONChatHoverEventType.SHOW_TEXT, "Clique aqui para Kickar todos os jogadores e ligar a Whitelist");
- kickallmaiswithelist.setClickEvent(JSONChatClickEventType.SUGGEST_COMMAND, "/utilidades kickall whitelist");
- line3.addExtra(kickallmaiswithelist);
- JSONChatMessage line4 = new JSONChatMessage(" ", null, null);
- JSONChatExtra stop = new JSONChatExtra("§e✳§c STOP");
- stop.setHoverEvent(JSONChatHoverEventType.SHOW_TEXT, "Clique aqui dar STOP no servidor (abre com a whitelist ativada)");
- stop.setClickEvent(JSONChatClickEventType.SUGGEST_COMMAND, "/utilidades stop");
- line4.addExtra(stop);
- if (args.length == 0) {
- if (sender.hasPermission("moon.utilidades")) {
- sender.sendMessage(" §f Todos os comandos admin:");
- sender.sendMessage("");
- line1.sendToPlayer(p);
- line2.sendToPlayer(p);
- line3.sendToPlayer(p);
- sender.sendMessage("");
- line4.sendToPlayer(p);
- sender.sendMessage("");
- } else {
- sender.sendMessage("§cVocê não tem permissão");
- }
- }
- if (p.hasPermission("moon.manutencao")) {
- if (args.length >= 3) {
- sender.sendMessage("§cErrado. Correto: /manu start");
- return true;
- }
- } else {
- p.sendMessage("§cVocê não tem permissão para isso");
- }
- if (sender.hasPermission("moon.kickallandwhitelist")) {
- if (args.length > 0 && args[0].equalsIgnoreCase("kickall") && args[1].equalsIgnoreCase("whitelist")) {
- Bukkit.getOnlinePlayers().forEach(player -> p.kickPlayer("§c§lMOONMC \n §cTodos os jogadores foram kikados!"));
- Bukkit.setWhitelist(true);
- Bukkit.getWorld("plotworld").save();
- Bukkit.getWorld("world").save();
- }
- }
- if (sender.hasPermission("moon.kickall")) {
- if (args.length > 0 && args[0].equalsIgnoreCase("kickall")) {
- Bukkit.getOnlinePlayers().forEach(player -> p.kickPlayer("§c§lMOONMC \n §cTodos os jogadores foram kikados!"));
- Bukkit.getWorld("plotworld").save();
- Bukkit.getWorld("world").save();
- }
- }
- if (sender.hasPermission("moon.stop")) {
- if (args.length > 0 && args[0].equalsIgnoreCase("stop")) {
- Bukkit.getOnlinePlayers().forEach(player -> p.kickPlayer("§c§lMOONMC \n §cO servidor foi fechado temporariamente!"));
- Bukkit.getWorld("plotworld").save();
- Bukkit.getWorld("world").save();
- Bukkit.setWhitelist(true);
- Bukkit.shutdown();
- }
- }
- if (sender.hasPermission("moon.manutencao.start")) {
- if (args.length > 0 && args[0].equalsIgnoreCase("manutencao") && args[1].equalsIgnoreCase("start")) {
- Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lc muteall");
- for (int i = 0; i < 1000; ++i) {
- sender.sendMessage("");
- }
- for (Player players : Bukkit.getOnlinePlayers()) {
- players.sendMessage("");
- players.sendMessage("§cServidor entrando em manutenção em 1 minuto!");
- players.sendMessage("");
- }
- Bukkit.setWhitelist(true);
- Bukkit.getWorld("plotworld").save();
- Bukkit.getWorld("world").save();
- Bukkit.getScheduler().scheduleSyncDelayedTask(JavaPlugin.getPlugin(MoonManutencao.class), () -> {
- for (Player players : Bukkit.getOnlinePlayers()) {
- players.sendMessage("");
- players.sendMessage("§cServidor entrando em manutenção em 30 minuto!");
- players.sendMessage("");
- }
- }, 30 * 20);
- Bukkit.getScheduler().scheduleSyncDelayedTask(JavaPlugin.getPlugin(MoonManutencao.class), () -> {
- Bukkit.getOnlinePlayers().forEach(player -> p.kickPlayer("§c§lMOONMC \n §c Todos os jogadores foram kikados!"));
- Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "lc unmuteall");
- Bukkit.shutdown();
- }, 60 * 20);
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement