Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.anton.FirstPlugin;
- import java.util.Random;
- import java.util.logging.Logger;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Location;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Turtle extends JavaPlugin
- {
- Logger myPluginLogger = Bukkit.getLogger();
- @Override
- public void onEnable()
- {
- myPluginLogger.info("[FirstPlugin] Plugin is starting up");
- }
- @Override
- public void onDisable()
- {
- myPluginLogger.info("[FirstPlugin] Plugin shutting down");
- }
- // This is basic command operation returning a message to the player
- public boolean onCommand(CommandSender theSender, Command cmd, String commandLabel, String[] args)
- {
- if(commandLabel.equalsIgnoreCase("flameon"))
- {
- Player thePlayer = (Player) theSender;
- if(args.length == 1)
- {
- if (args[0].equalsIgnoreCase("Hello"))
- {
- thePlayer.sendMessage(ChatColor.AQUA + "Hi");
- }
- }
- else thePlayer.sendMessage(ChatColor.DARK_AQUA + "FlameON :D");
- }
- return true;
- }
- // Teleportation and Locations
- public boolean onCommand1(CommandSender Sender, Command cmd, String command, String[] args)
- {
- if(cmd.getName().equalsIgnoreCase("teleportme") && Sender instanceof Player)
- {
- Player player = (Player) Sender;
- Location originalLocation = player.getLocation();
- Random random = new Random();
- int x = random.nextInt(1000) + 1;
- int y = 150;
- int z = random.nextInt(1000) + 1;
- Location teleportLocation = new Location(player.getWorld(), x, y, z);
- player.teleport(teleportLocation);
- player.sendMessage(ChatColor.GREEN + "You have been teleported" + (int) teleportLocation.distance(originalLocation) + "blocks away");
- return true;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement