mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2024-11-16 01:08:46 +00:00
fix EnchantBenchCommand...
This commit is contained in:
parent
31448d3408
commit
66d5f92092
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.command;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandException;
|
||||
@ -25,9 +26,9 @@ public class CommandEnchantBench extends BaseCommand {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {
|
||||
return true;
|
||||
protected void clearEnchatRange(Location loc) {
|
||||
setRange(loc, Material.AIR);
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
};
|
||||
|
||||
@Override
|
||||
@ -37,8 +38,15 @@ public class CommandEnchantBench extends BaseCommand {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
setEnchatRange(loc);
|
||||
p.openEnchanting(loc, true);
|
||||
clearEnchatRange(loc);
|
||||
p.openEnchanting(loc.clone().add(0, 255, 0), true);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
clearEnchatRange(loc);
|
||||
}
|
||||
|
||||
}, 200);
|
||||
break;
|
||||
case 1:
|
||||
switch (args[0]) {
|
||||
@ -55,42 +63,6 @@ public class CommandEnchantBench extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
protected void setRange(Location loc, Material ma) {
|
||||
setBlock(loc, -2, 0, -2, ma);
|
||||
setBlock(loc, -2, 1, -1, ma);
|
||||
setBlock(loc, -2, 0, 1, ma);
|
||||
setBlock(loc, -1, 0, 2, ma);
|
||||
|
||||
setBlock(loc, 2, 0, 2, ma);
|
||||
setBlock(loc, 2, 1, 2, ma);
|
||||
setBlock(loc, 1, 0, 2, ma);
|
||||
setBlock(loc, 2, 0, 1, ma);
|
||||
|
||||
setBlock(loc, -2, 0, -2, ma);
|
||||
setBlock(loc, -2, 1, -2, ma);
|
||||
setBlock(loc, -1, 0, -2, ma);
|
||||
setBlock(loc, -2, 0, -1, ma);
|
||||
|
||||
setBlock(loc, 2, 0, -2, ma);
|
||||
setBlock(loc, 2, 1, -2, ma);
|
||||
setBlock(loc, 1, 0, -2, ma);
|
||||
setBlock(loc, 2, 0, -1, ma);
|
||||
}
|
||||
|
||||
protected void clearEnchatRange(Location loc) {
|
||||
setRange(loc, Material.AIR);
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
protected void setEnchatRange(Location loc) {
|
||||
setRange(loc, Material.BOOKSHELF);
|
||||
loc.getBlock().setType(Material.ENCHANTMENT_TABLE);
|
||||
}
|
||||
|
||||
protected void setBlock(Location loc, int x, int y, int z, Material ma) {
|
||||
new Location(loc.getWorld(), loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getBlock().setType(ma);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumArguments() {
|
||||
return 0;
|
||||
@ -100,4 +72,50 @@ public class CommandEnchantBench extends BaseCommand {
|
||||
public String getPossibleArguments() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void setBlock(Location loc, int x, int y, int z, Material ma) {
|
||||
new Location(loc.getWorld(), loc.getBlockX() + x, loc.getBlockY() + y + 255, loc.getBlockZ() + z).getBlock().setType(ma);
|
||||
}
|
||||
|
||||
protected void setEnchatRange(Location loc) {
|
||||
setRange(loc, Material.BOOKSHELF);
|
||||
loc.getBlock().setType(Material.ENCHANTMENT_TABLE);
|
||||
}
|
||||
|
||||
protected void setRange(Location loc, Material ma) {
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
for (int k = -2; k < 3; k++) {
|
||||
if (i != 0 && j != 0) {
|
||||
setBlock(loc, i, j, k, ma);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// setBlock(loc, -2, 0, -2, ma);
|
||||
// setBlock(loc, -2, 1, -1, ma);
|
||||
// setBlock(loc, -2, 0, 1, ma);
|
||||
// setBlock(loc, -1, 0, 2, ma);
|
||||
//
|
||||
// setBlock(loc, 2, 0, 2, ma);
|
||||
// setBlock(loc, 2, 1, 2, ma);
|
||||
// setBlock(loc, 1, 0, 2, ma);
|
||||
// setBlock(loc, 2, 0, 1, ma);
|
||||
//
|
||||
// setBlock(loc, -2, 0, -2, ma);
|
||||
// setBlock(loc, -2, 1, -2, ma);
|
||||
// setBlock(loc, -1, 0, -2, ma);
|
||||
// setBlock(loc, -2, 0, -1, ma);
|
||||
//
|
||||
// setBlock(loc, 2, 0, -2, ma);
|
||||
// setBlock(loc, 2, 1, -2, ma);
|
||||
// setBlock(loc, 1, 0, -2, ma);
|
||||
// setBlock(loc, 2, 0, -1, ma);
|
||||
}
|
||||
}
|
||||
|
@ -6,91 +6,91 @@ commands:
|
||||
simpleessential:
|
||||
description: 简单基础插件
|
||||
aliases: [se,sme]
|
||||
usage: §6使用§a/se help §6查看帮助!
|
||||
usage: §6使用 §a/se help §6查看帮助!
|
||||
permission: se.*
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
tpa:
|
||||
description: 传送到目标玩家
|
||||
aliases: [setps,smetpa]
|
||||
usage: §6使用§a/tpa <player> §6传送到目标玩家!
|
||||
usage: §6使用 §a/tpa <player> §6传送到目标玩家!
|
||||
permission: se.tpa
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
tphere:
|
||||
description: 邀请目标玩家
|
||||
aliases: [tph]
|
||||
usage: §6使用§a/tphere <player> §6邀请目标玩家!
|
||||
usage: §6使用 §a/tphere <player> §6邀请目标玩家!
|
||||
permission: se.tphere
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
tpaccept:
|
||||
description: 接受传送或邀请
|
||||
aliases: [tpok]
|
||||
usage: §6使用§a/tpaccept §6接受传送或邀请!
|
||||
usage: §6使用 §a/tpaccept §6接受传送或邀请!
|
||||
permission: se.tpaccept
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
tpdeny:
|
||||
description: 拒绝传送或邀请
|
||||
aliases: [tpno]
|
||||
usage: §6使用§a/tpdeny §6拒绝传送或邀请!
|
||||
usage: §6使用 §a/tpdeny §6拒绝传送或邀请!
|
||||
permission: se.tpdeny
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
back:
|
||||
description: 回到上一个TP地点
|
||||
aliases: [seback]
|
||||
usage: §6使用§a/back §6回到上一个TP地点!
|
||||
usage: §6使用 §a/back §6回到上一个TP地点!
|
||||
permission: se.back
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
top:
|
||||
description: 传送到最高方块
|
||||
aliases: [setop]
|
||||
usage: §6使用§a/top §6传送到当前位置最高方块!
|
||||
usage: §6使用 §a/top §6传送到当前位置最高方块!
|
||||
permission: se.top
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
home:
|
||||
description: 传送到家里
|
||||
aliases: [sehome]
|
||||
usage: §6使用§a/home §6传送到家里!
|
||||
usage: §6使用 §a/home §6传送到家里!
|
||||
permission: se.home
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
sethome:
|
||||
description: 设置当前位置为家
|
||||
aliases: [sesethome]
|
||||
usage: §6使用§a/sethome §6设置当前位置为家!
|
||||
usage: §6使用 §a/sethome §6设置当前位置为家!
|
||||
permission: se.sethome
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
suicide:
|
||||
description: 自杀
|
||||
aliases: [sesuicide,sd]
|
||||
usage: §6使用§a/suicide §6结束自己的生命!
|
||||
usage: §6使用 §a/suicide §6结束自己的生命!
|
||||
permission: se.suicide
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
hat:
|
||||
description: 帽子
|
||||
aliases: [sehat]
|
||||
usage: §6使用§a/hat §6把手上的物品带在头上!
|
||||
usage: §6使用 §a/hat §6把手上的物品带在头上!
|
||||
permission: se.hat
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
workbench:
|
||||
description: 打开随身工作台
|
||||
aliases: [seworkbench,wb,sewb]
|
||||
usage: §6使用§a/workbench §6打开随身工作台!
|
||||
usage: §6使用 §a/workbench §6打开随身工作台!
|
||||
permission: se.workbench
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
enchantbench:
|
||||
description: 打开随身附魔台(30级)
|
||||
aliases: [seenchantbench,seeb,eb]
|
||||
usage: §6使用§a/enchantbench §6打开随身附魔台(30级)!
|
||||
usage: §6使用 §a/enchantbench §6打开随身附魔台(30级)!
|
||||
permission: se.enchantbench
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
setspawn:
|
||||
description: 设置世界出生点
|
||||
aliases: [sesetspawn]
|
||||
usage: §6使用§a/setspawn §6设置世界出生点!
|
||||
usage: §6使用 §a/setspawn §6设置世界出生点!
|
||||
permission: se.setspawn
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
spawn:
|
||||
description: 返回世界出生点
|
||||
aliases: [sespawn]
|
||||
usage: §6使用§a/spawn §6返回世界出生点!
|
||||
usage: §6使用 §a/spawn §6返回世界出生点!
|
||||
permission: se.spawn
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user