Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.Da_Pepsi_Monster.TempFly;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class main extends JavaPlugin
- {
- public boolean onCommand(CommandSender theSender, Command cmd, String commandLabel, String[] args)
- {
- if(theSender instanceof Player)
- {
- final Player player = (Player) theSender;
- if(commandLabel.equalsIgnoreCase("tempfly"))
- {
- try
- {
- if(args[0].equalsIgnoreCase("version"))
- {
- player.sendMessage(ChatColor.GOLD + " TempFly " + ChatColor.GREEN + "v1.0 " + ChatColor.GRAY + "plugin developed by " + ChatColor.GREEN + "Da_Pepsi_Monster");
- }
- else if(args[0].equalsIgnoreCase("ver"))
- {
- player.sendMessage(ChatColor.GOLD + " TempFly " + ChatColor.GREEN + "v1.0 " + ChatColor.GRAY + "plugin developed by " + ChatColor.GREEN + "Da_Pepsi_Monster");
- }
- else if(args[0].equalsIgnoreCase("use"))
- {
- if(player.hasPermission("tempfly.use"))
- {
- player.sendMessage(ChatColor.AQUA + "You have been given flight for 15 seconds!");
- player.setAllowFlight(true);
- player.setFlying(true);
- player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20 * 30, 5));
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable()
- {
- public void run()
- {
- player.sendMessage(ChatColor.AQUA + "Flight disabled! You have 15 seconds to land safely.");
- player.setAllowFlight(false);
- player.setFlying(false);
- }
- }, 20 * 15);
- }
- else player.sendMessage(ChatColor.RED + "You do not have permission: " + ChatColor.WHITE + "tempfly.use");
- }
- }
- catch (Exception exception)
- {
- player.sendMessage(ChatColor.RED + " Invalid Argument");
- }
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement