diff --git a/pom.xml b/pom.xml
index 6032c06..244b648 100644
--- a/pom.xml
+++ b/pom.xml
@@ -175,6 +175,13 @@
true
+
+ xyz.xenondevs
+ particle
+ 1.8.3
+ compile
+ true
+
org.spigotmc
@@ -313,6 +320,10 @@
org.bstats
cc.carm.plugin.moeteleport.lib.bstats
+
+ xyz.xenondevs.particle
+ cc.carm.plugin.moeteleport.lib.praticle
+
org.json
cc.carm.plugin.moeteleport.lib.json
diff --git a/src/main/java/cc/carm/plugin/moeteleport/Main.java b/src/main/java/cc/carm/plugin/moeteleport/Main.java
index c4a8156..735cfb7 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/Main.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/Main.java
@@ -15,6 +15,7 @@
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit;
+import xyz.xenondevs.particle.utils.ReflectionUtils;
public class Main extends EasyPlugin {
private static Main instance;
@@ -34,7 +35,7 @@ public Main() {
}
@Override
- protected boolean initialize() {
+ protected void load() {
log("加载插件配置文件...");
this.configProvider = MineConfiguration.from(this, "config.yml");
@@ -43,6 +44,11 @@ protected boolean initialize() {
this.messageProvider = MineConfiguration.from(this, "messages.yml");
this.messageProvider.initialize(PluginMessages.class);
+ }
+
+ @Override
+ protected boolean initialize() {
+
log("初始化存储方式...");
StorageMethod storageMethod = StorageMethod.read(PluginConfig.STORAGE.METHOD.get());
@@ -56,7 +62,6 @@ protected boolean initialize() {
return false; // 初始化失败,不再继续加载
}
-
log("加载地标管理器...");
warpManager = new WarpManager();
@@ -90,7 +95,6 @@ protected boolean initialize() {
e.printStackTrace();
}
-
if (PluginConfig.METRICS.getNotNull()) {
log("启用统计数据...");
Metrics metrics = new Metrics(this, 14459);
@@ -104,6 +108,9 @@ protected boolean initialize() {
log("已禁用检查更新,跳过。");
}
+ log("初始化粒子库...");
+ ReflectionUtils.setPlugin(this);
+
return true;
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/listener/TeleportListener.java b/src/main/java/cc/carm/plugin/moeteleport/listener/TeleportListener.java
index a114b94..87bac78 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/listener/TeleportListener.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/listener/TeleportListener.java
@@ -23,7 +23,7 @@ public void onMove(PlayerMoveEvent event) {
if (from.getBlockX() == to.getBlockX()
&& from.getBlockY() == to.getBlockY()
- && from.getBlockZ() == to.getBlockZ()){
+ && from.getBlockZ() == to.getBlockZ()) {
return;
}
diff --git a/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java b/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java
index a20d093..193858c 100644
--- a/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java
+++ b/src/main/java/cc/carm/plugin/moeteleport/manager/TeleportManager.java
@@ -12,6 +12,8 @@
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.Nullable;
+import xyz.xenondevs.particle.ParticleBuilder;
+import xyz.xenondevs.particle.ParticleEffect;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
@@ -42,6 +44,8 @@ public void shutdown() {
}
public void tickQueue() {
+ boolean enableEffect = PluginConfig.TELEPORTATION.EFFECTS.getNotNull();
+
Iterator> queueIterator = teleportQueue.entrySet().iterator();
while (queueIterator.hasNext()) {
Map.Entry entry = queueIterator.next();
@@ -52,6 +56,12 @@ public void tickQueue() {
queue.getPlayer(),
queue.getRemainSeconds() + 1, queue.getTarget().getText()
);
+
+ if (enableEffect) {
+ new ParticleBuilder(ParticleEffect.PORTAL, queue.getPlayer().getLocation())
+ .setAmount(100).display();
+ }
+
continue;
}
@@ -74,6 +84,14 @@ public TeleportQueue getQueue(Player player) {
return getQueue(player.getUniqueId());
}
+ public boolean isChanneling(UUID uuid) {
+ return teleportQueue.containsKey(uuid);
+ }
+
+ public boolean isChanneling(Player player) {
+ return isChanneling(player.getUniqueId());
+ }
+
public @Nullable Duration getDelayDuration() {
return Duration.of(PluginConfig.TELEPORTATION.WAIT_TIME.getNotNull(), ChronoUnit.SECONDS);
}