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 ArrowPickup();
new BlockFadeListener(); new BlockFadeListener();
new LeaveableArena(); new LeaveableArena();
new ClickAnalyzer();
new HotbarKit.HotbarKitListener(); new HotbarKit.HotbarKitListener();
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f)); 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 @Override
public void onDisable() { public void onDisable() {
GlobalRecorder.getInstance().close(); GlobalRecorder.getInstance().close();
ClickAnalyzer.close();
} }
public static void setSpectateState(FightTeam winFightTeam, String winreason, String subtitle, Object... params) { public static void setSpectateState(FightTeam winFightTeam, String winreason, String subtitle, Object... params) {

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.utils.CraftbukkitWrapper; import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -26,7 +27,6 @@ import org.bukkit.entity.Player;
import java.io.*; import java.io.*;
public class ClickAnalyzer { public class ClickAnalyzer {
private ClickAnalyzer() {}
private static final PrintStream output; 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()); 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"); public static final Class<?> blockPlacePacket = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInBlockPlace");
private Object blockPlace(Player p, Object packet) { private Object blockPlace(Player p, Object packet) {
ClickAnalyzer.onBlockPlace(p);
boolean mainHand = BountifulWrapper.impl.mainHand(packet); boolean mainHand = BountifulWrapper.impl.mainHand(packet);
if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p)) if(!isNotSent(p) && BountifulWrapper.impl.bowInHand(mainHand, p))
GlobalRecorder.getInstance().bowSpan(p, true, !mainHand); GlobalRecorder.getInstance().bowSpan(p, true, !mainHand);