1
0
mirror of https://e.coding.net/circlecloud/SimpleEssential.git synced 2024-11-16 01:08:46 +00:00

fix sethome and home command...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-08-13 22:32:41 +08:00
parent 5ae7ea726f
commit a8b92a19a0
3 changed files with 38 additions and 25 deletions

View File

@ -11,9 +11,7 @@ import org.bukkit.entity.Player;
import cn.citycraft.SimpleEssential.SimpleEssential;
/**
* @author 蒋天蓓
* 2015年8月12日下午2:04:05
* TODO
* @author 蒋天蓓 2015年8月12日下午2:04:05 TODO
*/
public class CommandHome extends SimpleEssentialCommand {
SimpleEssential plugin;
@ -27,8 +25,14 @@ public class CommandHome extends SimpleEssentialCommand {
}
@Override
public String getPossibleArguments() {
return "";
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
Player p = (Player) sender;
Location loc = p.getBedSpawnLocation();
if (loc == null) {
p.sendMessage("§c你的床丢失了或者被方块阻挡了!");
return;
}
plugin.tpcontrol.magicTeleport(p, loc);
}
@Override
@ -37,9 +41,7 @@ public class CommandHome extends SimpleEssentialCommand {
}
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
Player p = (Player) sender;
Location loc = p.getBedSpawnLocation();
plugin.tpcontrol.magicTeleport(p, loc);
public String getPossibleArguments() {
return "";
}
}

View File

@ -12,9 +12,7 @@ import org.bukkit.entity.Player;
import cn.citycraft.SimpleEssential.SimpleEssential;
/**
* @author 蒋天蓓
* 2015年8月12日下午2:04:05
* TODO
* @author 蒋天蓓 2015年8月12日下午2:04:05 TODO
*/
public class CommandSetHome extends SimpleEssentialCommand {
SimpleEssential plugin;
@ -28,8 +26,15 @@ public class CommandSetHome extends SimpleEssentialCommand {
}
@Override
public String getPossibleArguments() {
return "";
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
Player p = (Player) sender;
Block b = p.getLocation().getBlock();
if (b.getType() == Material.BED_BLOCK) {
p.setBedSpawnLocation(b.getLocation(), true);
p.sendMessage("§a家设置成功!");
} else {
p.sendMessage("§c请站在床上设置家!");
}
}
@Override
@ -38,13 +43,7 @@ public class CommandSetHome extends SimpleEssentialCommand {
}
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
Player p = (Player) sender;
Block b = p.getLocation().add(0, -1, 0).getBlock();
if (b.getType() == Material.BED_BLOCK) {
} else {
}
public String getPossibleArguments() {
return "";
}
}

View File

@ -40,11 +40,23 @@ commands:
permission: se.back
permission-message: §c你没有 <permission> 的权限来执行此命令!
top:
description: 回到上一个TP地点
description: 传送到最高方块
aliases: [setop]
usage: §b使用/top 传送到当前位置最高方块!
permission: se.top
permission-message: §c你没有 <permission> 的权限来执行此命令!
home:
description: 传送到家里
aliases: [sehome]
usage: §b使用/home 传送到家里!
permission: se.home
permission-message: §c你没有 <permission> 的权限来执行此命令!
sethome:
description: 设置当前位置为家
aliases: [sesethome]
usage: §b使用/sethome 设置当前位置为家!
permission: se.sethome
permission-message: §c你没有 <permission> 的权限来执行此命令!
permissions:
se.*:
description: 简单基础插件所有权限!