RecordSystem (Beta) #199
@ -20,11 +20,9 @@
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.record.RecordSystem;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
@ -84,6 +82,8 @@ public class Fight {
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
* 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
|
||||
* SoundAtPlayerPacket (0x34) + string soundType, soundCategory + float volume, pitch
|
||||
*
|
||||
*
|
||||
* ChatPacket (0xA0) + String message
|
||||
@ -164,9 +165,9 @@ public class RecordSystem {
|
||||
if((short)blockState == blockState && shortX > 0 && shortX < 256 && shortZ > 0 && shortZ < 256){
|
||||
//Short block packet
|
||||
Recorder.rByte(0x33);
|
||||
Recorder.rByte(pos.getX());
|
||||
Recorder.rByte(shortX);
|
||||
Recorder.rByte(pos.getY());
|
||||
Recorder.rByte(pos.getZ());
|
||||
Recorder.rByte(shortZ);
|
||||
Recorder.rShort((short)blockState);
|
||||
}else{
|
||||
//Block packet
|
||||
@ -200,6 +201,15 @@ public class RecordSystem {
|
||||
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) {
|
||||
Recorder.rByte(0xA0);
|
||||
Recorder.rString(s);
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren