Implementing sound at player
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
c68d967a82
Commit
90737ca915
@ -20,11 +20,9 @@
|
|||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
|
import de.steamwar.fightsystem.record.RecordSystem;
|
||||||
import de.steamwar.sql.Schematic;
|
import de.steamwar.sql.Schematic;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.*;
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -84,6 +82,8 @@ public class Fight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void playSound(Sound sound, float volume, float pitch) {
|
public static void playSound(Sound sound, float volume, float pitch) {
|
||||||
|
if(Config.recording())
|
||||||
|
RecordSystem.soundAtPlayer(sound.name(), SoundCategory.AMBIENT.name(), volume, pitch);
|
||||||
//volume: max. 100, pitch: max. 2
|
//volume: max. 100, pitch: max. 2
|
||||||
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), sound, volume, pitch));
|
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), sound, volume, pitch));
|
||||||
}
|
}
|
||||||
|
@ -66,8 +66,9 @@ public class RecordSystem {
|
|||||||
*
|
*
|
||||||
* BlockPacket (0x30) + pos int, byte, int + int BlockState
|
* BlockPacket (0x30) + pos int, byte, int + int BlockState
|
||||||
* ParticlePacket (0x31) + double x, y, z + string particleType
|
* ParticlePacket (0x31) + double x, y, z + string particleType
|
||||||
* SoundPacket (0x32) + int x, y, z + string soundType + string soundType + float volume, pitch
|
* SoundPacket (0x32) + int x, y, z + string soundType + string soundCategory + float volume, pitch
|
||||||
* ShortBlockPacket (0x33) + pos relative to ArenaMinX,ArenaMinZ byte, byte, byte + short BlockState
|
* ShortBlockPacket (0x33) + pos relative to ArenaMinX,ArenaMinZ byte, byte, byte + short BlockState
|
||||||
|
* SoundAtPlayerPacket (0x34) + string soundType, soundCategory + float volume, pitch
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* ChatPacket (0xA0) + String message
|
* ChatPacket (0xA0) + String message
|
||||||
@ -164,9 +165,9 @@ public class RecordSystem {
|
|||||||
if((short)blockState == blockState && shortX > 0 && shortX < 256 && shortZ > 0 && shortZ < 256){
|
if((short)blockState == blockState && shortX > 0 && shortX < 256 && shortZ > 0 && shortZ < 256){
|
||||||
//Short block packet
|
//Short block packet
|
||||||
Recorder.rByte(0x33);
|
Recorder.rByte(0x33);
|
||||||
Recorder.rByte(pos.getX());
|
Recorder.rByte(shortX);
|
||||||
Recorder.rByte(pos.getY());
|
Recorder.rByte(pos.getY());
|
||||||
Recorder.rByte(pos.getZ());
|
Recorder.rByte(shortZ);
|
||||||
Recorder.rShort((short)blockState);
|
Recorder.rShort((short)blockState);
|
||||||
}else{
|
}else{
|
||||||
//Block packet
|
//Block packet
|
||||||
@ -200,6 +201,15 @@ public class RecordSystem {
|
|||||||
Recorder.flush();
|
Recorder.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static synchronized void soundAtPlayer(String soundType, String soundCategory, float volume, float pitch){
|
||||||
|
Recorder.rByte(0x34);
|
||||||
|
Recorder.rString(soundType);
|
||||||
|
Recorder.rString(soundCategory);
|
||||||
|
Recorder.rFloat(volume);
|
||||||
|
Recorder.rFloat(pitch);
|
||||||
|
Recorder.flush();
|
||||||
|
}
|
||||||
|
|
||||||
public static synchronized void chat(String s) {
|
public static synchronized void chat(String s) {
|
||||||
Recorder.rByte(0xA0);
|
Recorder.rByte(0xA0);
|
||||||
Recorder.rString(s);
|
Recorder.rString(s);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren