Package com.killruana.zcraft.administration

Source Code of com.killruana.zcraft.administration.HaxPluginCommand

package com.killruana.zcraft.administration;

import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.killruana.zcraft.ZCraftPlugin;
import com.killruana.zcraft.divers.Textes;

public class HaxPluginCommand implements CommandExecutor
{
    private final ZCraftPlugin plugin;

    public HaxPluginCommand(ZCraftPlugin plugin) {
        this.plugin = plugin;
    }

    public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
    {
      Player lanceur = (Player) sender;

        // T'as pas les droits, tu lances pas
      if (!lanceur.hasPermission("zcraft.administration.hax"))
      {
          lanceur.sendMessage(Textes.pas_les_droits);
            return true;
        }

        // On vérifie qu'il y a bien un argument
        if (args.length > 2)
        {
            return false;
        }

       
        Player maso = plugin.getServer().getPlayer(args[0]);
        if (maso == null)
        {
                lanceur.sendMessage("Ce joueur n'existe pas");
                return true;
        }
       
        if (args.length == 2)
        {
          int tmp = Integer.parseInt(args[1]);
          Location whereIsBryan = maso.getLocation();
            whereIsBryan.setY(tmp);
            maso.teleport(whereIsBryan);

            lanceur.getServer().broadcastMessage("HAAAAAAAX");
         
            return true;
        }
        else
        {
          Location whereIsBryan = maso.getLocation();
          whereIsBryan.setY(128);
          maso.teleport(whereIsBryan);

          lanceur.getServer().broadcastMessage("HAAAAAAAX");
          return true;
        }
     
    }
}
TOP

Related Classes of com.killruana.zcraft.administration.HaxPluginCommand

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.