mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2024-11-16 01:08:46 +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.CommandHome;
|
||||
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.CommandTop;
|
||||
import cn.citycraft.SimpleEssential.command.CommandTpa;
|
||||
@ -34,7 +36,7 @@ import cn.citycraft.SimpleEssential.utils.VersionChecker;
|
||||
|
||||
/**
|
||||
* 简单基础插件
|
||||
*
|
||||
*
|
||||
* @author 蒋天蓓 2015年8月11日下午3:29:32
|
||||
*/
|
||||
public class SimpleEssential extends JavaPlugin {
|
||||
@ -48,6 +50,12 @@ public class SimpleEssential extends JavaPlugin {
|
||||
*/
|
||||
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
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
for (BaseCommand command : commandlist) {
|
||||
@ -85,25 +93,22 @@ public class SimpleEssential extends JavaPlugin {
|
||||
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
|
||||
public void onLoad() {
|
||||
Config.load(this, "1.0");
|
||||
Language.load(this, "1.0");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册命令
|
||||
*
|
||||
* @param command
|
||||
* - 被注册的命令类
|
||||
*/
|
||||
public void registerCommand(BaseCommand command) {
|
||||
commandlist.add(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册命令
|
||||
*/
|
||||
@ -121,25 +126,24 @@ public class SimpleEssential extends JavaPlugin {
|
||||
registerCommand(new CommandSuicide(this));
|
||||
registerCommand(new CommandEnchantBench(this));
|
||||
registerCommand(new CommandWorkBench(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册命令
|
||||
*
|
||||
* @param command
|
||||
* - 被注册的命令类
|
||||
*/
|
||||
public void registerCommand(BaseCommand command) {
|
||||
commandlist.add(command);
|
||||
registerCommand(new CommandSetSpawn(this));
|
||||
registerCommand(new CommandSpawn(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册事件
|
||||
*
|
||||
*
|
||||
* @param listener
|
||||
* - 被注册的事件类
|
||||
*/
|
||||
public void registerEvent(Listener listener) {
|
||||
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 接受传送'
|
||||
tpdeny: '§c输入命令/tpdeny 或 /tpno 拒绝传送'
|
||||
nobackloc: '§c未找到可以Back的地点!'
|
||||
setspawn: '§a已配置 §d世界:%s §a出生点 §3X: %s Y: %s Z: %s!'
|
||||
#自杀
|
||||
Suicide:
|
||||
msg: '§6玩家: §a%s §d活不下去 - §c自杀了!'
|
||||
|
@ -81,7 +81,19 @@ commands:
|
||||
usage: §6使用§a/enchantbench §6打开随身附魔台(30级)!
|
||||
permission: se.enchantbench
|
||||
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:
|
||||
se.*:
|
||||
description: 简单基础插件所有权限!
|
||||
@ -103,4 +115,5 @@ permissions:
|
||||
se.hat: true
|
||||
se.workbench: true
|
||||
se.enchantbench: true
|
||||
se.spawn: true
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user