Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.LYSwitch.lms;
- import me.LYSwitch.main.main;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- public class LMS implements CommandExecutor {
- public main plugin;
- public LMS(main instance) {
- plugin = instance;
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label,
- String[] args) {
- final Player p = (Player) sender;
- if (label.equalsIgnoreCase("lms")) {
- if (args.length == 0) {
- sender.sendMessage(ChatColor.WHITE + "[" + ChatColor.RED
- + "EliteFights" + ChatColor.WHITE + "] " + "Usage:");
- sender.sendMessage("<command> : join <rank> : Administrator");
- sender.sendMessage("<command> : host <rank> : Default");
- return true;
- }
- if (args.length > 0) {
- if (args[0].equalsIgnoreCase("join")) {
- if (sender.hasPermission("default.lms.join")) {
- if (plugin.lmshost.size() == 1) {
- if (!plugin.lmsjoin.contains(p.getName())) {
- if (!plugin.lmsarena.contains(p.getName())) {
- // If there's a host then,
- Bukkit.getServer().broadcastMessage(
- ChatColor.WHITE + "["
- + ChatColor.RED
- + "EliteFights"
- + ChatColor.WHITE + "] "
- + sender.getName()
- + " has joined the LMS");
- plugin.lmsjoin.add(p.getName());
- } else { // If there isn't a host then,
- p.sendMessage(ChatColor.WHITE
- + "["
- + ChatColor.RED
- + "EliteFights"
- + ChatColor.WHITE
- + "] "
- + ChatColor.RED
- + "An LMS is not being hosted at the moment.");
- }
- }
- }
- }
- } else if (args[0].equalsIgnoreCase("host")) {
- if (sender.hasPermission("admin.lms.host")) {
- if (!plugin.lmshost.contains(p.getName())) {
- if (!plugin.lmsjoin.contains(p.getName())) {
- Bukkit.getServer().broadcastMessage(
- ChatColor.WHITE + "[" + ChatColor.RED
- + "EliteFights"
- + ChatColor.WHITE + "] "
- + p.getName()
- + " has started an LMS.");
- Bukkit.getServer()
- .broadcastMessage(
- ChatColor.WHITE
- + "["
- + ChatColor.RED
- + "EliteFights"
- + ChatColor.WHITE
- + "] "
- + "LMS is starting in 30 seconds.");
- sender.sendMessage(ChatColor.WHITE + "["
- + ChatColor.RED + "EliteFights"
- + ChatColor.WHITE + "] "
- + ChatColor.WHITE + "You have also"
- + ChatColor.ITALIC + " joined"
- + ChatColor.WHITE + " the LMS");
- plugin.lmshost.add(p.getName());
- plugin.lmsjoin.add(p.getName());
- }
- } else {
- p.sendMessage(ChatColor.WHITE + "[" + ChatColor.RED
- + "EliteFights" + ChatColor.WHITE + "] "
- + "You're already hosting an LMS.");
- }
- if (plugin.lmsjoin.size() > 1) {
- Bukkit.getServer()
- // TODO: Time between /lms host and when
- // they're
- // tp'd
- .getScheduler()
- .scheduleSyncDelayedTask(plugin,
- new Runnable() {
- public void run() {
- Double x = 1000.00;
- Double y = 10.00;
- Double z = 1000.00;
- Location loc = new Location(
- p.getWorld(), x, y,
- z);
- p.teleport(loc);
- p.sendMessage(ChatColor.WHITE
- + "["
- + ChatColor.RED
- + "EliteFights"
- + ChatColor.WHITE
- + "] "
- + "You've been teleported, prepare to fight.");
- plugin.lmsarena.add(p
- .getName());
- plugin.lmshost.remove(p
- .getName());
- plugin.lmsjoin.remove(p
- .getName());
- }
- }, 600);
- // Syntaxes.
- }
- }
- }
- }
- return false;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement