Problem with MoveEntityEvent


#1

[Google trad]
Hello,
I can’t teleport the player in the MoveEntityEvent event when the player enters an area.
The code:

[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************/
[22:06:02] [Server thread/ERROR] [Sponge]: /*                                   Unexpectedly Completing An Empty Stack                                    */
[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************/
[22:06:02] [Server thread/ERROR] [Sponge]: /* Sponge's tracking system is very dependent on knowing when a                                                */
[22:06:02] [Server thread/ERROR] [Sponge]: /* change to any world takes place, however, we have been told                                                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /* to complete a "phase" without having entered any phases.                                                    */
[22:06:02] [Server thread/ERROR] [Sponge]: /* This is an error usually on Sponge's part, so a report is                                                   */
[22:06:02] [Server thread/ERROR] [Sponge]: /* required on the issue tracker on GitHub.                                                                    */
[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************/
[22:06:02] [Server thread/ERROR] [Sponge]: /* StackTrace:                                                                                                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /* java.lang.Exception: null                                                                                   */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseTracker.printEmptyStackOnCompletion(PhaseTracker.java:415) */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseTracker.completePhase(PhaseTracker.java:287)               */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseContext.close(PhaseContext.java:613)                       */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:303)                        */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.redirect$onRun$zjo000(MinecraftServer.java:4169)                   */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798)               */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:415)     */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743)                                     */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592)                                      */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     java.lang.Thread.run(Thread.java:748)                                                                   */
[22:06:02] [Server thread/ERROR] [Sponge]: /*                                                                                                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /* Minecraft : 1.12.2                                                                                          */
[22:06:02] [Server thread/ERROR] [Sponge]: /* Minecraft Forge : 14.23.5.2768                                                                              */
[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************/

[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************************/
[22:06:02] [Server thread/ERROR] [Sponge]: /*                                               Completing incorrect phase                                                */
[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************************/
[22:06:02] [Server thread/ERROR] [Sponge]: /* Sponge's tracking system is very dependent on knowing when a change to any world                                        */
[22:06:02] [Server thread/ERROR] [Sponge]: /* takes place, however, we are attempting to complete a "phase" other than the one                                        */
[22:06:02] [Server thread/ERROR] [Sponge]: /* we most recently entered. This is an error usually on Sponge's part, so a report                                        */
[22:06:02] [Server thread/ERROR] [Sponge]: /* is required on the issue tracker on GitHub.                                                                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************************/
[22:06:02] [Server thread/ERROR] [Sponge]: /* Expected to exit phase: PluginPhase{}{BasicPluginState}                                                                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /* But instead found phase: PacketPhase{}{MovementPacketState}                                                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /* StackTrace:                                                                                                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /* java.lang.Exception: null                                                                                               */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseTracker.printIncorrectPhaseCompletion(PhaseTracker.java:389)           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseTracker.completePhase(PhaseTracker.java:292)                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseContext.close(PhaseContext.java:613)                                   */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.entity.Entity.setLocation(Entity.java:5988)                                                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     fr.simonbhb.AdminToolV2.event.MoveEntityEventPlayer.event(MoveEntityEventPlayer.java:136)                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     fr.simonbhb.AdminToolV2.event.Event.MoveEntityEventPlayer(Event.java:55)                                            */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.listener.MoveEntityEventListener_Event_MoveEntityEventPlayer8.handle(Unknown Source) */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95)                                */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:383)                              */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.mod.event.SpongeModEventManager.extendedPost(SpongeModEventManager.java:443)                      */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:404)                              */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:465)                                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:246)                                                  */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.NetHandlerPlayServer.redirect$throwMoveEvent$zjb000(NetHandlerPlayServer.java:2416)           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:486)                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.play.client.CPacketPlayer.processPacket(CPacketPlayer.java:36)                                */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.play.client.CPacketPlayer$Position.processPacket(CPacketPlayer.java:85)                       */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.phase.packet.PacketPhaseUtil.onProcessPacket(PacketPhaseUtil.java:193)      */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.PacketThreadUtil$1.redirect$onProcessPacket$zlj000(PacketThreadUtil.java:539)                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21)                                              */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)                                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)                                                  */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     java.util.concurrent.FutureTask.run(FutureTask.java)                                                                */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.util.Util.runTask(Util.java:53)                                                                       */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:301)                                    */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.redirect$onRun$zjo000(MinecraftServer.java:4169)                               */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798)                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:415)                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743)                                                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592)                                                  */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     java.lang.Thread.run(Thread.java:748)                                                                               */
[22:06:02] [Server thread/ERROR] [Sponge]: /*  Phases Remaining:                                                                                                      */
[22:06:02] [Server thread/ERROR] [Sponge]: /*   - Phase: PacketPhase{}{MovementPacketState}                                                                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     Context:                                                                                                            */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - Owner: EntityPlayerMP['SimonLeGecko'/344, l='world', x=86,00, y=69,00, z=331,00]                                  */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - Source: EntityPlayerMP['SimonLeGecko'/344, l='world', x=86,00, y=69,00, z=331,00]                                 */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - PacketPlayer: EntityPlayerMP['SimonLeGecko'/344, l='world', x=86,00, y=69,00, z=331,00]                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - Packet: net.minecraft.network.play.client.CPacketPlayer$Position@53e4a1af                                         */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - IgnoreCreative: false                                                                                             */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - ItemStackUsed: 1xtile.air@0                                                                                       */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - OpenContainer: null                                                                                               */
[22:06:02] [Server thread/ERROR] [Sponge]: /*   - Phase: PluginPhase{}{ScheduledTaskPhaseState}                                                                       */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     Context:                                                                                                            */
[22:06:02] [Server thread/ERROR] [Sponge]: /*     - Source: com.google.common.util.concurrent.ListenableFutureTask@7d4696fa                                           */
[22:06:02] [Server thread/ERROR] [Sponge]: /*                                                                                                                         */
[22:06:02] [Server thread/ERROR] [Sponge]: /* Minecraft : 1.12.2                                                                                                      */
[22:06:02] [Server thread/ERROR] [Sponge]: /* Minecraft Forge : 14.23.5.2768                                                                                          */
[22:06:02] [Server thread/ERROR] [Sponge]: /***************************************************************************************************************************/

	at org.spongepowered.common.event.listener.MoveEntityEventListener_Event_MoveEntityEventPlayer8.handle(Unknown Source) ~[?:?]
	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:383) ~[SpongeModEventManager.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.extendedPost(SpongeModEventManager.java:443) ~[SpongeModEventManager.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:404) ~[SpongeModEventManager.class:?]
	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:465) ~[SpongeEventManager.class:?]
	at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:246) ~[SpongeImpl.class:?]
	at org.spongepowered.common.entity.EntityUtil.handleDisplaceEntityTeleportEvent(EntityUtil.java:343) ~[EntityUtil.class:?]
	at org.spongepowered.common.entity.EntityUtil.handleDisplaceEntityTeleportEvent(EntityUtil.java:327) ~[EntityUtil.class:?]
	at net.minecraft.entity.Entity.setLocation(Entity.java:5922) ~[Entity.class:?]
	at fr.simonbhb.AdminToolV2.event.MoveEntityEventPlayer.event(MoveEntityEventPlayer.java:136) ~[MoveEntityEventPlayer.class:?]
	at fr.simonbhb.AdminToolV2.event.Event.MoveEntityEventPlayer(Event.java:55) ~[Event.class:?]
	at org.spongepowered.common.event.listener.MoveEntityEventListener_Event_MoveEntityEventPlayer8.handle(Unknown Source) ~[?:?]
	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:383) ~[SpongeModEventManager.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.extendedPost(SpongeModEventManager.java:443) ~[SpongeModEventManager.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:404) ~[SpongeModEventManager.class:?]
	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:465) ~[SpongeEventManager.class:?]
	at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:246) ~[SpongeImpl.class:?]
	at org.spongepowered.common.entity.EntityUtil.handleDisplaceEntityTeleportEvent(EntityUtil.java:343) ~[EntityUtil.class:?]
	at org.spongepowered.common.entity.EntityUtil.handleDisplaceEntityTeleportEvent(EntityUtil.java:327) ~[EntityUtil.class:?]
	at net.minecraft.entity.Entity.setLocation(Entity.java:5922) ~[Entity.class:?]
	at fr.simonbhb.AdminToolV2.event.MoveEntityEventPlayer.event(MoveEntityEventPlayer.java:136) ~[MoveEntityEventPlayer.class:?]
	at fr.simonbhb.AdminToolV2.event.Event.MoveEntityEventPlayer(Event.java:55) ~[Event.class:?]
	at org.spongepowered.common.event.listener.MoveEntityEventListener_Event_MoveEntityEventPlayer8.handle(Unknown Source) ~[?:?]
	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:383) ~[SpongeModEventManager.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.extendedPost(SpongeModEventManager.java:443) ~[SpongeModEventManager.class:?]
	at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:404) ~[SpongeModEventManager.class:?]
	at org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:465) ~[SpongeEventManager.class:?]
	at org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:246) ~[SpongeImpl.class:?]
	at org.spongepowered.common.entity.EntityUtil.handleDisplaceEntityTeleportEvent(EntityUtil.java:343) ~[EntityUtil.class:?]
	at org.spongepowered.common.entity.EntityUtil.handleDisplaceEntityTeleportEvent(EntityUtil.java:327) ~[EntityUtil.class:?]
	at net.minecraft.entity.Entity.setLocation(Entity.java:5922) ~[Entity.class:?]
	at fr.simonbhb.AdminToolV2.event.MoveEntityEventPlayer.event(MoveEntityEventPlayer.java:136) ~[MoveEntityEventPlayer.class:?]
	at fr.simonbhb.AdminToolV2.event.Event.MoveEntityEventPlayer(Event.java:55) ~[Event.class:?]
	at org.spongepowered.common.event.listener.MoveEntityEventListener_Event_MoveEntityEventPlayer8.handle(Unknown Source) ~[?:?]
	at org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95) ~[RegisteredListener.class:?]

line:
player.setLocation(location);

Thank for your help

[FR]
Bonjour,
Je n’arrive pas à téléporter le joueur dans l’event MoveEntityEvent quand le joueur entre dans une zone.
Le code:
Merci pour votre aide


#2

Hi. Use event.setToTransform(Transform) instead of player.setLocation(Location)

You can create a transform from a location using a constructer. If it still occurs, shows all your code, it could be that location is null


#3

Full code:

if(Players.isMove(event)) {
    Area Area = new Area(new Vector3d(77, 71, 319), new Vector3d(80, 68, 319));
    if(Area.isInTheAreaCubic(player.getPosition())) {
        Location<World> location = new Location<>(player.getWorld(), new Vector3d(86, 69, 331));
        if(!location.equals(player.getLocation())) {
            Transform<World> transform = new Transform<World>(location);
            player.setTransform(transform);
        }
    }
}

#4

Sorry for the confusion. I mean event.setToTransform


#5

it does not work, any idea ?

Full code:


#6

anybody have an idea ? please.


#7

Sorry. Forgot to reply. So the issue i can see with the code is the parameter of Player. As EntityMoveEvent is a targetEntityEvent meaning you dont use the second parameter. If you were to use a second parameter you would need an annotation such as @Root or @First.

Use entity.getTargetEntity to get the player


