Solved Freezing a Mob.

Discussion in 'Plugin Development' started by Azeroth, Jan 1, 2013.

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

    Azeroth

    Is there any possibility to freeze a mob? I've been searching for 3 hours and couldn't find anything.
     
  2. Offline

    fireblast709

    • have an HashMap<UUID, Location> somewhere
    • store entity UUID with the position where they were frozen
    • schedule a repeating task that will teleport them to that location every tick
     
    MrBluebear3 likes this.
  3. Offline

    Azeroth

    Thanks, but how to make him not attacking people?
     
  4. Offline

    fireblast709

    cancel the EntityTargetEvent
     
    MrBluebear3 likes this.
  5. Offline

    Bjornke

    Unless you expect the Entity to remain frozen after server restarts, you can also use EntityID (Integer value) instead of UUID. It's faster if you're doing this for hundreds of mobs at once, but does not persist.
     
  6. Offline

    Azeroth

    Thanks. Solved.
    @OffTopic: Can I disable chat in game?
     
  7. Offline

    fireblast709

    cancel the chat event
     
    MrBluebear3 likes this.
  8. Offline

    Azeroth

    How? I tried many things. :/
     
  9. Offline

    fireblast709

    event.setCancelled(true)
     
  10. Offline

    Azeroth

    Not working.
    "event cannot be resolved"
    Or I'm trying to cancel wrong event (PlayerChatEvent)...
     
  11. Offline

    EnvisionRed

    AsyncPlayerChatEvent...PlayerChatEvent is deprecated, which should show up in your IDE. Shame on you for using deprecated methods. AsyncPlayerChatEvent is used now because chat is now handled in another thread.
     
  12. Offline

    Azeroth

    Oh... But with AsyncPlayerChatEvent there is the same problem with "event.setCancelled(true)" :/
     
  13. Offline

    fireblast709

    No PlayerChatEvent is advised if you do not know how to handle threads
     
  14. Offline

    Azeroth

    Someone can help me?
     
  15. Offline

    fireblast709

    post the code
     
  16. Offline

    Azeroth

    I tried:
    Code:
    public void AsyncPlayerChatEvent(boolean async, Player who, String message, Set<Player> players)
    {
        event.setCancelled(true);
    }
    And:
    Code:
    public void onChat(final AsyncPlayerChatEvent event)
    {
        event.setCancelled(true);
    }
     
  17. Offline

    Deathmarine


    GOD the overhead.... !!!!
    There a better ways but we can't talk about those methods.
     
  18. Offline

    fireblast709

    yup, overriding the NMS classes and use a boolean to toggle between normal and frozen, and when frozen the update is partially ignored
     
  19. Offline

    Azeroth

    Solved.
     
Thread Status:
Not open for further replies.

Share This Page