Player punches do 3 hearts of damage for some reason..

Discussion in 'Plugin Development' started by kayc01, Feb 15, 2016.

Thread Status:
Not open for further replies.
  1. Hey, so recently i have been making a H1Z1 style plugin and all of a sudden punches seem to be op.
    I have not done any coding to set damage amounts and when i punch i do half a heart of damage, anyone else that goes through the onJoin method (i made it so i do not run in the onJoin method for administrative purposes.) does 3 hearts damage per punch.

    Here is my onJoin.
    Is there anything here that could modify the damage output of damage.
    Because there is surely something about that method that i am not getting applied to myself.


    Code:
    @EventHandler
        public void onJoin (PlayerJoinEvent e) {
           
            Player p = e.getPlayer();
    
           
            if (!(p.getName().equalsIgnoreCase("ABkayCkay") || p.getName().equalsIgnoreCase("MikeSN"))) {
    
                inArena2.add(p);
               
                p.setFoodLevel(20);
                p.setHealth(20);
               
                p.getInventory().clear();
                p.getInventory().setArmorContents(null);
           
                p.sendMessage(ChatColor.GREEN + "You have sucesfully joined the arena, teleporting to waiting area.");
            
             if (inArena2.size() == 25) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 50) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 75) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 100) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 125) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
            
             for (Player staff : Bukkit.getOnlinePlayers()) {
                
                 if (staff.hasPermission("arena.admin")) {
                     staff.sendMessage(ChatColor.BLUE + "A challenger has joined the arena (" + p.getName() + "), there are now " + inArena2.size() + " People in the arena.");
                    
                   }
              }
            
                 World w = Bukkit.getServer().getWorld(settings.getData().getString("warps.waitarea.world"));
                double x = settings.getData().getDouble("warps.waitarea.x");
                double y = settings.getData().getDouble("warps.waitarea.y");
                double z = settings.getData().getDouble("warps.waitarea.z");
                p.teleport(new Location(w, x, y, z));
               
                Location loc = new Location(w, x, y, z);
               
                p.setBedSpawnLocation(loc, true);
            
           
            }
        }
    Or maybe its another plugin?
    I did recently delete EssentialsProtect and EssentialsSpawn in case they were interfering with my teleportation upon player join.

    Thanks!
     
  2. Offline

    Xerox262

    @kayc01 Do you have any damage events? EntityDamage? EntityDamageByEntity?

    Also rather than
    Code:
    if (inArena2.size() == 25) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 50) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 75) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 100) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
             else if (inArena2.size() == 125) {
                 Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
             }
    You can just use

    Code:
    if (inAreana2.size % 25 == 0) {
        Bukkit.broadcastMessage(ChatColor.GOLD + "There are now " + inArena2.size() + " players in the arena waiting for the game to start.");
    }
    And it will print out all numbers that are divisible by 25.
     
    Protophite likes this.
  3. Offline

    Zombie_Striker

    @kayc01
    How do you know it's 3 points damage? Did you debug?
     
  4. Cheers for that last tip and yeah there is an EntityDamage Event but that's for everyone. As I say I only do half a heart of damage and others do 3.

    Not actual debugging but lots of trial and errors with some people on team speak testing things. Players other than me are able to kill players and Mobs in 2-3 hits. .

    I'll paste my EntityDamage event in the morning but I'm fairly confident that's not the issue as it would then effect me too. But I only do half a heart damage.

    Thanks
     
  5. Offline

    teej107

    @kayc01 Maybe they are HACKING!!!!! *gasp*

    On a serious note, are you sure they aren't doing critical hits?
     
  6. What declairs a critical punch. It seems like every punch they do does it

    Here is the EnityDamageEvent btw:


    Code:
    @EventHandler
        public void onCancelFallDamage(EntityDamageEvent e) {
           
           
            if(e.getEntity() instanceof Player) { //Checks to see if the entity that is taking damage is a player
               
                Player p = (Player) e.getEntity();
               
            if (god == true) {
                if (e.getCause() == DamageCause.LAVA) {
                   
                     Random random = new Random();
                   
                    //World w = Bukkit.getServer().getWorld(settings.getData().getString("warps.waitarea.world"));
                      double x = settings.getData().getDouble("warps.waitarea.x");
                      //double y = settings.getData().getDouble("warps.waitarea.y");
                      double z = settings.getData().getDouble("warps.waitarea.z");
                     
                      int x2 = (int) x;
                      //int y2 = (int) y;
                      int z2 = (int) z;
                     
                        //p.teleport(new Location(w, x, y, z));
                        //p.sendMessage(ChatColor.GREEN + "Teleported to waiting area!");
                    
                      //int randomX = random.nextInt(1000) +1;
                      //int randomY = 150;
                      //int randomZ = random.nextInt(1000) +1;
                     
                      int RanX = random.nextInt(x2 + 500) +-1;
                      int RanY = 150;
                      int RanZ = random.nextInt(z2 + 500) +-1;
                     
                      Location teleportLocation = new Location(p.getWorld(), RanX, RanY, RanZ);
                      p.teleport(teleportLocation);
    
                      System.out.println("X: " + RanX + " , Y: " + RanY + " , Z: " + RanZ);
                      p.sendMessage(ChatColor.GOLD + "Re-Telported you for being in lava, sorry about that!");
                }
                else {
                //if(e.getCause() == DamageCause.FALL) { //if the cause of damage is fall damage
                    e.setCancelled(true); //you cancel the event.
                   
                }
                  }
           
           
                    //}
                }
            }
    I honestly think it might be a different plugin doing it.
    Just weird that i am not affected by it. (I only do half a heart instead of 3).

    I tried to make the setDamage(0.5) in a EntityDamageByEntity event but spammed null errors.
    So i deleted it.
     
    Last edited by a moderator: Feb 16, 2016
  7. Offline

    teej107

    Remove all plugins except for the one you are testing. Critical hits happen when you jump and you attack when going down.
     
  8. Offline

    Konato_K

    It's probably another plugin, but by personal experience if you're running a modified version of the server then that could be the issue, I remember changing some code for the wither skulls so they could go through teammates and suddenly players were able to deal 8 points of damage.
     
Thread Status:
Not open for further replies.

Share This Page