Skip to content

Commit

Permalink
[1.2.1] 版本更新
Browse files Browse the repository at this point in the history
- [A] 添加重载指令。
- [U] 令方块安全检测更加宽松。
- [F] 修复非玩家离开游戏情况下数据不保存的问题。
  • Loading branch information
CarmJos committed Feb 18, 2022
1 parent 3b3e678 commit b8d2d06
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>cc.carm.plugin</groupId>
<artifactId>moeteleport</artifactId>
<version>2.0.0</version>
<version>1.2.1</version>

<name>MoeTeleport</name>
<description>喵喵传送,简单的传送、设置家的插件。</description>
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/cc/carm/plugin/moeteleport/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import cc.carm.plugin.moeteleport.listener.UserListener;
import cc.carm.plugin.moeteleport.manager.ConfigManager;
import cc.carm.plugin.moeteleport.manager.RequestManager;
import cc.carm.plugin.moeteleport.manager.TeleportManager;
import cc.carm.plugin.moeteleport.manager.UserManager;
import cc.carm.plugin.moeteleport.model.UserData;
import cc.carm.plugin.moeteleport.util.ColorParser;
Expand All @@ -32,7 +31,6 @@ public class Main extends JavaPlugin {
public static boolean debugMode = true;
private static Main instance;
private UserManager userManager;
private TeleportManager teleportManager;
private RequestManager requestManager;

/**
Expand Down Expand Up @@ -132,8 +130,13 @@ public void onDisable() {
log(getName() + " " + getDescription().getVersion() + " 开始卸载...");
long startTime = System.currentTimeMillis();

log("关闭所有请求...");
getRequestManager().shutdown();

log("保存用户数据...");
getUserManager().getUserDataMap().values().forEach(UserData::save);
getUserManager().getUserDataMap().clear();

log("卸载监听器...");
Bukkit.getServicesManager().unregisterAll(this);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cc.carm.plugin.moeteleport.command;

import cc.carm.plugin.moeteleport.manager.ConfigManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class MoeTeleportCommand implements CommandExecutor {

@Override
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command,
@NotNull String s, @NotNull String[] args) {
if (args[0].equalsIgnoreCase("reload")) {
commandSender.sendMessage("Reloading config...");
ConfigManager.reload();
commandSender.sendMessage("Config reloaded.");
return true;
}
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public static boolean isSafeLocation(Location location) {
return false; // not transparent (will suffocate)
}
Block ground = leg.getRelative(BlockFace.DOWN);
return ground.getType().isSolid()
&& !PluginConfig.DANGEROUS_TYPES.get().contains(ground.getType().name());
return !PluginConfig.DANGEROUS_TYPES.get().contains(ground.getType().name());
}


Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ not-online:
- "&f目标玩家并不在线,无法发送请求。"
tpa:
- "&d%(player) &f请求传送到您身边,您有 &5%(expire)秒 &f的时间回应。"
- "&a&l[同意] &f输入 &5/tpaccept &f同意该请求。"
- "&c&l[拒绝] &f输入 &5/tpdeny &f拒绝该请求。"
- "&a&l[command=/tpAccept %(player)][同意][/command] &f输入 &5/tpaccept &f同意该请求。"
- "&c&l[command=/tpDeny %(player)][拒绝][/command] &f输入 &5/tpdeny &f拒绝该请求。"
tpahere:
- "&d%(player) &f请求传送您到Ta身边,您有 &5%(expire)秒 &f的时间回应。"
- "&a&l[同意] &f输入 &5/tpaccept &f同意该请求。"
- "&c&l[拒绝] &f输入 &5/tpdeny &f拒绝该请求。"
- "&a&l[command=/tpAccept %(player)][同意][/command] &f输入 &5/tpaccept &f同意该请求。"
- "&c&l[command=/tpDeny %(player)][拒绝][/command] &f输入 &5/tpdeny &f拒绝该请求。"
tpaccept:
- "&f您同意了 &d%(player) &f的传送请求。"
tpdeny:
Expand All @@ -38,7 +38,7 @@ no-request-player:
- "&f您当前没有收到来自 &d%(player) &f的传送请求。"
multi-requests:
- "&f您当前有&d%(num)条请求&f待处理,请输入 &5/%(command) <玩家名> &f决定回应谁的请求。"
- "&f您也可以再次输入 &5/%(command) &f直接回应最近的一条请求"
- "&f您也可以再次输入 &5/%(command) &f快速回应最近的一条请求"
request-sent-timeout:
- "&f发往 &d%(player) &f的传送请求已超时。"
request-received-timeout:
Expand All @@ -48,13 +48,13 @@ teleporting:
dangerous:
- "&f目标地点不安全,传送被取消。"
dangerous-here:
- "&f当前地点不安全,无法发送传送请求"
- "&f当前地点不安全,传送被取消"
notAvailable:
- "&f目标地点暂时无法前往,传送被取消。"

home-list-header:
- "&f您当前设定的所有家:"
home-list-object: "&8#&f%(id) &d%(location)"
home-list-object: "&8# &f%(id) &d%(location) &7[command=/home %(id)]✈[/command]"
home-not-found:
- "&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!"
home-set:
Expand Down
9 changes: 9 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ permissions:
description: "插件的主权限节点"
default: false

"MoeTeleport.admin":
description: "插件的管理员权限节点"
default: op

commands:
"MoeTeleport":
description: "插件的主命令,用于重载插件或查看插件信息。"
permission: "MoeTeleport.admin"
usage: "/MoeTeleport reload"

"back":
description: 返回传送前的上一个地点。

Expand Down

0 comments on commit b8d2d06

Please sign in to comment.