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

Move Effect to Utils add Base Language...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-08-14 14:15:57 +08:00
parent 83ea7a6c3e
commit 33867b92e5
4 changed files with 42 additions and 27 deletions

View File

@ -6,7 +6,6 @@ package cn.citycraft.SimpleEssential;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
@ -48,11 +47,11 @@ public class SimpleEssential extends JavaPlugin {
for (SimpleEssentialCommand command : commandlist) {
if (command.isValidTrigger(label)) {
if (!command.hasPermission(sender)) {
sender.sendMessage(ChatColor.RED + "你没有此命令的权限.");
sender.sendMessage(Language.getMessage("Base.no-permission"));
return true;
}
if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "此命令只能由玩家执行.");
sender.sendMessage(Language.getMessage("Base.playercommand"));
return true;
}
if (args.length >= command.getMinimumArguments()) {

View File

@ -7,7 +7,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
@ -16,33 +15,12 @@ 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;
/**
* @author 蒋天蓓 2015年8月12日下午2:26:10 传送控制类
*/
public class TeleportControl {
/**
* 粒子发生器
*
* @param loc
* - 粒子产生的地点
* @param range
* - 粒子的数量
*/
static void pEffect(Location loc, long range) {
try {
int i;
if (range < 2) {
range = 2;
}
for (i = 0; i < range; i++) {
loc.getWorld().playEffect(loc, Effect.LAVA_POP, 10, 100);
loc.getWorld().playEffect(loc, Effect.PORTAL, 10, 100);
}
} catch (Exception e) {
}
}
protected HashMap<Player, TeleportInfo> teleportList = new HashMap<Player, TeleportInfo>();
protected HashMap<Player, Location> lastlocList = new HashMap<Player, Location>();
private SimpleEssential plugin;
@ -170,7 +148,7 @@ public class TeleportControl {
public void run() {
while (System.currentTimeMillis() < timeoutmark) {
if (player.isOnline()) {
pEffect(player.getLocation(), lrng);
EffectUtil.run(player.getLocation(), lrng);
}
lrng++;
try {

View File

@ -0,0 +1,36 @@
/**
*
*/
package cn.citycraft.SimpleEssential.utils;
import org.bukkit.Effect;
import org.bukkit.Location;
/**
* @author 蒋天蓓
* 2015年8月14日下午2:07:02
* TODO
*/
public class EffectUtil {
/**
* 粒子发生器
*
* @param loc
* - 粒子产生的地点
* @param range
* - 粒子的数量
*/
public static void run(Location loc, long range) {
try {
int i;
if (range < 2) {
range = 2;
}
for (i = 0; i < range; i++) {
loc.getWorld().playEffect(loc, Effect.LAVA_POP, 10, 100);
loc.getWorld().playEffect(loc, Effect.PORTAL, 10, 100);
}
} catch (Exception e) {
}
}
}

View File

@ -3,6 +3,8 @@ version: 1.0
#基础语言配置
Base:
offline: "§c玩家 {0} 不存在或不在线!"
no-permission: '§c你没有此命令的权限.'
playercommand: '§c此命令只能由玩家执行.'
#基础传送系统
Teleport:
tp: '§a传送开始 {0}秒 后到达 目的地 §d世界: {1} §3X: {2} Z: {3}!'