-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.9.5]修复paper端情况下会导致其他插件铁砧和切石机逻辑异常的bug
- Loading branch information
YufiriaMazenta
committed
Jun 7, 2024
1 parent
fa2ddde
commit ae82a5a
Showing
7 changed files
with
145 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import java.text.SimpleDateFormat | ||
version = "1.9.4" | ||
version = "1.9.5" | ||
|
||
plugins { | ||
`java-library` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...a/com/github/yufiriamazenta/craftorithm/listener/OtherPluginsGrindstoneListenerProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.github.yufiriamazenta.craftorithm.listener; | ||
|
||
import crypticlib.CrypticLib; | ||
import crypticlib.listener.BukkitListener; | ||
import crypticlib.platform.IPlatform; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.EventPriority; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.inventory.PrepareGrindstoneEvent; | ||
import org.bukkit.plugin.RegisteredListener; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* 因为Grindstone在1.19才有,所以要独立出来 | ||
*/ | ||
@BukkitListener | ||
public enum OtherPluginsGrindstoneListenerProxy implements Listener { | ||
|
||
INSTANCE; | ||
|
||
@EventHandler(priority = EventPriority.LOWEST) | ||
public void proxyLowestPrepareGrindstone(PrepareGrindstoneEvent event) { | ||
proxyPrepareGrindstone(event, EventPriority.LOWEST); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.LOW) | ||
public void proxyLowPrepareGrindstone(PrepareGrindstoneEvent event) { | ||
proxyPrepareGrindstone(event, EventPriority.LOW); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.NORMAL) | ||
public void proxyNormalPrepareGrindstone(PrepareGrindstoneEvent event) { | ||
proxyPrepareGrindstone(event, EventPriority.NORMAL); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.HIGH) | ||
public void proxyHighPrepareGrindstone(PrepareGrindstoneEvent event) { | ||
proxyPrepareGrindstone(event, EventPriority.HIGH); | ||
} | ||
|
||
@EventHandler(priority = EventPriority.HIGHEST) | ||
public void proxyHighestPrepareGrindstone(PrepareGrindstoneEvent event) { | ||
proxyPrepareGrindstone(event, EventPriority.HIGHEST); | ||
} | ||
|
||
|
||
@EventHandler(priority = EventPriority.MONITOR) | ||
public void proxyMonitorPrepareGrindstone(PrepareGrindstoneEvent event) { | ||
proxyPrepareGrindstone(event, EventPriority.MONITOR); | ||
} | ||
|
||
public void proxyPrepareGrindstone(PrepareGrindstoneEvent event, EventPriority priority) { | ||
//因为只有paper及下游服务端才有这个问题,如果识别到是bukkit或者spigot,就不用处理 | ||
if (CrypticLib.platform().platform().equals(IPlatform.Platform.BUKKIT)) { | ||
return; | ||
} | ||
OtherPluginsListenerProxy proxy = OtherPluginsListenerProxy.INSTANCE; | ||
List<RegisteredListener> registeredListeners = proxy.getPrepareItemCraftEventListeners().get(priority); | ||
if (registeredListeners == null || registeredListeners.isEmpty()) { | ||
return; | ||
} | ||
proxy.executeListener(event, registeredListeners); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters