I am trying to create a new minigame (Halfway done) but I have no experience with java

Discussion in 'Bukkit Help' started by ProfessorPengu, Aug 13, 2023.

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

    ProfessorPengu

    I am using VisualBukkit for creating the plugin... Half of the problem is solved
    There are just few problems
    1. I want a specific player to randomly teleport like an enderman just before he is about to get killed by a specific player.
    2. I want a specific player to get banned when they get killed by a specific player and the killer would gain a heart
    I am not able to upload the picture of the codes for some reasons I hope you can help me... you dont have to write down the code. just point me towards a direction I love solving my problems myself. Thank you
    I am using Windows 10, and 1.20 version of minecraft

    Edit: oh so the photos did get uploaded, anyways in the photos I am using entity instead of a player so that I could better test the plugin by killing cows and seeing whether they would teleport or not. But when I kill them they just die, they wont teleport
     

    Attached Files:

  2. Offline

    lecreep

    i dont know how how capable is visual bukkit but i made something similar days ago and keep it fresh
    you need this to get the damager
    https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageByEntityEvent.html
    that extedns
    https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.html


    Code:
    on EntityDamageByEntityEvent
    if damagerPlayer is not instanceof player
        return
    if damagedPlayer is not instanceof player
        return
    if finalDamage < damagedPlayer.health
       return
    
    cancel event
    if damagerPlayer is THE_WANTED_KILLER
        ban damagedPlayer
        add health to damagerPlayer or do anything you want
    else
         teleport damagedPlayer anywhere
         and remove potion effects, refill health ,hunger etc... must handle the respawn fully by yourself, (or maybe you can kill the player in the next tick and control the location at respawn, maybe the first option is more work but more easy)
    
    
     
    Last edited: Aug 17, 2023
Thread Status:
Not open for further replies.

Share This Page