Skip to content

Commit e49ac7c

Browse files
committed
Bump to MC 26.1, and add Trumpet sounds to JingleNote
1 parent c40d2cd commit e49ac7c

5 files changed

Lines changed: 60 additions & 122 deletions

File tree

build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ allprojects {
9393
}
9494

9595
dependencies {
96-
compileOnly 'org.spigotmc:spigot-api:1.21.5-R0.1-SNAPSHOT'
97-
compileOnly 'com.sk89q.worldedit:worldedit-core:7.3.12-SNAPSHOT'
98-
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.3.12-SNAPSHOT'
99-
compileOnly 'com.sk89q.worldguard:worldguard-core:7.0.14-SNAPSHOT'
100-
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.14-SNAPSHOT'
96+
compileOnly 'org.spigotmc:spigot-api:26.1.2-R0.1-SNAPSHOT'
97+
compileOnly 'com.sk89q.worldedit:worldedit-core:7.4.1'
98+
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.4.1'
99+
compileOnly 'com.sk89q.worldguard:worldguard-core:7.0.16'
100+
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.16'
101101
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
102102
compileOnly 'net.dmulloy2:ProtocolLib:5.4.0'
103103
compileOnly 'fr.neatmonster:nocheatplus:3.15.1-RC'
@@ -106,8 +106,8 @@ allprojects {
106106
implementation "io.papermc:paperlib:1.0.7"
107107
implementation 'org.bstats:bstats-bukkit:2.2.1'
108108

109-
testImplementation 'org.spigotmc:spigot-api:1.21.3-R0.1-SNAPSHOT'
110-
testImplementation 'com.sk89q.worldedit:worldedit-core:7.3.8-SNAPSHOT'
109+
testImplementation 'org.spigotmc:spigot-api:26.1.2-R0.1-SNAPSHOT'
110+
testImplementation 'com.sk89q.worldedit:worldedit-core:7.4.1'
111111
testImplementation group: 'junit', name: 'junit', version: '4.12'
112112
testImplementation group: 'org.powermock', name: 'powermock-api-mockito', version: '1.7.4'
113113
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: '1.7.4'
Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.sk89q.craftbook.util.jinglenote;
22

33
public enum Instrument {
4-
54
BANJO,
65
BASEDRUM,
76
BASS,
@@ -17,43 +16,34 @@ public enum Instrument {
1716
IRON_XYLOPHONE,
1817
PLING,
1918
SNARE,
19+
TRUMPET,
20+
TRUMPET_DISTORTED,
21+
TROMBONE,
22+
TROMBONE_DISTORTED,
2023
XYLOPHONE;
2124

2225
public static Instrument toMCSound(byte instrument) {
23-
switch (instrument) {
24-
case 1:
25-
return Instrument.BASS;
26-
case 2:
27-
return Instrument.SNARE;
28-
case 3:
29-
return Instrument.HAT;
30-
case 4:
31-
return Instrument.BASEDRUM;
32-
case 5:
33-
return Instrument.GUITAR;
34-
case 6:
35-
return Instrument.BELL;
36-
case 7:
37-
return Instrument.CHIME;
38-
case 8:
39-
return Instrument.FLUTE;
40-
case 9:
41-
return Instrument.XYLOPHONE;
42-
case 10:
43-
return Instrument.PLING;
44-
case 11:
45-
return Instrument.BANJO;
46-
case 12:
47-
return Instrument.BIT;
48-
case 13:
49-
return Instrument.COW_BELL;
50-
case 14:
51-
return Instrument.DIDGERIDOO;
52-
case 15:
53-
return Instrument.IRON_XYLOPHONE;
54-
case 0:
55-
default:
56-
return Instrument.HARP;
57-
}
26+
return switch (instrument) {
27+
case 1 -> Instrument.BASS;
28+
case 2 -> Instrument.SNARE;
29+
case 3 -> Instrument.HAT;
30+
case 4 -> Instrument.BASEDRUM;
31+
case 5 -> Instrument.GUITAR;
32+
case 6 -> Instrument.BELL;
33+
case 7 -> Instrument.CHIME;
34+
case 8 -> Instrument.FLUTE;
35+
case 9 -> Instrument.XYLOPHONE;
36+
case 10 -> Instrument.PLING;
37+
case 11 -> Instrument.BANJO;
38+
case 12 -> Instrument.BIT;
39+
case 13 -> Instrument.COW_BELL;
40+
case 14 -> Instrument.DIDGERIDOO;
41+
case 15 -> Instrument.IRON_XYLOPHONE;
42+
case 16 -> Instrument.TRUMPET;
43+
case 17 -> Instrument.TRUMPET_DISTORTED;
44+
case 18 -> Instrument.TROMBONE;
45+
case 19 -> Instrument.TROMBONE_DISTORTED;
46+
default -> Instrument.HARP;
47+
};
5848
}
59-
}
49+
}

src/main/java/com/sk89q/craftbook/util/jinglenote/MidiJingleSequencer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public final class MidiJingleSequencer implements JingleSequencer {
3636
1, 1, 1, 1, 1, 1, 1, 1, // 32-39
3737
0,10,10, 1, 0, 0, 0, 4, // 40-47
3838
0, 0, 0, 0, 8, 8, 8,12, // 48-55
39-
8,14,14,14,14,14, 8, 8, // 56-63
40-
8, 8, 8,14,14, 8, 8, 8, // 64-71
39+
16,18,18,16,16,17,17,19, // 56-63
40+
18,18,18,18,8, 8, 8, 8, // 64-71
4141
8, 8, 8, 8,14, 8, 8, 8, // 72-79
4242
8,14, 8, 8, 5, 8,12, 1, // 80-87
4343
1, 0, 0, 8, 0, 0, 0, 0, // 88-95

src/main/java/com/sk89q/craftbook/util/jinglenote/bukkit/BukkitJingleNotePlayer.java

Lines changed: 23 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -37,80 +37,28 @@ public boolean isPlaying() {
3737

3838
}
3939

40-
private static Sound BANJO;
41-
private static Sound BIT;
42-
private static Sound COWBELL;
43-
private static Sound DIDGERIDOO;
44-
private static Sound IRON_XYLOPHONE;
45-
46-
static {
47-
try {
48-
for (Sound sound : Sound.class.getEnumConstants()) {
49-
switch (sound.name()) {
50-
case "BLOCK_NOTE_BLOCK_BANJO":
51-
BANJO = sound;
52-
break;
53-
case "BLOCK_NOTE_BLOCK_BIT":
54-
BIT = sound;
55-
break;
56-
case "BLOCK_NOTE_BLOCK_COW_BELL":
57-
COWBELL = sound;
58-
break;
59-
case "BLOCK_NOTE_BLOCK_DIDGERIDOO":
60-
DIDGERIDOO = sound;
61-
break;
62-
case "BLOCK_NOTE_BLOCK_IRON_XYLOPHONE":
63-
IRON_XYLOPHONE = sound;
64-
break;
65-
}
66-
}
67-
if (BANJO == null) {
68-
throw new RuntimeException();
69-
}
70-
} catch (Throwable t) {
71-
BANJO = Sound.BLOCK_NOTE_BLOCK_GUITAR;
72-
BIT = Sound.BLOCK_NOTE_BLOCK_PLING;
73-
COWBELL = Sound.BLOCK_NOTE_BLOCK_BELL;
74-
DIDGERIDOO = Sound.BLOCK_NOTE_BLOCK_BASS;
75-
IRON_XYLOPHONE = Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
76-
}
77-
}
78-
7940
private static Sound toSound(Instrument instrument) {
80-
switch(instrument) {
81-
case BASS:
82-
return Sound.BLOCK_NOTE_BLOCK_BASS;
83-
case SNARE:
84-
return Sound.BLOCK_NOTE_BLOCK_SNARE;
85-
case HAT:
86-
return Sound.BLOCK_NOTE_BLOCK_HAT;
87-
case BANJO:
88-
return BANJO;
89-
case BASEDRUM:
90-
return Sound.BLOCK_NOTE_BLOCK_BASEDRUM;
91-
case BELL:
92-
return Sound.BLOCK_NOTE_BLOCK_BELL;
93-
case BIT:
94-
return BIT;
95-
case CHIME:
96-
return Sound.BLOCK_NOTE_BLOCK_CHIME;
97-
case COW_BELL:
98-
return COWBELL;
99-
case DIDGERIDOO:
100-
return DIDGERIDOO;
101-
case FLUTE:
102-
return Sound.BLOCK_NOTE_BLOCK_FLUTE;
103-
case XYLOPHONE:
104-
return Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
105-
case IRON_XYLOPHONE:
106-
return IRON_XYLOPHONE;
107-
case PLING:
108-
return Sound.BLOCK_NOTE_BLOCK_PLING;
109-
case GUITAR:
110-
return Sound.BLOCK_NOTE_BLOCK_GUITAR;
111-
case HARP:
112-
default:
113-
return Sound.BLOCK_NOTE_BLOCK_HARP;
114-
}
41+
return switch (instrument) {
42+
case BASS -> Sound.BLOCK_NOTE_BLOCK_BASS;
43+
case SNARE -> Sound.BLOCK_NOTE_BLOCK_SNARE;
44+
case HAT -> Sound.BLOCK_NOTE_BLOCK_HAT;
45+
case BANJO -> Sound.BLOCK_NOTE_BLOCK_BANJO;
46+
case BASEDRUM -> Sound.BLOCK_NOTE_BLOCK_BASEDRUM;
47+
case BELL -> Sound.BLOCK_NOTE_BLOCK_BELL;
48+
case BIT -> Sound.BLOCK_NOTE_BLOCK_BIT;
49+
case CHIME -> Sound.BLOCK_NOTE_BLOCK_CHIME;
50+
case COW_BELL -> Sound.BLOCK_NOTE_BLOCK_COW_BELL;
51+
case DIDGERIDOO -> Sound.BLOCK_NOTE_BLOCK_DIDGERIDOO;
52+
case FLUTE -> Sound.BLOCK_NOTE_BLOCK_FLUTE;
53+
case XYLOPHONE -> Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
54+
case IRON_XYLOPHONE -> Sound.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE;
55+
case PLING -> Sound.BLOCK_NOTE_BLOCK_PLING;
56+
case GUITAR -> Sound.BLOCK_NOTE_BLOCK_GUITAR;
57+
case TRUMPET -> Sound.BLOCK_NOTE_BLOCK_TRUMPET;
58+
case TRUMPET_DISTORTED -> Sound.BLOCK_NOTE_BLOCK_TRUMPET_EXPOSED;
59+
case TROMBONE -> Sound.BLOCK_NOTE_BLOCK_TRUMPET_OXIDIZED;
60+
case TROMBONE_DISTORTED -> Sound.BLOCK_NOTE_BLOCK_TRUMPET_WEATHERED;
61+
default -> Sound.BLOCK_NOTE_BLOCK_HARP;
62+
};
11563
}
116-
}
64+
}

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ version: "${internalVersion}"
44
dev-url: https://dev.bukkit.org/projects/craftbook
55
depend: [WorldEdit]
66
softdepend: [WorldGuard, ProtocolLib, Vault]
7-
api-version: 1.21.5
7+
api-version: 26.1
88
commands:

0 commit comments

Comments
 (0)