Skip to content

Commit

Permalink
3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Leymooo committed Feb 18, 2018
1 parent 609d964 commit 085249c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/ru/leymooo/fixer/ItemChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.stream.Collectors;

import org.apache.commons.codec.binary.Base64;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.block.ShulkerBox;
Expand Down Expand Up @@ -174,7 +175,8 @@ private boolean checkNbt(ItemStack stack, Player p) {
cheat = true;
} else if (mat == Material.BANNER && checkBanner(stack)) {
cheat = true;
} else if (isPotion(stack) && !ignoreNbt.contains("CustomPotionEffects") && tag.containsKey("CustomPotionEffects") && checkPotion(stack, p)) {
} else if (isPotion(stack) && !ignoreNbt.contains("CustomPotionEffects") && tag.containsKey("CustomPotionEffects")
&& (checkPotion(stack, p) || checkCustomColor(tag.getCompound("CustomPotionEffects")))) {
cheat = true;
}
} catch (Exception e) {
Expand Down Expand Up @@ -210,6 +212,19 @@ private boolean isPotion(ItemStack stack) {
}
}

private boolean checkCustomColor(NbtCompound tag) {
if (tag.containsKey("CustomPotionColor")) {
int color = tag.getInteger("CustomPotionColor");
try {
Color.fromBGR(color);
} catch (IllegalArgumentException e) {
tag.remove("CustomPotionColor");
return true;
}
}
return false;
}

private boolean checkPotion(ItemStack stack, Player p) {
boolean cheat = false;
if (!p.hasPermission("itemfixer.bypass.potion")) {
Expand Down

0 comments on commit 085249c

Please sign in to comment.