mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
fixed respawn event (player returning from end to overworld)
This commit is contained in:
parent
ae40a6f47e
commit
284def319a
@ -22,8 +22,8 @@ public class PlayerManagerMixin {
|
||||
PlayerEvents.PLAYER_LOGGED_OUT.invoker().onPlayerLoggedOut(player);
|
||||
}
|
||||
|
||||
@Inject(method = "respawnPlayer", at = @At("TAIL"))
|
||||
@Inject(method = "respawnPlayer", at = @At("RETURN"))
|
||||
public void respawnPlayer(ServerPlayerEntity player, boolean alive, CallbackInfoReturnable<ServerPlayerEntity> info) {
|
||||
PlayerEvents.PLAYER_RESPAWN.invoker().onPlayerRespawn(player);
|
||||
PlayerEvents.PLAYER_RESPAWN.invoker().onPlayerRespawn(info.getReturnValue());
|
||||
}
|
||||
}
|
||||
|
@ -12,15 +12,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
public class ServerPlayerEntityMixin {
|
||||
@Inject(method = "teleport", at = @At("TAIL"))
|
||||
@Inject(method = "teleport", at = @At("RETURN"))
|
||||
public void teleport(ServerWorld targetWorld, double x, double y, double z, float yaw, float pitch, CallbackInfo info) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
if (targetWorld != player.world) {
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "changeDimension", at = @At("TAIL"))
|
||||
@Inject(method = "changeDimension", at = @At("RETURN"))
|
||||
public void changeDimension(ServerWorld destination, CallbackInfoReturnable<Entity> info) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
if (!player.removed) {
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ public class PlayerManagerMixin {
|
||||
PlayerEvents.PLAYER_LOGGED_OUT.invoker().onPlayerLoggedOut(player);
|
||||
}
|
||||
|
||||
@Inject(method = "respawnPlayer", at = @At("TAIL"))
|
||||
@Inject(method = "respawnPlayer", at = @At("RETURN"))
|
||||
public void respawnPlayer(ServerPlayerEntity player, boolean alive, CallbackInfoReturnable<ServerPlayerEntity> info) {
|
||||
PlayerEvents.PLAYER_RESPAWN.invoker().onPlayerRespawn(player);
|
||||
PlayerEvents.PLAYER_RESPAWN.invoker().onPlayerRespawn(info.getReturnValue());
|
||||
}
|
||||
}
|
||||
|
@ -12,15 +12,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
public class ServerPlayerEntityMixin {
|
||||
@Inject(method = "teleport", at = @At("TAIL"))
|
||||
@Inject(method = "teleport", at = @At("RETURN"))
|
||||
public void teleport(ServerWorld targetWorld, double x, double y, double z, float yaw, float pitch, CallbackInfo info) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
if (targetWorld != player.world) {
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "moveToWorld", at = @At("TAIL"))
|
||||
@Inject(method = "moveToWorld", at = @At("RETURN"))
|
||||
public void moveToWorld(ServerWorld destination, CallbackInfoReturnable<Entity> info) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
if (!player.removed) {
|
||||
PlayerEvents.PLAYER_CHANGED_DIMENSION.invoker().onPlayerChangedDimension(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user