mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2024-11-17 01:18:47 +00:00
add gc and world command...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
fa261fffcf
commit
ab8bff05c0
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>cn.citycraft</groupId>
|
<groupId>cn.citycraft</groupId>
|
||||||
<artifactId>SimpleEssential</artifactId>
|
<artifactId>SimpleEssential</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.2</version>
|
||||||
<name>SimpleEssential</name>
|
<name>SimpleEssential</name>
|
||||||
<description>轻量级基础插件</description>
|
<description>轻量级基础插件</description>
|
||||||
<build>
|
<build>
|
||||||
|
@ -16,6 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import cn.citycraft.SimpleEssential.command.BaseCommand;
|
import cn.citycraft.SimpleEssential.command.BaseCommand;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandBack;
|
import cn.citycraft.SimpleEssential.command.CommandBack;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandEnchantBench;
|
import cn.citycraft.SimpleEssential.command.CommandEnchantBench;
|
||||||
|
import cn.citycraft.SimpleEssential.command.CommandGc;
|
||||||
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;
|
||||||
@ -28,7 +29,8 @@ import cn.citycraft.SimpleEssential.command.CommandTpaccept;
|
|||||||
import cn.citycraft.SimpleEssential.command.CommandTpdeny;
|
import cn.citycraft.SimpleEssential.command.CommandTpdeny;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandTphere;
|
import cn.citycraft.SimpleEssential.command.CommandTphere;
|
||||||
import cn.citycraft.SimpleEssential.command.CommandWorkBench;
|
import cn.citycraft.SimpleEssential.command.CommandWorkBench;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.command.CommandWorld;
|
||||||
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
import cn.citycraft.SimpleEssential.listen.PlayerLocationListen;
|
import cn.citycraft.SimpleEssential.listen.PlayerLocationListen;
|
||||||
import cn.citycraft.SimpleEssential.teleport.TeleportControl;
|
import cn.citycraft.SimpleEssential.teleport.TeleportControl;
|
||||||
import cn.citycraft.config.FileConfig;
|
import cn.citycraft.config.FileConfig;
|
||||||
@ -50,22 +52,16 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
private List<BaseCommand> commandlist;
|
private List<BaseCommand> commandlist;
|
||||||
|
|
||||||
private void initTeleportControl() {
|
|
||||||
int tpdelay = config.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)
|
||||||
if (command.isValidTrigger(label)) {
|
if (command.isValidTrigger(label)) {
|
||||||
if (!command.hasPermission(sender)) {
|
if (!command.hasPermission(sender)) {
|
||||||
sender.sendMessage(Language.getMessage("Base.no-permission"));
|
sender.sendMessage(I18n.parse("Base.no-permission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) {
|
if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) {
|
||||||
sender.sendMessage(Language.getMessage("Base.playercommand"));
|
sender.sendMessage(I18n.parse("Base.playercommand"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length >= command.getMinimumArguments())
|
if (args.length >= command.getMinimumArguments())
|
||||||
@ -90,7 +86,7 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
config = new FileConfig(this);
|
config = new FileConfig(this);
|
||||||
Language.load(this);
|
I18n.load(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,6 +118,8 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
registerCommand(new CommandWorkBench(this));
|
registerCommand(new CommandWorkBench(this));
|
||||||
registerCommand(new CommandSetSpawn(this));
|
registerCommand(new CommandSetSpawn(this));
|
||||||
registerCommand(new CommandSpawn(this));
|
registerCommand(new CommandSpawn(this));
|
||||||
|
registerCommand(new CommandGc(this));
|
||||||
|
registerCommand(new CommandWorld(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,6 +132,12 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
getServer().getPluginManager().registerEvents(listener, this);
|
getServer().getPluginManager().registerEvents(listener, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initTeleportControl() {
|
||||||
|
int tpdelay = config.getInt("Teleport.delay", 3);
|
||||||
|
String tpcontorlname = config.getMessage("Teleport.name");
|
||||||
|
tpcontrol = new TeleportControl(this, tpcontorlname, tpdelay);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册事件
|
* 注册事件
|
||||||
*/
|
*/
|
||||||
|
@ -39,6 +39,13 @@ public abstract class BaseCommand {
|
|||||||
*/
|
*/
|
||||||
public abstract void execute(CommandSender sender, String label, String[] args) throws CommandException;
|
public abstract void execute(CommandSender sender, String label, String[] args) throws CommandException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得命令描述
|
||||||
|
*
|
||||||
|
* @return 命令描述
|
||||||
|
*/
|
||||||
|
public abstract String getDescription();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得最小参数个数
|
* 获得最小参数个数
|
||||||
*
|
*
|
||||||
@ -101,12 +108,10 @@ public abstract class BaseCommand {
|
|||||||
public final boolean isValidTrigger(String name) {
|
public final boolean isValidTrigger(String name) {
|
||||||
if (this.name.equalsIgnoreCase(name))
|
if (this.name.equalsIgnoreCase(name))
|
||||||
return true;
|
return true;
|
||||||
if (aliases != null) {
|
if (aliases != null)
|
||||||
for (String alias : aliases) {
|
for (String alias : aliases)
|
||||||
if (alias.equalsIgnoreCase(name))
|
if (alias.equalsIgnoreCase(name))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ public class CommandBack extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return true;
|
plugin.tpcontrol.back((Player) sender);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getDescription() {
|
||||||
plugin.tpcontrol.back((Player) sender);
|
return "回到上一个地点";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,4 +42,9 @@ public class CommandBack extends BaseCommand {
|
|||||||
public String getPossibleArguments() {
|
public String getPossibleArguments() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,11 @@ public class CommandEnchantBench extends BaseCommand {
|
|||||||
p.openEnchanting(null, true);
|
p.openEnchanting(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "打开随声附魔台";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumArguments() {
|
public int getMinimumArguments() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
import cn.citycraft.utils.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传送到顶部命令
|
||||||
|
*
|
||||||
|
* @author 蒋天蓓
|
||||||
|
* 2015年8月12日下午2:04:05
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CommandGc extends BaseCommand {
|
||||||
|
SimpleEssential plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public CommandGc(SimpleEssential main) {
|
||||||
|
super("gc", "mem");
|
||||||
|
this.plugin = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
|
Runtime rt = Runtime.getRuntime();
|
||||||
|
if (label.equalsIgnoreCase("gc"))
|
||||||
|
rt.gc();
|
||||||
|
sender.sendMessage(I18n.parse("Gc.Processors", rt.availableProcessors()));
|
||||||
|
sender.sendMessage(I18n.parse("Gc.maxMem", StringUtil.b2mb(rt.maxMemory())));
|
||||||
|
sender.sendMessage(I18n.parse("Gc.totalMem", StringUtil.b2mb(rt.totalMemory())));
|
||||||
|
sender.sendMessage(I18n.parse("Gc.freeMem", StringUtil.b2mb(rt.freeMemory())));
|
||||||
|
for (World wd : Bukkit.getWorlds())
|
||||||
|
sender.sendMessage(I18n.parse("World.info", wd.getName(), wd.getEnvironment().toString(), wd.getLoadedChunks().length, wd.getEntities().size(), wd.getPlayers().size()));
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "清理内存";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumArguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPossibleArguments() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 代小呆 created in 2015年8月16日下午1:44:22
|
* @Author 代小呆 created in 2015年8月16日下午1:44:22
|
||||||
@ -23,8 +23,26 @@ public class CommandHat extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPossibleArguments() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return "";
|
Player p = (Player) sender;
|
||||||
|
if (p.getItemInHand() == null) {
|
||||||
|
sender.sendMessage(I18n.parse("Hat.empty"));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
ItemStack hand = p.getItemInHand();
|
||||||
|
p.setItemInHand(null);
|
||||||
|
ItemStack helmet = p.getInventory().getHelmet();
|
||||||
|
if (!(helmet == null))
|
||||||
|
p.getInventory().addItem(helmet);
|
||||||
|
p.getInventory().setHelmet(hand);
|
||||||
|
sender.sendMessage(I18n.parse("Hat.enjoy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "把手上的方块带在手上";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,22 +51,8 @@ public class CommandHat extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getPossibleArguments() {
|
||||||
Player p = (Player) sender;
|
return "";
|
||||||
if (p.getItemInHand() == null) {
|
|
||||||
sender.sendMessage(Language.getMessage("Hat.empty"));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
ItemStack hand = p.getItemInHand();
|
|
||||||
p.setItemInHand(null);
|
|
||||||
ItemStack helmet = p.getInventory().getHelmet();
|
|
||||||
if (!(helmet == null)) {
|
|
||||||
p.getInventory().addItem(helmet);
|
|
||||||
}
|
|
||||||
p.getInventory().setHelmet(hand);
|
|
||||||
sender.sendMessage(Language.getMessage("Hat.enjoy"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,11 +9,11 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传送回家的命令
|
* 传送回家的命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
*/
|
*/
|
||||||
public class CommandHome extends BaseCommand {
|
public class CommandHome extends BaseCommand {
|
||||||
@ -27,20 +27,20 @@ public class CommandHome extends BaseCommand {
|
|||||||
this.plugin = main;
|
this.plugin = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOnlyPlayerExecutable() {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
Location loc = p.getBedSpawnLocation();
|
Location loc = p.getBedSpawnLocation();
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
p.sendMessage(Language.getMessage("Teleport.homelose"));
|
p.sendMessage(I18n.parse("Teleport.homelose"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plugin.tpcontrol.magicTeleport(p, loc);
|
plugin.tpcontrol.magicTeleport(p, loc);
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "回到家";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -52,4 +52,9 @@ public class CommandHome extends BaseCommand {
|
|||||||
public String getPossibleArguments() {
|
public String getPossibleArguments() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,11 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置家的命令
|
* 设置家的命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
*/
|
*/
|
||||||
public class CommandSetHome extends BaseCommand {
|
public class CommandSetHome extends BaseCommand {
|
||||||
@ -25,21 +25,20 @@ public class CommandSetHome extends BaseCommand {
|
|||||||
this.plugin = main;
|
this.plugin = main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOnlyPlayerExecutable() {
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
Block b = p.getLocation().getBlock();
|
Block b = p.getLocation().getBlock();
|
||||||
if (b.getType() == Material.BED_BLOCK) {
|
if (b.getType() == Material.BED_BLOCK) {
|
||||||
p.setBedSpawnLocation(b.getLocation(), true);
|
p.setBedSpawnLocation(b.getLocation(), true);
|
||||||
p.sendMessage(Language.getMessage("Teleport.sethomesuccess"));
|
p.sendMessage(I18n.parse("Teleport.sethomesuccess"));
|
||||||
} else {
|
} else
|
||||||
p.sendMessage(Language.getMessage("Teleport.sethomeerror"));
|
p.sendMessage(I18n.parse("Teleport.sethomeerror"));
|
||||||
}
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "设置家";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -51,4 +50,9 @@ public class CommandSetHome extends BaseCommand {
|
|||||||
public String getPossibleArguments() {
|
public String getPossibleArguments() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
@ -30,9 +30,14 @@ public class CommandSetSpawn extends BaseCommand {
|
|||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
Location loc = p.getLocation();
|
Location loc = p.getLocation();
|
||||||
p.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
p.getWorld().setSpawnLocation(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||||
p.sendMessage(Language.getMessage("Teleport.setspawn", p.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
p.sendMessage(I18n.parse("Teleport.setspawn", p.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "设置出生点";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumArguments() {
|
public int getMinimumArguments() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -29,6 +29,11 @@ public class CommandSpawn extends BaseCommand {
|
|||||||
plugin.tpcontrol.magicTeleport(p, p.getWorld().getSpawnLocation());
|
plugin.tpcontrol.magicTeleport(p, p.getWorld().getSpawnLocation());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "回到主城";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMinimumArguments() {
|
public int getMinimumArguments() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
import cn.citycraft.SimpleEssential.utils.EffectUtil;
|
import cn.citycraft.SimpleEssential.utils.EffectUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,22 +30,12 @@ public class CommandSuicide extends BaseCommand {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPossibleArguments() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMinimumArguments() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
List<ItemStack> drops = Arrays.asList(p.getInventory().getContents());
|
List<ItemStack> drops = Arrays.asList(p.getInventory().getContents());
|
||||||
int deoppedexp = (int) Math.floor(p.getExp());
|
int deoppedexp = (int) Math.floor(p.getExp());
|
||||||
String deathMessage = Language.getMessage("Suicide.msg");
|
String deathMessage = I18n.parse("Suicide.msg");
|
||||||
PlayerDeathEvent pd = new PlayerDeathEvent(p, drops, deoppedexp, deathMessage);
|
PlayerDeathEvent pd = new PlayerDeathEvent(p, drops, deoppedexp, deathMessage);
|
||||||
plugin.getServer().getPluginManager().callEvent(pd);
|
plugin.getServer().getPluginManager().callEvent(pd);
|
||||||
Bukkit.broadcastMessage(pd.getDeathMessage());
|
Bukkit.broadcastMessage(pd.getDeathMessage());
|
||||||
@ -53,6 +43,21 @@ public class CommandSuicide extends BaseCommand {
|
|||||||
p.setHealth(0);
|
p.setHealth(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "自杀";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumArguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPossibleArguments() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public boolean isOnlyPlayerExecutable() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package cn.citycraft.SimpleEssential.command;
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
@ -9,14 +9,14 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传送到顶部命令
|
* 传送到顶部命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓
|
* @author 蒋天蓓
|
||||||
* 2015年8月12日下午2:04:05
|
* 2015年8月12日下午2:04:05
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CommandTop extends BaseCommand {
|
public class CommandTop extends BaseCommand {
|
||||||
SimpleEssential plugin;
|
SimpleEssential plugin;
|
||||||
@ -30,13 +30,18 @@ public class CommandTop extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return true;
|
Player p = (Player) sender;
|
||||||
|
Location loc = p.getLocation();
|
||||||
|
int top = loc.getWorld().getHighestBlockYAt(loc);
|
||||||
|
loc.setY(top);
|
||||||
|
p.teleport(loc);
|
||||||
|
p.sendMessage(I18n.parse("Teleport.top"));
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPossibleArguments() {
|
public String getDescription() {
|
||||||
return "";
|
return "传送到最高点";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,12 +50,12 @@ public class CommandTop extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getPossibleArguments() {
|
||||||
Player p = (Player) sender;
|
return "";
|
||||||
Location loc = p.getLocation();
|
}
|
||||||
int top = loc.getWorld().getHighestBlockYAt(loc);
|
|
||||||
loc.setY(top);
|
@Override
|
||||||
p.teleport(loc);
|
public boolean isOnlyPlayerExecutable() {
|
||||||
p.sendMessage(Language.getMessage("Teleport.top"));
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package cn.citycraft.SimpleEssential.command;
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
@ -9,12 +9,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
import cn.citycraft.SimpleEssential.teleport.TeleportType;
|
import cn.citycraft.SimpleEssential.teleport.TeleportType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家传送命令
|
* 玩家传送命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓
|
* @author 蒋天蓓
|
||||||
* 2015年8月12日下午2:04:05
|
* 2015年8月12日下午2:04:05
|
||||||
*
|
*
|
||||||
@ -31,13 +31,22 @@ public class CommandTpa extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return true;
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
|
if (target == null) {
|
||||||
|
sender.sendMessage(I18n.parse("Base.offline", args[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plugin.tpcontrol.addtp((Player) sender, Bukkit.getPlayer(args[0]), TeleportType.TPA);
|
||||||
|
sender.sendMessage(I18n.parse("Teleport.tpsend"));
|
||||||
|
target.sendMessage(new String[] { I18n.parse("Teleport.tpa", sender.getName()),
|
||||||
|
I18n.parse("Teleport.tpaccept"),
|
||||||
|
I18n.parse("Teleport.tpdeny") });
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPossibleArguments() {
|
public String getDescription() {
|
||||||
return "<目标玩家>";
|
return "传送到玩家";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,18 +55,12 @@ public class CommandTpa extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getPossibleArguments() {
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
return "<目标玩家>";
|
||||||
if (target == null) {
|
}
|
||||||
sender.sendMessage(Language.getMessage("Base.offline", args[0]));
|
|
||||||
return;
|
@Override
|
||||||
}
|
public boolean isOnlyPlayerExecutable() {
|
||||||
plugin.tpcontrol.addtp((Player) sender, Bukkit.getPlayer(args[0]), TeleportType.TPA);
|
return true;
|
||||||
sender.sendMessage(Language.getMessage("Teleport.tpsend"));
|
|
||||||
target.sendMessage(new String[] {
|
|
||||||
Language.getMessage("Teleport.tpa", sender.getName()),
|
|
||||||
Language.getMessage("Teleport.tpaccept"),
|
|
||||||
Language.getMessage("Teleport.tpdeny")
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package cn.citycraft.SimpleEssential.command;
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
@ -11,10 +11,10 @@ import cn.citycraft.SimpleEssential.SimpleEssential;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 接受传送命令
|
* 接受传送命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓
|
* @author 蒋天蓓
|
||||||
* 2015年8月12日下午2:04:05
|
* 2015年8月12日下午2:04:05
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CommandTpaccept extends BaseCommand {
|
public class CommandTpaccept extends BaseCommand {
|
||||||
SimpleEssential plugin;
|
SimpleEssential plugin;
|
||||||
@ -28,13 +28,13 @@ public class CommandTpaccept extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return true;
|
plugin.tpcontrol.accept((Player) sender);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPossibleArguments() {
|
public String getDescription() {
|
||||||
return "";
|
return "接受传送";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -43,7 +43,12 @@ public class CommandTpaccept extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getPossibleArguments() {
|
||||||
plugin.tpcontrol.accept((Player) sender);
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package cn.citycraft.SimpleEssential.command;
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
@ -11,10 +11,10 @@ import cn.citycraft.SimpleEssential.SimpleEssential;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 拒绝传送命令
|
* 拒绝传送命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓
|
* @author 蒋天蓓
|
||||||
* 2015年8月12日下午2:04:05
|
* 2015年8月12日下午2:04:05
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CommandTpdeny extends BaseCommand {
|
public class CommandTpdeny extends BaseCommand {
|
||||||
SimpleEssential plugin;
|
SimpleEssential plugin;
|
||||||
@ -25,13 +25,14 @@ public class CommandTpdeny extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return true;
|
plugin.tpcontrol.accept((Player) sender);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPossibleArguments() {
|
public String getDescription() {
|
||||||
return "";
|
return "拒绝传送";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -40,8 +41,12 @@ public class CommandTpdeny extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getPossibleArguments() {
|
||||||
plugin.tpcontrol.accept((Player) sender);
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,12 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
import cn.citycraft.SimpleEssential.teleport.TeleportType;
|
import cn.citycraft.SimpleEssential.teleport.TeleportType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传送到玩家命令
|
* 传送到玩家命令
|
||||||
*
|
*
|
||||||
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
*/
|
*/
|
||||||
public class CommandTphere extends BaseCommand {
|
public class CommandTphere extends BaseCommand {
|
||||||
@ -29,21 +29,19 @@ public class CommandTphere extends BaseCommand {
|
|||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
Player target = Bukkit.getPlayer(args[0]);
|
Player target = Bukkit.getPlayer(args[0]);
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
sender.sendMessage(Language.getMessage("Base.offline", args[0]));
|
sender.sendMessage(I18n.parse("Base.offline", args[0]));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plugin.tpcontrol.addtp((Player) sender, Bukkit.getPlayer(args[0]), TeleportType.TPH);
|
plugin.tpcontrol.addtp((Player) sender, Bukkit.getPlayer(args[0]), TeleportType.TPH);
|
||||||
sender.sendMessage(Language.getMessage("Teleport.tpsend"));
|
sender.sendMessage(I18n.parse("Teleport.tpsend"));
|
||||||
target.sendMessage(new String[] {
|
target.sendMessage(new String[] { I18n.parse("Teleport.tphere", sender.getName()),
|
||||||
Language.getMessage("Teleport.tphere", sender.getName()),
|
I18n.parse("Teleport.tpaccept"),
|
||||||
Language.getMessage("Teleport.tpaccept"),
|
I18n.parse("Teleport.tpdeny") });
|
||||||
Language.getMessage("Teleport.tpdeny")
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public String getDescription() {
|
||||||
return true;
|
return "邀请玩家";
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,4 +53,9 @@ public class CommandTphere extends BaseCommand {
|
|||||||
public String getPossibleArguments() {
|
public String getPossibleArguments() {
|
||||||
return "<目标玩家>";
|
return "<目标玩家>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,13 +24,13 @@ public class CommandWorkBench extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOnlyPlayerExecutable() {
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
return true;
|
Bukkit.getPlayer(sender.getName()).openWorkbench(null, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
public String getDescription() {
|
||||||
Bukkit.getPlayer(sender.getName()).openWorkbench(null, true);
|
return "随身工作台";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,4 +42,9 @@ public class CommandWorkBench extends BaseCommand {
|
|||||||
public String getPossibleArguments() {
|
public String getPossibleArguments() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
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.I18n;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 蒋天蓓 2015年8月12日下午2:04:05
|
||||||
|
*/
|
||||||
|
public class CommandWorld extends BaseCommand {
|
||||||
|
SimpleEssential plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public CommandWorld(SimpleEssential main) {
|
||||||
|
super("world", "seworld");
|
||||||
|
this.plugin = main;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||||
|
Player p = (Player) sender;
|
||||||
|
switch (args.length) {
|
||||||
|
case 0:
|
||||||
|
p.sendMessage(I18n.parse("World.title"));
|
||||||
|
for (World wd : Bukkit.getWorlds())
|
||||||
|
p.sendMessage(I18n.parse("World.info", wd.getName(), wd.getEnvironment().toString(), wd.getLoadedChunks().length, wd.getEntities().size(), wd.getPlayers().size()));
|
||||||
|
case 1:
|
||||||
|
World wd = Bukkit.getWorld(args[1]);
|
||||||
|
if (wd != null)
|
||||||
|
p.teleport(wd.getSpawnLocation());
|
||||||
|
else
|
||||||
|
p.sendMessage(I18n.parse("World.unknow", args[1]));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinimumArguments() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPossibleArguments() {
|
||||||
|
return "[世界名称|世界序号]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOnlyPlayerExecutable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -4,16 +4,16 @@ import org.bukkit.plugin.Plugin;
|
|||||||
|
|
||||||
import cn.citycraft.config.FileConfig;
|
import cn.citycraft.config.FileConfig;
|
||||||
|
|
||||||
public class Language {
|
public class I18n {
|
||||||
private static String CONFIG_NAME = "language.yml";
|
private static String CONFIG_NAME = "language.yml";
|
||||||
private static FileConfig config;
|
private static FileConfig config;
|
||||||
|
|
||||||
public static String getMessage(String path) {
|
public static String parse(String path) {
|
||||||
return config.getMessage(path);
|
return config.getMessage(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMessage(String path, Object... args) {
|
public static String parse(String path, Object... args) {
|
||||||
return String.format(getMessage(path), args);
|
return String.format(parse(path), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load(Plugin p) {
|
public static void load(Plugin p) {
|
@ -14,7 +14,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
import cn.citycraft.SimpleEssential.utils.EffectUtil;
|
import cn.citycraft.SimpleEssential.utils.EffectUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,7 +46,7 @@ public class TeleportControl {
|
|||||||
Player target = ti.getTarget();
|
Player target = ti.getTarget();
|
||||||
Location loc = null;
|
Location loc = null;
|
||||||
if (!target.isOnline()) {
|
if (!target.isOnline()) {
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.offline"));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.offline"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ti.getTptype() == TeleportType.TPA) {
|
if (ti.getTptype() == TeleportType.TPA) {
|
||||||
@ -56,12 +56,12 @@ public class TeleportControl {
|
|||||||
target = player;
|
target = player;
|
||||||
loc = ti.getTarget().getLocation();
|
loc = ti.getTarget().getLocation();
|
||||||
}
|
}
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.accept", target.getDisplayName()));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.accept", target.getDisplayName()));
|
||||||
target.sendMessage(TpControlName + Language.getMessage("Teleport.acceptfrom", player.getDisplayName()));
|
target.sendMessage(TpControlName + I18n.parse("Teleport.acceptfrom", player.getDisplayName()));
|
||||||
magicTeleport(target, loc, TpDelay);
|
magicTeleport(target, loc, TpDelay);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.none"));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.none"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,7 +89,7 @@ public class TeleportControl {
|
|||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
magicTeleport(player, loc, 3);
|
magicTeleport(player, loc, 3);
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.nobackloc"));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.nobackloc"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,12 +104,12 @@ public class TeleportControl {
|
|||||||
if (ti != null) {
|
if (ti != null) {
|
||||||
Player target = ti.getTarget();
|
Player target = ti.getTarget();
|
||||||
if (target.isOnline()) {
|
if (target.isOnline()) {
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.deny", target.getDisplayName()));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.deny", target.getDisplayName()));
|
||||||
target.sendMessage(TpControlName + Language.getMessage("Teleport.denyfrom", player.getDisplayName()));
|
target.sendMessage(TpControlName + I18n.parse("Teleport.denyfrom", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.none"));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.none"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,7 +137,7 @@ public class TeleportControl {
|
|||||||
public void magicTeleport(final Player player, final Location loc, final int delay) {
|
public void magicTeleport(final Player player, final Location loc, final int delay) {
|
||||||
int petime = delay * 20 + 10;
|
int petime = delay * 20 + 10;
|
||||||
setLastloc(player, player.getLocation());
|
setLastloc(player, player.getLocation());
|
||||||
player.sendMessage(TpControlName + Language.getMessage("Teleport.tp", delay, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockZ()));
|
player.sendMessage(TpControlName + I18n.parse("Teleport.tp", delay, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockZ()));
|
||||||
List<PotionEffect> pe = new ArrayList<PotionEffect>();
|
List<PotionEffect> pe = new ArrayList<PotionEffect>();
|
||||||
pe.add(new PotionEffect(PotionEffectType.SLOW, petime, 255));
|
pe.add(new PotionEffect(PotionEffectType.SLOW, petime, 255));
|
||||||
pe.add(new PotionEffect(PotionEffectType.CONFUSION, petime, 255));
|
pe.add(new PotionEffect(PotionEffectType.CONFUSION, petime, 255));
|
||||||
|
@ -31,4 +31,13 @@ Suicide:
|
|||||||
#帽子
|
#帽子
|
||||||
Hat:
|
Hat:
|
||||||
empty: '§c看上去你手上什么都没有啊!'
|
empty: '§c看上去你手上什么都没有啊!'
|
||||||
enjoy: '§2享受你的新帽子吧!'
|
enjoy: '§2享受你的新帽子吧!'
|
||||||
|
Gc:
|
||||||
|
Processors: '§6使用核心: §a%s'
|
||||||
|
maxMem: '§6最大内存: §a%s'
|
||||||
|
totalMem: '§6已用内存: §a%s'
|
||||||
|
freeMem: '§6空闲内存: §a%s'
|
||||||
|
World:
|
||||||
|
title: '§6当前服务器的启用的世界如下'
|
||||||
|
info: '§6名称: §a%s §b- §6类型: §a%s §6区块: §a%s §6实体数: §a%s §6玩家数: §a%s'
|
||||||
|
unknow: '§c未知的世界 §a%s'
|
@ -95,6 +95,18 @@ commands:
|
|||||||
usage: §6使用 §a/spawn §6返回世界出生点!
|
usage: §6使用 §a/spawn §6返回世界出生点!
|
||||||
permission: se.spawn
|
permission: se.spawn
|
||||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||||
|
gc:
|
||||||
|
description: 清理内存
|
||||||
|
aliases: [mem,semem,segc]
|
||||||
|
usage: §6使用 §a/gc §6清理内存!
|
||||||
|
permission: se.gc
|
||||||
|
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||||
|
world:
|
||||||
|
description: 清理内存
|
||||||
|
aliases: [seworld]
|
||||||
|
usage: §6使用 §a/world [世界名称|世界序号] §6进行传送!
|
||||||
|
permission: se.world
|
||||||
|
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
se.*:
|
se.*:
|
||||||
|
Loading…
Reference in New Issue
Block a user