perf(bukkit): 优化 gui 按钮声音播放代码
This commit is contained in:
@@ -14,7 +14,7 @@ dependencies {
|
|||||||
exclude group: "com.google.code.gson"
|
exclude group: "com.google.code.gson"
|
||||||
}
|
}
|
||||||
|
|
||||||
shade 'net.kyori:adventure-platform-bukkit:4.1.2'
|
// shade 'net.kyori:adventure-platform-bukkit:4.1.2'
|
||||||
compileOnly('net.milkbowl.vault:VaultAPI:1.7') { transitive = false }
|
compileOnly('net.milkbowl.vault:VaultAPI:1.7') { transitive = false }
|
||||||
compileOnly('org.black_ixx:playerpoints:2.1.3') { transitive = false }
|
compileOnly('org.black_ixx:playerpoints:2.1.3') { transitive = false }
|
||||||
compileOnly("com.comphenix.protocol:ProtocolLib-API:4.4.0") { transitive = false }
|
compileOnly("com.comphenix.protocol:ProtocolLib-API:4.4.0") { transitive = false }
|
||||||
@@ -43,7 +43,7 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.compileJava.dependsOn(":hamster-core-common:build")
|
tasks.compileJava.dependsOn(":hamster-core-common:build")
|
||||||
tasks.create("shadowJar", Jar) {
|
tasks.register("shadowJar", Jar) {
|
||||||
dependsOn("jar")
|
dependsOn("jar")
|
||||||
from([
|
from([
|
||||||
tasks.jar.outputs.files.collect {
|
tasks.jar.outputs.files.collect {
|
||||||
@@ -57,7 +57,7 @@ tasks.create("shadowJar", Jar) {
|
|||||||
}
|
}
|
||||||
tasks.build.dependsOn(shadowJar)
|
tasks.build.dependsOn(shadowJar)
|
||||||
|
|
||||||
tasks.create("oldJar", Jar) {
|
tasks.register("oldJar", Jar) {
|
||||||
dependsOn("jar")
|
dependsOn("jar")
|
||||||
setClassifier("Old")
|
setClassifier("Old")
|
||||||
from([
|
from([
|
||||||
|
@@ -54,13 +54,22 @@ public abstract class PageHandler implements InventoryHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayButtonSound(@NotNull ClickType clickType, @NotNull InventoryAction action, int index) {
|
public void onPlayButtonSound(@NotNull ClickType clickType, @NotNull InventoryAction action, int index) {
|
||||||
PageConfig config = getPageConfig();
|
if (!(player instanceof Player)) {
|
||||||
Sound sound = config.getButtonSound(getButtonGroup().getButtonName(index));
|
|
||||||
sound = sound == null ? config.getButtonSound("default") : sound;
|
|
||||||
if (sound == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(player instanceof Player)) {
|
PageConfig config = getPageConfig();
|
||||||
|
String buttonName = getButtonGroup().getButtonName(index);
|
||||||
|
Sound sound = config.getButtonSound(buttonName);
|
||||||
|
if (sound == null) {
|
||||||
|
switch (buttonName) {
|
||||||
|
case "empty":
|
||||||
|
case "barrier":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sound = config.getButtonSound("default");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sound == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((Player) player).playSound(player.getLocation(), sound, 1, 1);
|
((Player) player).playSound(player.getLocation(), sound, 1, 1);
|
||||||
|
Reference in New Issue
Block a user