13
0
Add Tick
Dieser Commit ist enthalten in:
jojo 2020-08-22 19:29:15 +02:00
Ursprung 727d7c6b6e
Commit 69df058018
4 geänderte Dateien mit 29 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -56,14 +56,18 @@ class PacketProcessor {
int entityId = source.rInt(); int entityId = source.rInt();
boolean sneaking = source.rBoolean(); boolean sneaking = source.rBoolean();
REntity.getEntity(entityId).sneak(sneaking); Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
REntity.getEntity(entityId).sneak(sneaking);
});
} }
private void entityAnimation() throws IOException { private void entityAnimation() throws IOException {
int entityId = source.rInt(); int entityId = source.rInt();
byte animation = source.rByte(); byte animation = source.rByte();
REntity.getEntity(entityId).animation(animation); Bukkit.getScheduler().runTask(SpectateSystem.get(), () -> {
REntity.getEntity(entityId).animation(animation);
});
} }
private void tntSpawn() throws IOException { private void tntSpawn() throws IOException {
@ -122,9 +126,9 @@ class PacketProcessor {
} }
private void sound() throws IOException { private void sound() throws IOException {
double x = source.rDouble(); int x = source.rInt();
double y = source.rDouble(); int y = source.rInt();
double z = source.rDouble(); int z = source.rInt();
String soundName = source.rString(); String soundName = source.rString();
String soundCategory = source.rString(); String soundCategory = source.rString();
@ -183,6 +187,8 @@ class PacketProcessor {
case (byte) 0xa2: case (byte) 0xa2:
send(ChatMessageType.SYSTEM); send(ChatMessageType.SYSTEM);
break; break;
case (byte) 0xFF:
break;
default: default:
Bukkit.getLogger().log(Level.SEVERE, "Unknown packet recieved, closing"); Bukkit.getLogger().log(Level.SEVERE, "Unknown packet recieved, closing");
source.close(); source.close();

Datei anzeigen

@ -1,6 +1,7 @@
package de.steamwar.spectatesystem; package de.steamwar.spectatesystem;
import de.steamwar.spectatesystem.listener.ArenaListener; import de.steamwar.spectatesystem.listener.ArenaListener;
import de.steamwar.spectatesystem.listener.CancelListener;
import de.steamwar.spectatesystem.listener.JoinListener; import de.steamwar.spectatesystem.listener.JoinListener;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -18,6 +19,7 @@ public class SpectateSystem extends JavaPlugin {
instance = this; instance = this;
new JoinListener(); new JoinListener();
new ArenaListener(); new ArenaListener();
new CancelListener();
try { try {
acceptor = new ConnectionAcceptor(); acceptor = new ConnectionAcceptor();
} catch (IOException e) { } catch (IOException e) {

Datei anzeigen

@ -58,8 +58,9 @@ public abstract class REntity {
} }
public void sneak(boolean sneaking) { public void sneak(boolean sneaking) {
/*entity.setSneaking(sneaking); entity.setSneaking(sneaking);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(7, entity.getDataWatcher(), sneaking); // PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(1, entity.getDataWatcher(), sneaking);
/*PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(7, entity.getDataWatcher(), sneaking);
for(Player player : Bukkit.getOnlinePlayers()){ for(Player player : Bukkit.getOnlinePlayers()){
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection; PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
connection.sendPacket(packet); connection.sendPacket(packet);

Datei anzeigen

@ -0,0 +1,13 @@
package de.steamwar.spectatesystem.listener;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPhysicsEvent;
public class CancelListener extends BasicListener {
@EventHandler
public void onPhysics(BlockPhysicsEvent event) {
event.setCancelled(true);
}
}