diff --git a/pom.xml b/pom.xml
index b78d9c3..b5a4cef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
cc.carm.plugin
moeteleport
- 1.0.1
+ 1.0.2
MoeTeleport
喵喵传送,简单的传送、设置家的插件。
diff --git a/src/main/java/cc/carm/plugin/moeteleport/Main.java b/src/main/java/cc/carm/plugin/moeteleport/Main.java
index 3f20828..2ffe4d7 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/Main.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/Main.java
@@ -4,8 +4,12 @@
import cc.carm.plugin.moeteleport.command.completer.HomeNameCompleter;
import cc.carm.plugin.moeteleport.command.completer.PlayerNameCompleter;
import cc.carm.plugin.moeteleport.command.completer.TpRequestCompleter;
-import cc.carm.plugin.moeteleport.command.home.*;
-import cc.carm.plugin.moeteleport.command.tpa.*;
+import cc.carm.plugin.moeteleport.command.home.DelHomeCommand;
+import cc.carm.plugin.moeteleport.command.home.GoHomeCommand;
+import cc.carm.plugin.moeteleport.command.home.ListHomeCommand;
+import cc.carm.plugin.moeteleport.command.home.SetHomeCommand;
+import cc.carm.plugin.moeteleport.command.tpa.TpHandleCommand;
+import cc.carm.plugin.moeteleport.command.tpa.TpaCommand;
import cc.carm.plugin.moeteleport.listener.UserListener;
import cc.carm.plugin.moeteleport.manager.ConfigManager;
import cc.carm.plugin.moeteleport.manager.RequestManager;
@@ -57,9 +61,9 @@ public void onEnable() {
registerCommand("listHome", new ListHomeCommand());
registerCommand("tpa", new TpaCommand(), new PlayerNameCompleter());
- registerCommand("tpaHere", new TpaHereCommand(), new PlayerNameCompleter());
- registerCommand("tpAccept", new TpAcceptCommand(), new TpRequestCompleter());
- registerCommand("tpDeny", new TpDenyCommand(), new TpRequestCompleter());
+ registerCommand("tpaHere", new TpaCommand(), new PlayerNameCompleter());
+ registerCommand("tpAccept", new TpHandleCommand(), new TpRequestCompleter());
+ registerCommand("tpDeny", new TpHandleCommand(), new TpRequestCompleter());
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/BackCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/BackCommand.java
index 78afc31..267db72 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/command/BackCommand.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/command/BackCommand.java
@@ -21,13 +21,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
PluginMessages.NO_LAST_LOCATION.send(player);
return true;
}
- if (!TeleportManager.isSafeLocation(data.getLastLocation())) {
- PluginMessages.DANGEROUS.send(player);
- return true;
- }
-
- TeleportManager.teleport(player, data.getLastLocation());
-
+ TeleportManager.teleport(player, data.getLastLocation(), false);
return true;
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/home/DelHomeCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/home/DelHomeCommand.java
index de9e51e..1bad477 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/command/home/DelHomeCommand.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/command/home/DelHomeCommand.java
@@ -29,7 +29,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
} else {
PluginMessages.Home.REMOVED.sendWithPlaceholders(player,
new String[]{"%(name)", "%(location)"},
- new Object[]{locationInfo.getKey(), locationInfo.getValue().toString()});
+ new Object[]{locationInfo.getKey(), locationInfo.getValue().toFlatString()});
data.delHomeLocation(homeName);
}
return true;
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/home/GoHomeCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/home/GoHomeCommand.java
index 6559174..b83b906 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/command/home/GoHomeCommand.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/command/home/GoHomeCommand.java
@@ -26,7 +26,7 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
if (locationInfo == null) {
PluginMessages.Home.NOT_FOUND.sendWithPlaceholders(player);
} else {
- TeleportManager.teleport(player, locationInfo.getValue());
+ TeleportManager.teleport(player, locationInfo.getValue(), false);
}
return true;
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/home/ListHomeCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/home/ListHomeCommand.java
index 27a8480..a22511b 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/command/home/ListHomeCommand.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/command/home/ListHomeCommand.java
@@ -20,8 +20,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
PluginMessages.Home.HEADER.sendWithPlaceholders(player);
data.getHomeLocations().forEach((name, loc) -> PluginMessages.Home.LIST_OBJECT
.sendWithPlaceholders(player,
- new String[]{"%(name)", "%(location)"},
- new Object[]{name, loc.toString()}
+ new String[]{"%(id)", "%(location)"},
+ new Object[]{name, loc.toFlatString()}
));
return true;
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpDenyCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpDenyCommand.java
deleted file mode 100644
index 9880c03..0000000
--- a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpDenyCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package cc.carm.plugin.moeteleport.command.tpa;
-
-import cc.carm.plugin.moeteleport.Main;
-import cc.carm.plugin.moeteleport.configuration.PluginMessages;
-import cc.carm.plugin.moeteleport.model.TeleportRequest;
-import cc.carm.plugin.moeteleport.model.UserData;
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Comparator;
-
-public class TpDenyCommand implements CommandExecutor {
-
- @Override
- public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
- if (!(sender instanceof Player)) return false;
- Player player = (Player) sender;
- UserData data = Main.getUserManager().getData(player);
- if (data.getReceivedRequests().isEmpty()) {
- PluginMessages.Request.NOT_FOUND.sendWithPlaceholders(player);
- return true;
- }
- String targetName = args.length > 0 ? args[0] : null;
- if (targetName != null) {
- Player target = Bukkit.getPlayer(targetName);
- if (target == null || !data.getReceivedRequests().containsKey(target.getUniqueId())) {
- PluginMessages.Request.NOT_FOUND_PLAYER.sendWithPlaceholders(player,
- new String[]{"%(player)"},
- new Object[]{target == null ? targetName : target.getName()}
- );
- } else {
- TeleportRequest request = data.getReceivedRequests().get(target.getUniqueId());
- Main.getRequestManager().denyRequest(request); // 交给Manager处理
- }
- } else {
- data.getReceivedRequests().values().stream()
- .min(Comparator.comparingLong(TeleportRequest::getActiveTime))
- .ifPresent(request -> Main.getRequestManager().denyRequest(request));
- }
- return true;
- }
-
-}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpAcceptCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpHandleCommand.java
similarity index 56%
rename from src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpAcceptCommand.java
rename to src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpHandleCommand.java
index 1b5327d..2e37796 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpAcceptCommand.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpHandleCommand.java
@@ -13,10 +13,11 @@
import java.util.Comparator;
-public class TpAcceptCommand implements CommandExecutor {
+public class TpHandleCommand implements CommandExecutor {
@Override
- public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
+ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
+ @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) return false;
Player player = (Player) sender;
UserData data = Main.getUserManager().getData(player);
@@ -25,6 +26,8 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
return true;
}
String targetName = args.length > 0 ? args[0] : null;
+ boolean accept = command.getName().equalsIgnoreCase("tpAccept");
+ data.setEnableAutoSelect(false);
if (targetName != null) {
Player target = Bukkit.getPlayer(targetName);
if (target == null || !data.getReceivedRequests().containsKey(target.getUniqueId())) {
@@ -33,15 +36,30 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
new Object[]{target == null ? targetName : target.getName()}
);
} else {
- TeleportRequest request = data.getReceivedRequests().get(target.getUniqueId());
- Main.getRequestManager().acceptRequest(request); // 交给Manager处理
+ handle(data.getReceivedRequests().get(target.getUniqueId()), accept); // 交给Manager处理
}
} else {
- data.getReceivedRequests().values().stream()
- .min(Comparator.comparingLong(TeleportRequest::getActiveTime))
- .ifPresent(request -> Main.getRequestManager().acceptRequest(request));
+ if (data.getReceivedRequests().size() == 1 || data.isEnableAutoSelect()) {
+ data.getReceivedRequests().values().stream()
+ .min(Comparator.comparingLong(TeleportRequest::getActiveTime))
+ .ifPresent(request -> handle(request, accept));
+ } else {
+ PluginMessages.Request.MULTI.sendWithPlaceholders(player,
+ new String[]{"%(num)", "%(command)"},
+ new Object[]{data.getReceivedRequests().size(), command.getName()}
+ );
+ data.setEnableAutoSelect(true);
+ }
}
return true;
}
+ private void handle(TeleportRequest request, boolean accept) {
+ if (accept) {
+ Main.getRequestManager().acceptRequest(request);
+ } else {
+ Main.getRequestManager().denyRequest(request);
+ }
+ }
+
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaCommand.java
index 965bcdf..2b0d646 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaCommand.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaCommand.java
@@ -13,7 +13,8 @@
public class TpaCommand implements CommandExecutor {
@Override
- public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
+ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
+ @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player) || args.length < 1) return false;
Player player = (Player) sender;
Player target = Bukkit.getPlayer(args[0]);
@@ -21,7 +22,21 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
PluginMessages.NOT_ONLINE.sendWithPlaceholders(player);
return true;
}
- Main.getRequestManager().sendRequest(player, target, TeleportRequest.RequestType.TPA);
+
+ TeleportRequest request = Main.getUserManager().getData(target).getReceivedRequests().get(player.getUniqueId());
+ if (request != null) {
+ PluginMessages.Request.DUPLICATE.sendWithPlaceholders(sender,
+ new String[]{"%(player)", "%(expire)"},
+ new Object[]{target.getName(), request.getRemainSeconds()}
+ );
+ return true;
+ }
+ if (command.getName().equalsIgnoreCase("tpa")) {
+ Main.getRequestManager().sendRequest(player, target, TeleportRequest.RequestType.TPA);
+ } else {
+ Main.getRequestManager().sendRequest(player, target, TeleportRequest.RequestType.TPA_HERE);
+ }
+
return true;
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaHereCommand.java b/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaHereCommand.java
deleted file mode 100644
index da42a03..0000000
--- a/src/main/java/cc/carm/plugin/moeteleport/command/tpa/TpaHereCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package cc.carm.plugin.moeteleport.command.tpa;
-
-import cc.carm.plugin.moeteleport.Main;
-import cc.carm.plugin.moeteleport.configuration.PluginMessages;
-import cc.carm.plugin.moeteleport.model.TeleportRequest;
-import org.bukkit.Bukkit;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
-
-public class TpaHereCommand implements CommandExecutor {
-
- @Override
- public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
- if (!(sender instanceof Player) || args.length < 1) return false;
- Player player = (Player) sender;
- Player target = Bukkit.getPlayer(args[0]);
- if (target == null) {
- PluginMessages.NOT_ONLINE.sendWithPlaceholders(player);
- return true;
- }
- Main.getRequestManager().sendRequest(player, target, TeleportRequest.RequestType.TPA_HERE);
- return true;
- }
-
-}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginMessages.java b/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginMessages.java
index c933281..287c051 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginMessages.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/configuration/PluginMessages.java
@@ -25,6 +25,7 @@ public class PluginMessages {
public static final ConfigMessageList NOT_AVAILABLE = new ConfigMessageList("notAvailable");
public static class Request {
+ public static final ConfigMessageList DUPLICATE = new ConfigMessageList("request-duplicate");
public static final ConfigMessageList OFFLINE = new ConfigMessageList("offline");
public static final ConfigMessageList SENT = new ConfigMessageList("request-sent");
diff --git a/src/main/java/cc/carm/plugin/moeteleport/configuration/location/DataLocation.java b/src/main/java/cc/carm/plugin/moeteleport/configuration/location/DataLocation.java
index 4deef7f..3a49fea 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/configuration/location/DataLocation.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/configuration/location/DataLocation.java
@@ -8,10 +8,12 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.text.DecimalFormat;
import java.util.Objects;
public class DataLocation implements Cloneable {
+ public static final DecimalFormat format = new DecimalFormat("0.00");
private String worldName;
private double x;
private double y;
@@ -97,8 +99,8 @@ public Object clone() {
try {
return super.clone();
} catch (Exception ex) {
+ return null;
}
- return null;
}
@Override
@@ -124,6 +126,10 @@ public String toString() {
return worldName + " " + x + " " + y + " " + z + " " + yaw + " " + pitch;
}
+ public String toFlatString() {
+ return worldName + "@" + format.format(x) + ", " + format.format(y) + ", " + format.format(z);
+ }
+
@Deprecated
public String toSerializedString() {
return serializeToText();
diff --git a/src/main/java/cc/carm/plugin/moeteleport/manager/RequestManager.java b/src/main/java/cc/carm/plugin/moeteleport/manager/RequestManager.java
index 72f25e2..a6a58c6 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/manager/RequestManager.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/manager/RequestManager.java
@@ -42,7 +42,10 @@ public void checkRequests() {
.peek(entry -> PluginMessages.Request.RECEIVED_TIMEOUT.sendWithPlaceholders(
entry.getValue().getReceiver(), new String[]{"%(player)"},
new Object[]{entry.getValue().getSender().getName()}))
- .forEach(entry -> data.getSentRequests().remove(entry.getKey()))
+ .peek(entry -> Main.getUserManager()
+ .getData(entry.getValue().getSender()).getSentRequests()
+ .remove(entry.getKey()))
+ .forEach(entry -> data.getReceivedRequests().remove(entry.getKey()))
);
}
@@ -51,8 +54,9 @@ public void sendRequest(Player sender, Player receiver, TeleportRequest.RequestT
PluginMessages.Request.SENT.sendWithPlaceholders(sender,
new String[]{"%(player)", "%(expire)"},
- new Object[]{receiver, expireTime}
+ new Object[]{receiver.getName(), expireTime}
);
+
switch (type) {
case TPA: {
PluginMessages.TPA.sendWithPlaceholders(receiver,
@@ -85,7 +89,7 @@ public void acceptRequest(TeleportRequest request) {
new String[]{"%(player)"},
new Object[]{request.getSender().getName()}
);
- TeleportManager.teleport(request.getTeleportPlayer(), request.getTeleportLocation());
+ TeleportManager.teleport(request.getTeleportPlayer(), request.getTeleportLocation(), true);
removeRequests(request);
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java b/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java
index 725e97b..c011da5 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java
@@ -1,5 +1,6 @@
package cc.carm.plugin.moeteleport.manager;
+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.configuration.location.DataLocation;
@@ -10,29 +11,34 @@
public class TeleportManager {
- public static void teleport(Player player, DataLocation targetLocation) {
+ public static void teleport(Player player, DataLocation targetLocation, boolean onlySafety) {
Location location = targetLocation.getBukkitLocation();
if (location == null) {
PluginMessages.NOT_AVAILABLE.sendWithPlaceholders(player,
new String[]{"%(location)"},
- new Object[]{targetLocation.toString()}
+ new Object[]{targetLocation.toFlatString()}
);
} else {
- teleport(player, location);
+ teleport(player, location, onlySafety);
}
}
- public static void teleport(Player player, Location targetLocation) {
+ public static void teleport(Player player, Location targetLocation, boolean onlySafety) {
if (targetLocation.isWorldLoaded()) {
- player.teleport(targetLocation);
- PluginMessages.TELEPORTING.sendWithPlaceholders(player,
- new String[]{"%(location)"},
- new Object[]{new DataLocation(targetLocation).toString()}
- );
+ if (!onlySafety || TeleportManager.isSafeLocation(targetLocation)) {
+ Main.getUserManager().getData(player).setLastLocation(player.getLocation());
+ player.teleport(targetLocation);
+ PluginMessages.TELEPORTING.sendWithPlaceholders(player,
+ new String[]{"%(location)"},
+ new Object[]{new DataLocation(targetLocation).toFlatString()}
+ );
+ } else {
+ PluginMessages.DANGEROUS.send(player);
+ }
} else {
PluginMessages.NOT_AVAILABLE.sendWithPlaceholders(player,
new String[]{"%(location)"},
- new Object[]{new DataLocation(targetLocation).toString()}
+ new Object[]{new DataLocation(targetLocation).toFlatString()}
);
}
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/model/TeleportRequest.java b/src/main/java/cc/carm/plugin/moeteleport/model/TeleportRequest.java
index e05c4fb..7916fc8 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/model/TeleportRequest.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/model/TeleportRequest.java
@@ -1,8 +1,6 @@
package cc.carm.plugin.moeteleport.model;
import cc.carm.plugin.moeteleport.configuration.PluginConfig;
-import cc.carm.plugin.moeteleport.configuration.PluginMessages;
-import cc.carm.plugin.moeteleport.manager.TeleportManager;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
@@ -52,25 +50,16 @@ public long getActiveTime() {
return System.currentTimeMillis() - getCreateTime();
}
+ public long getRemainTime() {
+ return PluginConfig.EXPIRE_TIME.get() * 1000 - getActiveTime();
+ }
- /**
- * 尝试对玩家进行传送
- *
- * @return 是否传送成功
- */
- public boolean tryTeleport(@NotNull Location location) {
- if (!location.isWorldLoaded()) return false;
- if (!TeleportManager.isSafeLocation(location)) {
- PluginMessages.DANGEROUS.sendWithPlaceholders(getTeleportPlayer());
- return false;
- } else {
- TeleportManager.teleport(getTeleportPlayer(), location);
- return true;
- }
+ public long getRemainSeconds() {
+ return getRemainTime() / 1000;
}
public boolean isExpired() {
- return getActiveTime() > PluginConfig.EXPIRE_TIME.get() * 10000;
+ return getActiveTime() > PluginConfig.EXPIRE_TIME.get() * 1000;
}
public enum RequestType {
diff --git a/src/main/java/cc/carm/plugin/moeteleport/model/UserData.java b/src/main/java/cc/carm/plugin/moeteleport/model/UserData.java
index 6eb984e..d5f4a5b 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/model/UserData.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/model/UserData.java
@@ -1,12 +1,10 @@
package cc.carm.plugin.moeteleport.model;
import cc.carm.plugin.moeteleport.Main;
-import cc.carm.plugin.moeteleport.configuration.PluginConfig;
import cc.carm.plugin.moeteleport.configuration.location.DataLocation;
import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -24,8 +22,10 @@ public class UserData {
private LinkedHashMap homeLocations;
- private HashSet sentRequests; // 记录发出的请求
- private ConcurrentHashMap receivedRequests; // 记录收到的传送请求
+ private final HashSet sentRequests = new HashSet<>(); // 记录发出的请求
+ private final ConcurrentHashMap receivedRequests = new ConcurrentHashMap<>(); // 记录收到的传送请求
+
+ public boolean enableAutoSelect = false;
public UserData(@NotNull File dataFolder, @NotNull UUID uuid) {
this(new File(dataFolder, uuid + ".yml"));
@@ -88,12 +88,8 @@ public Map.Entry getHomeLocation(@Nullable String homeName
return lastLocation;
}
- public boolean backToLocation(Player player) {
- if (getLastLocation() == null) return false;
- else {
- player.teleport(getLastLocation());
- return true;
- }
+ public void setLastLocation(@Nullable Location lastLocation) {
+ this.lastLocation = lastLocation;
}
public HashSet getSentRequests() {
@@ -104,7 +100,13 @@ public ConcurrentHashMap getReceivedRequests() {
return receivedRequests;
}
+ public void setEnableAutoSelect(boolean enableAutoSelect) {
+ this.enableAutoSelect = enableAutoSelect;
+ }
+ public boolean isEnableAutoSelect() {
+ return enableAutoSelect;
+ }
public @NotNull File getDataFile() {
return dataFile;
diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml
index 2621da2..3dd0110 100644
--- a/src/main/resources/messages.yml
+++ b/src/main/resources/messages.yml
@@ -4,39 +4,41 @@ no-last-location:
not-online:
- "&f目标玩家并不在线,无法发送请求。"
tpa:
- - "&6%(player) &f请求传送到您身边,您有%(expire)秒的时间回应。"
- - "&a&l[同意] &f输入 &e/tpaccept &f同意该请求。"
- - "&c&l[拒绝] &f输入 &e/tpdeny &f拒绝该请求。"
+ - "&d%(player) &f请求传送到您身边,您有 &5%(expire)秒 &f的时间回应。"
+ - "&a&l[同意] &f输入 &5/tpaccept &f同意该请求。"
+ - "&c&l[拒绝] &f输入 &5/tpdeny &f拒绝该请求。"
tpahere:
- - "&6%(player) &f请求传送您到Ta身边,您有%(expire)秒的时间回应。"
- - "&a&l[同意] &f输入 &e/tpaccept &f同意该请求。"
- - "&c&l[拒绝] &f输入 &e/tpdeny &f拒绝该请求。"
+ - "&d%(player) &f请求传送您到Ta身边,您有 &5%(expire)秒 &f的时间回应。"
+ - "&a&l[同意] &f输入 &5/tpaccept &f同意该请求。"
+ - "&c&l[拒绝] &f输入 &5/tpdeny &f拒绝该请求。"
tpaccept:
- - "&f您同意了 &6%(player) &f的传送请求。"
+ - "&f您同意了 &d%(player) &f的传送请求。"
tpdeny:
- - "&f您&c拒绝&f了 &6%(player) &f的传送请求。"
+ - "&f您&d拒绝&f了 &d%(player) &f的传送请求。"
accepted:
- - "&6%(player) &f同意了您的传送请求。"
+ - "&d%(player) &f同意了您的传送请求。"
denied:
- - "&6%(player) &c拒绝&f了您的传送请求。"
+ - "&d%(player) &f拒绝了您的传送请求。"
offline:
- - "&6%(player) &f离线,相关请求已自动取消。"
+ - "&d%(player) &f离线,相关请求已自动取消。"
+request-duplicate:
+ - "&f您已经向 &d%(player) &f发送过传送请求,对方仍有 &5%(expire)秒 &f的时间回应该请求。"
request-sent:
- - "&f成功向玩家 &6%(player) 发送传送请求,对方有%(expire)秒的时间回应该请求。"
+ - "&f成功向玩家 &d%(player) &f发送传送请求,对方有 &5%(expire)秒 &f的时间回应该请求。"
no-request:
- "&f您当前没有任何待处理的传送请求。"
no-request-player:
- - "&f您当前没有收到来自 &6%(player) &f的传送请求。"
+ - "&f您当前没有收到来自 &d%(player) &f的传送请求。"
multi-requests:
- - "&f您当前有条请求待处理,请输入 &6%(command) <玩家名> &f决定回应谁的请求。"
- - "&f您也可以再次输入 &6%(command) &f直接回应最近的一条请求。"
+ - "&f您当前有&d%(num)条请求&f待处理,请输入 &5/%(command) <玩家名> &f决定回应谁的请求。"
+ - "&f您也可以再次输入 &5/%(command) &f直接回应最近的一条请求。"
request-sent-timeout:
- - "&f发往 &6%(player) &f的传送请求已超时。"
+ - "&f发往 &d%(player) &f的传送请求已超时。"
request-received-timeout:
- - "&f来自 &6%(player) &f的传送请求已超时。"
+ - "&f来自 &d%(player) &f的传送请求已超时。"
teleporting:
- - "&f正在传送到 &6%(location) &f..."
+ - "&f正在传送到 &d%(location) &f..."
dangerous:
- "&f目标地点不安全,传送被取消。"
dangerous-here:
@@ -46,15 +48,15 @@ notAvailable:
home-list-header:
- "&f您当前设定的所有家:"
-home-list-object: "&8#&f%(id) &6%(location)"
+home-list-object: "&8#&f%(id) &d%(location)"
home-not-found:
- - "&f您还没有设置这个家,请先输入 &e/setHome <家名称> &f设置一个吧!"
+ - "&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!"
home-set:
- - "&f成功设定名为 &6%(name) &f的家传送点。"
+ - "&f成功设定名为 &d%(name) &f的家传送点。"
home-removed:
- - "&f成功移除名为 &6%(name) &f的家传送点。"
+ - "&f成功移除名为 &d%(name) &f的家传送点。"
- "&7原先位置为 &f%(location) &7。"
home-over-limit:
- - "&f您最多只能设置 &6%(max) &f个家传送点!"
- - "&7可以输入 &e/delHome <家名称> &7删除之前的家传送点,"
- - "&7或输入 &e/setHome <家名称> &7覆盖之前的家传送点。"
\ No newline at end of file
+ - "&f您最多只能设置 &d%(max) &f个家传送点!"
+ - "&7可以输入 &5/delHome <家名称> &7删除之前的家传送点,"
+ - "&7或输入 &5/setHome <家名称> &7覆盖之前的家传送点。"
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 0d808eb..5b83806 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -23,10 +23,10 @@ commands:
"tpaHere":
usage: "/tpaHere <玩家>"
description: 请求一个玩家传送到自己身边。
- "tpaAccept":
+ "tpAccept":
usage: "/tpAccept [玩家]"
description: 同意一个请求,可以限定某个玩家。
- "tpaDeny":
+ "tpDeny":
usage: "/tpDeny [玩家]"
description: 拒绝一个请求,可以限定某个玩家。