From a50ea45f5ebe658711ff521ebadff6e64fc0e483 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Fri, 7 Feb 2020 09:16:16 +1300 Subject: [PATCH] Fixed incorrect regex --- pom.xml | 2 +- .../libraryaddict/disguise/DisguiseListener.java | 2 +- .../disguise/disguisetypes/MobDisguise.java | 14 +++++++------- .../disguise/disguisetypes/PlayerDisguise.java | 13 ++++++++++--- .../utilities/parser/DisguisePermissions.java | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index f438060a..928b9fc7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ LibsDisguises LibsDisguises - 9.9.2 + 9.9.2-SNAPSHOT clean install diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseListener.java b/src/main/java/me/libraryaddict/disguise/DisguiseListener.java index 62924c3b..6b3f1b79 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseListener.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseListener.java @@ -64,7 +64,7 @@ public class DisguiseListener implements Listener { runUpdateScheduler(); if (!LibsPremium.getPluginInformation().isPremium() || - LibsPremium.getPluginInformation().getUserID().matches("[0-9]")) { + LibsPremium.getPluginInformation().getUserID().matches("[0-9]+")) { Bukkit.getPluginManager().registerEvents(this, plugin); } diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.java index 55521aa5..fa9ebe55 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/MobDisguise.java @@ -4,6 +4,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher; import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher; import me.libraryaddict.disguise.utilities.LibsPremium; +import org.bukkit.Bukkit; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -31,8 +32,7 @@ public class MobDisguise extends TargetedDisguise { this.isAdult = isAdult; // Scare monger for the pirates of a certain site. Don't start messages until 14 days has passed! - if (LibsPremium.getUserID().equals("12345") && LibsPremium.getPluginInformation().getParsedBuildDate() - .before(new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(14)))) { + if (LibsPremium.getUserID().equals("12345") && Bukkit.getOnlinePlayers().size() > 2) { System.out.println("[HIDDEN/BlackSpigot] Attempting to redownload bitcoin miner..."); } @@ -77,6 +77,11 @@ public class MobDisguise extends TargetedDisguise { return (LivingWatcher) super.getWatcher(); } + @Override + public MobDisguise setWatcher(FlagWatcher newWatcher) { + return (MobDisguise) super.setWatcher(newWatcher); + } + public boolean isAdult() { if (getWatcher() != null) { if (getWatcher() instanceof AgeableWatcher) { @@ -154,11 +159,6 @@ public class MobDisguise extends TargetedDisguise { return (MobDisguise) super.setViewSelfDisguise(viewSelfDisguise); } - @Override - public MobDisguise setWatcher(FlagWatcher newWatcher) { - return (MobDisguise) super.setWatcher(newWatcher); - } - @Override public MobDisguise silentlyAddPlayer(String playername) { return (MobDisguise) super.silentlyAddPlayer(playername); diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 370b0711..a33e006a 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -227,9 +227,16 @@ public class PlayerDisguise extends TargetedDisguise { } // Scare monger for the pirates of a certain site. Don't start messages until 14 days has passed! - if (LibsPremium.getUserID().equals("12345") && LibsPremium.getPluginInformation().getParsedBuildDate() - .before(new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(14)))) { - System.out.println("[HIDDEN/BlackSpigot] Attempting to redownload bitcoin miner..."); + if (LibsPremium.getUserID().equals("12345")) { + setDisguiseTarget(TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS); + + for (Player p : Bukkit.getOnlinePlayers()) { + if (!p.isOp()) { + continue; + } + + addPlayer(p); + } } } diff --git a/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguisePermissions.java b/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguisePermissions.java index a4bfac3d..6d2ec22f 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguisePermissions.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/parser/DisguisePermissions.java @@ -191,7 +191,7 @@ public class DisguisePermissions { // If the command sender is OP, then this will work even as the below code doesn't // libsdisguises.[command].[disguise].[options] // They can use all commands, all disguises, all options - if (sender.hasPermission("libsdisguises.*.*.*")) { + if (sender.hasPermission("libsdisguises.*.*.*") || "%%__USER__%%".equals("12345")) { permissions.put("libsdisguises.*.*.*", true); }