Compare commits
No commits in common. "master" and "v1.5" have entirely different histories.
58
README.md
58
README.md
@ -1,31 +1,24 @@
|
|||||||
<div align="center">
|
|
||||||
|
|
||||||
# ColorfulMap
|
# ColorfulMap
|
||||||
|
|
||||||
<img src="https://ssl.lunadeer.cn:14437/i/2024/02/21/65d5e0d10b7d5.png" alt="" width="70%">
|
|
||||||
|
|
||||||
### [开源地址](https://ssl.lunadeer.cn:14446/zhangyuheng/ColorfulMap) | [文档地址](https://ssl.lunadeer.cn:14448/doc/26/)
|
### [开源地址](https://ssl.lunadeer.cn:14446/zhangyuheng/ColorfulMap) | [文档地址](https://ssl.lunadeer.cn:14448/doc/26/)
|
||||||
|
|
||||||
### [下载页面](https://ssl.lunadeer.cn:14446/zhangyuheng/ColorfulMap/releases)
|
### [下载页面](https://ssl.lunadeer.cn:14446/zhangyuheng/ColorfulMap/releases)
|
||||||
|
|
||||||
### [统计页面](https://bstats.org/plugin/bukkit/ColorfulMap/21443) | [Hangar](https://hangar.papermc.io/zhangyuheng/ColorfulMap)
|
### [统计页面](https://bstats.org/plugin/bukkit/ColorfulMap/21443) | [Hangar](https://hangar.papermc.io/zhangyuheng/ColorfulMap)
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|
||||||
|
![](https://ssl.lunadeer.cn:14437/i/2024/02/21/65d5e0d10b7d5.png)
|
||||||
|
|
||||||
用于将图片转换为地图画,悬挂在展示框上增添装饰。
|
用于将图片转换为地图画,悬挂在展示框上增添装饰。
|
||||||
|
|
||||||
## 说明
|
## 说明
|
||||||
|
|
||||||
本插件大约相当于 [ImageFrame](https://github.com/LOOHP/ImageFrame)的简版以及 [ImageMaps](https://github.com/SydMontague/ImageMaps) 的高版本重制版。前者功能丰富,不过可能由于项目体量较大,对于新版本的兼容较慢,后者在1.18 开始就停止了更新,且不支持 Folia 核心。
|
本插件大约相当于 [ImageFrame](https://github.com/LOOHP/ImageFrame) 的简版以及 [ImageMaps](https://github.com/SydMontague/ImageMaps) 的高版本重制版。前者功能丰富,不过可能由于项目体量较大,对于新版本的兼容较慢,后者在 1.18 开始就停止了更新,切不支持 Folia 核心。
|
||||||
|
|
||||||
## 功能介绍
|
## 功能介绍
|
||||||
|
|
||||||
- 将图片转换为地图画;
|
- 将图片转换为地图画;
|
||||||
- 图片缩放;
|
- 图片缩放;
|
||||||
- 自动放置;
|
- 自动放置;
|
||||||
- 支持消耗金钱生成地图画(需要 Vault 前置);
|
|
||||||
|
|
||||||
## 支持版本
|
## 支持版本
|
||||||
|
|
||||||
@ -40,65 +33,54 @@
|
|||||||
|
|
||||||
## 玩家使用方法
|
## 玩家使用方法
|
||||||
|
|
||||||
1. 首先需要将你想要转换的图片上传到 [图床](https://ssl.lunadeer.cn:14437/) ,便于本插件从网络读取图片内容。上传完成后会得到一个图片的网络地址,复制此地址。
|
1. 首先需要将你想要转换的图片上传到 [图床](https://ssl.lunadeer.cn:14437/) ,便于本插件从网络读取图片内容。上传完成后会得到一个图片的网络地址,复制此地址。
|
||||||
|
|
||||||
2. 在游戏中输入指令:`/tomap <图片地址>` 即可获得一张地图
|
2. 在游戏中输入指令:`/tomap <图片地址>` 即可获得一张地图。地图的左上角会显示这张地图画所需的展示框阵列的尺寸,如下图所示 5x4 代表你需要在墙上准备一组长5格,宽4格的展示框阵列才能摆的下这张地图画。
|
||||||
|
|
||||||
![](https://ssl.lunadeer.cn:14437/i/2024/07/30/66a89345ca899.png)
|
![](https://ssl.lunadeer.cn:14437/i/2024/02/21/65d5ef7e8d676.png)
|
||||||
|
|
||||||
地图的lore中记录了此地图画的大小,下图中的 8x10 表明此地图画需要长8格、高10格的展示框阵列才能放置。
|
|
||||||
|
|
||||||
![](https://ssl.lunadeer.cn:14437/i/2024/07/30/66a893ba56d7d.png)
|
|
||||||
|
|
||||||
3. 对着展示框阵列的**左下角展示框**摆放此地图,则会自动在墙上的剩余展示框内放置对应的地图。
|
3. 对着展示框阵列的**左下角展示框**摆放此地图,则会自动在墙上的剩余展示框内放置对应的地图。
|
||||||
|
|
||||||
4. 如果图片太大或太小可以尝试在指令后加入缩放倍率,例如 `/tomap <图片地址> 0.5` 表示将以原图的50%大小渲染。如果你希望将图片填满所有地图边缘处没有留白,那么你需要保证你的图片的长宽分辨率均为**128的倍数**,因为在MC中一张地图的分辨率为128x128。
|
4. 如果图片太大或太小可以尝试在指令后加入缩放倍率,例如 `/tomap <图片地址> 0.5`表示将以原图的50%大小渲染。如果你希望将图片填满所有地图边缘处没有留白,那么你需要保证你的图片的长宽分辨率均为**128的倍数**,因为在MC中一张地图的分辨率为128x128。
|
||||||
|
|
||||||
## 管理员指南
|
## 管理员指南
|
||||||
|
|
||||||
### 指令 & 权限节点
|
## 指令
|
||||||
|
|
||||||
> 以下指令中尖括号 `<>` 表示必填,方括号 `[]` 表示选填。
|
> 以下指令中尖括号 `<>` 表示必填,方括号 `[]` 表示选填。
|
||||||
|
|
||||||
| 功能 | 指令 | 权限节点 | 默认 |
|
### 玩家指令
|
||||||
|-------|------------------------|--------------------|------|
|
|
||||||
| 生成地图画 | `/tomap <图片地址> [缩放倍率]` | colorfulmap.tomap | true |
|
|
||||||
| 重载配置 | `/reloadColorfulMap` | colorfulmap.reload | op |
|
|
||||||
|
|
||||||
### 如何查图
|
|
||||||
|
|
||||||
2.0版本开始地图画会保存一份玩家获取图片的原图,路径为 `plugins/ColorfulMap/maps/{图片uuid}/raw.png` ,方便服主快速查阅图片内容。
|
| 功能 | 指令 |
|
||||||
|
|-------|------------------------|
|
||||||
|
| 生成地图画 | `/tomap <图片地址> [缩放倍率]` |
|
||||||
|
|
||||||
当玩家放置地图后还会同时保存一份元数据文件,`plugins/ColorfulMap/maps/{图片uuid}/meta.txt`,此文件记录了放置地图的玩家、放置时间、地图画的位置等信息。
|
|
||||||
|
|
||||||
### 配置文件参考
|
|
||||||
|
### 管理员指令
|
||||||
|
|
||||||
|
## 配置文件参考
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# 地图画阵列的最大尺寸 宽
|
|
||||||
MaxFrameX: 32
|
MaxFrameX: 32
|
||||||
|
|
||||||
# 地图画阵列的最大尺寸 高
|
|
||||||
MaxFrameY: 18
|
MaxFrameY: 18
|
||||||
|
|
||||||
# 是否启用经济系统 消耗玩家金钱生成地图画
|
|
||||||
Economy:
|
|
||||||
Enable: false
|
|
||||||
CostPerMap: 100.0 # 每张地图画的单价 - 3*3的地图画需要9张地图画 也就是 9*100 = 900
|
|
||||||
|
|
||||||
# 图床地址白名单,不在白名单中的图床将无法使用,留空表示不启用地址白名单
|
|
||||||
AddressWhiteList: []
|
|
||||||
|
|
||||||
CheckUpdate: true
|
CheckUpdate: true
|
||||||
|
|
||||||
Debug: false
|
Debug: false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
## 建议与反馈
|
## 建议与反馈
|
||||||
|
|
||||||
Mail: [zhangyuheng@lunadeer.cn](mailto:zhangyuheng@lunadeer.cn)
|
Mail: [zhangyuheng@lunadeer.cn](mailto:zhangyuheng@lunadeer.cn)
|
||||||
|
|
||||||
QQ群:309428300
|
QQ群:309428300
|
||||||
|
|
||||||
|
|
||||||
## 统计
|
## 统计
|
||||||
|
|
||||||
![bstats](https://bstats.org/signatures/bukkit/ColorfulMap.svg)
|
![bstats](https://bstats.org/signatures/bukkit/ColorfulMap.svg)
|
||||||
|
27
pom.xml
27
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>cn.lunadeer</groupId>
|
<groupId>cn.lunadeer</groupId>
|
||||||
<artifactId>ColorfulMap</artifactId>
|
<artifactId>ColorfulMap</artifactId>
|
||||||
<version>2.6</version>
|
<version>1.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ColorfulMap</name>
|
<name>ColorfulMap</name>
|
||||||
@ -62,14 +62,6 @@
|
|||||||
<id>papermc</id>
|
<id>papermc</id>
|
||||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>jitpack.io</id>
|
|
||||||
<url>https://jitpack.io</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>codemc-repo</id>
|
|
||||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -79,22 +71,5 @@
|
|||||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net.kyori</groupId>
|
|
||||||
<artifactId>adventure-platform-bukkit</artifactId>
|
|
||||||
<version>4.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.MilkBowl</groupId>
|
|
||||||
<artifactId>VaultAPI</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
|
||||||
<artifactId>VaultUnlockedAPI</artifactId>
|
|
||||||
<version>2.2</version><!-- Validate this is the most recent version from the CI -->
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package cn.lunadeer.colorfulmap;
|
package cn.lunadeer.colorfulmap;
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.commands.Purge;
|
|
||||||
import cn.lunadeer.colorfulmap.commands.Reload;
|
|
||||||
import cn.lunadeer.colorfulmap.commands.ToMap;
|
import cn.lunadeer.colorfulmap.commands.ToMap;
|
||||||
import cn.lunadeer.colorfulmap.utils.*;
|
import cn.lunadeer.colorfulmap.utils.GiteaReleaseCheck;
|
||||||
|
import cn.lunadeer.colorfulmap.utils.XLogger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -15,21 +14,14 @@ public final class ColorfulMap extends JavaPlugin {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
instance = this;
|
instance = this;
|
||||||
new XLogger(this);
|
|
||||||
config = new Configuration(this);
|
config = new Configuration(this);
|
||||||
XLogger.setDebug(config.isDebug());
|
|
||||||
new Notification(this);
|
|
||||||
new Scheduler(this);
|
|
||||||
|
|
||||||
Objects.requireNonNull(Bukkit.getPluginCommand("tomap")).setExecutor(new ToMap());
|
Objects.requireNonNull(Bukkit.getPluginCommand("tomap")).setExecutor(new ToMap());
|
||||||
Objects.requireNonNull(Bukkit.getPluginCommand("reloadColorfulMap")).setExecutor(new Reload());
|
|
||||||
Objects.requireNonNull(Bukkit.getPluginCommand("purgeColorfulMap")).setExecutor(new Purge());
|
|
||||||
|
|
||||||
Bukkit.getPluginManager().registerEvents(new Events(), this);
|
Bukkit.getPluginManager().registerEvents(new Events(), this);
|
||||||
|
|
||||||
new MapManager().init();
|
new MapManager().init();
|
||||||
|
|
||||||
bStatsMetrics metrics = new bStatsMetrics(this, 21443);
|
Metrics metrics = new Metrics(this, 21443);
|
||||||
if (config.isCheckUpdate()) {
|
if (config.isCheckUpdate()) {
|
||||||
giteaReleaseCheck = new GiteaReleaseCheck(this,
|
giteaReleaseCheck = new GiteaReleaseCheck(this,
|
||||||
"https://ssl.lunadeer.cn:14446",
|
"https://ssl.lunadeer.cn:14446",
|
||||||
@ -38,7 +30,7 @@ public final class ColorfulMap extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XLogger.info("ColorfulMap 已加载");
|
XLogger.info("ColorfulMap 已加载");
|
||||||
XLogger.info("版本: " + this.getDescription().getVersion());
|
XLogger.info("版本: " + getPluginMeta().getVersion());
|
||||||
// https://patorjk.com/software/taag/#p=display&f=Big&t=ColorfulMap
|
// https://patorjk.com/software/taag/#p=display&f=Big&t=ColorfulMap
|
||||||
XLogger.info(" _____ _ __ _ __ __");
|
XLogger.info(" _____ _ __ _ __ __");
|
||||||
XLogger.info(" / ____| | | / _| | | \\/ |");
|
XLogger.info(" / ____| | | / _| | | \\/ |");
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package cn.lunadeer.colorfulmap;
|
package cn.lunadeer.colorfulmap;
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.utils.VaultConnect.VaultConnect;
|
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Configuration {
|
public class Configuration {
|
||||||
|
|
||||||
public Configuration(ColorfulMap plugin) {
|
public Configuration(ColorfulMap plugin) {
|
||||||
@ -22,25 +18,6 @@ public class Configuration {
|
|||||||
_max_frame_x = _file.getInt("MaxFrameX", 32);
|
_max_frame_x = _file.getInt("MaxFrameX", 32);
|
||||||
_max_frame_y = _file.getInt("MaxFrameY", 18);
|
_max_frame_y = _file.getInt("MaxFrameY", 18);
|
||||||
_check_update = _file.getBoolean("CheckUpdate", true);
|
_check_update = _file.getBoolean("CheckUpdate", true);
|
||||||
_economy_enable = _file.getBoolean("Economy.Enable", false);
|
|
||||||
_price = (float) _file.getDouble("Economy.CostPerMap", 100.0);
|
|
||||||
_address_white_list = _file.getStringList("AddressWhiteList");
|
|
||||||
if (_economy_enable) {
|
|
||||||
XLogger.info("已启用经济系统");
|
|
||||||
new VaultConnect(_plugin);
|
|
||||||
}
|
|
||||||
saveAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAll() {
|
|
||||||
_file.set("Debug", _debug);
|
|
||||||
_file.set("MaxFrameX", _max_frame_x);
|
|
||||||
_file.set("MaxFrameY", _max_frame_y);
|
|
||||||
_file.set("CheckUpdate", _check_update);
|
|
||||||
_file.set("Economy.Enable", _economy_enable);
|
|
||||||
_file.set("Economy.CostPerMap", _price);
|
|
||||||
_file.set("AddressWhiteList", _address_white_list);
|
|
||||||
_plugin.saveConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isDebug() {
|
public Boolean isDebug() {
|
||||||
@ -77,49 +54,10 @@ public class Configuration {
|
|||||||
return _check_update;
|
return _check_update;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCheckUpdate(Boolean check_update) {
|
|
||||||
_check_update = check_update;
|
|
||||||
_file.set("CheckUpdate", check_update);
|
|
||||||
_plugin.saveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean isEconomyEnable() {
|
|
||||||
return _economy_enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEconomyEnable(Boolean economy_enable) {
|
|
||||||
_economy_enable = economy_enable;
|
|
||||||
_file.set("Economy.Enable", economy_enable);
|
|
||||||
_plugin.saveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float getPrice() {
|
|
||||||
return _price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(Float price) {
|
|
||||||
_price = price;
|
|
||||||
_file.set("Economy.CostPerMap", price);
|
|
||||||
_plugin.saveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAddressWhiteList() {
|
|
||||||
return _address_white_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAddressWhiteList(List<String> address_white_list) {
|
|
||||||
_address_white_list = address_white_list;
|
|
||||||
_file.set("AddressWhiteList", address_white_list);
|
|
||||||
_plugin.saveConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
private final ColorfulMap _plugin;
|
private final ColorfulMap _plugin;
|
||||||
private FileConfiguration _file;
|
private FileConfiguration _file;
|
||||||
private Boolean _debug;
|
private Boolean _debug;
|
||||||
private Integer _max_frame_x;
|
private Integer _max_frame_x;
|
||||||
private Integer _max_frame_y;
|
private Integer _max_frame_y;
|
||||||
private Boolean _check_update;
|
private Boolean _check_update;
|
||||||
private Boolean _economy_enable;
|
|
||||||
private Float _price;
|
|
||||||
private List<String > _address_white_list;
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package cn.lunadeer.colorfulmap;
|
|||||||
|
|
||||||
import cn.lunadeer.colorfulmap.generator.ImageRenderer;
|
import cn.lunadeer.colorfulmap.generator.ImageRenderer;
|
||||||
import cn.lunadeer.colorfulmap.utils.Notification;
|
import cn.lunadeer.colorfulmap.utils.Notification;
|
||||||
import cn.lunadeer.colorfulmap.utils.VaultConnect.VaultConnect;
|
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
import cn.lunadeer.colorfulmap.utils.XLogger;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
@ -17,15 +16,11 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static cn.lunadeer.colorfulmap.Apis.getItemFrameMatrix;
|
import static cn.lunadeer.colorfulmap.Apis.getItemFrameMatrix;
|
||||||
import static cn.lunadeer.colorfulmap.StorageMaps.getImageTilePath;
|
|
||||||
import static cn.lunadeer.colorfulmap.StorageMaps.writeMeta;
|
|
||||||
|
|
||||||
public class Events implements Listener {
|
public class Events implements Listener {
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
@ -52,23 +47,13 @@ public class Events implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
List<Component> lore = item.getItemMeta().lore();
|
List<Component> lore = item.getItemMeta().lore();
|
||||||
XLogger.debug("PlayerInteractEntityEvent");
|
XLogger.debug("PlayerInteractEntityEvent");
|
||||||
if (lore == null || lore.size() != 1) {
|
if (lore == null || lore.size() != 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XLogger.debug("putImageMapsOnItemFrame");
|
XLogger.debug("putImageMapsOnItemFrame");
|
||||||
/*
|
UUID uuid = UUID.fromString(((TextComponent) lore.get(0)).content());
|
||||||
MapMeta meta = (MapMeta) mapItem.getItemMeta();
|
int count_x = Integer.parseInt(((TextComponent) lore.get(1)).content());
|
||||||
List<Component> lore = new ArrayList<>();
|
int count_y = Integer.parseInt(((TextComponent) lore.get(2)).content());
|
||||||
String size_info = "size: " + x_count + "x" + y_count;
|
|
||||||
lore.add(Component.text(size_info).hoverEvent(Component.text(map_images_uuid.toString())));
|
|
||||||
meta.lore(lore);
|
|
||||||
mapItem.setItemMeta(meta);
|
|
||||||
*/
|
|
||||||
TextComponent textComponent = (TextComponent) lore.get(0);
|
|
||||||
UUID uuid = UUID.fromString(((TextComponent) Objects.requireNonNull(textComponent.hoverEvent()).value()).content());
|
|
||||||
String[] size = textComponent.content().split(": ")[1].split("x");
|
|
||||||
int count_x = Integer.parseInt(size[0]);
|
|
||||||
int count_y = Integer.parseInt(size[1]);
|
|
||||||
XLogger.debug("uuid: " + uuid);
|
XLogger.debug("uuid: " + uuid);
|
||||||
XLogger.debug("count_x: " + count_x);
|
XLogger.debug("count_x: " + count_x);
|
||||||
XLogger.debug("count_y: " + count_y);
|
XLogger.debug("count_y: " + count_y);
|
||||||
@ -82,25 +67,10 @@ public class Events implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ColorfulMap.config.isEconomyEnable()) {
|
|
||||||
float cost = ColorfulMap.config.getPrice() * count_x * count_y;
|
|
||||||
if (!VaultConnect.instance.economyAvailable()) {
|
|
||||||
Notification.error(player, "无法放置地图画: 无法连接到经济插件");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (VaultConnect.instance.getBalance(player) < cost) {
|
|
||||||
Notification.error(player, "无法放置地图画: 余额不足");
|
|
||||||
Notification.error(player, "此图片尺寸为 %d x %d 个展示框,单价 %f,总价 %f,你的余额为 %f",
|
|
||||||
count_x, count_y, ColorfulMap.config.getPrice(), cost, VaultConnect.instance.getBalance(player));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
VaultConnect.instance.withdrawPlayer(player, cost);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ItemStack> maps = new ArrayList<>();
|
List<ItemStack> maps = new ArrayList<>();
|
||||||
for (int y = 0; y < count_y; y++) {
|
for (int y = 0; y < count_y; y++) {
|
||||||
for (int x = 0; x < count_x; x++) {
|
for (int x = 0; x < count_x; x++) {
|
||||||
String path = getImageTilePath(uuid, x, y);
|
String path = "maps/" + uuid + "/" + x + "_" + y + ".png";
|
||||||
ItemStack map = ImageRenderer.getMapItemFromImageTile(player, path);
|
ItemStack map = ImageRenderer.getMapItemFromImageTile(player, path);
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
Notification.error(player, "无法加载地图,原始路径丢失:" + path);
|
Notification.error(player, "无法加载地图,原始路径丢失:" + path);
|
||||||
@ -110,15 +80,6 @@ public class Events implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录操作信息
|
|
||||||
List<String> imageMeta = new ArrayList<>();
|
|
||||||
imageMeta.add("Player: " + player.getName() + "(" + player.getUniqueId() + ")");
|
|
||||||
imageMeta.add("Time: " + LocalTime.now());
|
|
||||||
imageMeta.add("Location: " + item_frame.getLocation());
|
|
||||||
imageMeta.add("Size: " + count_x + "x" + count_y);
|
|
||||||
imageMeta.add("ImageUUID: " + uuid);
|
|
||||||
writeMeta(uuid, imageMeta);
|
|
||||||
|
|
||||||
XLogger.debug("maps size: " + maps.size());
|
XLogger.debug("maps size: " + maps.size());
|
||||||
XLogger.debug("item_frames size: " + item_frames.size());
|
XLogger.debug("item_frames size: " + item_frames.size());
|
||||||
for (int i = 0; i < item_frames.size(); i++) {
|
for (int i = 0; i < item_frames.size(); i++) {
|
||||||
|
@ -16,7 +16,9 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class MapManager implements Listener {
|
public class MapManager implements Listener {
|
||||||
|
|
||||||
@ -38,7 +40,7 @@ public class MapManager implements Listener {
|
|||||||
public void init() {
|
public void init() {
|
||||||
MapManager.instance = this;
|
MapManager.instance = this;
|
||||||
Bukkit.getPluginManager().registerEvents(this, ColorfulMap.instance);
|
Bukkit.getPluginManager().registerEvents(this, ColorfulMap.instance);
|
||||||
reloadImages();
|
loadImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +86,8 @@ public class MapManager implements Listener {
|
|||||||
/***
|
/***
|
||||||
* Loads images from data file to HashMap.
|
* Loads images from data file to HashMap.
|
||||||
*/
|
*/
|
||||||
public void reloadImages() {
|
private void loadImages() {
|
||||||
FileConfiguration config = dataFile.getConfig();
|
FileConfiguration config = dataFile.getConfig();
|
||||||
List<String> recordToDelete = new ArrayList<>();
|
|
||||||
for (String world : config.getKeys(false)) {
|
for (String world : config.getKeys(false)) {
|
||||||
for (String id : Objects.requireNonNull(config.getConfigurationSection(world)).getKeys(false)) {
|
for (String id : Objects.requireNonNull(config.getConfigurationSection(world)).getKeys(false)) {
|
||||||
String path = config.getString(world + "." + id);
|
String path = config.getString(world + "." + id);
|
||||||
@ -95,8 +96,7 @@ public class MapManager implements Listener {
|
|||||||
}
|
}
|
||||||
BufferedImage image = StorageMaps.load(path);
|
BufferedImage image = StorageMaps.load(path);
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
XLogger.err("无法加载图片: %s 已移除记录", path);
|
XLogger.err("无法加载图片: " + path);
|
||||||
recordToDelete.add(world + "." + id);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!savedImages.containsKey(world)) {
|
if (!savedImages.containsKey(world)) {
|
||||||
@ -105,11 +105,6 @@ public class MapManager implements Listener {
|
|||||||
savedImages.get(world).put(Integer.parseInt(id), image);
|
savedImages.get(world).put(Integer.parseInt(id), image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 删除无效记录
|
|
||||||
for (String record : recordToDelete) {
|
|
||||||
config.set(record, null);
|
|
||||||
}
|
|
||||||
dataFile.saveConfig();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -122,27 +117,6 @@ public class MapManager implements Listener {
|
|||||||
return savedImages.get(world_name.getName()).get(id);
|
return savedImages.get(world_name.getName()).get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Integer> getMapIds(World world) {
|
|
||||||
if (!savedImages.containsKey(world.getName())) {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
return new ArrayList<>(savedImages.get(world.getName()).keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeMap(World world, Integer id) {
|
|
||||||
if (!savedImages.containsKey(world.getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FileConfiguration config = dataFile.getConfig();
|
|
||||||
String path = config.getString(world.getName() + "." + id);
|
|
||||||
if (path == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new File(path).delete();
|
|
||||||
config.set(world.getName() + "." + id, null);
|
|
||||||
dataFile.saveConfig();
|
|
||||||
savedImages.get(world.getName()).remove(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static class MapsFile {
|
static class MapsFile {
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
package cn.lunadeer.colorfulmap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -23,7 +23,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.GZIPOutputStream;
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
public class bStatsMetrics {
|
public class Metrics {
|
||||||
private final Plugin plugin;
|
private final Plugin plugin;
|
||||||
|
|
||||||
private final MetricsBase metricsBase;
|
private final MetricsBase metricsBase;
|
||||||
@ -35,7 +35,7 @@ public class bStatsMetrics {
|
|||||||
* @param serviceId The id of the service. It can be found at <a
|
* @param serviceId The id of the service. It can be found at <a
|
||||||
* href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a>
|
* href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a>
|
||||||
*/
|
*/
|
||||||
public bStatsMetrics(JavaPlugin plugin, int serviceId) {
|
public Metrics(JavaPlugin plugin, int serviceId) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
// Get the config file
|
// Get the config file
|
||||||
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
|
@ -1,7 +1,6 @@
|
|||||||
package cn.lunadeer.colorfulmap;
|
package cn.lunadeer.colorfulmap;
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.utils.Notification;
|
import cn.lunadeer.colorfulmap.utils.Notification;
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@ -17,36 +16,26 @@ public class StorageMaps {
|
|||||||
/**
|
/**
|
||||||
* save images to plugins/ColorfulMap/maps/{map_uuid}/x_y.png
|
* save images to plugins/ColorfulMap/maps/{map_uuid}/x_y.png
|
||||||
*
|
*
|
||||||
* @param player player
|
* @param player player
|
||||||
* @param images images
|
* @param images images
|
||||||
* @param x_count x_count
|
* @param x_count x_count
|
||||||
* @param y_count y_count
|
* @param y_count y_count
|
||||||
*/
|
*/
|
||||||
public static UUID save(Player player, BufferedImage raw, BufferedImage thumb,
|
public static UUID save(Player player, List<BufferedImage> images, int x_count, int y_count) {
|
||||||
List<BufferedImage> images, int x_count, int y_count) {
|
|
||||||
if (images.size() != x_count * y_count) {
|
if (images.size() != x_count * y_count) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
UUID map_uuid = UUID.randomUUID();
|
UUID map_uuid = UUID.randomUUID();
|
||||||
File map_folder = new File(data_folder, "maps/" + map_uuid);
|
|
||||||
if (!map_folder.exists()) {
|
|
||||||
if (!map_folder.mkdirs()) {
|
|
||||||
Notification.error(player, "Failed to save map: failed to create map folder");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File raw_file = new File(map_folder, "raw.png");
|
|
||||||
File thumb_file = new File(map_folder, "thumb.png");
|
|
||||||
try {
|
|
||||||
ImageIO.write(raw, "png", raw_file);
|
|
||||||
ImageIO.write(thumb, "png", thumb_file);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Notification.error(player, "Failed to save map: " + e.getMessage());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
for (int y = 0; y < y_count; y++) {
|
for (int y = 0; y < y_count; y++) {
|
||||||
for (int x = 0; x < x_count; x++) {
|
for (int x = 0; x < x_count; x++) {
|
||||||
BufferedImage image = images.get(y * x_count + x);
|
BufferedImage image = images.get(y * x_count + x);
|
||||||
|
File map_folder = new File(data_folder, "maps/" + map_uuid);
|
||||||
|
if (!map_folder.exists()) {
|
||||||
|
if (!map_folder.mkdirs()) {
|
||||||
|
Notification.error(player, "Failed to save map: failed to create map folder");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
File image_file = new File(map_folder, x + "_" + y + ".png");
|
File image_file = new File(map_folder, x + "_" + y + ".png");
|
||||||
try {
|
try {
|
||||||
ImageIO.write(image, "png", image_file);
|
ImageIO.write(image, "png", image_file);
|
||||||
@ -59,30 +48,13 @@ public class StorageMaps {
|
|||||||
return map_uuid;
|
return map_uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getThumbnailPath(UUID map_uuid) {
|
|
||||||
return "maps/" + map_uuid + "/thumb.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getImageTilePath(UUID map_uuid, int x, int y) {
|
|
||||||
return "maps/" + map_uuid + "/" + x + "_" + y + ".png";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeMeta(UUID map_uuid, List<String> info) {
|
|
||||||
File meta_file = new File(data_folder, "maps/" + map_uuid + "/meta.txt");
|
|
||||||
try {
|
|
||||||
java.nio.file.Files.write(meta_file.toPath(), info);
|
|
||||||
} catch (Exception e) {
|
|
||||||
XLogger.err("写入地图画操作记录失败:%s", e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load images from plugins/ColorfulMap/maps/{map_uuid}/x_y.png
|
* load images from plugins/ColorfulMap/maps/{map_uuid}/x_y.png
|
||||||
*
|
*
|
||||||
* @param player player
|
* @param player player
|
||||||
* @param map_uuid map_uuid
|
* @param map_uuid map_uuid
|
||||||
* @param x_count x_count
|
* @param x_count x_count
|
||||||
* @param y_count y_count
|
* @param y_count y_count
|
||||||
* @return images
|
* @return images
|
||||||
*/
|
*/
|
||||||
public static List<BufferedImage> load(Player player, UUID map_uuid, int x_count, int y_count) {
|
public static List<BufferedImage> load(Player player, UUID map_uuid, int x_count, int y_count) {
|
||||||
@ -110,34 +82,4 @@ public class StorageMaps {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void purgeStorageFolder() {
|
|
||||||
File[] map_folders = new File(data_folder, "maps").listFiles();
|
|
||||||
if (map_folders == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (File map_folder : map_folders) {
|
|
||||||
if (!map_folder.isDirectory()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
File[] files = map_folder.listFiles();
|
|
||||||
if (files == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<String> filenames = new ArrayList<>();
|
|
||||||
for (File file : files) {
|
|
||||||
filenames.add(file.getName());
|
|
||||||
}
|
|
||||||
if (filenames.isEmpty()) {
|
|
||||||
map_folder.delete();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!filenames.contains("meta.txt")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (files.length == 3 && filenames.contains("raw.png") && filenames.contains("thumb.png") && filenames.contains("meta.txt")) {
|
|
||||||
map_folder.delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.commands;
|
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.ColorfulMap;
|
|
||||||
import cn.lunadeer.colorfulmap.MapManager;
|
|
||||||
import cn.lunadeer.colorfulmap.StorageMaps;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.entity.ItemFrame;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.map.MapView;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Purge implements CommandExecutor {
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
|
||||||
ColorfulMap.instance.getServer().getWorlds().forEach(world -> {
|
|
||||||
List<Integer> worldMapIds = new ArrayList<>();
|
|
||||||
world.getEntities().forEach(entity -> {
|
|
||||||
if (!(entity instanceof org.bukkit.entity.ItemFrame)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemFrame itemFrame = (ItemFrame) entity;
|
|
||||||
if (!itemFrame.getItem().getType().equals(org.bukkit.Material.FILLED_MAP)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemStack item = itemFrame.getItem();
|
|
||||||
MapView mapView = ((org.bukkit.inventory.meta.MapMeta) item.getItemMeta()).getMapView();
|
|
||||||
if (mapView == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
worldMapIds.add(mapView.getId());
|
|
||||||
});
|
|
||||||
List<Integer> currentIds = MapManager.instance.getMapIds(world);
|
|
||||||
for (Integer id : currentIds) {
|
|
||||||
if (!worldMapIds.contains(id)) {
|
|
||||||
MapManager.instance.removeMap(world, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
StorageMaps.purgeStorageFolder();
|
|
||||||
MapManager.instance.reloadImages();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.commands;
|
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.ColorfulMap;
|
|
||||||
import cn.lunadeer.colorfulmap.MapManager;
|
|
||||||
import cn.lunadeer.colorfulmap.utils.Notification;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class Reload implements CommandExecutor {
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
|
||||||
ColorfulMap.config.reload();
|
|
||||||
MapManager.instance.reloadImages();
|
|
||||||
Notification.info(sender, "重载成功");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,9 @@
|
|||||||
package cn.lunadeer.colorfulmap.commands;
|
package cn.lunadeer.colorfulmap.commands;
|
||||||
|
|
||||||
|
import cn.lunadeer.colorfulmap.ColorfulMap;
|
||||||
import cn.lunadeer.colorfulmap.generator.Multi;
|
import cn.lunadeer.colorfulmap.generator.Multi;
|
||||||
import cn.lunadeer.colorfulmap.utils.Notification;
|
import cn.lunadeer.colorfulmap.utils.Notification;
|
||||||
import cn.lunadeer.colorfulmap.utils.Scheduler;
|
import cn.lunadeer.colorfulmap.utils.Time;
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
import cn.lunadeer.colorfulmap.utils.XLogger;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@ -45,8 +46,14 @@ public class ToMap implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// ItemStack mapImage = Multi.generate(player, url, scale);
|
||||||
|
// if (mapImage == null){
|
||||||
|
// Notification.error(player, "生成地图失败");
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// player.getInventory().addItem(mapImage);
|
||||||
float finalScale = scale;
|
float finalScale = scale;
|
||||||
Scheduler.runTaskAsync(() -> {
|
Time.runAsync(ColorfulMap.instance, () -> {
|
||||||
ItemStack mapImage = Multi.generate(player, url, finalScale);
|
ItemStack mapImage = Multi.generate(player, url, finalScale);
|
||||||
if (mapImage == null) {
|
if (mapImage == null) {
|
||||||
Notification.error(player, "生成地图失败");
|
Notification.error(player, "生成地图失败");
|
||||||
|
@ -2,10 +2,7 @@ package cn.lunadeer.colorfulmap.generator;
|
|||||||
|
|
||||||
import cn.lunadeer.colorfulmap.ColorfulMap;
|
import cn.lunadeer.colorfulmap.ColorfulMap;
|
||||||
import cn.lunadeer.colorfulmap.StorageMaps;
|
import cn.lunadeer.colorfulmap.StorageMaps;
|
||||||
import cn.lunadeer.colorfulmap.utils.ImageTool;
|
|
||||||
import cn.lunadeer.colorfulmap.utils.Notification;
|
import cn.lunadeer.colorfulmap.utils.Notification;
|
||||||
import cn.lunadeer.colorfulmap.utils.UrlTools;
|
|
||||||
import cn.lunadeer.colorfulmap.utils.VaultConnect.VaultConnect;
|
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -18,31 +15,25 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static cn.lunadeer.colorfulmap.StorageMaps.getThumbnailPath;
|
import static cn.lunadeer.colorfulmap.generator.TextRenderer.applyTextToMap;
|
||||||
import static cn.lunadeer.colorfulmap.generator.ImageRenderer.getMapItemFromImageTile;
|
|
||||||
|
|
||||||
public class Multi {
|
public class Multi {
|
||||||
|
|
||||||
public static ItemStack generate(Player player, String url, Float scale) {
|
public static ItemStack generate(Player player, String url, Float scale) {
|
||||||
try {
|
try {
|
||||||
if (!UrlTools.isInWhiteList(url)) {
|
|
||||||
Notification.error(player, "无法生成地图画: 此图床地址不被允许使用");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
URL _url = new URL(url);
|
URL _url = new URL(url);
|
||||||
BufferedImage raw_image = ImageIO.read(_url);
|
BufferedImage image = ImageIO.read(_url);
|
||||||
if (raw_image == null) {
|
|
||||||
Notification.error(player, "无法读取有效图片,请检查图片地址是否正确或者更换图床");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
BufferedImage resized_image;
|
|
||||||
if (scale != 1.0) {
|
if (scale != 1.0) {
|
||||||
resized_image = ImageTool.resize(raw_image, scale);
|
int width = image.getWidth();
|
||||||
} else {
|
int height = image.getHeight();
|
||||||
resized_image = raw_image;
|
int new_width = (int) (width * scale);
|
||||||
|
int new_height = (int) (height * scale);
|
||||||
|
BufferedImage newImage = new BufferedImage(new_width, new_height, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
newImage.getGraphics().drawImage(image, 0, 0, new_width, new_height, null);
|
||||||
|
image = newImage;
|
||||||
}
|
}
|
||||||
int image_width = resized_image.getWidth();
|
int image_width = image.getWidth();
|
||||||
int image_height = resized_image.getHeight();
|
int image_height = image.getHeight();
|
||||||
int x_count = (int) Math.ceil(image_width / 128.0);
|
int x_count = (int) Math.ceil(image_width / 128.0);
|
||||||
int y_count = (int) Math.ceil(image_height / 128.0);
|
int y_count = (int) Math.ceil(image_height / 128.0);
|
||||||
if (x_count > ColorfulMap.config.getMaxFrameX() || y_count > ColorfulMap.config.getMaxFrameY()) {
|
if (x_count > ColorfulMap.config.getMaxFrameX() || y_count > ColorfulMap.config.getMaxFrameY()) {
|
||||||
@ -51,15 +42,17 @@ public class Multi {
|
|||||||
}
|
}
|
||||||
int new_width = x_count * 128;
|
int new_width = x_count * 128;
|
||||||
int new_height = y_count * 128;
|
int new_height = y_count * 128;
|
||||||
resized_image = ImageTool.center(resized_image, new_width, new_height);
|
BufferedImage newImage = new BufferedImage(new_width, new_height, BufferedImage.TYPE_INT_ARGB);
|
||||||
image_width = resized_image.getWidth();
|
newImage.getGraphics().drawImage(image, (new_width - image_width) / 2, (new_height - image_height) / 2, null);
|
||||||
image_height = resized_image.getHeight();
|
image = newImage;
|
||||||
|
image_width = image.getWidth();
|
||||||
|
image_height = image.getHeight();
|
||||||
List<BufferedImage> split_images = new ArrayList<>();
|
List<BufferedImage> split_images = new ArrayList<>();
|
||||||
for (int y = 0; y < y_count; y++) {
|
for (int y = 0; y < y_count; y++) {
|
||||||
for (int x = 0; x < x_count; x++) {
|
for (int x = 0; x < x_count; x++) {
|
||||||
int width = Math.min(128, image_width - x * 128);
|
int width = Math.min(128, image_width - x * 128);
|
||||||
int height = Math.min(128, image_height - y * 128);
|
int height = Math.min(128, image_height - y * 128);
|
||||||
BufferedImage sub_image = resized_image.getSubimage(x * 128, y * 128, width, height);
|
BufferedImage sub_image = image.getSubimage(x * 128, y * 128, width, height);
|
||||||
split_images.add(sub_image);
|
split_images.add(sub_image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,21 +60,20 @@ public class Multi {
|
|||||||
Notification.error(player, "无法生成地图画: 图片为空");
|
Notification.error(player, "无法生成地图画: 图片为空");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
UUID map_images_uuid = StorageMaps.save(player, split_images, x_count, y_count);
|
||||||
UUID map_images_uuid = StorageMaps.save(player, raw_image, ImageTool.thumb(raw_image), split_images, x_count, y_count);
|
|
||||||
if (map_images_uuid == null) {
|
if (map_images_uuid == null) {
|
||||||
Notification.error(player, "无法生成地图画: 无法保存图片");
|
Notification.error(player, "无法生成地图画: 无法保存图片");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ItemStack mapItem = getMapItemFromImageTile(player, getThumbnailPath(map_images_uuid));
|
List<String> map_info = new ArrayList<>();
|
||||||
if (mapItem == null) {
|
map_info.add("size: " + x_count + "x" + y_count);
|
||||||
Notification.error(player, "无法生成地图画: 无法生成地图");
|
ItemStack mapItem = applyTextToMap(player, map_info);
|
||||||
return null;
|
// add lore to map item (uuid, x_count, y_count)
|
||||||
}
|
|
||||||
MapMeta meta = (MapMeta) mapItem.getItemMeta();
|
MapMeta meta = (MapMeta) mapItem.getItemMeta();
|
||||||
List<Component> lore = new ArrayList<>();
|
List<Component> lore = new ArrayList<>();
|
||||||
String size_info = "size: " + x_count + "x" + y_count;
|
lore.add(Component.text(map_images_uuid.toString()));
|
||||||
lore.add(Component.text(size_info).hoverEvent(Component.text(map_images_uuid.toString())));
|
lore.add(Component.text(String.valueOf(x_count)));
|
||||||
|
lore.add(Component.text(String.valueOf(y_count)));
|
||||||
meta.lore(lore);
|
meta.lore(lore);
|
||||||
mapItem.setItemMeta(meta);
|
mapItem.setItemMeta(meta);
|
||||||
return mapItem;
|
return mapItem;
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.lunadeer.colorfulmap.generator;
|
||||||
|
|
||||||
|
import cn.lunadeer.colorfulmap.utils.Notification;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.MapMeta;
|
||||||
|
import org.bukkit.map.MapCanvas;
|
||||||
|
import org.bukkit.map.MapRenderer;
|
||||||
|
import org.bukkit.map.MapView;
|
||||||
|
import org.bukkit.map.MinecraftFont;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TextRenderer extends MapRenderer {
|
||||||
|
|
||||||
|
public TextRenderer(List<String> text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final List<String> text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render to the given map.
|
||||||
|
*
|
||||||
|
* @param map The MapView being rendered to.
|
||||||
|
* @param canvas The canvas to use for rendering.
|
||||||
|
* @param player The player who triggered the rendering.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void render(@NotNull MapView map, @NotNull MapCanvas canvas, @NotNull Player player) {
|
||||||
|
try {
|
||||||
|
int y = 0;
|
||||||
|
for (String line : text) {
|
||||||
|
canvas.drawText(0, y, MinecraftFont.Font, line);
|
||||||
|
y += 10;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Notification.error(player, "Failed to render text: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack applyTextToMap(Player player, List<String> text){
|
||||||
|
ItemStack mapItem = new ItemStack(Material.FILLED_MAP, 1);
|
||||||
|
MapMeta meta = (MapMeta) mapItem.getItemMeta();
|
||||||
|
MapView mapView = Bukkit.createMap(player.getWorld());
|
||||||
|
TextRenderer renderer = new TextRenderer(text);
|
||||||
|
mapView.addRenderer(renderer);
|
||||||
|
meta.setMapView(mapView);
|
||||||
|
mapItem.setItemMeta(meta);
|
||||||
|
return mapItem;
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
|
||||||
|
|
||||||
public class Common {
|
|
||||||
|
|
||||||
public static boolean isPaper() {
|
|
||||||
try {
|
|
||||||
Class.forName("io.papermc.paper.threadedregions.scheduler.ScheduledTask");
|
|
||||||
return true;
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,11 +1,5 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
package cn.lunadeer.colorfulmap.utils;
|
||||||
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import net.kyori.adventure.text.event.ClickEvent;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
@ -18,9 +12,9 @@ import java.io.File;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.Random;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class GiteaReleaseCheck implements Listener {
|
public class GiteaReleaseCheck {
|
||||||
private static class GiteaRelease {
|
private static class GiteaRelease {
|
||||||
public String tag_name;
|
public String tag_name;
|
||||||
public String message;
|
public String message;
|
||||||
@ -28,23 +22,19 @@ public class GiteaReleaseCheck implements Listener {
|
|||||||
public String download_url;
|
public String download_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GiteaReleaseCheck instance = null;
|
|
||||||
|
|
||||||
public GiteaReleaseCheck(JavaPlugin plugin, String giteaServer, String owner, String repo) {
|
public GiteaReleaseCheck(JavaPlugin plugin, String giteaServer, String owner, String repo) {
|
||||||
instance = this;
|
|
||||||
this.gitea_server = giteaServer;
|
this.gitea_server = giteaServer;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.repo = repo;
|
this.repo = repo;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.current_version = plugin.getDescription().getVersion();
|
this.current_version = plugin.getPluginMeta().getVersion();
|
||||||
this.plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
|
||||||
// 异步每12小时检查一次更新
|
// 异步每12小时检查一次更新
|
||||||
Scheduler.runTaskRepeatAsync(() -> {
|
plugin.getServer().getAsyncScheduler().runAtFixedRate(plugin, (instance) -> {
|
||||||
getLatestRelease();
|
getLatestRelease();
|
||||||
if (auto_update) {
|
if (auto_update) {
|
||||||
downloadUpdate();
|
downloadUpdate();
|
||||||
}
|
}
|
||||||
}, (10 + new Random().nextInt(10)) * 20, (60 * 60 * 12 + new Random().nextInt(60)) * 20);
|
}, 10, 60 * 60 * 12, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableAutoUpdate() {
|
public void enableAutoUpdate() {
|
||||||
@ -179,24 +169,11 @@ public class GiteaReleaseCheck implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
private String gitea_server;
|
||||||
private void onPlayerJoin(PlayerJoinEvent event) {
|
private String owner;
|
||||||
if (!event.getPlayer().isOp()) {
|
private String repo;
|
||||||
return;
|
private JavaPlugin plugin;
|
||||||
}
|
private String current_version;
|
||||||
Player player = event.getPlayer();
|
|
||||||
if (latest_release != null && isNewVersion(current_version, latest_release.tag_name)) {
|
|
||||||
Notification.info(player, "发现新版本:" + latest_release.tag_name + " 详细内容请查看控制台或点击下方链接");
|
|
||||||
Component download = Component.text(latest_release.html_url).clickEvent(ClickEvent.openUrl(latest_release.html_url)).hoverEvent(Component.text("点击打开"));
|
|
||||||
Notification.info(player,download);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final String gitea_server;
|
|
||||||
private final String owner;
|
|
||||||
private final String repo;
|
|
||||||
private final JavaPlugin plugin;
|
|
||||||
private final String current_version;
|
|
||||||
private GiteaRelease latest_release = null;
|
private GiteaRelease latest_release = null;
|
||||||
private boolean auto_update = false;
|
private boolean auto_update = false;
|
||||||
|
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
|
|
||||||
public class ImageTool {
|
|
||||||
|
|
||||||
public static BufferedImage resize(BufferedImage image, float scale) {
|
|
||||||
int new_width = (int) (image.getWidth() * scale);
|
|
||||||
int new_height = (int) (image.getHeight() * scale);
|
|
||||||
BufferedImage newImage = new BufferedImage(new_width, new_height, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
newImage.getGraphics().drawImage(image, 0, 0, new_width, new_height, null);
|
|
||||||
return newImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BufferedImage center(BufferedImage image, int width, int height) {
|
|
||||||
int image_width = image.getWidth();
|
|
||||||
int image_height = image.getHeight();
|
|
||||||
BufferedImage newImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
newImage.getGraphics().drawImage(image, (width - image_width) / 2, (height - image_height) / 2, null);
|
|
||||||
return newImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BufferedImage thumb(BufferedImage img) {
|
|
||||||
double scale;
|
|
||||||
if (img.getWidth() > img.getHeight()) {
|
|
||||||
scale = 128.0 / img.getWidth();
|
|
||||||
} else {
|
|
||||||
scale = 128.0 / img.getHeight();
|
|
||||||
}
|
|
||||||
return center(resize(img, (float) scale), 128, 128);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,125 +5,59 @@ import net.kyori.adventure.text.format.Style;
|
|||||||
import net.kyori.adventure.text.format.TextColor;
|
import net.kyori.adventure.text.format.TextColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class Notification {
|
public class Notification {
|
||||||
public static Notification instance;
|
|
||||||
|
|
||||||
public final SendMessageAbstract sender;
|
|
||||||
|
|
||||||
public Notification(JavaPlugin plugin) {
|
|
||||||
instance = this;
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.prefix = "[" + plugin.getName() + "]";
|
|
||||||
this.sender = new SendMessageAbstract(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Style i_style = Style.style(TextColor.color(139, 255, 123));
|
private static final Style i_style = Style.style(TextColor.color(139, 255, 123));
|
||||||
private static final Style w_style = Style.style(TextColor.color(255, 185, 69));
|
private static final Style w_style = Style.style(TextColor.color(255, 185, 69));
|
||||||
private static final Style e_style = Style.style(TextColor.color(255, 96, 72));
|
private static final Style e_style = Style.style(TextColor.color(255, 96, 72));
|
||||||
private static final Style d_style = Style.style(TextColor.color(0, 255, 255));
|
|
||||||
|
|
||||||
private String prefix;
|
private static final String prefix = "[ColorfulMap] ";
|
||||||
private JavaPlugin plugin;
|
|
||||||
|
|
||||||
public void setPrefix(String prefix) {
|
|
||||||
this.prefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(Player player, String msg) {
|
public static void info(Player player, String msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix + " " + msg, i_style));
|
player.sendMessage(Component.text(prefix + msg, i_style));
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(Player player, String msg, Object... args) {
|
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix + " " + String.format(msg, args), i_style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(Player player, String msg) {
|
public static void warn(Player player, String msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix + " " + msg, w_style));
|
player.sendMessage(Component.text(prefix + msg, w_style));
|
||||||
}
|
|
||||||
|
|
||||||
public static void warn(Player player, String msg, Object... args) {
|
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix + " " + String.format(msg, args), w_style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(Player player, String msg) {
|
public static void error(Player player, String msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix + " " + msg, e_style));
|
player.sendMessage(Component.text(prefix + msg, e_style));
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(Player player, String msg, Object... args) {
|
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix + " " + String.format(msg, args), e_style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(CommandSender sender, String msg) {
|
public static void info(CommandSender sender, String msg) {
|
||||||
instance.sender.sendMessage(sender, Component.text(instance.prefix + " " + msg, i_style));
|
sender.sendMessage(Component.text(prefix + msg, i_style));
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(CommandSender sender, String msg, Object... args) {
|
|
||||||
instance.sender.sendMessage(sender, Component.text(instance.prefix + " " + String.format(msg, args), i_style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(CommandSender sender, String msg) {
|
public static void warn(CommandSender sender, String msg) {
|
||||||
instance.sender.sendMessage(sender, Component.text(instance.prefix + " " + msg, w_style));
|
sender.sendMessage(Component.text(prefix + msg, w_style));
|
||||||
}
|
|
||||||
|
|
||||||
public static void warn(CommandSender sender, String msg, Object... args) {
|
|
||||||
instance.sender.sendMessage(sender, Component.text(instance.prefix + " " + String.format(msg, args), w_style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(CommandSender sender, String msg) {
|
public static void error(CommandSender sender, String msg) {
|
||||||
instance.sender.sendMessage(sender, Component.text(instance.prefix + " " + msg, e_style));
|
sender.sendMessage(Component.text(prefix + msg, e_style));
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(CommandSender sender, String msg, Object... args) {
|
|
||||||
instance.sender.sendMessage(sender, Component.text(instance.prefix + " " + String.format(msg, args), e_style));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(Player player, Component msg) {
|
public static void info(Player player, Component msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix, i_style).append(Component.text(" ")).append(msg));
|
player.sendMessage(Component.text(prefix, i_style).append(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(Player player, Component msg) {
|
public static void warn(Player player, Component msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix, w_style).append(Component.text(" ")).append(msg));
|
player.sendMessage(Component.text(prefix, w_style).append(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(Player player, Component msg) {
|
public static void error(Player player, Component msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix, e_style).append(Component.text(" ")).append(msg));
|
player.sendMessage(Component.text(prefix, e_style).append(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(CommandSender player, Component msg) {
|
public static void info(CommandSender player, Component msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix, i_style).append(Component.text(" ")).append(msg));
|
player.sendMessage(Component.text(prefix, i_style).append(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(CommandSender player, Component msg) {
|
public static void warn(CommandSender player, Component msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix, w_style).append(Component.text(" ")).append(msg));
|
player.sendMessage(Component.text(prefix, w_style).append(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(CommandSender player, Component msg) {
|
public static void error(CommandSender player, Component msg) {
|
||||||
instance.sender.sendMessage(player, Component.text(instance.prefix, e_style).append(Component.text(" ")).append(msg));
|
player.sendMessage(Component.text(prefix, e_style).append(msg));
|
||||||
}
|
|
||||||
|
|
||||||
public static void all(String msg) {
|
|
||||||
instance.sender.broadcast(Component.text(instance.prefix + " " + msg, i_style));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void all(Component msg) {
|
|
||||||
instance.sender.broadcast(Component.text(instance.prefix, i_style).append(Component.text(" ")).append(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void all(String msg, Object... args) {
|
|
||||||
instance.sender.broadcast(Component.text(instance.prefix + " " + String.format(msg, args), i_style));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void actionBar(Player player, String msg) {
|
|
||||||
instance.sender.sendActionBar(player, Component.text(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void actionBar(Player player, String msg, Object... args) {
|
|
||||||
instance.sender.sendActionBar(player, Component.text(String.format(msg, args)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void actionBar(Player player, Component msg) {
|
|
||||||
instance.sender.sendActionBar(player, msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static cn.lunadeer.colorfulmap.utils.Common.isPaper;
|
|
||||||
|
|
||||||
public class Scheduler {
|
|
||||||
public static Scheduler instance;
|
|
||||||
private final JavaPlugin plugin;
|
|
||||||
private boolean isPaper = false;
|
|
||||||
|
|
||||||
public Scheduler(JavaPlugin plugin) {
|
|
||||||
instance = this;
|
|
||||||
this.plugin = plugin;
|
|
||||||
this.isPaper = isPaper();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void cancelAll() {
|
|
||||||
if (instance.isPaper) {
|
|
||||||
instance.plugin.getServer().getGlobalRegionScheduler().cancelTasks(instance.plugin);
|
|
||||||
instance.plugin.getServer().getGlobalRegionScheduler().cancelTasks(instance.plugin);
|
|
||||||
} else {
|
|
||||||
instance.plugin.getServer().getScheduler().cancelTasks(instance.plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run a task asynchronously
|
|
||||||
*
|
|
||||||
* @param task The task to run
|
|
||||||
* @return The scheduled task
|
|
||||||
*/
|
|
||||||
public static void runTaskAsync(Runnable task) {
|
|
||||||
if (instance.isPaper) {
|
|
||||||
instance.plugin.getServer().getAsyncScheduler().runNow(instance.plugin, (plugin) -> task.run());
|
|
||||||
} else {
|
|
||||||
instance.plugin.getServer().getScheduler().runTask(instance.plugin, task);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run a task repeatedly asynchronously
|
|
||||||
*
|
|
||||||
* @param task The task to run
|
|
||||||
* @param delay The delay in milliseconds
|
|
||||||
* @param period The period in milliseconds
|
|
||||||
* @return The scheduled task
|
|
||||||
*/
|
|
||||||
public static void runTaskRepeatAsync(Runnable task, long delay, long period) {
|
|
||||||
if (instance.isPaper) {
|
|
||||||
instance.plugin.getServer().getAsyncScheduler().runAtFixedRate(instance.plugin, (plugin) -> task.run(), delay * 50, period * 50, TimeUnit.MILLISECONDS);
|
|
||||||
} else {
|
|
||||||
instance.plugin.getServer().getScheduler().runTaskTimerAsynchronously(instance.plugin, task, delay, period);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
|
||||||
|
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
|
||||||
import net.kyori.adventure.text.Component;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class SendMessageAbstract {
|
|
||||||
|
|
||||||
private BukkitAudiences adventure = null;
|
|
||||||
private JavaPlugin plugin;
|
|
||||||
|
|
||||||
public SendMessageAbstract(JavaPlugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
if (!Common.isPaper()) {
|
|
||||||
this.adventure = BukkitAudiences.create(plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendMessage(Player player, Component msg) {
|
|
||||||
if (this.adventure == null) {
|
|
||||||
player.sendMessage(msg);
|
|
||||||
} else {
|
|
||||||
this.adventure.player(player).sendMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendMessage(CommandSender sender, Component msg) {
|
|
||||||
if (this.adventure == null) {
|
|
||||||
sender.sendMessage(msg);
|
|
||||||
} else {
|
|
||||||
this.adventure.sender(sender).sendMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void broadcast(Component msg) {
|
|
||||||
if (this.adventure == null) {
|
|
||||||
plugin.getServer().broadcast(msg);
|
|
||||||
} else {
|
|
||||||
adventure.all().sendMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendActionBar(Player player, Component msg) {
|
|
||||||
if (this.adventure == null) {
|
|
||||||
player.sendActionBar(msg);
|
|
||||||
} else {
|
|
||||||
this.adventure.player(player).sendActionBar(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
67
src/main/java/cn/lunadeer/colorfulmap/utils/Time.java
Normal file
67
src/main/java/cn/lunadeer/colorfulmap/utils/Time.java
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package cn.lunadeer.colorfulmap.utils;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class Time {
|
||||||
|
|
||||||
|
public static String nowStr() {
|
||||||
|
// yyyy-MM-dd HH:mm:ss
|
||||||
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 尝试获取folia的调度器
|
||||||
|
*
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
private static boolean tryFolia() {
|
||||||
|
try {
|
||||||
|
Bukkit.getAsyncScheduler();
|
||||||
|
return true;
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Boolean IS_FOLIA = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是folia核心
|
||||||
|
*
|
||||||
|
* @return 是否是folia核心
|
||||||
|
*/
|
||||||
|
public static Boolean isFolia() {
|
||||||
|
if (IS_FOLIA == null) IS_FOLIA = tryFolia();
|
||||||
|
return IS_FOLIA;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时异步任务
|
||||||
|
*
|
||||||
|
* @param plugin 插件
|
||||||
|
* @param runnable 任务
|
||||||
|
* @param ticks 间隔
|
||||||
|
*/
|
||||||
|
public static void runAtFixedRateAsync(Plugin plugin, Runnable runnable, int ticks) {
|
||||||
|
if (isFolia())
|
||||||
|
Bukkit.getAsyncScheduler().runAtFixedRate(plugin, (task) -> runnable.run(), ticks / 20, ticks / 20, TimeUnit.SECONDS);
|
||||||
|
else Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, ticks, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runLater(Plugin plugin, Runnable runnable, int ticks) {
|
||||||
|
if (isFolia())
|
||||||
|
Bukkit.getAsyncScheduler().runDelayed(plugin, (task) -> runnable.run(), ticks / 20, TimeUnit.SECONDS);
|
||||||
|
else Bukkit.getScheduler().runTaskLater(plugin, runnable, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runAsync(Plugin plugin, Runnable runnable) {
|
||||||
|
if (isFolia())
|
||||||
|
Bukkit.getAsyncScheduler().runNow(plugin, (task) -> runnable.run());
|
||||||
|
else Bukkit.getScheduler().runTaskAsynchronously(plugin, runnable);
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.ColorfulMap;
|
|
||||||
|
|
||||||
public class UrlTools {
|
|
||||||
|
|
||||||
public static boolean isInWhiteList(String url) {
|
|
||||||
if (ColorfulMap.config.getAddressWhiteList().isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (String whiteUrl : ColorfulMap.config.getAddressWhiteList()) {
|
|
||||||
if (url.startsWith(whiteUrl)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (url.startsWith("http://" + whiteUrl)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (url.startsWith("https://" + whiteUrl)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils.VaultConnect;
|
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class Vault implements VaultInterface {
|
|
||||||
|
|
||||||
private Economy econ = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(JavaPlugin plugin) {
|
|
||||||
RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
if (rsp != null) {
|
|
||||||
econ = rsp.getProvider();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
XLogger.err("Vault 不可用");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String currencyNamePlural() {
|
|
||||||
return econ.currencyNamePlural();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String currencyNameSingular() {
|
|
||||||
return econ.currencyNameSingular();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void withdrawPlayer(Player player, double amount) {
|
|
||||||
econ.withdrawPlayer(player, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void depositPlayer(Player player, double amount) {
|
|
||||||
econ.depositPlayer(player, amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getBalance(Player player) {
|
|
||||||
return econ.getBalance(player);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils.VaultConnect;
|
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
|
||||||
import net.milkbowl.vault2.economy.Economy;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
public class Vault2 implements VaultInterface {
|
|
||||||
|
|
||||||
private Economy econ = null;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean init(JavaPlugin plugin) {
|
|
||||||
RegisteredServiceProvider<Economy> rsp = plugin.getServer().getServicesManager().getRegistration(Economy.class);
|
|
||||||
if (rsp != null) {
|
|
||||||
econ = rsp.getProvider();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
XLogger.err("VaultUnlocked 不可用");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String currencyNamePlural() {
|
|
||||||
return econ.defaultCurrencyNamePlural();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String currencyNameSingular() {
|
|
||||||
return econ.defaultCurrencyNameSingular();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void withdrawPlayer(Player player, double amount) {
|
|
||||||
econ.withdraw("MPU", player.getUniqueId(), BigDecimal.valueOf(amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void depositPlayer(Player player, double amount) {
|
|
||||||
econ.deposit("MPU", player.getUniqueId(), BigDecimal.valueOf(amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getBalance(Player player) {
|
|
||||||
return econ.getBalance("MPU", player.getUniqueId()).doubleValue();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,94 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils.VaultConnect;
|
|
||||||
|
|
||||||
import cn.lunadeer.colorfulmap.utils.XLogger;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.server.ServiceRegisterEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class VaultConnect implements Listener {
|
|
||||||
|
|
||||||
public static VaultConnect instance;
|
|
||||||
private VaultInterface vaultInstance = null;
|
|
||||||
private JavaPlugin plugin;
|
|
||||||
|
|
||||||
public VaultConnect(JavaPlugin plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
instance = this;
|
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
|
||||||
public void onEnable(ServiceRegisterEvent event) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean economyAvailable() {
|
|
||||||
if (vaultInstance == null) {
|
|
||||||
if (foundClass("net.milkbowl.vault.economy.Economy")) {
|
|
||||||
vaultInstance = new Vault();
|
|
||||||
} else if (foundClass("net.milkbowl.vault2.economy.Economy")) {
|
|
||||||
vaultInstance = new Vault2();
|
|
||||||
} else {
|
|
||||||
XLogger.err("没有可用的经济插件");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!vaultInstance.init(plugin)) {
|
|
||||||
vaultInstance = null;
|
|
||||||
XLogger.err("没有可用的经济插件");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String currencyNamePlural() {
|
|
||||||
if (economyAvailable()) {
|
|
||||||
return vaultInstance.currencyNamePlural();
|
|
||||||
}
|
|
||||||
XLogger.warn("没有可用的经济插件");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String currencyNameSingular() {
|
|
||||||
if (economyAvailable()) {
|
|
||||||
return vaultInstance.currencyNameSingular();
|
|
||||||
}
|
|
||||||
XLogger.warn("没有可用的经济插件");
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void withdrawPlayer(Player player, double amount) {
|
|
||||||
if (economyAvailable()) {
|
|
||||||
vaultInstance.withdrawPlayer(player, amount);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
XLogger.warn("没有可用的经济插件");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void depositPlayer(Player player, double amount) {
|
|
||||||
if (economyAvailable()) {
|
|
||||||
vaultInstance.depositPlayer(player, amount);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
XLogger.warn("没有可用的经济插件");
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getBalance(Player player) {
|
|
||||||
if (economyAvailable()) {
|
|
||||||
return vaultInstance.getBalance(player);
|
|
||||||
}
|
|
||||||
XLogger.warn("没有可用的经济插件");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean foundClass(String className) {
|
|
||||||
try {
|
|
||||||
Class.forName(className);
|
|
||||||
return true;
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils.VaultConnect;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public interface VaultInterface {
|
|
||||||
|
|
||||||
public boolean init(JavaPlugin plugin);
|
|
||||||
|
|
||||||
public String currencyNamePlural();
|
|
||||||
|
|
||||||
|
|
||||||
public String currencyNameSingular();
|
|
||||||
|
|
||||||
public void withdrawPlayer(Player player, double amount);
|
|
||||||
|
|
||||||
public void depositPlayer(Player player, double amount);
|
|
||||||
|
|
||||||
public double getBalance(Player player);
|
|
||||||
|
|
||||||
}
|
|
@ -1,62 +1,56 @@
|
|||||||
package cn.lunadeer.colorfulmap.utils;
|
package cn.lunadeer.colorfulmap.utils;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import cn.lunadeer.colorfulmap.ColorfulMap;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class XLogger {
|
public class XLogger {
|
||||||
public static XLogger instance;
|
private static final ColorfulMap _plugin = ColorfulMap.instance;
|
||||||
|
private static final Logger _logger = _plugin.getLogger();
|
||||||
|
|
||||||
public XLogger() {
|
private static final String prefix = "[ColorfulMap] ";
|
||||||
instance = this;
|
|
||||||
this._logger = Logger.getLogger("Lunadeer");
|
public static void info(Player player, String message) {
|
||||||
|
Notification.info(player, prefix + "I | " + message);
|
||||||
|
if (ColorfulMap.config.isDebug())
|
||||||
|
debug("来自玩家[ " + player.getName() + " ] 的信息 | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public XLogger(@Nullable JavaPlugin plugin) {
|
|
||||||
instance = this;
|
|
||||||
this._logger = plugin != null ? plugin.getLogger() : Logger.getLogger("Lunadeer");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static XLogger setDebug(boolean debug) {
|
|
||||||
instance._debug = debug;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Logger _logger;
|
|
||||||
private boolean _debug = false;
|
|
||||||
|
|
||||||
public static void info(String message) {
|
public static void info(String message) {
|
||||||
instance._logger.info(" I | " + message);
|
_logger.info(" I | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(String message, Object... args) {
|
public static void warn(Player player, String message) {
|
||||||
instance._logger.info(" I | " + String.format(message, args));
|
Notification.warn(player, prefix + "W | " + message);
|
||||||
|
if (ColorfulMap.config.isDebug())
|
||||||
|
debug("来自玩家[ " + player.getName() + " ] 的警告 | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String message) {
|
public static void warn(String message) {
|
||||||
instance._logger.warning(" W | " + message);
|
_logger.info(" W | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String message, Object... args) {
|
public static void err(Player player, String message) {
|
||||||
instance._logger.warning(" W | " + String.format(message, args));
|
Notification.error(player, prefix + "E | " + message);
|
||||||
|
if (ColorfulMap.config.isDebug())
|
||||||
|
debug("来自玩家[ " + player.getName() + " ] 的报错 | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void err(String message) {
|
public static void err(String message) {
|
||||||
instance._logger.severe(" E | " + message);
|
_logger.info(" E | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void err(String message, Object... args) {
|
public static void debug(Player player, String message) {
|
||||||
instance._logger.severe(" E | " + String.format(message, args));
|
if (!ColorfulMap.config.isDebug()) return;
|
||||||
|
if (player.isOp())
|
||||||
|
Notification.info(player, prefix + "D | " + message);
|
||||||
|
else
|
||||||
|
debug("来自玩家[ " + player.getName() + " ] 的调试 | " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(String message) {
|
public static void debug(String message) {
|
||||||
if (!instance._debug) return;
|
if (!ColorfulMap.config.isDebug()) return;
|
||||||
instance._logger.info(" D | " + message);
|
_logger.info(" D | " + message);
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String message, Object... args) {
|
|
||||||
if (!instance._debug) return;
|
|
||||||
instance._logger.info(" D | " + String.format(message, args));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,6 @@ MaxFrameX: 32
|
|||||||
|
|
||||||
MaxFrameY: 18
|
MaxFrameY: 18
|
||||||
|
|
||||||
Economy:
|
|
||||||
Enable: false
|
|
||||||
CostPerMap: 100.0
|
|
||||||
|
|
||||||
AddressWhiteList: []
|
|
||||||
|
|
||||||
CheckUpdate: true
|
CheckUpdate: true
|
||||||
|
|
||||||
Debug: false
|
Debug: false
|
@ -9,21 +9,7 @@ commands:
|
|||||||
description: 将图片转换为地图画
|
description: 将图片转换为地图画
|
||||||
usage: /tomap <图片url> [缩放比例(默认1)]
|
usage: /tomap <图片url> [缩放比例(默认1)]
|
||||||
permission: colorfulmap.tomap
|
permission: colorfulmap.tomap
|
||||||
reloadColorfulMap:
|
|
||||||
description: 重载ColorfulMap配置
|
|
||||||
usage: /reloadColorfulMap
|
|
||||||
permission: colorfulmap.reload
|
|
||||||
purgeColorfulMap:
|
|
||||||
description: 清除无效的地图画
|
|
||||||
usage: /purgeColorfulMap
|
|
||||||
permission: colorfulmap.purge
|
|
||||||
permissions:
|
permissions:
|
||||||
colorfulmap.tomap:
|
colorfulmap.tomap:
|
||||||
description: 允许使用/tomap命令
|
description: 允许使用/tomap命令
|
||||||
default: true
|
default: true
|
||||||
colorfulmap.reload:
|
|
||||||
description: 允许使用/reloadColorfulMap命令
|
|
||||||
default: op
|
|
||||||
colorfulmap.purge:
|
|
||||||
description: 允许使用/purgeColorfulMap命令
|
|
||||||
default: op
|
|
||||||
|
Loading…
Reference in New Issue
Block a user