mirror of
https://github.com/CarmJos/MoeTeleport.git
synced 2026-06-05 00:28:16 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ee18d0f3c | |||
| b311820483 | |||
| b8d2d060dc | |||
| 3b3e678fc7 | |||
| 47dfad862b | |||
| aa723087d4 | |||
| 55a692243d | |||
| 7862a698bd | |||
| 351f9a8590 | |||
| ce3226ee18 | |||
| 5461063263 | |||
| c7b0bf8261 |
@@ -1,7 +1,7 @@
|
||||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||
|
||||
name: Build
|
||||
name: Build & Tests
|
||||
|
||||
on:
|
||||
# 支持手动触发构建
|
||||
@@ -29,10 +29,15 @@ jobs:
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ github.repository_owner }}
|
||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
- name: "Target Stage"
|
||||
run: mkdir staging && cp target/*.jar staging
|
||||
|
||||
- name: "Target Staging"
|
||||
run: |
|
||||
mkdir artifacts
|
||||
cp -vrf target/ artifacts/target/
|
||||
cp -vrf asset/*.jar artifacts
|
||||
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Artifact
|
||||
path: staging
|
||||
path: artifacts
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Release Version
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published # 创建release的时候触发
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: "Set up JDK"
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
# cache: maven
|
||||
server-id: github
|
||||
server-username: MAVEN_USERNAME
|
||||
server-password: MAVEN_TOKEN
|
||||
- name: "Package"
|
||||
run: mvn -B package --file pom.xml -Dmaven.javadoc.skip=true -DskipTests
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ github.repository_owner }}
|
||||
MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
|
||||
- name: "Upload Release Asset"
|
||||
id: upload-release-asset
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }}
|
||||
asset_path: asset/*.jar
|
||||
asset_content_type: application/java-archive
|
||||
@@ -18,6 +18,8 @@
|
||||
## [依赖](https://github.com/CarmJos/MoeTeleport/network/dependencies)
|
||||
|
||||
- **[必须]** 插件本体基于 [Spigot-API](https://hub.spigotmc.org/stash/projects/SPIGOT) 、[BukkitAPI](http://bukkit.org/) 实现。
|
||||
- **[自带]** 消息格式基于 [MineDown](https://github.com/Phoenix616/MineDown) 实现。
|
||||
- 所有 messages.yml 均支持 MineDown 语法。
|
||||
- **[推荐]** 变量部分基于 [PlaceholderAPI](https://www.spigotmc.org/resources/6245/) 实现。
|
||||
|
||||
详细依赖列表可见 [Dependencies](https://github.com/CarmJos/MoeTeleport/network/dependencies) 。
|
||||
@@ -28,6 +30,10 @@
|
||||
- 可选参数 `[参数]`
|
||||
|
||||
```text
|
||||
# /MoeTeleport reload
|
||||
@ 管理指令 (MoeTeleport.admin)
|
||||
- 重载插件配置文件。
|
||||
|
||||
# /back
|
||||
- 返回上一个传送地点
|
||||
|
||||
@@ -41,7 +47,9 @@
|
||||
- 拒绝一个请求,可以限定某个玩家。
|
||||
|
||||
# /home [name]
|
||||
- 返回家 (不填name会返回第一个家,若存在home则优先返回home)
|
||||
- 返回设定的家
|
||||
- 不填name会返回第一个设置的家
|
||||
- 若存在名为“home”的家则优先返回“home”。
|
||||
# /listHome
|
||||
- 列出所有家的位置
|
||||
# /setHome [name]
|
||||
@@ -58,7 +66,9 @@
|
||||
|
||||
### 消息配置文件 ([messages.yml](src/main/resources/messages.yml))
|
||||
|
||||
详见源文件。
|
||||
支持 [MineDown 语法](https://wiki.phoenix616.dev/library:minedown:syntax),详见源文件。
|
||||
|
||||
|
||||
|
||||
### 玩家数据配置文件 (data/\<UUID\>.yml)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<groupId>cc.carm.plugin</groupId>
|
||||
<artifactId>moeteleport</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<version>2.0.0</version>
|
||||
|
||||
<name>MoeTeleport</name>
|
||||
<description>喵喵传送,简单的传送、设置家的插件。</description>
|
||||
@@ -71,6 +71,11 @@
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>minebench-repo</id>
|
||||
<url>https://repo.minebench.de/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>github</id>
|
||||
<name>GitHub Packages</name>
|
||||
@@ -103,6 +108,13 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.themoep</groupId>
|
||||
<artifactId>minedown</artifactId>
|
||||
<version>1.7.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
@@ -161,12 +173,12 @@
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<outputDirectory>${project.basedir}/asset/</outputDirectory>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
@@ -176,6 +188,12 @@
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>de.themoep.minedown</pattern>
|
||||
<shadedPattern>cc.carm.plugin.moeteleport.lib.minedown</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cc.carm.plugin.moeteleport;
|
||||
|
||||
import cc.carm.plugin.moeteleport.command.BackCommand;
|
||||
import cc.carm.plugin.moeteleport.command.MoeTeleportCommand;
|
||||
import cc.carm.plugin.moeteleport.command.completer.HomeNameCompleter;
|
||||
import cc.carm.plugin.moeteleport.command.completer.PlayerNameCompleter;
|
||||
import cc.carm.plugin.moeteleport.command.completer.TpRequestCompleter;
|
||||
@@ -13,13 +14,14 @@ 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;
|
||||
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;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -27,61 +29,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
private static Main instance;
|
||||
public static boolean debugMode = true;
|
||||
|
||||
private static Main instance;
|
||||
private UserManager userManager;
|
||||
private TeleportManager teleportManager;
|
||||
private RequestManager requestManager;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
log(getName() + " " + getDescription().getVersion() + " &7开始加载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
log("加载配置文件...");
|
||||
ConfigManager.initConfig();
|
||||
|
||||
log("加载用户管理器...");
|
||||
this.userManager = new UserManager(this);
|
||||
|
||||
log("加载请求管理器...");
|
||||
this.requestManager = new RequestManager(this);
|
||||
|
||||
log("注册监听器...");
|
||||
regListener(new UserListener());
|
||||
|
||||
log("注册指令...");
|
||||
registerCommand("back", new BackCommand());
|
||||
|
||||
registerCommand("home", new GoHomeCommand(), new HomeNameCompleter());
|
||||
registerCommand("delHome", new DelHomeCommand(), new HomeNameCompleter());
|
||||
registerCommand("setHome", new SetHomeCommand());
|
||||
registerCommand("listHome", new ListHomeCommand());
|
||||
|
||||
registerCommand("tpa", new TpaCommand(), new PlayerNameCompleter());
|
||||
registerCommand("tpaHere", new TpaCommand(), new PlayerNameCompleter());
|
||||
registerCommand("tpAccept", new TpHandleCommand(), new TpRequestCompleter());
|
||||
registerCommand("tpDeny", new TpHandleCommand(), new TpRequestCompleter());
|
||||
|
||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
log(getName() + " " + getDescription().getVersion() + " 开始卸载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
getRequestManager().shutdown();
|
||||
|
||||
log("卸载监听器...");
|
||||
Bukkit.getServicesManager().unregisterAll(this);
|
||||
|
||||
log("卸载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册监听器
|
||||
*
|
||||
@@ -131,4 +83,67 @@ public class Main extends JavaPlugin {
|
||||
return Main.getInstance().requestManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
log(getName() + " " + getDescription().getVersion() + " &7开始加载...");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
log("加载配置文件...");
|
||||
ConfigManager.initConfig();
|
||||
|
||||
log("加载用户管理器...");
|
||||
this.userManager = new UserManager(this);
|
||||
|
||||
if (Bukkit.getOnlinePlayers().size() > 0) {
|
||||
log(" 加载现有用户数据...");
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
UserData data = Main.getUserManager().loadData(player.getUniqueId());
|
||||
Main.getUserManager().getUserDataMap().put(player.getUniqueId(), data);
|
||||
}
|
||||
}
|
||||
|
||||
log("加载请求管理器...");
|
||||
this.requestManager = new RequestManager(this);
|
||||
|
||||
log("注册监听器...");
|
||||
regListener(new UserListener());
|
||||
|
||||
log("注册指令...");
|
||||
registerCommand("MoeTeleport", new MoeTeleportCommand());
|
||||
|
||||
registerCommand("back", new BackCommand());
|
||||
|
||||
registerCommand("home", new GoHomeCommand(), new HomeNameCompleter());
|
||||
registerCommand("delHome", new DelHomeCommand(), new HomeNameCompleter());
|
||||
registerCommand("setHome", new SetHomeCommand());
|
||||
registerCommand("listHome", new ListHomeCommand());
|
||||
|
||||
registerCommand("tpa", new TpaCommand(), new PlayerNameCompleter());
|
||||
registerCommand("tpaHere", new TpaCommand(), new PlayerNameCompleter());
|
||||
registerCommand("tpAccept", new TpHandleCommand(), new TpRequestCompleter());
|
||||
registerCommand("tpDeny", new TpHandleCommand(), new TpRequestCompleter());
|
||||
|
||||
log("加载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
||||
log("卸载完成 ,共耗时 " + (System.currentTimeMillis() - startTime) + " ms 。");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import cc.carm.plugin.moeteleport.configuration.values.ConfigValueMap;
|
||||
|
||||
public class PluginConfig {
|
||||
|
||||
public static final ConfigValueMap<String, Integer> PERMISSIONS = new ConfigValueMap<>(
|
||||
"permissions", s -> s, Integer.class
|
||||
public static final ConfigValueMap<Integer, String> PERMISSIONS = new ConfigValueMap<>(
|
||||
"permissions", Integer::parseInt, String.class
|
||||
);
|
||||
|
||||
public static final ConfigValueList<String> DANGEROUS_TYPES = new ConfigValueList<>(
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Objects;
|
||||
public class DataLocation implements Cloneable {
|
||||
|
||||
public static final DecimalFormat format = new DecimalFormat("0.00");
|
||||
private String worldName;
|
||||
private final String worldName;
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
@@ -38,6 +38,32 @@ public class DataLocation implements Cloneable {
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
public static DataLocation deserializeText(String s) {
|
||||
if (s == null || !s.contains(";")) return null;
|
||||
String[] args = StringUtils.split(s, ";");
|
||||
if (args.length < 4) return null;
|
||||
try {
|
||||
String worldName = args[0];
|
||||
double x = NumberConversions.toDouble(args[1]);
|
||||
double y = NumberConversions.toDouble(args[2]);
|
||||
double z = NumberConversions.toDouble(args[3]);
|
||||
float yaw = 0;
|
||||
float pitch = 0;
|
||||
if (args.length == 6) {
|
||||
yaw = NumberConversions.toFloat(args[4]);
|
||||
pitch = NumberConversions.toFloat(args[5]);
|
||||
}
|
||||
return new DataLocation(worldName, x, y, z, yaw, pitch);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static DataLocation parseString(String s) {
|
||||
return deserializeText(s);
|
||||
}
|
||||
|
||||
public String getWorldName() {
|
||||
return worldName;
|
||||
}
|
||||
@@ -82,12 +108,10 @@ public class DataLocation implements Cloneable {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
|
||||
public @NotNull Location getBukkitLocation(World world) {
|
||||
return new Location(world, getX(), getY(), getZ(), getYaw(), getPitch());
|
||||
}
|
||||
|
||||
|
||||
public @Nullable Location getBukkitLocation() {
|
||||
World world = Bukkit.getWorld(getWorldName());
|
||||
if (world == null) return null;
|
||||
@@ -143,30 +167,4 @@ public class DataLocation implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public static DataLocation deserializeText(String s) {
|
||||
if (s == null || !s.contains(";")) return null;
|
||||
String[] args = StringUtils.split(s, ";");
|
||||
if (args.length < 4) return null;
|
||||
try {
|
||||
String worldName = args[0];
|
||||
double x = NumberConversions.toDouble(args[1]);
|
||||
double y = NumberConversions.toDouble(args[2]);
|
||||
double z = NumberConversions.toDouble(args[3]);
|
||||
float yaw = 0;
|
||||
float pitch = 0;
|
||||
if (args.length == 6) {
|
||||
yaw = NumberConversions.toFloat(args[4]);
|
||||
pitch = NumberConversions.toFloat(args[5]);
|
||||
}
|
||||
return new DataLocation(worldName, x, y, z, yaw, pitch);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static DataLocation parseString(String s) {
|
||||
return deserializeText(s);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -50,13 +49,13 @@ public class ConfigValueMap<K, V> {
|
||||
if (valueCache != null) return valueCache;
|
||||
ConfigurationSection section = getConfiguration().getConfigurationSection(this.configSection);
|
||||
if (section == null) return new LinkedHashMap<>();
|
||||
Set<String> keys = getConfiguration().getKeys(false);
|
||||
Set<String> keys = section.getKeys(false);
|
||||
if (keys.isEmpty()) return new LinkedHashMap<>();
|
||||
else {
|
||||
LinkedHashMap<K, V> result = new LinkedHashMap<>();
|
||||
for (String key : keys) {
|
||||
K finalKey = keyCast.apply(key);
|
||||
Object val = getConfiguration().get(this.configSection);
|
||||
Object val = section.get(key);
|
||||
V finalValue = this.valueClazz.isInstance(val) ? this.valueClazz.cast(val) : null;
|
||||
if (finalKey != null && finalValue != null) {
|
||||
result.put(finalKey, finalValue);
|
||||
@@ -67,7 +66,8 @@ public class ConfigValueMap<K, V> {
|
||||
}
|
||||
}
|
||||
|
||||
public void set(HashMap<K, V> valuesMap) {
|
||||
public void set(LinkedHashMap<K, V> valuesMap) {
|
||||
this.valueCache = valuesMap;
|
||||
getConfiguration().createSection(this.configSection, valuesMap);
|
||||
this.save();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class UserListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(PlayerQuitEvent event) {
|
||||
public void onQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Main.getRequestManager().cancelAllRequests(player);
|
||||
Main.getUserManager().getData(player).save(); //保存
|
||||
|
||||
@@ -53,8 +53,7 @@ public class TeleportManager {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,16 +41,17 @@ public class UserManager {
|
||||
}
|
||||
|
||||
public int getMaxHome(Player player) {
|
||||
Map<String, Integer> permissions = PluginConfig.PERMISSIONS.get();
|
||||
int value = PluginConfig.DEFAULT_HOME.get();
|
||||
for (Map.Entry<String, Integer> entry : permissions.entrySet()) {
|
||||
if (entry.getValue() > value && player.hasPermission(
|
||||
Main.getInstance().getName() + "." + entry.getKey()
|
||||
Map<Integer, String> permissions = PluginConfig.PERMISSIONS.get();
|
||||
int current = PluginConfig.DEFAULT_HOME.get();
|
||||
|
||||
for (Map.Entry<Integer, String> entry : permissions.entrySet()) {
|
||||
if (entry.getKey() > current && player.hasPermission(
|
||||
Main.getInstance().getName() + "." + entry.getValue()
|
||||
)) {
|
||||
value = entry.getValue();
|
||||
current = entry.getKey();
|
||||
}
|
||||
}
|
||||
return value;
|
||||
return current;
|
||||
}
|
||||
|
||||
public HashMap<UUID, UserData> getUserDataMap() {
|
||||
|
||||
@@ -17,15 +17,11 @@ public class UserData {
|
||||
|
||||
private final @NotNull File dataFile;
|
||||
private final @NotNull FileConfiguration dataConfig;
|
||||
|
||||
private @Nullable Location lastLocation;
|
||||
|
||||
private LinkedHashMap<String, DataLocation> homeLocations;
|
||||
|
||||
private final HashSet<UUID/*receiverUUID*/> sentRequests = new HashSet<>(); // 记录发出的请求
|
||||
private final ConcurrentHashMap<UUID/*senderUUID*/, TeleportRequest> receivedRequests = new ConcurrentHashMap<>(); // 记录收到的传送请求
|
||||
|
||||
public boolean enableAutoSelect = false;
|
||||
private @Nullable Location lastLocation;
|
||||
private LinkedHashMap<String, DataLocation> homeLocations;
|
||||
|
||||
public UserData(@NotNull File dataFolder, @NotNull UUID uuid) {
|
||||
this(new File(dataFolder, uuid + ".yml"));
|
||||
@@ -100,14 +96,14 @@ public class UserData {
|
||||
return receivedRequests;
|
||||
}
|
||||
|
||||
public void setEnableAutoSelect(boolean enableAutoSelect) {
|
||||
this.enableAutoSelect = enableAutoSelect;
|
||||
}
|
||||
|
||||
public boolean isEnableAutoSelect() {
|
||||
return enableAutoSelect;
|
||||
}
|
||||
|
||||
public void setEnableAutoSelect(boolean enableAutoSelect) {
|
||||
this.enableAutoSelect = enableAutoSelect;
|
||||
}
|
||||
|
||||
public @NotNull File getDataFile() {
|
||||
return dataFile;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package cc.carm.plugin.moeteleport.util;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
@@ -7,8 +6,7 @@ import java.util.regex.Pattern;
|
||||
public class ColorParser {
|
||||
|
||||
public static String parse(String text) {
|
||||
text = parseHexColor(text);
|
||||
return parseColor(text);
|
||||
return parseColor(parseHexColor(text));
|
||||
}
|
||||
|
||||
public static String parseColor(final String text) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cc.carm.plugin.moeteleport.util;
|
||||
|
||||
import de.themoep.minedown.MineDown;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -17,7 +18,7 @@ public class MessageUtil {
|
||||
public static void send(@Nullable CommandSender sender, List<String> messages) {
|
||||
if (messages == null || messages.isEmpty() || sender == null) return;
|
||||
for (String s : messages) {
|
||||
sender.sendMessage(ColorParser.parse(s));
|
||||
sender.spigot().sendMessage(MineDown.parse(s));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ defaultHome: 1
|
||||
permissions:
|
||||
# 以下命令全部为 MoeTeleport 的子节点
|
||||
# 如 "home.vip" 的权限全拼就是 "MoeTeleport.home.vip"
|
||||
"home.vip": 10 # 最多可以设置10个家
|
||||
10: "home.vip" # 最多可以设置10个家
|
||||
|
||||
# 传送请求过期时间
|
||||
expireTime: 30
|
||||
|
||||
@@ -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[同意]](show_text=点击同意请求 run_command=/tpAccept %(player)) &f输入 &5/tpAccept &f同意该请求。"
|
||||
- "[&c&l[拒绝]](show_text=点击拒绝请求 run_command=/tpDeny %(player)) &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[同意]](show_text=点击同意请求 run_command=/tpAccept %(player)) &f输入 &5/tpAccept &f同意该请求。"
|
||||
- "[&c&l[拒绝]](show_text=点击拒绝请求 run_command=/tpDeny %(player)) &f输入 &5/tpDeny &f拒绝该请求。"
|
||||
tpaccept:
|
||||
- "&f您同意了 &d%(player) &f的传送请求。"
|
||||
tpdeny:
|
||||
@@ -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:
|
||||
@@ -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✈](show_text=点击返回家 %(id) run_command=/home %(id))"
|
||||
home-not-found:
|
||||
- "&f您还没有设置这个家,请先输入 &5/setHome <家名称> &f设置一个吧!"
|
||||
home-set:
|
||||
|
||||
@@ -13,7 +13,16 @@ permissions:
|
||||
description: "插件的主权限节点"
|
||||
default: false
|
||||
|
||||
"MoeTeleport.admin":
|
||||
description: "插件的管理员权限节点"
|
||||
default: op
|
||||
|
||||
commands:
|
||||
"MoeTeleport":
|
||||
description: "插件的主命令,用于重载插件或查看插件信息。"
|
||||
permission: "MoeTeleport.admin"
|
||||
usage: "/MoeTeleport reload"
|
||||
|
||||
"back":
|
||||
description: 返回传送前的上一个地点。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user