mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2025-01-08 12:39:20 +00:00
Move Effect to Utils add Base Language...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
83ea7a6c3e
commit
33867b92e5
@ -6,7 +6,6 @@ package cn.citycraft.SimpleEssential;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandException;
|
import org.bukkit.command.CommandException;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -48,11 +47,11 @@ public class SimpleEssential extends JavaPlugin {
|
|||||||
for (SimpleEssentialCommand command : commandlist) {
|
for (SimpleEssentialCommand command : commandlist) {
|
||||||
if (command.isValidTrigger(label)) {
|
if (command.isValidTrigger(label)) {
|
||||||
if (!command.hasPermission(sender)) {
|
if (!command.hasPermission(sender)) {
|
||||||
sender.sendMessage(ChatColor.RED + "你没有此命令的权限.");
|
sender.sendMessage(Language.getMessage("Base.no-permission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) {
|
if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "此命令只能由玩家执行.");
|
sender.sendMessage(Language.getMessage("Base.playercommand"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length >= command.getMinimumArguments()) {
|
if (args.length >= command.getMinimumArguments()) {
|
||||||
|
@ -7,7 +7,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
@ -16,33 +15,12 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||||
import cn.citycraft.SimpleEssential.config.Config;
|
import cn.citycraft.SimpleEssential.config.Config;
|
||||||
import cn.citycraft.SimpleEssential.config.Language;
|
import cn.citycraft.SimpleEssential.config.Language;
|
||||||
|
import cn.citycraft.SimpleEssential.utils.EffectUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 蒋天蓓 2015年8月12日下午2:26:10 传送控制类
|
* @author 蒋天蓓 2015年8月12日下午2:26:10 传送控制类
|
||||||
*/
|
*/
|
||||||
public class TeleportControl {
|
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, TeleportInfo> teleportList = new HashMap<Player, TeleportInfo>();
|
||||||
protected HashMap<Player, Location> lastlocList = new HashMap<Player, Location>();
|
protected HashMap<Player, Location> lastlocList = new HashMap<Player, Location>();
|
||||||
private SimpleEssential plugin;
|
private SimpleEssential plugin;
|
||||||
@ -170,7 +148,7 @@ public class TeleportControl {
|
|||||||
public void run() {
|
public void run() {
|
||||||
while (System.currentTimeMillis() < timeoutmark) {
|
while (System.currentTimeMillis() < timeoutmark) {
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
pEffect(player.getLocation(), lrng);
|
EffectUtil.run(player.getLocation(), lrng);
|
||||||
}
|
}
|
||||||
lrng++;
|
lrng++;
|
||||||
try {
|
try {
|
||||||
|
36
src/cn/citycraft/SimpleEssential/utils/EffectUtil.java
Normal file
36
src/cn/citycraft/SimpleEssential/utils/EffectUtil.java
Normal 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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,8 @@ version: 1.0
|
|||||||
#基础语言配置
|
#基础语言配置
|
||||||
Base:
|
Base:
|
||||||
offline: "§c玩家 {0} 不存在或不在线!"
|
offline: "§c玩家 {0} 不存在或不在线!"
|
||||||
|
no-permission: '§c你没有此命令的权限.'
|
||||||
|
playercommand: '§c此命令只能由玩家执行.'
|
||||||
#基础传送系统
|
#基础传送系统
|
||||||
Teleport:
|
Teleport:
|
||||||
tp: '§a传送开始 {0}秒 后到达 目的地 §d世界: {1} §3X: {2} Z: {3}!'
|
tp: '§a传送开始 {0}秒 后到达 目的地 §d世界: {1} §3X: {2} Z: {3}!'
|
||||||
|
Loading…
Reference in New Issue
Block a user