1
mirror of https://github.com/CarmJos/MoeTeleport.git synced 2024-09-19 21:35:56 +00:00

1.0.4 版本更新

- [A] 添加返回死亡地点的功能。
- [A] 添加返回死亡地点的功能的开关配置。
- [U] 修改了`config.yml`中`dangerousBlocks` 的名称为 `dangerous-blocks`
This commit is contained in:
Carm Jos 2021-12-17 13:49:32 +08:00
parent 4da69909e3
commit d71a3ab6cd
6 changed files with 34 additions and 6 deletions

View File

@ -13,7 +13,7 @@
<groupId>cc.carm.plugin</groupId>
<artifactId>moeteleport</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>MoeTeleport</name>
<description>喵喵传送,简单的传送、设置家的插件。</description>

View File

@ -11,14 +11,19 @@ public class PluginConfig {
);
public static final ConfigValueList<String> DANGEROUS_TYPES = new ConfigValueList<>(
"dangerousBlocks", String.class, new String[]{"LAVA"}
"dangerous-blocks", String.class, new String[]{"LAVA"}
);
public static final ConfigValue<Integer> EXPIRE_TIME = new ConfigValue<>(
"expireTime", Integer.class, 30
);
public static final ConfigValue<Integer> DEFAULT_HOME = new ConfigValue<>(
"defaultHome", Integer.class, 1
);
public static final ConfigValue<Boolean> DEATH_GO_BACK = new ConfigValue<>(
"death-back", Boolean.class, true
);
}

View File

@ -24,6 +24,8 @@ public class PluginMessages {
public static final ConfigMessageList NOT_AVAILABLE = new ConfigMessageList("notAvailable");
public static final ConfigMessageList DEATH_BACK = new ConfigMessageList("death-back");
public static class Request {
public static final ConfigMessageList DUPLICATE = new ConfigMessageList("request-duplicate");
public static final ConfigMessageList OFFLINE = new ConfigMessageList("offline");

View File

@ -1,10 +1,13 @@
package cc.carm.plugin.moeteleport.listener;
import cc.carm.plugin.moeteleport.Main;
import cc.carm.plugin.moeteleport.configuration.PluginConfig;
import cc.carm.plugin.moeteleport.configuration.PluginMessages;
import cc.carm.plugin.moeteleport.model.UserData;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -20,11 +23,20 @@ public class UserListener implements Listener {
}
@EventHandler
public void onQuit(PlayerQuitEvent event) {
public void onDeath(PlayerQuitEvent event) {
Player player = event.getPlayer();
Main.getRequestManager().cancelAllRequests(player);
Main.getUserManager().getData(player).save(); //保存
Main.getUserManager().getUserDataMap().remove(player.getUniqueId());
}
@EventHandler
public void onDeath(PlayerDeathEvent event) {
if (PluginConfig.DEATH_GO_BACK.get()) {
Player player = event.getEntity();
Main.getUserManager().getData(player).setLastLocation(player.getLocation());
PluginMessages.DEATH_BACK.send(player);
}
}
}

View File

@ -4,14 +4,17 @@ defaultHome: 1
permissions:
# 以下命令全部为 MoeTeleport 的子节点
# 如 "home.1" 的权限全拼就是 "MoeTeleport.home.1"
"home.1": 1 # 代表最多可以设置一个家
# 如 "home.vip" 的权限全拼就是 "MoeTeleport.home.vip"
"home.vip": 10 # 最多可以设置10个家
# 传送请求过期时间
expireTime: 30
# 返回死亡点
# 开启后将允许玩家输入 /back 返回死亡地点。
death-back: true
# 危险的方块类型,将判断目的地脚下的方块的类型是否在这个列表中
dangerousBlocks:
dangerous-blocks:
- LAVA
- AIR

View File

@ -1,6 +1,9 @@
no-last-location:
- "&f您当前没有进行传送无法返回上个地点。"
death-back:
- "&f您可以输入 &5/back &f返回您的死亡地点。"
not-online:
- "&f目标玩家并不在线无法发送请求。"
tpa:
@ -19,6 +22,9 @@ accepted:
- "&d%(player) &f同意了您的传送请求。"
denied:
- "&d%(player) &f拒绝了您的传送请求。"
offline:
- "&d%(player) &f离线相关请求已自动取消。"