mirror of
https://e.coding.net/circlecloud/SimpleEssential.git
synced 2025-01-06 12:18:56 +00:00
#2 Update
+ /suicide command with a not working death message + Buggy /hat + A function to register controllers likes register events and commands * Moved command utility to a single package cn.citycraft/SimpleEssential/command/utils ! Sometimes language file dosn't working and I don't know what happened ! Hat cannot judge is a air on hand... I tried to if but not working! ! Death message for suicide is not working! # I know that's all my fault and please fix them! # Symbols: + Add - Remove x Fixed ! Bug # Description * Change # Wish you know!
This commit is contained in:
parent
1c529d697c
commit
1ff9008275
@ -1,7 +1,8 @@
|
||||
package cn.citycraft.SimpleEssential;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -14,18 +15,20 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import cn.citycraft.SimpleEssential.command.CommandBack;
|
||||
import cn.citycraft.SimpleEssential.command.CommandHat;
|
||||
import cn.citycraft.SimpleEssential.command.CommandHome;
|
||||
import cn.citycraft.SimpleEssential.command.CommandSetHome;
|
||||
import cn.citycraft.SimpleEssential.command.CommandSuicide;
|
||||
import cn.citycraft.SimpleEssential.command.CommandTop;
|
||||
import cn.citycraft.SimpleEssential.command.CommandTpa;
|
||||
import cn.citycraft.SimpleEssential.command.CommandTpaccept;
|
||||
import cn.citycraft.SimpleEssential.command.CommandTpdeny;
|
||||
import cn.citycraft.SimpleEssential.command.CommandTphere;
|
||||
import cn.citycraft.SimpleEssential.command.SimpleEssentialCommand;
|
||||
import cn.citycraft.SimpleEssential.command.utils.teleport.TeleportControl;
|
||||
import cn.citycraft.SimpleEssential.config.Config;
|
||||
import cn.citycraft.SimpleEssential.config.Language;
|
||||
import cn.citycraft.SimpleEssential.listen.PlayerLocationListen;
|
||||
import cn.citycraft.SimpleEssential.teleport.TeleportControl;
|
||||
import cn.citycraft.SimpleEssential.listeners.TeleportDeathBackListener;
|
||||
import cn.citycraft.SimpleEssential.utils.VersionChecker;
|
||||
|
||||
/**
|
||||
@ -36,7 +39,7 @@ import cn.citycraft.SimpleEssential.utils.VersionChecker;
|
||||
public class SimpleEssential extends JavaPlugin {
|
||||
|
||||
/**
|
||||
* 传送控制
|
||||
* 控制器
|
||||
*/
|
||||
public TeleportControl tpcontrol;
|
||||
/**
|
||||
@ -75,9 +78,9 @@ public class SimpleEssential extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
tpcontrol = new TeleportControl(this);
|
||||
this.registerCommands();
|
||||
this.registerEvents();
|
||||
this.registerControllers();
|
||||
new VersionChecker(this);
|
||||
}
|
||||
|
||||
@ -85,7 +88,13 @@ public class SimpleEssential extends JavaPlugin {
|
||||
* 注册事件
|
||||
*/
|
||||
private void registerEvents() {
|
||||
registerEvent(new PlayerLocationListen(this));
|
||||
registerEvent(new TeleportDeathBackListener(this));
|
||||
}
|
||||
/**
|
||||
* 初始化控制器
|
||||
*/
|
||||
private void registerControllers(){
|
||||
tpcontrol = new TeleportControl(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -107,7 +116,9 @@ public class SimpleEssential extends JavaPlugin {
|
||||
registerCommand(new CommandBack(this));
|
||||
registerCommand(new CommandSetHome(this));
|
||||
registerCommand(new CommandHome(this));
|
||||
|
||||
registerCommand(new CommandSuicide(this));
|
||||
registerCommand(new CommandHat(this));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
60
src/cn/citycraft/SimpleEssential/command/CommandHat.java
Normal file
60
src/cn/citycraft/SimpleEssential/command/CommandHat.java
Normal file
@ -0,0 +1,60 @@
|
||||
package cn.citycraft.SimpleEssential.command;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||
import cn.citycraft.SimpleEssential.config.Language;
|
||||
|
||||
/**
|
||||
*@Author 代小呆 created in 2015年8月16日下午1:44:22
|
||||
*/
|
||||
|
||||
public class CommandHat extends SimpleEssentialCommand{
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private SimpleEssential plugin;
|
||||
|
||||
public CommandHat(SimpleEssential se) {
|
||||
super("hat","sehat");
|
||||
this.plugin = se;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPossibleArguments() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumArguments() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
Player p = (Player)sender;
|
||||
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
|
||||
public boolean isOnlyPlayerExecutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
61
src/cn/citycraft/SimpleEssential/command/CommandSuicide.java
Normal file
61
src/cn/citycraft/SimpleEssential/command/CommandSuicide.java
Normal file
@ -0,0 +1,61 @@
|
||||
package cn.citycraft.SimpleEssential.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.command.CommandException;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
//import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
//import cn.citycraft.SimpleEssential.config.Language;
|
||||
import cn.citycraft.SimpleEssential.utils.EffectUtil;
|
||||
//import cn.citycraft.SimpleEssential.utils.Randomer;
|
||||
|
||||
/**
|
||||
* 自杀命令
|
||||
*@Author 代小呆 created in 2015年8月14日下午4:24:19
|
||||
*/
|
||||
|
||||
public class CommandSuicide extends SimpleEssentialCommand{
|
||||
private SimpleEssential plugin;
|
||||
|
||||
public CommandSuicide(SimpleEssential main) {
|
||||
super("suicide", new String[]{"sesuicide","sd"});
|
||||
this.plugin = main;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPossibleArguments() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumArguments() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
Player p = (Player)sender;
|
||||
EffectUtil.run(p.getLocation(), 10, Effect.POTION_BREAK);
|
||||
PlayerDeathEvent pd = new PlayerDeathEvent(p,Arrays.asList(p.getInventory().getContents()),
|
||||
(int) Math.floor(p.getExp()),p.getName() + "自杀了");
|
||||
plugin.getServer().getPluginManager().callEvent(pd);
|
||||
// plugin.getServer().broadcastMessage(Language.getMessage("Suicide.suicide",sender.getName()));
|
||||
p.setHealth(0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnlyPlayerExecutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -9,8 +9,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||
import cn.citycraft.SimpleEssential.command.utils.teleport.TeleportType;
|
||||
import cn.citycraft.SimpleEssential.config.Language;
|
||||
import cn.citycraft.SimpleEssential.teleport.TeleportType;
|
||||
|
||||
/**
|
||||
* 玩家传送命令
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||
import cn.citycraft.SimpleEssential.command.utils.teleport.TeleportType;
|
||||
import cn.citycraft.SimpleEssential.config.Language;
|
||||
import cn.citycraft.SimpleEssential.teleport.TeleportType;
|
||||
|
||||
/**
|
||||
* 传送到玩家命令
|
||||
|
@ -1,183 +1,183 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.teleport;
|
||||
|
||||
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;
|
||||
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 {
|
||||
protected HashMap<Player, TeleportInfo> teleportList = new HashMap<Player, TeleportInfo>();
|
||||
protected HashMap<Player, Location> lastlocList = new HashMap<Player, Location>();
|
||||
private SimpleEssential plugin;
|
||||
|
||||
private int TpDelay = Config.getInstance().getInt("Teleport.delay", 3);
|
||||
|
||||
public TeleportControl(SimpleEssential plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家接受传送请求
|
||||
*
|
||||
* @param player
|
||||
* - 执行的玩家
|
||||
*/
|
||||
public void accept(Player player) {
|
||||
TeleportInfo ti = teleportList.remove(player);
|
||||
if (ti != null) {
|
||||
Player target = ti.getTarget();
|
||||
Location loc = null;
|
||||
if (!target.isOnline()) {
|
||||
player.sendMessage(Language.getMessage("Teleport.offline"));
|
||||
return;
|
||||
}
|
||||
if (ti.getTptype() == TeleportType.TPA) {
|
||||
target = ti.getTarget();
|
||||
loc = player.getLocation();
|
||||
} else {
|
||||
target = player;
|
||||
loc = ti.getTarget().getLocation();
|
||||
}
|
||||
player.sendMessage(Language.getMessage("Teleport.accept"));
|
||||
target.sendMessage(Language.getMessage("Teleport.acceptfrom"));
|
||||
magicTeleport(target, loc, TpDelay);
|
||||
return;
|
||||
}
|
||||
player.sendMessage(Language.getMessage("Teleport.none"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加传送请求到传送列表
|
||||
*
|
||||
* @param player
|
||||
* - 发出请求的玩家
|
||||
* @param target
|
||||
* - 目标玩家
|
||||
* @param tptype
|
||||
* - 传送类型
|
||||
*/
|
||||
public void addtp(Player player, Player target, TeleportType tptype) {
|
||||
teleportList.put(target, new TeleportInfo(player, tptype));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家返回上次传送的地点
|
||||
*
|
||||
* @param player
|
||||
* - 被传送的玩家
|
||||
*/
|
||||
public void back(Player player) {
|
||||
Location loc = lastlocList.get(player);
|
||||
if (loc != null) {
|
||||
magicTeleport(player, loc, 3);
|
||||
} else {
|
||||
player.sendMessage(Language.getMessage("Teleport.nobackloc"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家拒绝传送请求
|
||||
*
|
||||
* @param player
|
||||
* - 执行的玩家
|
||||
*/
|
||||
public void deny(Player player) {
|
||||
TeleportInfo ti = teleportList.remove(player);
|
||||
if (ti != null) {
|
||||
Player target = ti.getTarget();
|
||||
if (target.isOnline()) {
|
||||
player.sendMessage(Language.getMessage("Teleport.deny"));
|
||||
target.sendMessage(Language.getMessage("Teleport.denyfrom"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
player.sendMessage(Language.getMessage("Teleport.none"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔法传送
|
||||
*
|
||||
* @param player
|
||||
* - 被传送的玩家
|
||||
* @param loc
|
||||
* - 传送的地点
|
||||
*/
|
||||
public void magicTeleport(final Player player, final Location loc) {
|
||||
magicTeleport(player, loc, TpDelay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔法传送
|
||||
*
|
||||
* @param player
|
||||
* - 被传送的玩家
|
||||
* @param loc
|
||||
* - 传送的地点
|
||||
* @param delay
|
||||
* - 传送延时
|
||||
*/
|
||||
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()));
|
||||
List<PotionEffect> pe = new ArrayList<PotionEffect>();
|
||||
pe.add(new PotionEffect(PotionEffectType.SLOW, petime, 255));
|
||||
pe.add(new PotionEffect(PotionEffectType.CONFUSION, petime, 255));
|
||||
player.addPotionEffects(pe);
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
long timeoutmark = System.currentTimeMillis() + delay * 1000;
|
||||
long lrng = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (System.currentTimeMillis() < timeoutmark) {
|
||||
if (player.isOnline()) {
|
||||
EffectUtil.run(player.getLocation(), lrng, Effect.MOBSPAWNER_FLAMES, Effect.PORTAL);
|
||||
}
|
||||
lrng++;
|
||||
try {
|
||||
Thread.sleep(128);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline()) {
|
||||
player.teleport(loc);
|
||||
}
|
||||
}
|
||||
}, delay * 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置最后的地址数据
|
||||
*
|
||||
* @param player
|
||||
* - 玩家
|
||||
* @param loc
|
||||
* - 地点
|
||||
*/
|
||||
public void setLastloc(Player player, Location loc) {
|
||||
lastlocList.put(player, loc);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.command.utils.teleport;
|
||||
|
||||
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;
|
||||
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 {
|
||||
protected HashMap<Player, TeleportInfo> teleportList = new HashMap<Player, TeleportInfo>();
|
||||
protected HashMap<Player, Location> lastlocList = new HashMap<Player, Location>();
|
||||
private SimpleEssential plugin;
|
||||
|
||||
private int TpDelay = Config.getInstance().getInt("Teleport.delay", 3);
|
||||
|
||||
public TeleportControl(SimpleEssential plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家接受传送请求
|
||||
*
|
||||
* @param player
|
||||
* - 执行的玩家
|
||||
*/
|
||||
public void accept(Player player) {
|
||||
TeleportInfo ti = teleportList.remove(player);
|
||||
if (ti != null) {
|
||||
Player target = ti.getTarget();
|
||||
Location loc = null;
|
||||
if (!target.isOnline()) {
|
||||
player.sendMessage(Language.getMessage("Teleport.offline"));
|
||||
return;
|
||||
}
|
||||
if (ti.getTptype() == TeleportType.TPA) {
|
||||
target = ti.getTarget();
|
||||
loc = player.getLocation();
|
||||
} else {
|
||||
target = player;
|
||||
loc = ti.getTarget().getLocation();
|
||||
}
|
||||
player.sendMessage(Language.getMessage("Teleport.accept"));
|
||||
target.sendMessage(Language.getMessage("Teleport.acceptfrom"));
|
||||
magicTeleport(target, loc, TpDelay);
|
||||
return;
|
||||
}
|
||||
player.sendMessage(Language.getMessage("Teleport.none"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加传送请求到传送列表
|
||||
*
|
||||
* @param player
|
||||
* - 发出请求的玩家
|
||||
* @param target
|
||||
* - 目标玩家
|
||||
* @param tptype
|
||||
* - 传送类型
|
||||
*/
|
||||
public void addtp(Player player, Player target, TeleportType tptype) {
|
||||
teleportList.put(target, new TeleportInfo(player, tptype));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家返回上次传送的地点
|
||||
*
|
||||
* @param player
|
||||
* - 被传送的玩家
|
||||
*/
|
||||
public void back(Player player) {
|
||||
Location loc = lastlocList.get(player);
|
||||
if (loc != null) {
|
||||
magicTeleport(player, loc, 3);
|
||||
} else {
|
||||
player.sendMessage(Language.getMessage("Teleport.nobackloc"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家拒绝传送请求
|
||||
*
|
||||
* @param player
|
||||
* - 执行的玩家
|
||||
*/
|
||||
public void deny(Player player) {
|
||||
TeleportInfo ti = teleportList.remove(player);
|
||||
if (ti != null) {
|
||||
Player target = ti.getTarget();
|
||||
if (target.isOnline()) {
|
||||
player.sendMessage(Language.getMessage("Teleport.deny"));
|
||||
target.sendMessage(Language.getMessage("Teleport.denyfrom"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
player.sendMessage(Language.getMessage("Teleport.none"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔法传送
|
||||
*
|
||||
* @param player
|
||||
* - 被传送的玩家
|
||||
* @param loc
|
||||
* - 传送的地点
|
||||
*/
|
||||
public void magicTeleport(final Player player, final Location loc) {
|
||||
magicTeleport(player, loc, TpDelay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 魔法传送
|
||||
*
|
||||
* @param player
|
||||
* - 被传送的玩家
|
||||
* @param loc
|
||||
* - 传送的地点
|
||||
* @param delay
|
||||
* - 传送延时
|
||||
*/
|
||||
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()));
|
||||
List<PotionEffect> pe = new ArrayList<PotionEffect>();
|
||||
pe.add(new PotionEffect(PotionEffectType.SLOW, petime, 255));
|
||||
pe.add(new PotionEffect(PotionEffectType.CONFUSION, petime, 255));
|
||||
player.addPotionEffects(pe);
|
||||
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||
long timeoutmark = System.currentTimeMillis() + delay * 1000;
|
||||
long lrng = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (System.currentTimeMillis() < timeoutmark) {
|
||||
if (player.isOnline()) {
|
||||
EffectUtil.run(player.getLocation(), lrng, Effect.MOBSPAWNER_FLAMES, Effect.PORTAL);
|
||||
}
|
||||
lrng++;
|
||||
try {
|
||||
Thread.sleep(128);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline()) {
|
||||
player.teleport(loc);
|
||||
}
|
||||
}
|
||||
}, delay * 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置最后的地址数据
|
||||
*
|
||||
* @param player
|
||||
* - 玩家
|
||||
* @param loc
|
||||
* - 地点
|
||||
*/
|
||||
public void setLastloc(Player player, Location loc) {
|
||||
lastlocList.put(player, loc);
|
||||
}
|
||||
}
|
@ -1,31 +1,31 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.teleport;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* 玩家传送记录
|
||||
*
|
||||
* @author 蒋天蓓
|
||||
* 2015年8月12日下午2:56:25
|
||||
*
|
||||
*/
|
||||
public class TeleportInfo {
|
||||
protected TeleportType tptype;
|
||||
protected Player target;
|
||||
|
||||
public TeleportInfo(Player target, TeleportType tptype) {
|
||||
this.target = target;
|
||||
this.tptype = tptype;
|
||||
}
|
||||
|
||||
public TeleportType getTptype() {
|
||||
return tptype;
|
||||
}
|
||||
|
||||
public Player getTarget() {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.command.utils.teleport;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* 玩家传送记录
|
||||
*
|
||||
* @author 蒋天蓓
|
||||
* 2015年8月12日下午2:56:25
|
||||
*
|
||||
*/
|
||||
public class TeleportInfo {
|
||||
protected TeleportType tptype;
|
||||
protected Player target;
|
||||
|
||||
public TeleportInfo(Player target, TeleportType tptype) {
|
||||
this.target = target;
|
||||
this.tptype = tptype;
|
||||
}
|
||||
|
||||
public TeleportType getTptype() {
|
||||
return tptype;
|
||||
}
|
||||
|
||||
public Player getTarget() {
|
||||
return target;
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.teleport;
|
||||
|
||||
/**
|
||||
* 传送类型枚举
|
||||
*
|
||||
* @author 蒋天蓓
|
||||
* 2015年8月12日下午2:56:59
|
||||
*
|
||||
*/
|
||||
public enum TeleportType {
|
||||
TPA, TPH
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.command.utils.teleport;
|
||||
|
||||
/**
|
||||
* 传送类型枚举
|
||||
*
|
||||
* @author 蒋天蓓
|
||||
* 2015年8月12日下午2:56:59
|
||||
*
|
||||
*/
|
||||
public enum TeleportType {
|
||||
TPA, TPH
|
||||
}
|
@ -1,35 +1,35 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.listen;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||
|
||||
/**
|
||||
* 玩家传送点记录监听
|
||||
*
|
||||
* @author 蒋天蓓
|
||||
* 2015年8月12日下午8:19:33
|
||||
*
|
||||
*/
|
||||
public class PlayerLocationListen implements Listener {
|
||||
SimpleEssential plugin;
|
||||
|
||||
public PlayerLocationListen(SimpleEssential main) {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerDeath(PlayerDeathEvent e) {
|
||||
Player player = e.getEntity();
|
||||
Location loc = player.getLocation();
|
||||
plugin.tpcontrol.setLastloc(player, loc);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package cn.citycraft.SimpleEssential.listeners;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
|
||||
import cn.citycraft.SimpleEssential.SimpleEssential;
|
||||
|
||||
/**
|
||||
* 玩家传送点记录监听
|
||||
*
|
||||
* @author 蒋天蓓
|
||||
* 2015年8月12日下午8:19:33
|
||||
*
|
||||
*/
|
||||
public class TeleportDeathBackListener implements Listener {
|
||||
SimpleEssential plugin;
|
||||
|
||||
public TeleportDeathBackListener(SimpleEssential main) {
|
||||
this.plugin = main;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerDeath(PlayerDeathEvent e) {
|
||||
Player player = e.getEntity();
|
||||
Location loc = player.getLocation();
|
||||
plugin.tpcontrol.setLastloc(player, loc);
|
||||
}
|
||||
}
|
@ -23,4 +23,11 @@ Teleport:
|
||||
tphere: '§b玩家: %s§b请求你传送到他那里!'
|
||||
tpaccept: '§a输入命令/tpaccept 或 /tpok 接受传送'
|
||||
tpdeny: '§c输入命令/tpdeny 或 /tpno 拒绝传送'
|
||||
nobackloc: '§c未找到可以Back的地点!'
|
||||
nobackloc: '§c未找到可以Back的地点!'
|
||||
#自杀
|
||||
Suicide:
|
||||
suicide: '玩家 %s 自刎了!'
|
||||
#帽子
|
||||
Hat:
|
||||
empty: '§c看上去你手上什么都没有啊!'
|
||||
enjoy: '§2享受你的新帽子吧!'
|
@ -63,6 +63,12 @@ commands:
|
||||
usage: §b使用/suicide结束自己的生命!
|
||||
permission: se.suicide
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
hat:
|
||||
description: 戴上手中的物品到脑袋上
|
||||
aliases: [sehat]
|
||||
usage: §b使用/hat戴上一款亮闪闪的帽子!
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user