|
7 | 7 | import io.github.techstreet.dfscript.DFScript; |
8 | 8 | import io.github.techstreet.dfscript.event.KeyPressEvent; |
9 | 9 | import io.github.techstreet.dfscript.event.ReceiveChatEvent; |
| 10 | +import io.github.techstreet.dfscript.event.RecieveSoundEvent; |
10 | 11 | import io.github.techstreet.dfscript.event.SendChatEvent; |
11 | 12 | import io.github.techstreet.dfscript.event.system.Event; |
12 | 13 | import io.github.techstreet.dfscript.script.action.ScriptActionArgument.ScriptActionArgumentType; |
@@ -137,7 +138,31 @@ public enum ScriptClientValueArgument implements ScriptArgument { |
137 | 138 | (event, context) -> new ScriptTextValue(DFScript.PLAYER_UUID)), |
138 | 139 |
|
139 | 140 | PLAYER_NAME("Player Name", "The name of the player.", Items.PLAYER_HEAD, ScriptActionArgumentType.TEXT, |
140 | | - (event, context) -> new ScriptTextValue(DFScript.PLAYER_NAME)); |
| 141 | + (event, context) -> new ScriptTextValue(DFScript.PLAYER_NAME)), |
| 142 | + |
| 143 | + EVENT_SOUND("ReceivedSound", "The ID of the sound. (OnReceiveSound)", Items.NAUTILUS_SHELL, ScriptActionArgumentType.TEXT, (event, context) -> { |
| 144 | + if(event instanceof RecieveSoundEvent e) { |
| 145 | + return new ScriptTextValue(e.getSoundId().toString().replaceAll("^minecraft:", "")); |
| 146 | + } else { |
| 147 | + throw new IllegalStateException("The event is not a receive sound event."); |
| 148 | + } |
| 149 | + }), |
| 150 | + |
| 151 | + EVENT_VOLUME("ReceivedSoundVolume", "The volume of the sound received. (OnReceiveSound)", Items.NOTE_BLOCK, ScriptActionArgumentType.NUMBER, (event, context) -> { |
| 152 | + if(event instanceof RecieveSoundEvent e) { |
| 153 | + return new ScriptNumberValue(e.getVolume()); |
| 154 | + } else { |
| 155 | + throw new IllegalStateException("The event is not a receive sound event."); |
| 156 | + } |
| 157 | + }), |
| 158 | + |
| 159 | + EVENT_PITCH("ReceivedSoundPitch", "The pitch of the sound received. (OnReceiveSound)", Items.JUKEBOX, ScriptActionArgumentType.NUMBER, (event, context) -> { |
| 160 | + if(event instanceof RecieveSoundEvent e) { |
| 161 | + return new ScriptNumberValue(e.getPitch()); |
| 162 | + } else { |
| 163 | + throw new IllegalStateException("The event is not a receive sound event."); |
| 164 | + } |
| 165 | + }); |
141 | 166 |
|
142 | 167 | private final String name; |
143 | 168 | private final ItemStack icon; |
|
0 commit comments