Merge pull request 'Simple click logger' (#342) from clickAnalyzer into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #342 Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
Commit
78d03e6f52
@ -93,6 +93,7 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new ArrowPickup();
|
new ArrowPickup();
|
||||||
new BlockFadeListener();
|
new BlockFadeListener();
|
||||||
new LeaveableArena();
|
new LeaveableArena();
|
||||||
|
new ClickAnalyzer();
|
||||||
|
|
||||||
new EnterHandler();
|
new EnterHandler();
|
||||||
new TechHider();
|
new TechHider();
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
This file is a part of the SteamWar software.
|
||||||
|
|
||||||
|
Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 static final Class<?> blockPlace = Reflection.getClass("{nms.network.protocol.play}.PacketPlayInBlockPlace");
|
||||||
|
|
||||||
|
private final PrintStream output;
|
||||||
|
|
||||||
|
public ClickAnalyzer () {
|
||||||
|
ProtocolAPI.setIncomingHandler(blockPlace, this::onBlockPlace);
|
||||||
|
try {
|
||||||
|
output = new PrintStream(new BufferedOutputStream(new FileOutputStream(new File(Bukkit.getWorlds().get(0).getWorldFolder(), "clicks.csv"))));
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new SecurityException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object onBlockPlace(Player player, Object packet) {
|
||||||
|
output.println(player.getName() + "," + System.nanoTime() + "," + CraftbukkitWrapper.impl.headRotation(player) + "," + player.getLocation().getPitch());
|
||||||
|
return packet;
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren