package ru.swat1x;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import ru.swat1x.chat.ChatMain;
import ru.swat1x.commands.Back;
import ru.swat1x.commands.Ban;
import ru.swat1x.commands.Broadcast;
import ru.swat1x.commands.BroadcastMessages;
import ru.swat1x.commands.Call;
import ru.swat1x.commands.CommandSpy;
import ru.swat1x.commands.Economy;
import ru.swat1x.commands.EnderChest;
import ru.swat1x.commands.Fly;
import ru.swat1x.commands.Gamemode;
import ru.swat1x.commands.God;
import ru.swat1x.commands.Hat;
import ru.swat1x.commands.Heal;
import ru.swat1x.commands.Home;
import ru.swat1x.commands.Info;
import ru.swat1x.commands.Invsee;
import ru.swat1x.commands.MegaWolf;
import ru.swat1x.commands.Msg;
import ru.swat1x.commands.Near;
import ru.swat1x.commands.Nick;
import ru.swat1x.commands.Rtp;
import ru.swat1x.commands.Rules;
import ru.swat1x.commands.S;
import ru.swat1x.commands.Sit;
import ru.swat1x.commands.Spawn;
import ru.swat1x.commands.Speed;
import ru.swat1x.commands.Time;
import ru.swat1x.commands.Tp;
import ru.swat1x.commands.Warp;
import ru.swat1x.commands.Weather;
import ru.swat1x.handler.Handler;
import ru.swat1x.killermoney.MobListener;
import ru.swat1x.placeholders.PlaceholderMain;
import net.milkbowl.vault.chat.Chat;
public class AltEss extends JavaPlugin implements CommandExecutor{
private static Chat chat = null;
@Override
public void onEnable() {
BroadcastMessages.broadcastMessages();
setupChat();
getCommand("tp").setExecutor(new Tp());
getCommand("adv").setExecutor(new BroadcastMessages());
getCommand("s").setExecutor(new S());
getCommand("time").setExecutor(new Time());
getCommand("weather").setExecutor(new Weather());
getCommand("home").setExecutor(new Home());
getCommand("heal").setExecutor(new Heal());
getCommand("eco").setExecutor(new Economy());
getCommand("ec").setExecutor(new EnderChest());
Bukkit.getPluginManager().registerEvents(new Economy(), this);
Bukkit.getPluginManager().registerEvents(new Info(), this);
Bukkit.getPluginManager().registerEvents(new Back(), this);
Bukkit.getPluginManager().registerEvents(new MobListener(), this);
getCommand("gamemode").setExecutor(new Gamemode());
getCommand("speed").setExecutor(new Speed());
getCommand("fly").setExecutor(new Fly());
getCommand("god").setExecutor(new God());
getCommand("rules").setExecutor(new Rules());
getCommand("rtp").setExecutor(new Rtp());
getCommand("near").setExecutor(new Near());
getCommand("megawolf").setExecutor(new MegaWolf());
getCommand("back").setExecutor(new Back());
getCommand("spawn").setExecutor(new Spawn());
getCommand("info").setExecutor(new Info());
Bukkit.getPluginManager().registerEvents(new God(), this);
Bukkit.getPluginManager().registerEvents(new ChatMain(), this);
Bukkit.getPluginManager().registerEvents(new CommandSpy(), this);
Bukkit.getPluginManager().registerEvents(new Handler(), this);
Bukkit.getPluginManager().registerEvents(new Ban(), this);
getCommand("sit").setExecutor(new Sit());
getCommand("warp").setExecutor(new Warp());
getCommand("hat").setExecutor(new Hat());
getCommand("invsee").setExecutor(new Invsee());
getCommand("commandspy").setExecutor(new CommandSpy());
getCommand("msg").setExecutor(new Msg());
getCommand("nick").setExecutor(new Nick());
getCommand("call").setExecutor(new Call(this));
getCommand("broadcast").setExecutor(new Broadcast());
getCommand("altess").setExecutor(this);
getCommand("ban").setExecutor(new Ban());
if( Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")){
//Registering placeholder will be use here
new PlaceholderMain().register();
}
}
private boolean setupChat() {
RegisteredServiceProvider<Chat> rsp = getServer().getServicesManager().getRegistration(Chat.class);
chat = rsp.getProvider();
return chat != null;
}
public static Chat getChat() {
return chat;
}
}