SteamWar/FightSystem
Archiviert
13
1

Hotfix BlockPhysicsEvent sub 1.12 recording

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-08-27 22:34:20 +02:00
Ursprung 67296c29c2
Commit c164c7ebfe

Datei anzeigen

@ -25,6 +25,7 @@ import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers;
import de.steamwar.core.Core;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
@ -123,6 +124,22 @@ public class Recording implements Listener {
GlobalRecorder.getInstance().entitySpeed(tnt);
}
}, 1, 1);
if(Core.getVersion() > 12){
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, new Listener() {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent e){
if(e.getBlock() == e.getSourceBlock() || e.getChangedType() == Material.AIR)
GlobalRecorder.getInstance().blockChange(e.getBlock());
}
});
}else{
new StateDependentListener(ArenaMode.AntiReplay, FightState.All, new Listener() {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent e){
GlobalRecorder.getInstance().blockChange(e.getBlock());
}
});
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@ -198,12 +215,6 @@ public class Recording implements Listener {
GlobalRecorder.getInstance().tntSpawn(e.getEntity());
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPhysics(BlockPhysicsEvent e){
if(e.getBlock() == e.getSourceBlock() || e.getChangedType() == Material.AIR)
GlobalRecorder.getInstance().blockChange(e.getBlock());
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onExplosion(EntityExplodeEvent e){
if(e.getEntityType() != EntityType.PRIMED_TNT)