fix voice, pvp

This commit is contained in:
ayunami2000 2022-08-21 22:47:23 -04:00
parent 37c9b4888d
commit a74abf3d4b
7 changed files with 30750 additions and 30746 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -68,7 +68,7 @@ window.initializeVoiceClient = (() => {
self.client.signalDisconnect(self.peerId); self.client.signalDisconnect(self.peerId);
}); });
} }
this.peerConnection.addEventListener("connectionstatechange", (evt) => { this.peerConnection.addEventListener("connectionstatechange", (evt) => {
if(self.peerConnection.connectionState === 'disconnected') { if(self.peerConnection.connectionState === 'disconnected') {
self.client.signalDisconnect(self.peerId); self.client.signalDisconnect(self.peerId);
@ -254,7 +254,7 @@ window.initializeVoiceClient = (() => {
} }
signalConnect(peerId, offer) { signalConnect(peerId, offer) {
if (!this.hasInit) initializeDevices(); if (!this.hasInit) this.initializeDevices();
try { try {
const peerConnection = new RTCPeerConnection({ iceServers: this.ICEServers, optional: [ { DtlsSrtpKeyAgreement: true } ] }); const peerConnection = new RTCPeerConnection({ iceServers: this.ICEServers, optional: [ { DtlsSrtpKeyAgreement: true } ] });
const peerInstance = new EaglercraftVoicePeer(this, peerId, peerConnection, offer); const peerInstance = new EaglercraftVoicePeer(this, peerId, peerConnection, offer);

View File

@ -31,6 +31,7 @@ public class EAGMinecraftServer extends MinecraftServer {
this.gamemode = gamemode; this.gamemode = gamemode;
this.setCanSpawnAnimals(true); this.setCanSpawnAnimals(true);
this.setCanSpawnNPCs(true); this.setCanSpawnNPCs(true);
this.setAllowPvp(true);
} }
public void mainLoop() { public void mainLoop() {

View File

@ -144,7 +144,7 @@ public class VoiceChatPlugin {
dos2.write(sig); dos2.write(sig);
dos2.writeUTF(user); dos2.writeUTF(user);
dos2.writeUTF(data); dos2.writeUTF(data);
player.playerNetServerHandler.sendPacket(new Packet250CustomPayload("EAG|Voice", baos2.toByteArray())); voicePlayers.get(targetUser2).playerNetServerHandler.sendPacket(new Packet250CustomPayload("EAG|Voice", baos2.toByteArray()));
} }
break; break;
default: default:
@ -163,7 +163,6 @@ public class VoiceChatPlugin {
public static void activate(List<String> ice) { public static void activate(List<String> ice) {
if(iceServers.size() == 0) { if(iceServers.size() == 0) {
iceServers.clear();
iceServers.addAll(ice); iceServers.addAll(ice);
for(Object o : MinecraftServer.getServer().getConfigurationManager().playerEntityList) { for(Object o : MinecraftServer.getServer().getConfigurationManager().playerEntityList) {
handleConnect((EntityPlayerMP) o); handleConnect((EntityPlayerMP) o);