New Method to Register Bow Listener
Dieser Commit ist enthalten in:
Ursprung
3497e2d1e7
Commit
4cc03892c9
@ -55,28 +55,7 @@ public class Recording implements Listener {
|
|||||||
|
|
||||||
private static final int AIR = 0;
|
private static final int AIR = 0;
|
||||||
private static final Random random = new Random();
|
private static final Random random = new Random();
|
||||||
|
private static final PacketAdapter BOW_PACKET_PROCESSOR = new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.BLOCK_PLACE) {
|
||||||
public Recording() {
|
|
||||||
new StateDependentListener(Config.recording(), FightState.All, this);
|
|
||||||
new StateDependent(Config.recording(), FightState.Ingame){
|
|
||||||
@Override
|
|
||||||
public void enable() {
|
|
||||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
|
||||||
setKitItems(Fight.getBlueTeam());
|
|
||||||
setKitItems(Fight.getRedTeam());
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disable() {
|
|
||||||
despawnTeam(Fight.getRedTeam());
|
|
||||||
despawnTeam(Fight.getBlueTeam());
|
|
||||||
despawnTNT();
|
|
||||||
}
|
|
||||||
}.register();
|
|
||||||
|
|
||||||
//Bow Listener
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Client.BLOCK_PLACE) {
|
|
||||||
@Override
|
@Override
|
||||||
public void onPacketReceiving(PacketEvent event) {
|
public void onPacketReceiving(PacketEvent event) {
|
||||||
PacketContainer packet = event.getPacket();
|
PacketContainer packet = event.getPacket();
|
||||||
@ -102,7 +81,37 @@ public class Recording implements Listener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
public Recording() {
|
||||||
|
new StateDependentListener(Config.recording(), FightState.All, this);
|
||||||
|
new StateDependent(Config.recording(), FightState.Ingame){
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||||
|
setKitItems(Fight.getBlueTeam());
|
||||||
|
setKitItems(Fight.getRedTeam());
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() {
|
||||||
|
despawnTeam(Fight.getRedTeam());
|
||||||
|
despawnTeam(Fight.getBlueTeam());
|
||||||
|
despawnTNT();
|
||||||
|
}
|
||||||
|
}.register();
|
||||||
|
new StateDependent(Config.recording(), FightState.All) {
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
ProtocolLibrary.getProtocolManager().addPacketListener(BOW_PACKET_PROCESSOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() {
|
||||||
|
ProtocolLibrary.getProtocolManager().removePacketListener(BOW_PACKET_PROCESSOR);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren