Create Instance (PvP)

Discussion in 'Plugin Development' started by _TheTimelord_, Apr 28, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    _TheTimelord_

    Hey,

    I've been working on a small PvP plugin, but in order to reduce lag I decided to attempt to create an "instancing" system of the arenas. For those not familiar, an instance is basically a separate copy of an area that is used only by a certain player or players. The key is that this instance must physically occupy the same area, as the issue is that too many chunks are being loaded by using copies of the arena. Is there an "easy" way to do this that doesn't involve a crapton of packet manipulation?

    Thanks,
    Time
     
  2. Offline

    Zombie_Striker

    @_TheTimelord_
    1. When players enter an arena
    2. For loop through all players online
    3. If the player from #2 is not equal to themselves, and if the player is not Dueling the main player:
    4. Call Player#hidePlayer( #2 ) to hide all player.
    5. When the player leaves the arena
    6. For loop through all players online.
    7. Call Player#showPlayer(#6)
     
  3. Offline

    _TheTimelord_

    I knew that hidePlayer physically hid them, but does it also prevent hitting them server-side? Additionally, the arena system has pots and arrows, etc... I severely doubt that method automagically hides all projectiles created by that player? @Zombie_Striker
     
  4. Offline

    Zombie_Striker

    @_TheTimelord_
    Although players cannot hit hiding players, you cannot work with arrows without using packets. Because only certain players can interact and see with the arrows, the arrows cannot be 'real'. For you to support arrows in the same arena, you will need use packets to create the arrow and set its velocity. After that, you then need to do your own calculations to see if it hit the player.
     
Thread Status:
Not open for further replies.

Share This Page