Merge pull request 'AddMoney' (#4) from AddMoney into main

Reviewed-on: #4
This commit is contained in:
JaTiTV 2022-04-16 16:53:58 +02:00
commit 4bdbe98f8a
24 changed files with 142 additions and 66 deletions

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: me.clip:placeholderapi:2.9.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/me/clip/placeholderapi/2.9.2/placeholderapi-2.9.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/me/clip/placeholderapi/2.9.2/placeholderapi-2.9.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/me/clip/placeholderapi/2.9.2/placeholderapi-2.9.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -43,6 +43,7 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.9.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: me.clip:placeholderapi:2.11.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jetbrains:annotations:19.0.0" level="project" />
</component>
</module>

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>11.1</version>
<version>11.4</version>
<packaging>jar</packaging>
<name>T2CodeLib</name>
@ -103,7 +103,7 @@
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.9.2</version>
<version>2.11.1</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@ -7,10 +7,34 @@ import org.bukkit.inventory.ItemStack;
public class ItemVersion {
private static Material Head;
private static ItemStack HeadIS;
private static ItemStack CRAFTING_TABLE;
private static ItemStack YELLOW_WOOL;
private static ItemStack ORANGE_WOOL;
private static ItemStack GREEN_WOOL;
private static ItemStack GRAY_WOOL;
private static ItemStack RED_WOOL;
private static ItemStack RED_STAINED_GLASS_PANE;
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");
YELLOW_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 4);
ORANGE_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 1);
GREEN_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 5);
GRAY_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 8);
RED_WOOL = new ItemStack(Material.valueOf("WOOL"), 1, (short) 14);
RED_STAINED_GLASS_PANE = new ItemStack(Material.valueOf("STAINED_GLASS_PANE"), 1, (short) 14);
CRAFTING_TABLE = new ItemStack(Material.valueOf("WORKBENCH"));
} else {
Head = Material.valueOf("PLAYER_HEAD");
CRAFTING_TABLE = new ItemStack(Material.CRAFTING_TABLE);
YELLOW_WOOL = new ItemStack(Material.YELLOW_WOOL);
ORANGE_WOOL = new ItemStack(Material.ORANGE_WOOL);
GREEN_WOOL = new ItemStack(Material.GREEN_WOOL);
GRAY_WOOL = new ItemStack(Material.GRAY_WOOL);
RED_WOOL = new ItemStack(Material.RED_WOOL);
RED_STAINED_GLASS_PANE = new ItemStack(Material.RED_STAINED_GLASS_PANE);
}
HeadIS = new ItemStack(Head);
}
@ -21,4 +45,32 @@ public class ItemVersion {
public static ItemStack getHeadIS() {
return HeadIS;
}
public static ItemStack getCraftingTable() {
return CRAFTING_TABLE;
}
public static ItemStack getYellowWool() {
return YELLOW_WOOL;
}
public static ItemStack getOrangeWool() {
return ORANGE_WOOL;
}
public static ItemStack getGreenWool() {
return GREEN_WOOL;
}
public static ItemStack getGrayWool() {
return GRAY_WOOL;
}
public static ItemStack getRedWool() {
return RED_WOOL;
}
public static ItemStack getRedStainedGlassPane() {
return RED_STAINED_GLASS_PANE;
}
}

View File

