diff --git a/pom.xml b/pom.xml
index 4076cbe..49bd225 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
IgorLink
DonationExecutor
- 0.3.3-SNAPSHOT
+ 0.3.4-SNAPSHOT
jar
DonationExecutor
diff --git a/src/main/java/igorlink/donationexecutor/Executor.java b/src/main/java/igorlink/donationexecutor/Executor.java
index df1cf3a..c056658 100644
--- a/src/main/java/igorlink/donationexecutor/Executor.java
+++ b/src/main/java/igorlink/donationexecutor/Executor.java
@@ -20,7 +20,6 @@
import static igorlink.service.Utils.*;
import static java.lang.Math.random;
import static java.lang.Math.round;
-import static org.bukkit.Bukkit.getPlayer;
import static org.bukkit.Bukkit.getPlayerExact;
public class Executor {
@@ -105,7 +104,7 @@ public static void shitToInventory (Player player, String donationUsername) {
meta.setLore(List.of("§7Это говно ужасно вонюче и занимает много места"));
itemStack.setItemMeta(meta);
- for (int i = 0; i < MainConfig.dirtAmount; i++) {
+ for (int i = 0; i < MainConfig.getDirtAmount(); i++) {
player.getInventory().addItem(itemStack);
}
}
@@ -187,7 +186,7 @@ public static void spawnCreeper (Player player, String donationUsername) {
public static void giveDiamonds (Player player, String donationUsername) {
//Give some diamonds to the player
announce(donationUsername, "насыпал тебе алмазов!", "насыпал алмазов", player, true);
- ExecUtils.giveToPlayer(player, Material.DIAMOND, 4, donationUsername);
+ ExecUtils.giveToPlayer(player, Material.DIAMOND, MainConfig.getDiamondsAmount(), donationUsername);
}
public static void giveStackOfDiamonds (Player player, String donationUsername) {
@@ -197,7 +196,7 @@ public static void giveStackOfDiamonds (Player player, String donationUsername)
public static void giveBread (Player player, String donationUsername) {
announce(donationUsername, "дал тебе Советского Хлеба!", "дал Советского Хлеба", player, true);
- ExecUtils.giveToPlayer(player, Material.BREAD, 4, donationUsername, "§6Советский Хлеб");
+ ExecUtils.giveToPlayer(player, Material.BREAD, MainConfig.getBreadAmount(), donationUsername, "§6Советский Хлеб");
}
public static void callNKVD (Player player, String donationUsername) {
@@ -206,16 +205,16 @@ public static void callNKVD (Player player, String donationUsername) {
announce(donationUsername, "хочет отправить тебя в ГУЛАГ!", "хочет отправить в ГУЛАГ", player, true);
direction.setY(0);
direction.normalize();
- for (int i = 1; i <= 1; i++) {
+ for (int i = 1; i <= MainConfig.getAmountOfNKVD(); i++) {
Location newloc = player.getLocation().clone();
Vector newdir = direction.clone();
newdir = newdir.rotateAroundY(1.5708 * i).multiply(2);
newloc.add(newdir);
nkvdMob = (LivingEntity) player.getWorld().spawnEntity(newloc, EntityType.ZOMBIE);
nkvdMob.setCustomName("§cСотрудник НКВД");
- nkvdMob.getEquipment().setItem(EquipmentSlot.HAND, new ItemStack(Material.WOODEN_SWORD));
+ Objects.requireNonNull(nkvdMob.getEquipment()).setItem(EquipmentSlot.HAND, new ItemStack(Material.WOODEN_SWORD));
if (((Zombie) nkvdMob).isAdult()) {
- nkvdMob.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.28);
+ Objects.requireNonNull(nkvdMob.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED)).setBaseValue(0.28);
}
}
@@ -248,15 +247,15 @@ public static void randomChange (Player player, String donationUsername) {
}
- String replacedItems = new String("");
+ StringBuilder replacedItems = new StringBuilder();
int replacedCounter = 0;
for (int i = 0; i <= 4; i++) {
if (!(player.getInventory().getItem(randoms[i]) == null)) {
replacedCounter++;
if (replacedCounter > 1) {
- replacedItems = replacedItems + "§f, ";
+ replacedItems.append("§f, ");
}
- replacedItems = replacedItems + "§b" + Objects.requireNonNull(player.getInventory().getItem(randoms[i])).getAmount() + " §f" + Objects.requireNonNull(player.getInventory().getItem(randoms[i])).getI18NDisplayName();
+ replacedItems.append("§b").append(Objects.requireNonNull(player.getInventory().getItem(randoms[i])).getAmount()).append(" §f").append(Objects.requireNonNull(player.getInventory().getItem(randoms[i])).getI18NDisplayName());
}
player.getInventory().setItem(randoms[i], new ItemStack(Material.STONE, 1));
}
@@ -293,7 +292,7 @@ public static void tamedBecomesEnemies (Player player, String donationUsername)
public static void bigBoom (Player player, String donationUsername) {
announce(donationUsername, "сейчас тебя РАЗНЕСЕТ В КЛОЧЬЯ!!!", "сейчас РАЗНЕСЕТ В КЛОЧЬЯ", player, true);
- player.getWorld().createExplosion(player.getLocation(), MainConfig.bigBoomRadius, true);
+ player.getWorld().createExplosion(player.getLocation(), MainConfig.getBigBoomRadius(), true);
}
@@ -353,7 +352,7 @@ public static void spawnTamedCat (Player player, String donationUsername) {
public static void healPlayer (Player player, String donationUsername) {
announce(donationUsername, "подарил тебе котейку!", "подарил котейку", player, true);
- player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
+ player.setHealth(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue());
}
}
diff --git a/src/main/java/igorlink/donationexecutor/executionsstaff/executionsmanagement/executions/inventory/ShitToInventory.java b/src/main/java/igorlink/donationexecutor/executionsstaff/executionsmanagement/executions/inventory/ShitToInventory.java
index 6d93d5e..12f678e 100644
--- a/src/main/java/igorlink/donationexecutor/executionsstaff/executionsmanagement/executions/inventory/ShitToInventory.java
+++ b/src/main/java/igorlink/donationexecutor/executionsstaff/executionsmanagement/executions/inventory/ShitToInventory.java
@@ -22,7 +22,7 @@ public Boolean execute(String donationUsername, Player player) {
meta.setDisplayName("§cГОВНО ОТ §f" + donationUsername.toUpperCase());
meta.setLore(Arrays.asList("§7Это говно ужасно вонюче и занимает много места"));
itemStack.setItemMeta(meta);
- for (int i = 0; i < MainConfig.dirtAmount; i++) {
+ for (int i = 0; i < MainConfig.getDirtAmount(); i++) {
player.getInventory().addItem(itemStack);
}
return true;
diff --git a/src/main/java/igorlink/service/MainConfig.java b/src/main/java/igorlink/service/MainConfig.java
index f1dd72e..de6431b 100644
--- a/src/main/java/igorlink/service/MainConfig.java
+++ b/src/main/java/igorlink/service/MainConfig.java
@@ -4,16 +4,19 @@
import org.bukkit.configuration.file.FileConfiguration;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
public class MainConfig {
private static FileConfiguration config = DonationExecutor.getInstance().getConfig();
- public static int dirtAmount = 0;
- public static int diamondsAmount = 0;
- public static int breadAmount = 0;
- public static int bigBoomRadius = 0;
- public static String token;
- public static List listOfBlackListedSubstrings = new ArrayList<>();
+ private static int dirtAmount;
+ private static int diamondsAmount;
+ private static int breadAmount;
+ private static int bigBoomRadius;
+ private static int timeForAnnouncement;
+ private static int amountOfNKVD;
+ private static String token;
+ private static List listOfBlackListedSubstrings = new ArrayList<>();
public static List listOfWhiteListedSubstrings = new ArrayList<>();
private static Boolean twitchFilter;
private static Boolean forceResourcePack;
@@ -45,10 +48,11 @@ public static void loadMainConfig(Boolean isReload) throws InterruptedException
config = DonationExecutor.getInstance().getConfig();
- dirtAmount = config.getInt("DirtAmount");
- diamondsAmount = config.getInt("DiamondsAmount");
- breadAmount = config.getInt("BreadAmount");
- bigBoomRadius = config.getInt("BigBoomRadius");
+ dirtAmount = config.getInt("dirt-amount");
+ diamondsAmount = config.getInt("diamonds-amount");
+ breadAmount = config.getInt("bread-amount");
+ bigBoomRadius = config.getInt("big-boom-radius");
+ timeForAnnouncement = config.getInt("announcement-duration-seconds");
token = config.getString("DonationAlertsToken");
listOfBlackListedSubstrings = config.getStringList("BlacklistedSubstrings");
@@ -57,6 +61,7 @@ public static void loadMainConfig(Boolean isReload) throws InterruptedException
optifineNotification = config.getBoolean("notify-about-optifine");
twitchFilter = config.getBoolean("twitch-filter");
forceResourcePack = config.getBoolean("force-download-resourcepack");
+
}
@@ -65,11 +70,18 @@ public static void turnFilterOn() {
}
public static void turnFilterOff() { twitchFilter = false; }
- public static Boolean getFilterStatus() { return twitchFilter; }
- public static Boolean isForceResourcePack() {
+ public static boolean getFilterStatus() { return twitchFilter; }
+ public static boolean isForceResourcePack() {
return forceResourcePack;
}
- public static Boolean isOptifineNotificationOn() { return optifineNotification; }
+ public static boolean isOptifineNotificationOn() { return optifineNotification; }
+ public static int getDirtAmount() { return dirtAmount; }
+ public static int getBigBoomRadius() { return bigBoomRadius; }
+ public static int getDiamondsAmount() { return diamondsAmount; }
+ public static int getBreadAmount() { return breadAmount; }
+ public static int getTimeForAnnouncement() { return timeForAnnouncement; }
+ public static int getAmountOfNKVD() { return amountOfNKVD; }
+ public static List getListOfBlackListedSubstrings() { return listOfBlackListedSubstrings; }
}
diff --git a/src/main/java/igorlink/service/Utils.java b/src/main/java/igorlink/service/Utils.java
index 7c27f1a..04a9142 100644
--- a/src/main/java/igorlink/service/Utils.java
+++ b/src/main/java/igorlink/service/Utils.java
@@ -56,8 +56,7 @@ public static void announce(String donaterName, String subText, String alterSubt
if (donaterName.equals("")) {
_donaterName = "Кто-то";
}
- Title title = new Title("§c" + _donaterName, "§f" + subText);
- player.sendTitle(title);
+ player.sendTitle("§c" + _donaterName,"§f" + subText, 7, MainConfig.getTimeForAnnouncement()*20, 7);
player.sendMessage("§c[DE] §fДонатер §c" + _donaterName, "§f" + subText);
}
@@ -180,7 +179,7 @@ public static Boolean isBlackListed(String text) {
}
- for (String ss : MainConfig.listOfBlackListedSubstrings) {
+ for (String ss : MainConfig.getListOfBlackListedSubstrings()) {
for (int i = 0; i <= validationText.length() - ss.length(); i++) {
int tempi = i;
for (int j = 0; j <= ss.length(); j++) {
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 2cded3f..1dd9241 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -121,14 +121,17 @@ donation-amounts:
GiveStackOfDiamonds: 2012
#Далее вы можете добавите другие токены и других игроков по образцу выше.
+# Сколько секунд будет висеть оповещение о донате
+announcement-duration-seconds: 3
+
# Сколько блоков говна игроки будут получать в инвентарь от ShitToInventory
-DirtAmount: 10
+dirt-amount: 10
# Сколько алмазов игроки будут получать в инвентарь от GiveDiamonds
-DiamondsAmount: 4
+diamonds-amount: 4
# Сколько хлеба игроки будут получать в инвентарь от GiveBread
-BreadAmount: 4
+bread-amount: 4
# Радиус взрыва от BigBoom
-BigBoomRadius: 20
+big-boom-radius: 20
# ДЛЯ КОРРЕКТНОГО ОТОБРАЖЕНИЯ КАСТОМНЫХ СКИНОВ ПЛАГИНА У ИГРОКОВ ДОЛЖЕН БЫТЬ УСТАНОВЛЕН МОД OPTIFINE - https://optifine.net/downloads
# ЧТОБЫ ОТКЛЮЧИТЬ УВЕДОМЛЕНИЯ О НЕОБХОДИМОСТИ УСТАНОВИТЬ ОПТИФАЙН, ИЗМЕНИТЕ ЗНАЧЕНИЕ НИЖЕ С "true" НА "false"
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index f8b1e1d..49804ec 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,6 @@
name: DonationExecutor
-version: 0.3.3
+version: 0.3.4
+website: "https://github.com/link1107/DonationExecutor"
main: igorlink.donationexecutor.DonationExecutor
api-version: 1.18
authors: [Igor Link]