1
0
mirror of https://e.coding.net/circlecloud/SimpleEssential.git synced 2024-11-16 01:08:46 +00:00

add TpControl Name...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-08-18 20:21:38 +08:00
parent 568ea95ad2
commit 777b1cf71b
5 changed files with 41 additions and 26 deletions

View File

@ -77,12 +77,18 @@ public class SimpleEssential extends JavaPlugin {
@Override
public void onEnable() {
tpcontrol = new TeleportControl(this);
this.initTeleportControl();
this.registerCommands();
this.registerEvents();
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);
}
/**
* 注册事件
*/

View File

@ -14,7 +14,6 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import cn.citycraft.SimpleEssential.SimpleEssential;
import cn.citycraft.SimpleEssential.config.Config;
import cn.citycraft.SimpleEssential.config.Language;
import cn.citycraft.SimpleEssential.utils.EffectUtil;
@ -26,11 +25,13 @@ public class TeleportControl {
protected HashMap<Player, Location> lastlocList = new HashMap<Player, Location>();
private SimpleEssential plugin;
private int TpDelay = Config.getInstance().getInt("Teleport.delay", 3);
private int TpDelay = 0;
private String TpControlName = "";
public TeleportControl(SimpleEssential plugin) {
public TeleportControl(SimpleEssential plugin, String tpcontrolname, int tpdelay) {
this.plugin = plugin;
this.TpDelay = tpdelay;
this.TpControlName = tpcontrolname;
}
/**
@ -45,7 +46,7 @@ public class TeleportControl {
Player target = ti.getTarget();
Location loc = null;
if (!target.isOnline()) {
player.sendMessage(Language.getMessage("Teleport.offline"));
player.sendMessage(TpControlName + Language.getMessage("Teleport.offline"));
return;
}
if (ti.getTptype() == TeleportType.TPA) {
@ -55,12 +56,12 @@ public class TeleportControl {
target = player;
loc = ti.getTarget().getLocation();
}
player.sendMessage(Language.getMessage("Teleport.accept"));
target.sendMessage(Language.getMessage("Teleport.acceptfrom"));
player.sendMessage(TpControlName + Language.getMessage("Teleport.accept"));
target.sendMessage(TpControlName + Language.getMessage("Teleport.acceptfrom"));
magicTeleport(target, loc, TpDelay);
return;
}
player.sendMessage(Language.getMessage("Teleport.none"));
player.sendMessage(TpControlName + Language.getMessage("Teleport.none"));
}
/**
@ -88,7 +89,7 @@ public class TeleportControl {
if (loc != null) {
magicTeleport(player, loc, 3);
} else {
player.sendMessage(Language.getMessage("Teleport.nobackloc"));
player.sendMessage(TpControlName + Language.getMessage("Teleport.nobackloc"));
}
}
@ -103,12 +104,12 @@ public class TeleportControl {
if (ti != null) {
Player target = ti.getTarget();
if (target.isOnline()) {
player.sendMessage(Language.getMessage("Teleport.deny"));
target.sendMessage(Language.getMessage("Teleport.denyfrom"));
player.sendMessage(TpControlName + Language.getMessage("Teleport.deny"));
target.sendMessage(TpControlName + Language.getMessage("Teleport.denyfrom"));
}
return;
}
player.sendMessage(Language.getMessage("Teleport.none"));
player.sendMessage(TpControlName + Language.getMessage("Teleport.none"));
}
/**
@ -136,7 +137,7 @@ public class TeleportControl {
public void magicTeleport(final Player player, final Location loc, final int delay) {
int petime = delay * 20 + 10;
setLastloc(player, player.getLocation());
player.sendMessage(Language.getMessage("Teleport.tp", delay, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockZ()));
player.sendMessage(TpControlName + Language.getMessage("Teleport.tp", delay, loc.getWorld().getName(), loc.getBlockX(), loc.getBlockZ()));
List<PotionEffect> pe = new ArrayList<PotionEffect>();
pe.add(new PotionEffect(PotionEffectType.SLOW, petime, 255));
pe.add(new PotionEffect(PotionEffectType.CONFUSION, petime, 255));

View File

@ -18,9 +18,10 @@ import org.bukkit.plugin.Plugin;
import com.google.common.base.Charsets;
/**
* 自动更新类
*
* @author 蒋天蓓
* 2015年8月14日下午4:01:15
* 自动更新类
*/
public class VersionChecker implements Listener {
Plugin plugin;

View File

@ -26,7 +26,7 @@ Teleport:
nobackloc: '§c未找到可以Back的地点!'
#自杀
Suicide:
msg: '§6玩家: %s §c活不下去自杀了!'
msg: '§6玩家: §a%s §d活不下去 - §c自杀了!'
#帽子
Hat:
empty: '§c看上去你手上什么都没有啊'

View File

@ -6,63 +6,69 @@ commands:
simpleessential:
description: 简单基础插件
aliases: [se,sme]
usage: §b使用/se help 查看帮助!
usage: §6使用§a/se help §6查看帮助!
permission: se.*
permission-message: §c你没有 <permission> 的权限来执行此命令!
tpa:
description: 传送到目标玩家
aliases: [setps,smetpa]
usage: §b使用/tpa <player>传送到目标玩家!
usage: §6使用§a/tpa <player> §6传送到目标玩家!
permission: se.tpa
permission-message: §c你没有 <permission> 的权限来执行此命令!
tphere:
description: 邀请目标玩家
aliases: [tph]
usage: §b使用/tphere <player>邀请目标玩家!
usage: §6使用§a/tphere <player> §6邀请目标玩家!
permission: se.tphere
permission-message: §c你没有 <permission> 的权限来执行此命令!
tpaccept:
description: 接受传送或邀请
aliases: [tpok]
usage: §b使用/tpaccept 接受传送或邀请!
usage: §6使用§a/tpaccept §6接受传送或邀请!
permission: se.tpaccept
permission-message: §c你没有 <permission> 的权限来执行此命令!
tpdeny:
description: 拒绝传送或邀请
aliases: [tpno]
usage: §b使用/tpdeny 拒绝传送或邀请!
usage: §6使用§a/tpdeny §6拒绝传送或邀请!
permission: se.tpdeny
permission-message: §c你没有 <permission> 的权限来执行此命令!
back:
description: 回到上一个TP地点
aliases: [seback]
usage: §b使用/back 回到上一个TP地点!
usage: §6使用§a/back §6回到上一个TP地点!
permission: se.back
permission-message: §c你没有 <permission> 的权限来执行此命令!
top:
description: 传送到最高方块
aliases: [setop]
usage: §b使用/top 传送到当前位置最高方块!
usage: §6使用§a/top §6传送到当前位置最高方块!
permission: se.top
permission-message: §c你没有 <permission> 的权限来执行此命令!
home:
description: 传送到家里
aliases: [sehome]
usage: §b使用/home 传送到家里!
usage: §6使用§a/home §6传送到家里!
permission: se.home
permission-message: §c你没有 <permission> 的权限来执行此命令!
sethome:
description: 设置当前位置为家
aliases: [sesethome]
usage: §b使用/sethome 设置当前位置为家!
usage: §6使用§a/sethome §6设置当前位置为家!
permission: se.sethome
permission-message: §c你没有 <permission> 的权限来执行此命令!
suicide:
description: 自杀
aliases: [sesuicide,sd]
usage: §b使用/suicide结束自己的生命!
usage: §6使用§a/suicide §6结束自己的生命!
permission: se.suicide
permission-message: §c你没有 <permission> 的权限来执行此命令!
hat:
description: 帽子
aliases: [sehat]
usage: §6使用§a/hat §6把手上的物品带在头上!
permission: se.hat
permission-message: §c你没有 <permission> 的权限来执行此命令!
permissions:
se.*:
description: 简单基础插件所有权限!
@ -81,4 +87,5 @@ permissions:
se.sethome: true
se.home: true
se.suicide: true
se.hat: true