@ -22,6 +22,7 @@ public class NMSVersion {
public static boolean v1_17_R1;
public static boolean v1_18_R1;
public static boolean v1_18_R2;
public static boolean v1_19_R1;
public static void onCheck() {
isNMS = Bukkit.getServer().getClass().getPackage().getName();
@ -43,5 +44,6 @@ public class NMSVersion {
v1_17_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_17_R1");
v1_18_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R1");
v1_18_R2 = Bukkit.getServer().getClass().getPackage().getName().contains("1_18_R2");
v1_19_R1 = Bukkit.getServer().getClass().getPackage().getName().contains("1_19_R1");
}
}

View File

@ -43,6 +43,9 @@ public class PluginCheck {
public static Boolean luckyBox(){
return Bukkit.getPluginManager().getPlugin("T2C-LuckyBox") != null;
}
public static Boolean autoResponse(){
return Bukkit.getPluginManager().getPlugin("T2C-AutoResponse") != null;
}
public static Boolean opSec(){
return Bukkit.getPluginManager().getPlugin("OPSecurity") != null;
}
@ -53,7 +56,7 @@ public class PluginCheck {
return Bukkit.getPluginManager().getPlugin("Booster") != null;
}
public static Boolean antiMapCopy(){
return Bukkit.getPluginManager().getPlugin("AAntiMapCopy") != null;
return Bukkit.getPluginManager().getPlugin("AntiMapCopy") != null;
}
public static Boolean loreEditor(){
return Bukkit.getPluginManager().getPlugin("LoreEditor") != null;

View File

@ -26,7 +26,7 @@ public class UpdateAPI {
public static void join(Plugin plugin, String prefix, String perm, Player player, String spigot, String discord) {
String pluginVersion = plugin.getDescription().getVersion();
if (!player.hasPermission(perm) || !player.isOp()) {
if (!player.hasPermission(perm) && !player.isOp()) {
return;
}
if (UpdateAPI.PluginVersionen.get(plugin.getName()) == null) {

View File

@ -22,12 +22,20 @@ public class Vault {
}
p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix);
} else {
if (Main.eco.getBalance(p) < price) {
return false;
} else {
Main.eco.withdrawPlayer(p, price);
return true;
return Main.eco.withdrawPlayer(p,price).transactionSuccess();
}
return false;
}
public static boolean addMoney(String prefix, Player p, Double price) {
if (Main.eco == null) {
if (Bukkit.getPluginManager().getPlugin("Vault") == null) {
send.console(prefix + " §4\n" + prefix + " §4Vault could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/vault.34315/§4\n" + prefix);
}
p.sendMessage(prefix + "\n" + SelectLibMsg.VaultNotSetUp + "\n" + prefix);
} else {
return Main.eco.depositPlayer(p,price).transactionSuccess();
}
return false;
}

View File

@ -26,35 +26,36 @@ public class CmdExecuter implements CommandExecutor, TabCompleter {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!sender.hasPermission("t2code.admin")){
send.sender(sender,"§4No Permission §8t2code.admin");
if (!sender.hasPermission("t2code.admin")) {
send.sender(sender, "§4No Permission §8t2code.admin");
return false;
}
if (args.length == 0) {
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
} else {
switch (args[0].toLowerCase()) {
case "info":
case "plugin":
case "pl":
case "version":
case "ver":
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
return false;
}
if ("debug".equals(args[0].toLowerCase())) {
return false;
}
switch (args[0].toLowerCase()) {
case "info":
case "plugin":
case "pl":
case "version":
case "ver":
T2CodeTemplate.sendInfo(sender, Util.getPrefix(), Util.getSpigot(), Util.getDiscord(), Main.autor, Main.version, UpdateAPI.PluginVersionen.get(Main.plugin.getName()).publicVersion);
return false;
case "debug":
if (args.length != 2) {
send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
}
if ("createreportlog".equals(args[1].toLowerCase())) {
CreateReportLog.create(sender);
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
} else send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
default:
send.sender(sender, "§4Use: §7/t2code debug createReportLog");
return false;
}
return false;
}

View File

@ -5,10 +5,10 @@ import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import net.t2code.lib.Spigot.Lib.vault.Vault;
import net.t2code.lib.Util;
import net.t2code.luckyBox.api.LuckyBoxAPI;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@ -20,7 +20,6 @@ import java.util.Calendar;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class CreateReportLog {
protected static void create(CommandSender sender) {
send.sender(sender, Main.prefix + " §6A DebugLog is created...");
@ -102,24 +101,26 @@ public class CreateReportLog {
zip.putNextEntry(new ZipEntry(fileToZip.getName()));
Files.copy(fileToZip.toPath(), zip);
//File logToZip = new File(log);
//zipOut.putNextEntry(new ZipEntry(logToZip.getName()));
//Files.copy(logToZip.toPath(), zipOut);
addFileToZip("", "logs/latest.log", zip, false);
//pluginToDebug("T2CodeLib", "T2CodeLib", zip); todo bugfix (servercrash)
pluginToDebug("T2C-LuckyBox", "T2C-LuckyBox", zip);
pluginToDebug("WonderBagShop", "WonderBagShop", zip);
pluginToDebug("CommandGUI", "CommandGUI", zip);
pluginToDebug("OPSecurity", "OPSecurity", zip);
pluginToDebug("PaPiTest", "PaPiTest", zip);
pluginToDebug("PlotSquaredGUI", "PlotSquaredGUI", zip);
pluginToDebug("T2C-Alias", "T2Code-Alias", zip);
for (String pl : Util.getT2cPlugins()){
pluginToDebug(pl, zip);
}
//pluginToDebug("T2C-LuckyBox", zip);
//pluginToDebug("WonderBagShop", zip);
//pluginToDebug("CommandGUI", zip);
//pluginToDebug("OPSecurity", zip);
//pluginToDebug("PaPiTest", zip);
//pluginToDebug("PlotSquaredGUI", zip);
//pluginToDebug("T2C-Alias", zip);
//pluginToDebug("T2C-AutoResponse", zip);
//
//pluginToDebug("LoreEditor", zip);
//pluginToDebug("Booster", zip);
//pluginToDebug("AntiMapCopy", zip);
//pluginToDebug("AntiCopy", zip);
pluginToDebug("LoreEditor", "LoreEditor", zip);
pluginToDebug("Booster", "Booster", zip);
pluginToDebug("AntiMapCopy", "AntiCopy", zip);
zip.closeEntry();
zip.close();
} catch (IOException e) {
@ -133,7 +134,7 @@ public class CreateReportLog {
}
private static void pluginToDebug(String pluginName, String jar, ZipOutputStream zip) throws IOException {
private static void pluginToDebug(String pluginName, ZipOutputStream zip) throws IOException {
if (PluginCheck.pluginCheck(pluginName)) {
Plugin plugin = Bukkit.getPluginManager().getPlugin(pluginName);
File plConfigs = new File(plugin.getDataFolder().getPath());
@ -144,7 +145,7 @@ public class CreateReportLog {
File[] fileArray = f.listFiles();
for (File config : fileArray) {
if (config.getName().contains(jar) && config.getName().contains(".jar")) {
if (config.getName().contains(pluginName) && config.getName().contains(".jar")) {
addFileToZip("T2Code-Plugins", config.getPath(), zip, false);
}
}

View File

@ -11,7 +11,7 @@ import java.io.File;
public class SelectLibMsg {
private static Plugin plugin = Main.plugin;
private static String prefix = Main.prefix;
private static String prefix = Main.prefix;
public static String selectMSG;
@ -41,8 +41,6 @@ private static String prefix = Main.prefix;
VaultNotSetUp = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.VaultNotSetUp"));
SoundNotFound = Replace.replace(prefix, yamlConfiguration_msg.getString("Plugin.SoundNotFound"));
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
send.console(Prefix + " §2Language successfully selected to: §6" + selectMSG + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
}
}

View File

@ -1,5 +1,8 @@
package net.t2code.lib;
import java.util.Arrays;
import java.util.List;
public class Util {
private static Boolean Snapshot = false;
@ -32,4 +35,24 @@ public class Util {
public static Boolean getSnapshot(){
return Snapshot;
}
public static List<String> getT2cPlugins() {
return t2cPlugins;
}
private static List<String> t2cPlugins =
Arrays.asList(
"T2C-LuckyBox",
"WonderBagShop",
"CommandGUI",
"OPSecurity",
"PaPiTest",
"PlotSquaredGUI",
"T2C-Alias",
"T2C-AutoResponse",
"LoreEditor",
"Booster",
"AntiMapCopy",
"AntiCopy"
);
}

View File

@ -1,5 +1,5 @@
name: T2CodeLib
version: 11.1
version: 11.4
main: net.t2code.lib.Bungee.BMain
author: JaTiTV, Jkobs
description: Libarie from T2Code Plugins

View File

@ -1,5 +1,5 @@
name: T2CodeLib
version: 11.1
version: 11.4
main: net.t2code.lib.Spigot.system.Main
api-version: 1.13
prefix: T2CodeLib