1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-20 23:21:19 +01:00

Fix last commit player NOT monster

- Fix incomplete-switch argument
This commit is contained in:
montlikadani 2019-05-05 13:20:32 +02:00
parent c5dc27c072
commit 02ad7df873
11 changed files with 31 additions and 20 deletions

View File

@ -3,6 +3,7 @@ package com.gamingmesh.jobs;
import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
@ -17,5 +18,5 @@ public interface NMS {
public void setItemInMainHand(Player player, ItemStack item);
public double getMaxHealth(Player player);
public double getMaxHealth(LivingEntity entity);
}

View File

@ -53,6 +53,7 @@ public class SignUtil {
ArrayList<String> categoriesList = new ArrayList<>(ConfCategory.getKeys(false));
if (categoriesList.isEmpty())
return;
for (String category : categoriesList) {
ConfigurationSection NameSection = ConfCategory.getConfigurationSection(category);
com.gamingmesh.jobs.Signs.Sign newTemp = new com.gamingmesh.jobs.Signs.Sign();
@ -175,7 +176,7 @@ public class SignUtil {
timelapse--;
} else {
if (one.GetNumber() > PlayerList.size())
return true;
return true;
TopList pl = PlayerList.get(one.GetNumber() - 1);
String PlayerName = pl.getPlayerName();

View File

@ -524,7 +524,6 @@ public class JobsPaymentListener implements Listener {
}
@SuppressWarnings("incomplete-switch")
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryCraft(CraftItemEvent event) {
// make sure plugin is enabled
@ -609,6 +608,8 @@ public class JobsPaymentListener implements Listener {
case LEATHER_HELMET:
case LEATHER_LEGGINGS:
leather = true;
default:
break;
}
}
@ -1128,7 +1129,7 @@ public class JobsPaymentListener implements Listener {
if (Jobs.getGCManager().MonsterDamageUse && lVictim.hasMetadata(entityDamageByPlayer)) {
double damage = lVictim.getMetadata(entityDamageByPlayer).get(0).asDouble();
double perc = (damage * 100D) / Jobs.getNms().getMaxHealth((Player) lVictim);
double perc = (damage * 100D) / Jobs.getNms().getMaxHealth(lVictim);
if (perc < Jobs.getGCManager().MonsterDamagePercentage)
return;
}

View File

@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.entity.Villager.Profession;
import org.bukkit.event.block.BlockPistonRetractEvent;
@ -73,7 +74,7 @@ public class v1_10 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getMaxHealth();
public double getMaxHealth(LivingEntity entity) {
return entity.getMaxHealth();
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
@ -51,7 +52,7 @@ public class v1_11 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getMaxHealth();
public double getMaxHealth(LivingEntity entity) {
return entity.getMaxHealth();
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
@ -52,7 +53,7 @@ public class v1_12 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
public double getMaxHealth(LivingEntity entity) {
return entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
@ -36,7 +37,7 @@ public class v1_13 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
public double getMaxHealth(LivingEntity entity) {
return entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
@ -36,7 +37,7 @@ public class v1_14 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
public double getMaxHealth(LivingEntity entity) {
return entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getDefaultValue();
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.inventory.ItemStack;
@ -62,7 +63,7 @@ public class v1_7 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getMaxHealth();
public double getMaxHealth(LivingEntity entity) {
return entity.getMaxHealth();
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
@ -68,7 +69,7 @@ public class v1_8 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getMaxHealth();
public double getMaxHealth(LivingEntity entity) {
return entity.getMaxHealth();
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Zombie;
@ -68,7 +69,7 @@ public class v1_9 implements NMS {
}
@Override
public double getMaxHealth(Player player) {
return player.getMaxHealth();
public double getMaxHealth(LivingEntity entity) {
return entity.getMaxHealth();
}
}