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-03-24 14:28:04 +01:00
Ursprung 78d03e6f52
Commit b9b368320c
3 geänderte Dateien mit 6 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -93,7 +93,6 @@ public class FightSystem extends JavaPlugin {
new ArrowPickup();
new BlockFadeListener();
new LeaveableArena();
new ClickAnalyzer();
new EnterHandler();
new TechHider();

Datei anzeigen

@ -19,22 +19,18 @@
package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
import de.steamwar.fightsystem.utils.ProtocolAPI;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.io.*;
public class ClickAnalyzer {
private ClickAnalyzer() {}
private static final Class<?> blockPlace = Reflection.getClass("{nms.network.protocol.play}.PacketPlayInBlockPlace");
private static final PrintStream output;
private final PrintStream output;
public ClickAnalyzer () {
ProtocolAPI.setIncomingHandler(blockPlace, this::onBlockPlace);
static {
try {
output = new PrintStream(new BufferedOutputStream(new FileOutputStream(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "clicks.csv"))));
} catch (FileNotFoundException e) {
@ -42,8 +38,7 @@ public class ClickAnalyzer {
}
}
private Object onBlockPlace(Player player, Object packet) {
public static void onBlockPlace(Player player) {
output.println(player.getName() + "," + System.nanoTime() + "," + CraftbukkitWrapper.impl.headRotation(player) + "," + player.getLocation().getPitch());
return packet;
}
}

Datei anzeigen

@ -127,6 +127,8 @@ 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);