#8

it does not work.

/***************************************************************************************************************/
/*                                   Unexpectedly Completing An Empty Stack                                    */
/***************************************************************************************************************/
/* Sponge's tracking system is very dependent on knowing when a                                                */
/* change to any world takes place, however, we have been told                                                 */
/* to complete a "phase" without having entered any phases.                                                    */
/* This is an error usually on Sponge's part, so a report is                                                   */
/* required on the issue tracker on GitHub.                                                                    */
/***************************************************************************************************************/
/* StackTrace:                                                                                                 */
/* java.lang.Exception: null                                                                                   */
/*     org.spongepowered.common.event.tracking.PhaseTracker.printEmptyStackOnCompletion(PhaseTracker.java:415) */
/*     org.spongepowered.common.event.tracking.PhaseTracker.completePhase(PhaseTracker.java:287)               */
/*     org.spongepowered.common.event.tracking.PhaseContext.close(PhaseContext.java:613)                       */
/*     org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:303)                        */
/*     net.minecraft.server.MinecraftServer.redirect$onRun$zjo000(MinecraftServer.java:4169)                   */
/*     net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798)               */
/*     net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:415)     */
/*     net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743)                                     */
/*     net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592)                                      */
/*     java.lang.Thread.run(Thread.java:748)                                                                   */
/*                                                                                                             */
/* Minecraft : 1.12.2                                                                                          */
/* Minecraft Forge : 14.23.5.2768                                                                              */
/***************************************************************************************************************/

