First Commit

This commit is contained in:
jimmy1248 2013-12-27 19:14:36 +13:00
parent 164a2726dd
commit e7ea4ff0bd
2 changed files with 56 additions and 0 deletions

21
plugin.yml Normal file
View File

@ -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 <permission>
setspawn:
description: Sets spawn location
usage: /setspawn
permission: easyspawn.setspawn
permission-message: You don't have <permission>
permissions:
easyspawn.spawn:
description: Teleports you to spawn
default: true
easyspawn.setspawn:
description: Sets spawn location
default: op

View File

@ -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;
}
}