Add Sound
Fix Motion
Dieser Commit ist enthalten in:
Ursprung
d5910ea7b2
Commit
727d7c6b6e
@ -8,9 +8,7 @@ import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.minecraft.server.v1_15_R1.Block;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||
|
||||
import java.io.EOFException;
|
||||
@ -123,6 +121,25 @@ class PacketProcessor {
|
||||
});
|
||||
}
|
||||
|
||||
private void sound() throws IOException {
|
||||
double x = source.rDouble();
|
||||
double y = source.rDouble();
|
||||
double z = source.rDouble();
|
||||
|
||||
String soundName = source.rString();
|
||||
String soundCategory = source.rString();
|
||||
|
||||
float volume = source.rFloat();
|
||||
float pitch = source.rFloat();
|
||||
|
||||
Sound sound = Sound.valueOf(soundName);
|
||||
SoundCategory sCategory = SoundCategory.valueOf(soundCategory);
|
||||
|
||||
Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
|
||||
world.playSound(new Location(world, x, y, z), sound, sCategory, volume, pitch);
|
||||
});
|
||||
}
|
||||
|
||||
private void process(){
|
||||
try{
|
||||
while(!source.isClosed()){
|
||||
@ -154,6 +171,9 @@ class PacketProcessor {
|
||||
case 0x31:
|
||||
particle();
|
||||
break;
|
||||
case 0x32:
|
||||
sound();
|
||||
break;
|
||||
case (byte) 0xA0:
|
||||
send(ChatMessageType.CHAT);
|
||||
break;
|
||||
|
@ -76,6 +76,11 @@ public abstract class REntity {
|
||||
|
||||
public void setMotion(double dX, double dY, double dZ) {
|
||||
entity.setMot(dX, dY, dZ);
|
||||
PacketPlayOutEntityVelocity packet = new PacketPlayOutEntityVelocity(entity);
|
||||
for(Player player : Bukkit.getOnlinePlayers()){
|
||||
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
|
||||
connection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
private void sendToPlayer(Player player){
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren