This commit is contained in:
2021-12-04 05:27:03 +01:00
parent 13baf14d7d
commit 54b034fc31
13 changed files with 38 additions and 49 deletions

View File

@@ -2,14 +2,23 @@ package net.t2code.lib.Spigot.Lib.items;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class ItemVersion {
public static Material Head;
private static Material Head;
private static ItemStack HeadIS;
public static void scan(){
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
Head = Material.valueOf("SKULL");
} else Head = Material.valueOf("PLAYER_HEAD");
HeadIS = new ItemStack(Head);
}
public static Material getHead() {
return Head;
}
public static ItemStack getHeadIS() {
return HeadIS;
}
}

View File

@@ -5,6 +5,7 @@ import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Replace {
@@ -37,10 +38,10 @@ public class Replace {
public static List<String> replace(String prefix,Player player, List<String> Text) {
List<String> output = new ArrayList();
if (player == null) {
return Arrays.asList("player is null");
return Collections.singletonList("player is null");
}
if (Text == null) {
return Arrays.asList("Text is null");
return Collections.singletonList("Text is null");
}
for (String input : Text) {
output.add(PlaceholderAPI.setPlaceholders(player, input.replace("[prefix]", prefix).replace("&", "§")
@@ -51,8 +52,8 @@ public class Replace {
}
public static List replacePrice(String prefix,List<String> Text, String price) {
List rp = new ArrayList();
public static List<String> replacePrice(String prefix,List<String> Text, String price) {
List<String> rp = new ArrayList();
for (String s : Text) {
rp.add(s.replace("[prefix]", prefix).replace("&", "§")
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")
@@ -63,8 +64,8 @@ public class Replace {
}
public static List replacePrice(String prefix,Player player, List<String> Text, String price) {
List rp = new ArrayList();
public static List<String> replacePrice(String prefix,Player player, List<String> Text, String price) {
List<String> rp = new ArrayList();
for (String s : Text) {
rp.add(PlaceholderAPI.setPlaceholders(player, s.replace("[prefix]", prefix).replace("&", "§")
.replace("[ue]", "ü").replace("[UE]", "Ü").replace("[oe]", "ö")

View File

@@ -33,7 +33,7 @@ public class Vault {
}
public static void loadVault() throws InterruptedException {
Long long_ = Long.valueOf(System.currentTimeMillis());
long long_ = System.currentTimeMillis();
if (Main.plugin.getServer().getPluginManager().getPlugin("Vault") != null) {
vaultEnable = true;
RegisteredServiceProvider<Economy> eco = Main.plugin.getServer().getServicesManager().getRegistration(Economy.class);
@@ -41,14 +41,14 @@ public class Vault {
Main.eco = eco.getProvider();
if (Main.eco != null) {
connected = true;
send.console(Main.prefix + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Main.prefix + " §2Vault / Economy successfully connected!" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
} else {
connected = false;
send.console(Main.prefix + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Main.prefix + " §4Economy could not be connected / found! 1" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
} else {
connected = false;
send.console(Main.prefix + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Main.prefix + " §4Economy could not be connected / found! 2" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
RegisteredServiceProvider<Permission> perm = Main.plugin.getServer().getServicesManager().getRegistration(Permission.class);
if (perm != null) {
@@ -57,7 +57,7 @@ public class Vault {
} else {
vaultEnable = false;
connected = false;
send.console(Main.prefix + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Main.prefix + " §4Vault could not be connected! 3" + " §7- §e" + (System.currentTimeMillis() - long_) + "ms");
}
}

View File

@@ -40,7 +40,7 @@ public class Config {
}
}
public static void set(String path, List value, YamlConfiguration YamlConfiguration) {
public static void set(String path, List<String> value, YamlConfiguration YamlConfiguration) {
if (!YamlConfiguration.contains(path)) {
YamlConfiguration.set(path, value);
}
@@ -93,16 +93,7 @@ public class Config {
SOUND = sound1_9;
} else SOUND = sound1_13;
try {
Sound sound_Buy = Sound.valueOf(selectSoundFromConfig);
if (sound_Buy != null) {
return sound_Buy;
} else return null;
} catch (Exception e) {
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
return Sound.valueOf(SOUND);
}
return checkSound(SOUND, selectSoundFromConfig, prefix);
}
public static Sound checkSound(String sound1_8, String sound1_13, String selectSoundFromConfig, String prefix) {
@@ -111,24 +102,12 @@ public class Config {
SOUND = sound1_8;
} else SOUND = sound1_13;
try {
Sound sound_Buy = Sound.valueOf(selectSoundFromConfig);
if (sound_Buy != null) {
return sound_Buy;
} else return null;
} catch (Exception e) {
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
return Sound.valueOf(SOUND);
}
return checkSound(SOUND, selectSoundFromConfig, prefix);
}
public static Sound checkSound(String sound, String selectSoundFromConfig, String prefix) {
try {
Sound sound_Buy = Sound.valueOf(selectSoundFromConfig);
if (sound_Buy != null) {
return sound_Buy;
} else return null;
return Sound.valueOf(selectSoundFromConfig);
} catch (Exception e) {
send.console("§4\n§4\n§4\n" + SelectLibMsg.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§8Buy: §6" + selectSoundFromConfig) + "§4\n§4\n§4\n");
@@ -153,8 +132,8 @@ public class Config {
return (yamlConfiguration.getDouble(path));
}
public static List selectList(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getList(path));
public static List<String> selectList(String path, YamlConfiguration yamlConfiguration) {
return (yamlConfiguration.getStringList(path));
}
public static ItemStack selectItemStack(String path, YamlConfiguration yamlConfiguration) {
@@ -162,7 +141,7 @@ public class Config {
}
public static List selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
public static List<String> selectList(String prefix, String path, YamlConfiguration yamlConfiguration) {
List<String> output = new ArrayList<>();
List<String> input = yamlConfiguration.getStringList(path);
for (String st : input) {
@@ -171,7 +150,7 @@ public class Config {
return output;
}
public static void select(String prefix, List value, String path, YamlConfiguration yamlConfiguration) {
public static void select(String prefix, List<String> value, String path, YamlConfiguration yamlConfiguration) {
List<String> output = new ArrayList<>();
List<String> input = yamlConfiguration.getStringList(path);
for (String st : input) {