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