mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2025-01-07 12:28:56 +00:00
add setspawn and spawn command...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
c126d80a41
commit
fcdb4236fa
@ -19,6 +19,8 @@ import cn.citycraft.SimpleEssential.command.CommandEnchantBench;
|
|||||||
import cn.citycraft.SimpleEssential.command.CommandHat;
|
import cn.citycraft.SimpleEssential.command.CommandHat;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandHome;
|
import cn.citycraft.SimpleEssential.command.CommandHome;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandSetHome;
|
import cn.citycraft.SimpleEssential.command.CommandSetHome;
|
||||||
|
import cn.citycraft.SimpleEssential.command.CommandSetSpawn;
|
||||||
|
import cn.citycraft.SimpleEssential.command.CommandSpawn;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandSuicide;
|
import cn.citycraft.SimpleEssential.command.CommandSuicide;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandTop;
|
import cn.citycraft.SimpleEssential.command.CommandTop;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandTpa;
|
import cn.citycraft.SimpleEssential.command.CommandTpa;
|
||||||
@ -48,6 +50,12 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
private List<BaseCommand> commandlist;
|
private List<BaseCommand> commandlist;
|
||||||
|
|
||||||
|
private void initTeleportControl() {
|
||||||
|
int tpdelay = Config.getInstance().getInt("Teleport.delay", 3);
|
||||||
|
String tpcontorlname = Config.getMessage("Teleport.name");
|
||||||
|
tpcontrol = new TeleportControl(this, tpcontorlname, tpdelay);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
for (BaseCommand command : commandlist) {
|
for (BaseCommand command : commandlist) {
|
||||||
@ -85,25 +93,22 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
new VersionChecker(this);
|
new VersionChecker(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTeleportControl() {
|
|
||||||
int tpdelay = Config.getInstance().getInt("Teleport.delay", 3);
|
|
||||||
String tpcontorlname = Config.getMessage("Teleport.name");
|
|
||||||
tpcontrol = new TeleportControl(this, tpcontorlname, tpdelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册事件
|
|
||||||
*/
|
|
||||||
private void registerEvents() {
|
|
||||||
registerEvent(new PlayerLocationListen(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
Config.load(this, "1.0");
|
Config.load(this, "1.0");
|
||||||
Language.load(this, "1.0");
|
Language.load(this, "1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册命令
|
||||||
|
*
|
||||||
|
* @param command
|
||||||
|
* - 被注册的命令类
|
||||||
|
*/
|
||||||
|
public void registerCommand(BaseCommand command) {
|
||||||
|
commandlist.add(command);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册命令
|
* 注册命令
|
||||||
*/
|
*/
|
||||||
@ -121,16 +126,8 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
registerCommand(new CommandSuicide(this));
|
registerCommand(new CommandSuicide(this));
|
||||||
registerCommand(new CommandEnchantBench(this));
|
registerCommand(new CommandEnchantBench(this));
|
||||||
registerCommand(new CommandWorkBench(this));
|
registerCommand(new CommandWorkBench(this));
|
||||||
}
|
registerCommand(new CommandSetSpawn(this));
|
||||||
|
registerCommand(new CommandSpawn(this));
|
||||||
/**
|
|
||||||
* 注册命令
|
|
||||||
*
|
|
||||||
* @param command
|
|
||||||
* - 被注册的命令类
|
|
||||||
*/
|
|
||||||
public void registerCommand(BaseCommand command) {
|
|
||||||
commandlist.add(command);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,4 +139,11 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
public void registerEvent(Listener listener) {
|
public void registerEvent(Listener listener) {
|
||||||
getServer().getPluginManager().registerEvents(listener, this);
|
getServer().getPluginManager().registerEvents(listener, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册事件
|
||||||
|
*/
|
||||||
|
private void registerEvents() {
|
||||||
|
registerEvent(new PlayerLocationListen(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
|
import cn.citycraft.SimpleEssential.config.Language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
|
*/
|
||||||
|
public class CommandSetSpawn extends BaseCommand {
|
||||||
|
SimpleEssential plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public CommandSetSpawn(SimpleEssential main) {
|
||||||
|
super("setspawn", "sesetspawn");
|
||||||
|
this.plugin = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
Location loc = p.getLocation();
|
||||||
|
p.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
|
p.sendMessage(Language.getMessage("Teleport.setspawn", p.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumArguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPossibleArguments() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
46
src/cn/citycraft/SimpleEssential/command/CommandSpawn.java
Normal file
46
src/cn/citycraft/SimpleEssential/command/CommandSpawn.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
|
*/
|
||||||
|
public class CommandSpawn extends BaseCommand {
|
||||||
|
SimpleEssential plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public CommandSpawn(SimpleEssential main) {
|
||||||
|
super("spawn", "sespawn");
|
||||||
|
this.plugin = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
plugin.tpcontrol.magicTeleport(p, p.getWorld().getSpawnLocation());
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumArguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPossibleArguments() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@ Teleport:
|
|||||||
tpaccept: '§a输入命令/tpaccept 或 /tpok 接受传送'
|
tpaccept: '§a输入命令/tpaccept 或 /tpok 接受传送'
|
||||||
tpdeny: '§c输入命令/tpdeny 或 /tpno 拒绝传送'
|
tpdeny: '§c输入命令/tpdeny 或 /tpno 拒绝传送'
|
||||||
nobackloc: '§c未找到可以Back的地点!'
|
nobackloc: '§c未找到可以Back的地点!'
|
||||||
|
setspawn: '§a已配置 §d世界:%s §a出生点 §3X: %s Y: %s Z: %s!'
|
||||||
#自杀
|
#自杀
|
||||||
Suicide:
|
Suicide:
|
||||||
msg: '§6玩家: §a%s §d活不下去 - §c自杀了!'
|
msg: '§6玩家: §a%s §d活不下去 - §c自杀了!'
|
||||||
|
@ -81,6 +81,18 @@ commands:
|
|||||||
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:
|
||||||
|
description: 设置世界出生点
|
||||||
|
aliases: [sesetspawn]
|
||||||
|
usage: §6使用§a/setspawn §6设置世界出生点!
|
||||||
|
permission: se.setspawn
|
||||||
|
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||||
|
spawn:
|
||||||
|
description: 返回世界出生点
|
||||||
|
aliases: [sespawn]
|
||||||
|
usage: §6使用§a/spawn §6返回世界出生点!
|
||||||
|
permission: se.spawn
|
||||||
|
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
se.*:
|
se.*:
|
||||||
@ -103,4 +115,5 @@ permissions:
|
|||||||
se.hat: true
|
se.hat: true
|
||||||
se.workbench: true
|
se.workbench: true
|
||||||
se.enchantbench: true
|
se.enchantbench: true
|
||||||
|
se.spawn: true
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user