12
1

Adding more Record Methods

Dieser Commit ist enthalten in:
Chaoscaot 2021-04-12 16:07:16 +02:00
Ursprung 63d8da1f94
Commit 3f1706f40f
3 geänderte Dateien mit 41 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -347,7 +347,7 @@ public class Config {
EventTeamRedID = 0;
BothTeamsPublic = true;
MaximumTeamMembers = Integer.MAX_VALUE;
SpectateSystem = false;
SpectateSystem = true;
}
String blueLeader = System.getProperty("blueLeader", null);
@ -384,6 +384,6 @@ public class Config {
return ArenaMode.Test.contains(mode);
}
public static boolean recording(){
return mode == ArenaMode.EVENT;
return true;//mode == ArenaMode.EVENT;
}
}

Datei anzeigen

@ -36,10 +36,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.*;
@ -111,6 +108,21 @@ public class Recording implements Listener {
RecordSystem.entityAnimation(e.getPlayer(), AIR);
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent e) {
if(e.getEntityType() != EntityType.PLAYER)
return;
Player p = (Player) e.getEntity();
if(isNotSent(p))
return;
RecordSystem.damageAnimation(p);
if(e.getCause() == EntityDamageEvent.DamageCause.FIRE_TICK)
RecordSystem.setOnFire(p);
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTNTSpawn(EntitySpawnEvent e){
//TODO: Falling block
@ -228,4 +240,6 @@ public class Recording implements Listener {
FightPlayer fp = Fight.getFightPlayer(p);
return fp == null || !fp.isLiving() || FightState.getFightState() == FightState.SPECTATE;
}
}

Datei anzeigen

@ -64,8 +64,9 @@ public class RecordSystem {
* PlayerItemPacket (0x07) + int EntityId + String item + boolean enchanted + String slot
* ArrowSpawnPacket (0x08) + int EntityId
* FireballSpawnPacket (0x09) + int EntityId
* TODO Bow spanning
*
* BowSpanPacket (0x0A) + int EntityId + boolean hand
* PlayerDamagePacket (0x0B) + int EntityId
* SetOnFire (0x0C) + int EntityId
*
*
* BlockPacket (0x30) + pos int, byte, int + int BlockState
@ -172,6 +173,24 @@ public class RecordSystem {
spawnEntity(e);
}
public static synchronized void bowSpan(Player p) {
Recorder.rByte(0x0A);
Recorder.rInt(p.getEntityId());
Recorder.flush();
}
public static synchronized void damageAnimation(Player p) {
Recorder.rByte(0x0B);
Recorder.rInt(p.getEntityId());
Recorder.flush();
}
public static synchronized void setOnFire(Player p) {
Recorder.rByte(0x0C);
Recorder.rInt(p.getEntityId());
Recorder.flush();
}
public static synchronized void blockChange(Block block){
int blockState = blockToId(block);