SteamWar/FightSystem
Archiviert
13
1

Add Bow Damge and Fire #261

Manuell gemergt
Lixfel hat 14 Commits von record_extension nach master 2021-04-23 19:52:27 +02:00 zusammengeführt
Nur Änderungen aus Commit 48fe87ffa3 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -67,19 +67,16 @@ public class Recording implements Listener {
return;
RecordSystem.bowSpan(p, true, hand != EnumWrappers.Hand.MAIN_HAND);
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.BLOCK_DIG) {
@Override
public void onPacketReceiving(PacketEvent e) {
if(e.getPlayer() != event.getPlayer())
return;
}
};
PacketContainer packetDig = e.getPacket();
if(packetDig.getPlayerDigTypes().read(0) == EnumWrappers.PlayerDigType.RELEASE_USE_ITEM) {
RecordSystem.bowSpan(e.getPlayer(), false, hand != EnumWrappers.Hand.MAIN_HAND);
ProtocolLibrary.getProtocolManager().removePacketListener(this);
}
}
});
private static final PacketAdapter BOW_PACKET_DEDRAW_PROCESSOR = new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.BLOCK_DIG) {
@Override
public void onPacketReceiving(PacketEvent e) {
PacketContainer packetDig = e.getPacket();
if(packetDig.getPlayerDigTypes().read(0) == EnumWrappers.PlayerDigType.RELEASE_USE_ITEM) {
RecordSystem.bowSpan(e.getPlayer(), false, false);
}
}
};
@ -105,11 +102,13 @@ public class Recording implements Listener {
@Override
public void enable() {
ProtocolLibrary.getProtocolManager().addPacketListener(BOW_PACKET_PROCESSOR);
ProtocolLibrary.getProtocolManager().addPacketListener(BOW_PACKET_DEDRAW_PROCESSOR);
}
@Override
public void disable() {
ProtocolLibrary.getProtocolManager().removePacketListener(BOW_PACKET_PROCESSOR);
ProtocolLibrary.getProtocolManager().removePacketListener(BOW_PACKET_DEDRAW_PROCESSOR);
}
}.register();
}