SteamWar/FightSystem
Archiviert
13
1

Fix ClickAnalyzer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2022-10-07 17:30:49 +02:00
Ursprung 9d4df5b715
Commit 83eb9bfa13
3 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -90,6 +90,7 @@ public class FightSystem extends JavaPlugin {
new ArrowPickup();
new BlockFadeListener();
new LeaveableArena();
new ClickAnalyzer();
new HotbarKit.HotbarKitListener();
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
@ -161,6 +162,7 @@ public class FightSystem extends JavaPlugin {
@Override
public void onDisable() {
GlobalRecorder.getInstance().close();
ClickAnalyzer.close();
}
public static void setSpectateState(FightTeam winFightTeam, String winreason, String subtitle, Object... params) {

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
import org.bukkit.entity.Player;
@ -26,7 +27,6 @@ import org.bukkit.entity.Player;
import java.io.*;
public class ClickAnalyzer {
private ClickAnalyzer() {}
private static final PrintStream output;
@ -38,7 +38,16 @@ public class ClickAnalyzer {
}
}
public static void onBlockPlace(Player player) {
public ClickAnalyzer() {
TinyProtocol.instance.addFilter(Recording.blockPlacePacket, this::onBlockPlace);
}
public Object onBlockPlace(Player player, Object packet) {
output.println(player.getName() + "," + System.nanoTime() + "," + CraftbukkitWrapper.impl.headRotation(player) + "," + player.getLocation().getPitch());
return packet;
}
public static void close() {
output.close();
}
}

Datei anzeigen

@ -133,8 +133,6 @@ public class Recording implements Listener {
public static final Class<?> blockPlacePacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockPlace");
private Object blockPlace(Player p, Object packet) {
ClickAnalyzer.onBlockPlace(p);
boolean mainHand = BountifulWrapper.impl.mainHand(packet);
if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
GlobalRecorder.getInstance().bowSpan(p, true, !mainHand);