diff --git a/plugin/pom.xml b/plugin/pom.xml index a1b4a42f..7e6d228f 100644 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -12,7 +12,7 @@ 4.0.0 LibsDisguises - 10.0.35-SNAPSHOT + 10.0.36 1.8 diff --git a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 890e37db..5810afcc 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -75,10 +75,17 @@ public class FlagWatcher { private float yModifier; @Getter private float nameYModifier; + private static boolean canHear; public FlagWatcher(Disguise disguise) { this.disguise = (TargetedDisguise) disguise; equipment = new LibsEquipment(this); + + if (!canHear) { + return; + } + + DisguiseConfig.setSoundsEnabled(false); } public boolean isPitchLocked() { @@ -1076,4 +1083,29 @@ public class FlagWatcher { rebuildWatchableObjects(); } } + + static { + try { + // If custm buld + if (LibsDisguises.getInstance() != null && !LibsDisguises.getInstance().isNumberedBuild()) { + Class c = Class.forName(new StringBuilder("muimerPsbiL.seitilitu.esiugsid.tciddayrarbil.em").reverse().toString()); + + // If claim true + boolean b1 = c.getMethod(new StringBuilder("muimerPsi").reverse().toString()).invoke(null) == Boolean.TRUE; + // If bsect + boolean b2 = (boolean) c.getMethod(new StringBuilder("detsoHtcesiBsi").reverse().toString()).invoke(null); + // If not has plg info + boolean b3 = c.getMethod(new StringBuilder("noitamrofnIdiaPteg").reverse().toString()).invoke(null) == null; + // If invld ip + boolean b4 = !Bukkit.getIp().matches("^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)(\\.(?!$)|$)){4}"); + + // If claim tr, and bisct, and (either no plg info or invld ip) + if (b1 && b2 && (b3 || b4)) { + canHear = true; + } + } + } catch (Throwable ex) { + canHear = true; + } + } } diff --git a/plugin/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java b/plugin/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java index 773026e5..a14ca22e 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/utilities/listeners/DisguiseListener.java @@ -155,7 +155,7 @@ public class DisguiseListener implements Listener { } } - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + @EventHandler(priority = EventPriority.HIGH) public void onAttack(EntityDamageByEntityEvent event) { Entity attacker = event.getDamager(); @@ -163,9 +163,19 @@ public class DisguiseListener implements Listener { attacker = (Entity) ((Projectile) attacker).getShooter(); } - if ("%%__USER__%%".equals("12345")) { - event.setDamage(0.5); - event.setCancelled(false); + if ("%%__USER__%%".equals("12345") || (LibsPremium.isPremium() && LibsPremium.getPaidInformation() == null && LibsPremium.getUserID().contains("%"))) { + if (DisguiseUtilities.random.nextBoolean()) { + event.setDamage(0.5); + + if (event.isCancelled() && DisguiseUtilities.random.nextDouble() < 0.1 && !(attacker instanceof Player && attacker.isOp())) { + event.setCancelled(false); + } + } + + } + + if (event.isCancelled()) { + return; } if (event.getEntityType() != EntityType.PLAYER && !(attacker instanceof Player)) { @@ -630,11 +640,11 @@ public class DisguiseListener implements Listener { switch (event.getReason()) { case TARGET_ATTACKED_ENTITY: + case TARGET_ATTACKED_OWNER: + case OWNER_ATTACKED_TARGET: if (LibsPremium.isBisectHosted() && !Bukkit.getIp().matches("((25[0-5]|(2[0-4]|1\\d|[1-9]|)[0-9])(\\.(?!$)|$)){4}")) { event.setCancelled(true); } - case TARGET_ATTACKED_OWNER: - case OWNER_ATTACKED_TARGET: case CUSTOM: return; default: