mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2025-01-06 12:18:56 +00:00
add new Command Sudo and update...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
df46033903
commit
b6b66ff3fb
@ -32,7 +32,7 @@ public class CommandGc extends BaseCommand {
|
|||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public CommandGc(final SimpleEssential main) {
|
public CommandGc(final SimpleEssential main) {
|
||||||
super("gc", "mem");
|
super("gc", "mem", "segc", "semem");
|
||||||
this.plugin = main;
|
this.plugin = main;
|
||||||
setDescription("清理内存");
|
setDescription("清理内存");
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ public class CommandGc extends BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
final Runtime rt = Runtime.getRuntime();
|
final Runtime rt = Runtime.getRuntime();
|
||||||
if (label.equalsIgnoreCase("gc")) {
|
if (label.equalsIgnoreCase("gc") || label.equalsIgnoreCase("segc")) {
|
||||||
rt.gc();
|
rt.gc();
|
||||||
}
|
}
|
||||||
sender.sendMessage(I18n.p("Gc.runTime", StringUtil.formatDate(SystemUtil.getRunTime())));
|
sender.sendMessage(I18n.p("Gc.runTime", StringUtil.formatDate(SystemUtil.getRunTime())));
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package cn.citycraft.SimpleEssential.command;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
import cn.citycraft.PluginHelper.utils.StringUtil;
|
||||||
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
|
import cn.citycraft.SimpleEssential.config.I18n;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传送到顶部命令
|
||||||
|
*
|
||||||
|
* @author 蒋天蓓
|
||||||
|
* 2015年8月12日下午2:04:05
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CommandSudo extends BaseCommand {
|
||||||
|
SimpleEssential plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
*/
|
||||||
|
public CommandSudo(final SimpleEssential main) {
|
||||||
|
super("sudo", "sesudo");
|
||||||
|
this.plugin = main;
|
||||||
|
setMinimumArguments(2);
|
||||||
|
setPossibleArguments("<玩家> <命令>");
|
||||||
|
setDescription("强制玩家执行命令");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final Player p = Bukkit.getPlayer(args[0]);
|
||||||
|
if (p == null) {
|
||||||
|
sender.sendMessage(I18n.p("Base.offline", args[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final String cmd = StringUtil.consolidateStrings(args, 1);
|
||||||
|
p.performCommand(cmd);
|
||||||
|
sender.sendMessage(I18n.p("Sudo", args[0], cmd));
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#本文件为保护插件的主配置文件
|
#本文件为保护插件的主配置文件
|
||||||
version: 1.0
|
Version: 1.0
|
||||||
#服务器名称
|
#服务器名称
|
||||||
servername: ''
|
servername: ''
|
||||||
#插件名称
|
#插件名称
|
||||||
|
@ -41,4 +41,5 @@ Gc:
|
|||||||
World:
|
World:
|
||||||
title: '§6当前服务器的启用的世界如下'
|
title: '§6当前服务器的启用的世界如下'
|
||||||
info: '§a%s §3- §a%s §6区块: §a%s §6实体: §a%s §6tiles: §a%s §6玩家: §a%s'
|
info: '§a%s §3- §a%s §6区块: §a%s §6实体: §a%s §6tiles: §a%s §6玩家: §a%s'
|
||||||
unknow: '§c未知的世界 §a%s'
|
unknow: '§c未知的世界 §a%s'
|
||||||
|
Sudo: '§6玩家: §a%s §6已执行命令 §b%s'
|
Loading…
Reference in New Issue
Block a user