Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.github.thestuntman.TINCL;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.World;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.*;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import java.util.List;
- import java.util.Locale;
- /**
- * Created by The_Stuntman on 1/31/14.
- */
- public class tinclCommandExecutor implements CommandExecutor {
- private Main plugin;
- public tinclCommandExecutor(Main plugin) {
- this.plugin = plugin;
- }
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- Player TargetPlayer = null;
- Player player = (Player) sender;
- if (args.length == 0)
- {
- sender.sendMessage(ChatColor.RED + "Syntax is /tincl help,info");
- return true;
- }
- switch(args[0].toLowerCase(Locale.ENGLISH))
- {
- case "help":
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.YELLOW + "/tincl - Show the command syntax");
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.YELLOW + "/tincl help - view tincl commands");
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.YELLOW + "/tincl swarm [playername] - spawn angry chicken on targetted player");
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.YELLOW + "/tincl info - helpful info");
- break;
- case "info":
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.DARK_PURPLE + "There is no Chicken Level");
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.DARK_PURPLE + "Created by: The_Stuntman");
- break;
- case "swarm":
- if(!player.hasPermission("swarm.tincl")){
- player.sendMessage(ChatColor.RED + "You do not have permission to perform this command");
- }else{
- if (args.length > 1){
- TargetPlayer = Bukkit.getServer().getPlayer(args[1]);
- World world = TargetPlayer.getWorld();
- Location TargetLocation = TargetPlayer.getLocation();
- TargetPlayer.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.YELLOW + "An Evil Chicken has attacked you!");
- Entity chicken = world.spawnEntity(TargetLocation, EntityType.CHICKEN);
- Entity zombie = world.spawnEntity(TargetLocation, EntityType.ZOMBIE);
- zombie.setPassenger(chicken);
- tinclListener.zombieIds.add(zombie.getEntityId()+"");
- tinclListener.chickenIds.add(chicken.getEntityId()+"");
- double radius = 3D;
- List<Entity> near = TargetLocation.getWorld().getEntities();
- for(Entity e : near) {
- if(e.getLocation().distance(TargetLocation) <= radius && e instanceof Zombie)
- {
- Zombie zombiecart = (Zombie) e;
- ((Zombie) e).setBaby(true);
- zombiecart.setBaby(true);
- zombiecart.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 1));
- }
- if(e.getLocation().distance(TargetLocation) <= radius && e instanceof Chicken)
- {
- Chicken evilchicken = (Chicken) e;
- evilchicken.setCustomName(ChatColor.RED + "Evil Chicken");
- evilchicken.setCustomNameVisible(true);
- }
- }
- }else{
- player.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.RED + "you need to target a player!");
- }
- break;
- }
- default:
- sender.sendMessage(ChatColor.DARK_GREEN + "[TINCL]" + ChatColor.RED + "Invalid Syntax");
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment