From 8e4a78e0522131fd3e7407c09fa49078aa90b723 Mon Sep 17 00:00:00 2001 From: link1107 <66795347+link1107@users.noreply.github.com> Date: Sat, 12 Feb 2022 11:47:48 +0100 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=200.3.5=20?= =?UTF-8?q?-=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0=20String=20?= =?UTF-8?q?index=20out=20of=20range=20-=20=D0=A4=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B3=D0=B0,=20=D0=B8=D0=B7-=D0=B7=D0=B0=20=D0=BA?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D1=80=D0=BE=D0=B3=D0=BE=20=D0=B3=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D1=8B=20=D0=B8=20=D0=B8=D1=84=D1=80=D0=B8=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B5=D0=BB=D1=8F=D0=BB=D0=B8=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=B5=D1=80=D0=B1=D0=BE=D0=BB=D0=B0=D0=BC=D0=B8,=20?= =?UTF-8?q?=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B=D0=B5=20=D0=B2=D1=8B=D0=B7?= =?UTF-8?q?=D1=8B=D0=B2=D0=B0=D0=BB=D0=B8=20=D0=B2=D0=B7=D1=80=D1=8B=D0=B2?= =?UTF-8?q?=D1=8B,=20=D0=BA=D0=B0=D0=BA=20=D1=83=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=B5=D1=80=D0=B1=D0=BE=D0=BB=D0=BE=D0=B2=20=D0=A1=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=BD=D0=B0=20-=20=D0=A4=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=D0=B1=D0=B0=D0=B3=D0=B0,=20=D0=BF=D0=BE=D0=B7=D0=B2=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=D0=B2=D1=88=D0=B5=D0=B3=D0=BE=20=D0=BE=D0=B1=D0=BE?= =?UTF-8?q?=D0=B9=D1=82=D0=B8=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D1=8B=D1=85=20=D0=B4=D0=BE=D0=BD=D0=B0=D1=82=D0=B0=D1=85=20-?= =?UTF-8?q?=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B8=20"this.streamerPlayersManager"=20is=20null=20-=20=D0=A4?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=20=D0=BE=D0=BF=D0=BE=D0=B2=D0=B5=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20HealPlayer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../donationexecutor/DonationExecutor.java | 4 +++- .../igorlink/donationexecutor/Executor.java | 7 ++++--- .../executionsstaff/giantmobs/GiantMob.java | 3 ++- .../giantmobs/GiantMobEventListener.java | 4 ++-- src/main/java/igorlink/service/Utils.java | 20 +++++++++---------- src/main/resources/plugin.yml | 8 ++++---- 7 files changed, 25 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index eab0fd0..ad51cbe 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ IgorLink DonationExecutor - 0.3.4 + 0.3.5 jar DonationExecutor diff --git a/src/main/java/igorlink/donationexecutor/DonationExecutor.java b/src/main/java/igorlink/donationexecutor/DonationExecutor.java index aa997d5..ec828d7 100644 --- a/src/main/java/igorlink/donationexecutor/DonationExecutor.java +++ b/src/main/java/igorlink/donationexecutor/DonationExecutor.java @@ -42,7 +42,9 @@ public void onEnable() { public void onDisable() { try { isRunningStatus = false; - streamerPlayersManager.stop(); + if (CheckNameAndToken()) { + streamerPlayersManager.stop(); + } } catch (InterruptedException e) { logToConsole("Какая-то ебаная ошибка, похуй на нее вообще"); } diff --git a/src/main/java/igorlink/donationexecutor/Executor.java b/src/main/java/igorlink/donationexecutor/Executor.java index 3804b17..efaac93 100644 --- a/src/main/java/igorlink/donationexecutor/Executor.java +++ b/src/main/java/igorlink/donationexecutor/Executor.java @@ -157,6 +157,7 @@ public static void nekoglai (Player player, String donationUsername) { public static void killStalins (Player player, String donationUsername) { //Remove Last Death Dropped Items + announce(donationUsername, "убил Сталиных вокруг тебя!", "убил Сталиных вокруг", player, true); List stalins = player.getNearbyEntities(200, 200, 200); for (Entity e: stalins) { if (e instanceof Giant) { @@ -336,12 +337,12 @@ public static void giveIronSword (Player player, String donationUsername) { } public static void giveIronKirka (Player player, String donationUsername) { - announce(donationUsername, "дал тебе железный меч!", "дал железный меч", player, true); + announce(donationUsername, "дал тебе железную кирку!", "дал железную кирку", player, true); ExecUtils.giveToPlayer(player, Material.IRON_AXE, 1, donationUsername); } public static void giveDiamondKirka (Player player, String donationUsername) { - announce(donationUsername, "дал тебе железный меч!", "дал железный меч", player, true); + announce(donationUsername, "дал тебе алмазную кирку!", "дал алмазную кирку", player, true); ExecUtils.giveToPlayer(player, Material.DIAMOND_AXE, 1, donationUsername); } @@ -377,7 +378,7 @@ public static void spawnTamedCat (Player player, String donationUsername) { } public static void healPlayer (Player player, String donationUsername) { - announce(donationUsername, "подарил тебе котейку!", "подарил котейку", player, true); + announce(donationUsername, "полностью вас вылечил!", "полностью вылечил", player, true); player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue()); } diff --git a/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMob.java b/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMob.java index 342352b..e468656 100644 --- a/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMob.java +++ b/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMob.java @@ -6,6 +6,7 @@ import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.RayTraceResult; import org.bukkit.util.Vector; @@ -349,7 +350,7 @@ public void run() { .add(0, -2, 0), EntityType.FIREBALL); stalinBall.setDirection(genVec(stalinBall.getLocation(), target.getLocation()).clone().multiply(2)); - + stalinBall.setMetadata("type", new FixedMetadataValue(DonationExecutor.getInstance(), "giantball")); } }.runTaskTimer(DonationExecutor.getInstance(), 0, 45); diff --git a/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMobEventListener.java b/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMobEventListener.java index eb83387..e935317 100644 --- a/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMobEventListener.java +++ b/src/main/java/igorlink/donationexecutor/executionsstaff/giantmobs/GiantMobEventListener.java @@ -45,12 +45,12 @@ public void onGiantMobDamage(EntityDamageEvent e){ //Обрабатываем попадание снежка и файербола @EventHandler public void onProjectileHit(ProjectileHitEvent e) { - if (e.getEntity() instanceof Snowball) { + if ( (e.getEntity() instanceof Snowball) && (((Snowball) e.getEntity()).getItem().getLore().contains("Stalinball")) ) { //Урон от снежка if ((e.getHitEntity()) instanceof LivingEntity) { ((LivingEntity) e.getHitEntity()).damage(1.0D); } - } else if (e.getEntity() instanceof Fireball) { + } else if ( (e.getEntity() instanceof Fireball) && (e.getEntity().hasMetadata("type")) ) { //Взрыв от файербола if (!(e.getHitEntity() instanceof Giant)) { e.getEntity().getWorld().createExplosion(e.getEntity().getLocation(), 2.0F, true); diff --git a/src/main/java/igorlink/service/Utils.java b/src/main/java/igorlink/service/Utils.java index c5fdac3..cd915d1 100644 --- a/src/main/java/igorlink/service/Utils.java +++ b/src/main/java/igorlink/service/Utils.java @@ -170,12 +170,6 @@ public static Boolean isBlackListed(String text) { return false; } -// for (String ss : MainConfig.listOfWhiteListedSubstrings) { -// if (validationText.contains(ss)) { -// validationText = validationText.replace(ss, ""); -// } -// } - if (!(validationText.matches("[a-zа-я0-9$!ё]*"))) { return true; @@ -188,22 +182,22 @@ public static Boolean isBlackListed(String text) { for (int j = 0; j <= ss.length(); j++) { if (j == ss.length()) { + //если мы прошли всю субстроку до конца - значит слово содержит субстроку из блеклиста return true; } + //Если текущая буква субстроки равна или синонимична текущей букве в слове, значит идем дальше смотреть следующий символ if (validationText.charAt(tempi + j) == ss.charAt(j)) { continue; - } else if ((mapOfSynonimousChars.containsKey(ss.charAt(j)))) { - if ((mapOfSynonimousChars.get(ss.charAt(j)).contains(validationText.charAt(tempi + j)))) { - continue; - } + } else if ((mapOfSynonimousChars.containsKey(ss.charAt(j))) && (mapOfSynonimousChars.get(ss.charAt(j)).contains(validationText.charAt(tempi + j)))) { + continue; } while (true) { if (j==0) { break; } - if (!(validationText.charAt(tempi + j) == validationText.charAt(tempi + j - 1))) { + if (validationText.charAt(tempi + j) != validationText.charAt(tempi + j - 1)) { if (!(mapOfSynonimousChars.containsKey(validationText.charAt(tempi + j)))) { break; } else if (!(mapOfSynonimousChars.get(validationText.charAt(tempi + j)).contains(validationText.charAt(tempi + j - 1)))) { @@ -216,6 +210,10 @@ public static Boolean isBlackListed(String text) { } } + if ((validationText.length()-tempi-j) < (ss.length()-j)) { + break; + } + if (validationText.charAt(tempi + j) == ss.charAt(j)) { continue; } else if ((mapOfSynonimousChars.containsKey(ss.charAt(j)))) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b708922..f7aa5d7 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: DonationExecutor -version: 0.3.4 +version: 0.3.5 website: "https://github.com/link1107/DonationExecutor" main: igorlink.donationexecutor.DonationExecutor api-version: 1.18 @@ -20,8 +20,8 @@ commands: aliases: [de] description: "Позволяет имитировать донаты для тестов или для воспроизведения события вручную" usage: "§c[DonationExecutor] §fДоступные команды: \n - §c/d §7donate §b<СУММА> <ИМЯ>§f - сымитировать донат\n - §c/d §7reload§f - перезагрузить настройки из конфига - §c/d §7filter §bON|OFF§f - включить/выключить фильтр никнеймов" + §c/de §7donate §b<СУММА> <ИМЯ>§f - сымитировать донат\n + §c/de §7reload§f - перезагрузить настройки из конфига + §c/de §7filter §bON|OFF§f - включить/выключить фильтр никнеймов"