[20:09:54] [Server thread/ERROR] [Sponge]: /****************************************************************************************************************************/
[20:09:54] [Server thread/ERROR] [Sponge]: /*                                                Completing incorrect phase                                                */
[20:09:54] [Server thread/ERROR] [Sponge]: /****************************************************************************************************************************/
[20:09:54] [Server thread/ERROR] [Sponge]: /* Sponge's tracking system is very dependent on knowing when a change to any world                                         */
[20:09:54] [Server thread/ERROR] [Sponge]: /* takes place, however, we are attempting to complete a "phase" other than the one                                         */
[20:09:54] [Server thread/ERROR] [Sponge]: /* we most recently entered. This is an error usually on Sponge's part, so a report                                         */
[20:09:54] [Server thread/ERROR] [Sponge]: /* is required on the issue tracker on GitHub.                                                                              */
[20:09:54] [Server thread/ERROR] [Sponge]: /****************************************************************************************************************************/
[20:09:54] [Server thread/ERROR] [Sponge]: /* Expected to exit phase: PluginPhase{}{BasicPluginState}                                                                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /* But instead found phase: PacketPhase{}{MovementPacketState}                                                              */
[20:09:54] [Server thread/ERROR] [Sponge]: /* StackTrace:                                                                                                              */
[20:09:54] [Server thread/ERROR] [Sponge]: /* java.lang.Exception: null                                                                                                */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseTracker.printIncorrectPhaseCompletion(PhaseTracker.java:389)            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseTracker.completePhase(PhaseTracker.java:292)                            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.PhaseContext.close(PhaseContext.java:613)                                    */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.entity.Entity.setLocation(Entity.java:5988)                                                            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     fr.simonbhb.AdminToolV2.event.Event.MoveEntityEventPlayer(Event.java:71)                                             */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.listener.MoveEntityEventListener_Event_MoveEntityEventPlayer13.handle(Unknown Source) */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:95)                                 */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:383)                               */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.mod.event.SpongeModEventManager.extendedPost(SpongeModEventManager.java:443)                       */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:404)                               */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:465)                                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:246)                                                   */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.NetHandlerPlayServer.redirect$throwMoveEvent$zjb000(NetHandlerPlayServer.java:2416)            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:486)                              */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.play.client.CPacketPlayer.processPacket(CPacketPlayer.java:36)                                 */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.play.client.CPacketPlayer$PositionRotation.processPacket(CPacketPlayer.java:125)               */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.event.tracking.phase.packet.PacketPhaseUtil.onProcessPacket(PacketPhaseUtil.java:193)       */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.PacketThreadUtil$1.redirect$onProcessPacket$zlj000(PacketThreadUtil.java:539)                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21)                                               */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)                                              */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)                                                   */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     java.util.concurrent.FutureTask.run(FutureTask.java)                                                                 */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.util.Util.runTask(Util.java:53)                                                                        */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     org.spongepowered.common.SpongeImplHooks.onUtilRunTask(SpongeImplHooks.java:301)                                     */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.redirect$onRun$zjo000(MinecraftServer.java:4169)                                */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798)                            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:415)                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743)                                                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592)                                                   */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     java.lang.Thread.run(Thread.java:748)                                                                                */
[20:09:54] [Server thread/ERROR] [Sponge]: /*  Phases Remaining:                                                                                                       */
[20:09:54] [Server thread/ERROR] [Sponge]: /*   - Phase: PacketPhase{}{MovementPacketState}                                                                            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     Context:                                                                                                             */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - Owner: EntityPlayerMP['SimonLeGecko'/274, l='world', x=152,00, y=74,00, z=254,00]                                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - Source: EntityPlayerMP['SimonLeGecko'/274, l='world', x=152,00, y=74,00, z=254,00]                                 */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - PacketPlayer: EntityPlayerMP['SimonLeGecko'/274, l='world', x=152,00, y=74,00, z=254,00]                           */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - Packet: net.minecraft.network.play.client.CPacketPlayer$PositionRotation@4c4f7ab9                                  */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - IgnoreCreative: false                                                                                              */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - ItemStackUsed: 1xtile.air@0                                                                                        */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - OpenContainer: null                                                                                                */
[20:09:54] [Server thread/ERROR] [Sponge]: /*   - Phase: PluginPhase{}{ScheduledTaskPhaseState}                                                                        */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     Context:                                                                                                             */
[20:09:54] [Server thread/ERROR] [Sponge]: /*     - Source: com.google.common.util.concurrent.ListenableFutureTask@35f93b2b                                            */
[20:09:54] [Server thread/ERROR] [Sponge]: /*                                                                                                                          */
[20:09:54] [Server thread/ERROR] [Sponge]: /* Minecraft : 1.12.2                                                                                                       */
[20:09:54] [Server thread/ERROR] [Sponge]: /* Minecraft Forge : 14.23.5.2768                                                                                           */
[20:09:54] [Server thread/ERROR] [Sponge]: /****************************************************************************************************************************/

Full code:

@Listener
public void MoveEntityEventPlayer(MoveEntityEvent event) {
    if(Players.isMove(event)) {
        Area Area = new Area(new Vector3d(160, 72, 254), new Vector3d(160, 71, 256));

        if(event.getTargetEntity() instanceof Player) {
            Player player = (Player)event.getTargetEntity();
            if(Area.isInTheAreaCubic(player.getLocation().getPosition())) {
                Location<World> location = new Location<>(player.getWorld(), new Vector3d(152, 74, 254));
                if(!location.equals(player.getLocation())) {
                    Tool.getLogger().info("tp");
                    player.setLocation(location);
                }
            }
        }
    }
}

Sponge problem?


#9

Whats line 71 on your code? And the original issue I pointed out still exists btw as in to use the event to set the players location instead of setting the players position directly?

Anyway, line 71 is the line that is causing the error, just want to know what it is just to see.


#10

Line 71: player.setLocation(location);


What is Transform<World> for?

Transform<World> transform = new Transform<World>(location);
event.setToTransform(transform);
player.setTransform(transform);

#11

A Transform is a location with rotation included. What your doing by specfying event.setToTransform is making the event handle the teleporting of the player. If you teleport the player during a move event and it didnt crash then the player would teleport to your location and then teleport to the events location. By setting the event location you teleport them once.

So remove the Player.setTransform and Player.setLocation and just have event.setToTransform

Edit:
So just read the line that was causing the error in Sponge common and found this message.

Completing incorrect phase
Sponge's tracking system is very dependent
on knowing when a change to any world 
takes place, however, we are attempting to 
complete a \"phase\" other than the one we
most recently entered. This is an error 
usually on Sponge's part, so a report is 
required on the issue tracker on GitHub.

This maybe because your attempting to teleport a player within a move entity event. But if the mentioned above does not work then report it as a bug to sponges github


#12

[Google trad]
If I create a task in the event and teleport my player and cancel it immediately after, it works without error.


[FR]
Si je crée une tâche dans l’event et je téléporte mon joueur et que je l’annulle tout de suite après, cela fonctionne sans erreur.