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

Datei anzeigen

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

Datei anzeigen

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