From e7ea4ff0bdd1efda81492d474662ca25d0e5be88 Mon Sep 17 00:00:00 2001 From: jimmy1248 Date: Fri, 27 Dec 2013 19:14:36 +1300 Subject: [PATCH] First Commit --- plugin.yml | 21 +++++++++++++ src/net/jimmy1248/easyspawn/EasySpawn.java | 35 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 plugin.yml create mode 100644 src/net/jimmy1248/easyspawn/EasySpawn.java diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..df09268 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,21 @@ +name: EasySpawn +main: net.jimmy1248.easyspawn.EasySpawn +version: 1.7.2 +commands: + spawn: + description: Teleports you to spawn + usage: /spawn + permission: easyspawn.spawn + permission-message: You don't have + setspawn: + description: Sets spawn location + usage: /setspawn + permission: easyspawn.setspawn + permission-message: You don't have +permissions: + easyspawn.spawn: + description: Teleports you to spawn + default: true + easyspawn.setspawn: + description: Sets spawn location + default: op diff --git a/src/net/jimmy1248/easyspawn/EasySpawn.java b/src/net/jimmy1248/easyspawn/EasySpawn.java new file mode 100644 index 0000000..20abe32 --- /dev/null +++ b/src/net/jimmy1248/easyspawn/EasySpawn.java @@ -0,0 +1,35 @@ +package net.jimmy1248.easyspawn; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class EasySpawn extends JavaPlugin{ + @Override + public void onEnable() { + getCommand("spawn").setExecutor(this); + getCommand("setspawn").setExecutor(this); + } + + @Override + public boolean onCommand(CommandSender sender, Command command, + String label, String[] args) { + if(sender instanceof Player){ + Player player = (Player)sender; + if(command.getName().equalsIgnoreCase("spawn")){ + player.teleport(player.getWorld().getSpawnLocation()); + player.sendMessage("You have been teleported to spawn."); + return true; + } + if(command.getName().equalsIgnoreCase("setspawn")){ + player.getWorld().setSpawnLocation(player.getLocation().getBlockX(), + player.getLocation().getBlockY(),player.getLocation().getBlockZ()); + player.sendMessage("Spawn set."); + return true; + } + } + return false; + } + +}