Make /back track all teleports
This commit is contained in:
parent
256f518fb4
commit
c2047ccd2c
1 changed files with 13 additions and 0 deletions
|
@ -1,13 +1,18 @@
|
|||
package cc.reconnected.server.mixin;
|
||||
|
||||
import cc.reconnected.server.RccServer;
|
||||
import cc.reconnected.server.core.BackTracker;
|
||||
import cc.reconnected.server.core.customChat.CustomDeathMessage;
|
||||
import cc.reconnected.server.struct.ServerPosition;
|
||||
import eu.pb4.placeholders.api.PlaceholderContext;
|
||||
import eu.pb4.placeholders.api.Placeholders;
|
||||
import eu.pb4.placeholders.api.parsers.NodeParser;
|
||||
import eu.pb4.placeholders.api.parsers.TextParserV1;
|
||||
import net.minecraft.entity.damage.DamageTracker;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.network.packet.s2c.play.PositionFlag;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
@ -16,6 +21,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
public class ServerPlayerEntityMixin {
|
||||
@Unique
|
||||
|
@ -36,4 +43,10 @@ public class ServerPlayerEntityMixin {
|
|||
var player = (ServerPlayerEntity) (Object) this;
|
||||
return CustomDeathMessage.onDeath(player, instance);
|
||||
}
|
||||
|
||||
@Inject(method = "teleport(Lnet/minecraft/server/world/ServerWorld;DDDLjava/util/Set;FF)Z", at = @At("HEAD"))
|
||||
public void rccServer$requestTeleport(ServerWorld world, double destX, double destY, double destZ, Set<PositionFlag> flags, float yaw, float pitch, CallbackInfoReturnable<Boolean> cir) {
|
||||
var player = (ServerPlayerEntity) (Object) this;
|
||||
BackTracker.lastPlayerPositions.put(player.getUuid(), new ServerPosition(player));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue