This commit is contained in:
JaTiTV 2022-08-10 15:27:27 +02:00
parent 893f99c3e5
commit 7be7c9f09e
18 changed files with 188 additions and 201 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.t2code</groupId>
<artifactId>CommandGUI_V2</artifactId>
<version>2.8.9</version>
<version>2.8.10</version>
<packaging>jar</packaging>
<name>CommandGUI</name>
@ -54,14 +54,15 @@
<repositories>
<!-- repo.t2code / T2Code -->
<repository>
<id>Builders-Paradise</id>
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
</repository>
<repository>
<id>T2Code</id>
<url>https://repo.t2code.net/repository/T2Code/</url>
</repository>
<repository>
<id>Builders-Paradise</id>
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
</repository>
<!-- placeholderAPI -->
<repository>
<id>placeholderapi</id>
@ -71,6 +72,17 @@
<dependencies>
<!-- repo.t2code / T2Code -->
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>DEV-13.0</version>
<classifier>dev-3</classifier>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>bungee</artifactId>
@ -96,16 +108,7 @@
<artifactId>PlugmanGUI</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId>
<version>12.4</version>
</dependency>
<dependency>
<groupId>net.t2code</groupId>
<artifactId>LuckyBox-API</artifactId>
<version>4.2.2</version>
</dependency>
<!-- placeholderAPI -->
<dependency>
<groupId>me.clip</groupId>

View File

@ -3,7 +3,6 @@ package de.jatitv.commandguiv2.Bungee;
import de.jatitv.commandguiv2.Util;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.lib.Bungee.Lib.messages.Bsend;
import java.util.logging.Level;

View File

@ -13,7 +13,6 @@ package de.jatitv.commandguiv2.Bungee;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.plugin.Plugin;
import net.t2code.lib.Bungee.Lib.messages.Bsend;
import java.io.IOException;
import java.io.InputStream;

View File

@ -1,16 +1,14 @@
package de.jatitv.commandguiv2.Spigot;
//s<ds
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
import de.jatitv.commandguiv2.Spigot.system.Load;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.database.MySQL;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
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.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
@ -53,24 +51,25 @@ public final class Main extends JavaPlugin {
autor = this.getDescription().getAuthors();
version = this.getDescription().getVersion();
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12 || MCVersion.minecraft1_13 || MCVersion.minecraft1_14 || MCVersion.minecraft1_15 || NMSVersion.v1_16_R1) {
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12() || T2CmcVersion.isMc1_13() ||
T2CmcVersion.isMc1_14() || T2CmcVersion.isMc1_15() || T2CmcVersion.isNms1_16_R1()) {
legacy = true;
}
if (PluginCheck.pluginCheck("CommandGUI")) {
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.error(this, "");
send.error(this, "An older version of the plugin T2C-CommandGUI was found!");
send.error(this, "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
send.error(this, "Please remove the older version (CommandGUI)!");
send.error(this, this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
send.error(this, "");
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
if (T2CpluginCheck.pluginCheck("CommandGUI")) {
T2Csend.error( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Csend.error( "");
T2Csend.error( "An older version of the plugin T2C-CommandGUI was found!");
T2Csend.error( "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
T2Csend.error( "Please remove the older version (CommandGUI)!");
T2Csend.error( this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
T2Csend.error( "");
T2Csend.error( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
return;
}
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
if (PluginCheck.papi()) {
if (T2CpluginCheck.papi()) {
PaPi = true;
}
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
@ -78,24 +77,24 @@ public final class Main extends JavaPlugin {
}
public static void addonLoad() {
if (PluginCheck.plotSquaredGUI()) {
if (T2CpluginCheck.plotSquaredGUI()) {
PlotSquaredGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
}
if (PluginCheck.luckyBox()) {
if (T2CpluginCheck.luckyBox()) {
LuckyBox = true;
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
}
if (PluginCheck.plugManGUI()) {
if (T2CpluginCheck.plugManGUI()) {
PlugManGUI = true;
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
}
}
public static void addonEnable(Plugin plugin) {
send.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
T2Csend.console(Util.getPrefix() + " §aAddon for: §e" + plugin.getName() + "§7 - Version: " + plugin.getDescription().getVersion() + " §aloaded successfully!");
}
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {
@ -132,13 +131,13 @@ public final class Main extends JavaPlugin {
}
public static void sendTryCatch(Class c, StackTraceElement line) {
send.error(plugin, c.getName() + " Line: " + line.getLineNumber());
T2Csend.error(c.getName() + " Line: " + line.getLineNumber());
}
@Override
public void onDisable() {
// Plugin shutdown logic
if (enable) T2CodeTemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
if (enable) T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
MySQL.close();
}

View File

@ -12,10 +12,8 @@ import de.jatitv.commandguiv2.Spigot.sound.Sound;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import io.github.solyze.plugmangui.inventories.PluginListGUI;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.luckyBox.api.LuckyBoxAPI;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -47,7 +45,7 @@ public class OpenGUI {
player.openInventory((new PluginListGUI(54, 1)).getInventory());
} else {
if (player.hasPermission(Permissions.admin)) {
send.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
T2Csend.player(player, prefix + " §4PlugManGUI could not be found! §9Please download it here: " +
"§6https://spigotmc.org/resources/plugmangui.87599/");
}
}
@ -57,7 +55,7 @@ public class OpenGUI {
LuckyBoxAPI.openShop(player);
} else {
if (player.hasPermission(Permissions.admin)) {
send.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
T2Csend.player(player, prefix + " §4T2C-LuckyBox could not be found! §9Please download it here: " +
"§6https://www.spigotmc.org/resources/luckybox.98154/");
}
}
@ -80,7 +78,7 @@ public class OpenGUI {
try {
Function function = Main.functionHashMap.get(slot.function);
if (function == null) {
send.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
T2Csend.error(Main.getPlugin(), "The Function " + slot.function + " in the GUI " + gui.key + " does not exist!");
continue;
}
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
@ -131,8 +129,8 @@ public class OpenGUI {
Sound.play(player, SoundEnum.OpenInventory);
}
player.openInventory(inventory);
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} else send.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.guiName)));
T2Csend.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
} else T2Csend.player(player, SelectMessages.GUIIsDisabled.replace("[gui]", Replace.replace(prefix, gui.guiName)));
}
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {

View File

@ -1,7 +1,7 @@
package de.jatitv.commandguiv2.Spigot.listener;
import de.jatitv.commandguiv2.Spigot.Main;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@ -42,12 +42,12 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
send.debug(Main.getPlugin(),"stream: "+stream.toString());
T2Csend.debug(Main.getPlugin(),"stream: "+stream.toString());
try {
String subChannel = stream.readUTF();
String input = stream.readUTF();
send.debug(Main.getPlugin(),"subChannel: " +subChannel);
send.debug(Main.getPlugin(),"input: " +input);
T2Csend.debug(Main.getPlugin(),"subChannel: " +subChannel);
T2Csend.debug(Main.getPlugin(),"input: " +input);
switch (subChannel) {
case "join":
Main.bungeejoinplayers.add(input);

View File

@ -4,8 +4,9 @@ package de.jatitv.commandguiv2.Spigot.listener;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -18,6 +19,6 @@ public class PluginEvent implements Listener {
public void onJoinEvent(PlayerLoginEvent event) {
Player player = event.getPlayer();
SelectDatabase.nameCheck(player);
UpdateAPI.join(Main.getPlugin(),prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord());
T2CupdateAPI.join(Main.getPlugin(),prefix, Permissions.updatemsg, event.getPlayer(), Util.getSpigotID(), Util.getDiscord());
}
}

View File

@ -9,8 +9,8 @@ import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.enums.EcoEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
@ -51,7 +51,7 @@ public class Obj_Select {
String guiName = yamlConfiguration_gui.getString("GUI.Name");
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
String guiFillItemItem;
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
@ -65,7 +65,7 @@ public class Obj_Select {
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
Function functionCheck = Main.functionHashMap.get(function);
if (functionCheck == null) {
send.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
T2Csend.error(Main.getPlugin(), "The Function " + function + " in the GUI " + key + " does not exist!");
}
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
@ -133,7 +133,7 @@ public class Obj_Select {
try {
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
} catch (Exception ex) {
send.error(Main.getPlugin(), "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
T2Csend.error(Main.getPlugin(), "The EcoModule " + yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase() + " in the function file "
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
}
} else ecoModule = EcoEnum.VAULT;
@ -182,7 +182,7 @@ public class Obj_Select {
try {
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
} catch (Exception ex) {
send.error(Main.getPlugin(), "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
T2Csend.error(Main.getPlugin(), "The VotePoints Mode " + yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase() + " in the function file "
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
}
}
@ -194,7 +194,7 @@ public class Obj_Select {
try {
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
} catch (Exception ex) {
send.error(Main.getPlugin(), "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
T2Csend.error(Main.getPlugin(), "The Item Mode " + yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase() + " in the function file "
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
}
}

View File

@ -7,8 +7,7 @@ import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.entity.Player;
public class Sound {
@ -37,7 +36,7 @@ public class Sound {
try {
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
} catch (Exception e1) {
send.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
T2Csend.console("§4\n§4\n§4\n" + SelectMessages.SoundNotFound.replace("[prefix]", prefix)
.replace("[sound]", "§6GUI: §e" + gui.key + " §6Function: §e" + function.key + "§r §6Slot: §e" + (slot.slot + 1) + " §6CustomSound: §9" + function.customSound_Sound));
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
}

View File

@ -1,32 +1,26 @@
package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Main;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
public class Debug {
private static final Plugin plugin = Main.getPlugin();
public static void debugmsg() {
send.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
send.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
send.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
send.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
send.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
send.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
send.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
send.debug(plugin, "§5----------------------------------");
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Csend.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
T2Csend.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
T2Csend.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
T2Csend.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
T2Csend.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
T2Csend.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
T2Csend.debug(plugin, "§5----------------------------------");
if (new File(Main.getPath(), "config.yml").exists()) {
File f = new File(String.valueOf(Main.getPath()));
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
@ -36,22 +30,22 @@ public class Debug {
File[] fileArray3 = f3.listFiles();
if (fileArray != null) {
for (File config : fileArray) {
send.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
T2Csend.debug(plugin, String.valueOf(config).replace("plugins/CommandGUI/", ""));
}
}
if (fileArray2 != null) {
for (File config2 : fileArray2) {
send.debug(plugin, String.valueOf(config2).replace("plugins/CommandGUI/", ""));
T2Csend.debug(plugin, String.valueOf(config2).replace("plugins/CommandGUI/", ""));
}
} else send.debug(plugin, "No GUI files available");
} else T2Csend.debug(plugin, "No GUI files available");
if (fileArray3 != null) {
for (File config3 : fileArray3) {
send.debug(plugin, String.valueOf(config3).replace("plugins/CommandGUI/", ""));
T2Csend.debug(plugin, String.valueOf(config3).replace("plugins/CommandGUI/", ""));
}
} else send.debug(plugin, "No language files available");
} else T2Csend.debug(plugin, "No language files available");
}
send.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
}
}

View File

@ -22,11 +22,11 @@ import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.database.SQLITE;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
@ -39,14 +39,14 @@ public class Load {
public static void onLoad(String prefix, List<String> autor, String version, String spigot, int spigotID, String discord, int bstatsID) {
Long long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord);
Long long_ = T2Ctemplate.onLoadHeader(prefix, autor, version, spigot, discord);
try {
Debug.debugmsg();
} catch (Exception e) {
e.printStackTrace();
}
send.console(prefix + " §8-------------------------------");
T2Csend.console(prefix + " §8-------------------------------");
try {
ConfigConverterUnderV5.renameMainFolder();
} catch (Exception e) {
@ -97,16 +97,16 @@ public class Load {
if (SelectConfig.getBungee()) {
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "cgui:bungee")) {
send.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
T2Csend.debug(plugin, "registerOutgoingPluginChannel §ecgui:bungee");
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "cgui:bungee");
}
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "cgui:onlinepl")) {
send.debug(plugin, "registerIncomingPluginChannel §ecgui:onlinepl");
T2Csend.debug(plugin, "registerIncomingPluginChannel §ecgui:onlinepl");
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "cgui:onlinepl", new Bungee_Sender_Reciver());
}
}
if (PluginCheck.papi()) {
if (T2CpluginCheck.papi()) {
new Papi().register();
}
@ -137,14 +137,14 @@ public class Load {
e.printStackTrace();
}
send.console(prefix + " §8-------------------------------");
T2Csend.console(prefix + " §8-------------------------------");
loadStorage(prefix);
send.console(prefix + " §8-------------------------------");
T2Csend.console(prefix + " §8-------------------------------");
if (Main.PaPi) {
send.console(prefix + " §2PlaceholderAPI successfully connected!");
T2Csend.console(prefix + " §2PlaceholderAPI successfully connected!");
} else {
send.console(prefix + " §4PlaceholderAPI could not be connected / found!");
T2Csend.console(prefix + " §4PlaceholderAPI could not be connected / found!");
}
try {
@ -155,12 +155,12 @@ public class Load {
if (SelectConfig.getHelpAlias()) {
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
send.debug(plugin, "CommandRegister: commandguihelp");
T2Csend.debug(plugin, "CommandRegister: commandguihelp");
}
Main.getPlugin().getCommand("commandgui").setExecutor(new CmdExecuter_GUI());
send.debug(plugin, "CommandRegister: commandgui");
T2Csend.debug(plugin, "CommandRegister: commandgui");
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
send.debug(plugin, "CommandRegister: commandgui-item");
T2Csend.debug(plugin, "CommandRegister: commandgui-item");
try {
AliasRegister.onRegister();
@ -173,28 +173,28 @@ public class Load {
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
if (!MCVersion.minecraft1_8 && !MCVersion.minecraft1_9) {
if (!T2CmcVersion.isMc1_8() && !T2CmcVersion.isMc1_9()) {
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
}
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
T2CupdateAPI.onUpdateCheck(plugin, prefix, spigotID, discord);
Metrics.Bstats();
Main.addonLoad();
T2CodeTemplate.onLoadFooter(prefix, long_);
T2Ctemplate.onLoadFooter(prefix, long_);
}
private static void loadStorage(String prefix) {
try {
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
} catch (Exception ignored) {
send.error(Main.getPlugin(), "The storage medium " + SelectConfig.getStorage() + " is not supported!");
send.error(Main.getPlugin(), "Storage medium " + StorageEnum.SQLITE + " is used.");
T2Csend.error( "The storage medium " + SelectConfig.getStorage() + " is not supported!");
T2Csend.error("Storage medium " + StorageEnum.SQLITE + " is used.");
SelectDatabase.setStorage(StorageEnum.SQLITE);
}
switch (SelectDatabase.getStorage()) {
case MYSQL:
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
MySQL.main();
try {
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
@ -217,11 +217,11 @@ public class Load {
}
break;
case YML:
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
break;
default:
case SQLITE:
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
try {
SQLITE.main();
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +

View File

@ -3,7 +3,7 @@ package de.jatitv.commandguiv2.Spigot.system;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
import net.t2code.lib.Spigot.Lib.register.Register;
import net.t2code.t2codelib.SPIGOT.api.register.T2Cregister;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.Plugin;
@ -27,53 +27,53 @@ public class Permissions {
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
public static void onPermRegister() {
Register.permission(command, op, plugin);
Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
T2Cregister.permission(command, op, plugin);
T2Cregister.permissionDescription(command, "Required permission to open GUIs via command", plugin);
Register.permission(getGuiItemAtLogin, op, plugin);
Register.permission(giveItemOther, op, plugin);
Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
T2Cregister.permission(getGuiItemAtLogin, op, plugin);
T2Cregister.permission(giveItemOther, op, plugin);
T2Cregister.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
Register.permission(useitem, op, plugin);
Register.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
T2Cregister.permission(useitem, op, plugin);
T2Cregister.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
Register.permission(useitemToggle, op, plugin);
Register.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
T2Cregister.permission(useitemToggle, op, plugin);
T2Cregister.permissionDescription(useitemToggle, "Required permission to enable/disable the GUI Item for itself (if the function UseItem/AllowToggle is set to true)", plugin);
Register.permission(updatemsg, op, plugin);
Register.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
T2Cregister.permission(updatemsg, op, plugin);
T2Cregister.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", plugin);
Register.permission(bypass, op, plugin);
Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
T2Cregister.permission(bypass, op, plugin);
T2Cregister.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
Register.permission(info, notOp, plugin);
Register.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
T2Cregister.permission(info, notOp, plugin);
T2Cregister.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
Register.permission(player, op, command, true, plugin);
Register.permission(player, op, getGuiItemAtLogin, true, plugin);
Register.permission(player, op, useitem, true, plugin);
Register.permission(player, op, useitemToggle, true, plugin);
Register.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
T2Cregister.permission(player, op, command, true, plugin);
T2Cregister.permission(player, op, getGuiItemAtLogin, true, plugin);
T2Cregister.permission(player, op, useitem, true, plugin);
T2Cregister.permission(player, op, useitemToggle, true, plugin);
T2Cregister.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
Register.permission(admin, op, command, true, plugin);
Register.permission(admin, op, getGuiItemAtLogin, true, plugin);
Register.permission(admin, op, giveItemOther, true, plugin);
Register.permission(admin, op, useitem, true, plugin);
Register.permission(admin, op, useitemToggle, true, plugin);
Register.permission(admin, op, updatemsg, true, plugin);
Register.permission(admin, op, bypass, true, plugin);
Register.permission(admin, op, info, true, plugin);
Register.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
T2Cregister.permission(admin, op, command, true, plugin);
T2Cregister.permission(admin, op, getGuiItemAtLogin, true, plugin);
T2Cregister.permission(admin, op, giveItemOther, true, plugin);
T2Cregister.permission(admin, op, useitem, true, plugin);
T2Cregister.permission(admin, op, useitemToggle, true, plugin);
T2Cregister.permission(admin, op, updatemsg, true, plugin);
T2Cregister.permission(admin, op, bypass, true, plugin);
T2Cregister.permission(admin, op, info, true, plugin);
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
for (Gui gui : Main.guiHashMap.values()) {
Register.permission(command + "." + gui.key, op, plugin);
Register.permission(admin, op, command + "." + gui.key, true, plugin);
T2Cregister.permission(command + "." + gui.key, op, plugin);
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
for (Slot slot : gui.slots) {
Register.permission(slot.permissionToUse, op, plugin);
Register.permission(admin, op, slot.permissionToUse, true, plugin);
Register.permission(slot.permissionToSee, op, plugin);
Register.permission(admin, op, slot.permissionToSee, true, plugin);
T2Cregister.permission(slot.permissionToUse, op, plugin);
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
T2Cregister.permission(slot.permissionToSee, op, plugin);
T2Cregister.permission(admin, op, slot.permissionToSee, true, plugin);
}
}
}

View File

@ -7,8 +7,8 @@ import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.api.CGuiAPI;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -44,14 +44,14 @@ public class Events implements Listener {
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
if (CGuiAPI.JoinDisable) {
send.debug(Main.getPlugin(), "JoinDisable");
T2Csend.debug(Main.getPlugin(), "JoinDisable");
return;
}
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
new BukkitRunnable() {
@Override
public void run() {
send.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
T2Csend.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
ItemChange.itemChange(e.getPlayer(), true);
}
}.runTaskLater(Main.getPlugin(), 20L * 1);
@ -149,7 +149,7 @@ public class Events implements Listener {
if (SelectConfig.getUseItem_Enable()) {
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
if (e.getItem() != null && p.getItemInHand().getType() == ItemVersion.getHead()) {
if (e.getItem() != null && p.getItemInHand().getType() == T2CitemVersion.getHead()) {
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
openGUI(e, p);
}
@ -181,12 +181,12 @@ public class Events implements Listener {
if (SelectConfig.getUseItemGameModeProtection()) {
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInGameMode);
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
return;
}
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInGameMode);
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
return;
}
}
@ -194,12 +194,12 @@ public class Events implements Listener {
if (SelectConfig.getUseItemWorldProtection()) {
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInWorld);
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
return;
}
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
e.setCancelled(true);
send.player(player, SelectMessages.UseItemDisabledInWorld);
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
return;
}
}
@ -207,7 +207,7 @@ public class Events implements Listener {
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
} else {
send.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
T2Csend.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
}
}

View File

@ -1,7 +1,6 @@
package de.jatitv.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;

View File

@ -2,7 +2,7 @@ package de.jatitv.commandguiv2.Spigot.useItem;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -37,11 +37,11 @@ public class ItemChange {
}
}
}
send.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
T2Csend.debug(Main.getPlugin(), "GiveOnlyOnFirstJoin: " + player.getName());
return;
}
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
send.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
return;
}
new BukkitRunnable() {
@ -51,7 +51,7 @@ public class ItemChange {
if (pln == null) return;
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
send.debug(Main.getPlugin(), "Give: " + player.getName());
T2Csend.debug(Main.getPlugin(), "Give: " + player.getName());
UseItem.giveUseItem(player);
if (setCursor) {
setCursor(player, slot);
@ -71,41 +71,40 @@ public class ItemChange {
}
}
}.runTaskLater(Main.getPlugin(), 1L * 1);
}
private static void setCursor(Player player, int slot) {
send.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 1 Player: " + player.getName());
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
return;
}
send.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 2 Player: " + player.getName());
if (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
if (!player.hasPlayedBefore()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
}
return;
}
send.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
if (!SelectConfig.getBungee()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
return;
}
send.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
if (SelectConfig.getUseItem_ServerChange()) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
return;
}
send.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
send.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
send.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
T2Csend.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
if (Main.bungeejoinplayers.contains(player.getName())) {
player.getInventory().setHeldItemSlot(slot - 1);
send.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
T2Csend.debug(Main.getPlugin(), "setCursor 9 Player: " + player.getName());
Main.bungeejoinplayers.remove(player.getName());
}
}

View File

@ -2,15 +2,14 @@ package de.jatitv.commandguiv2.Spigot.useItem;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import de.jatitv.commandguiv2.Spigot.useItem.Events;
import de.jatitv.commandguiv2.Spigot.Main;
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
import net.t2code.lib.Spigot.Lib.replace.Replace;
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -32,7 +31,7 @@ public class UseItem {
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
player.getInventory().addItem(itemStack(player));
} else {
send.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
T2Csend.debug(Main.getPlugin(), "setUseItem: " + player.getName() + " Slot: " + Integer.parseInt(String.valueOf(slot - 1)));
player.getInventory().setItem(slot - 1, itemStack(player));
}
}
@ -47,17 +46,17 @@ public class UseItem {
private static ItemStack itemStack(Player player) {
ItemStack item = null;
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
if (MCVersion.minecraft1_8 || MCVersion.minecraft1_9 || MCVersion.minecraft1_10 || MCVersion.minecraft1_11 || MCVersion.minecraft1_12) {
send.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
send.error(Main.getPlugin(), "Playerheads for UseItem are only available from version 1.13!");
if (T2CmcVersion.isMc1_8() || T2CmcVersion.isMc1_9() || T2CmcVersion.isMc1_10() || T2CmcVersion.isMc1_11() || T2CmcVersion.isMc1_12()) {
T2Csend.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
T2Csend.error("Playerheads for UseItem are only available from version 1.13!");
} else {
item = ItemVersion.getHeadIS();
item = T2CitemVersion.getHeadIS();
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
if (SelectConfig.getUseItem_Base64_Enable()) {
if (Main.PaPi) {
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
profile.getProperties().put("textures", new Property("textures", SelectConfig.getUseItem_Base64value()));
Field profileField = null;
@ -75,8 +74,8 @@ public class UseItem {
} else p = SelectConfig.getUseItem_PlayerName();
playerheadmeta.setOwner(p);
if (Main.PaPi) {
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
}
item.setItemMeta(playerheadmeta);
}
@ -85,8 +84,8 @@ public class UseItem {
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
if (Main.PaPi) {
itemMeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else itemMeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
item.setItemMeta(itemMeta);
item.setAmount(1);
}
@ -97,13 +96,13 @@ public class UseItem {
if (SelectConfig.getUseItemGameModeProtection()) {
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInGameMode);
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInGameMode);
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
@ -111,13 +110,13 @@ public class UseItem {
if (SelectConfig.getUseItemWorldProtection()) {
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInWorld);
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
if (interact) {
send.player(player, SelectMessages.UseItemDisabledInWorld);
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
return true;
}
@ -126,11 +125,11 @@ public class UseItem {
}
public static void removeItem(Player player) {
send.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
T2Csend.debug(Main.getPlugin(), "World disabled: " + player.getName() + " " + player.getWorld().toString());
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
ItemStack itm = player.getInventory().getItem(iam);
if (itm != null) {
if (itm.getType() == Material.valueOf(SelectConfig.getUseItem_Material()) || itm.getType() == ItemVersion.getHead()) {
if (itm.getType() == Material.valueOf(SelectConfig.getUseItem_Material()) || itm.getType() == T2CitemVersion.getHead()) {
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
player.getInventory().remove(itm);
player.updateInventory();

View File

@ -1,10 +1,8 @@
package de.jatitv.commandguiv2;
import net.t2code.lib.Spigot.system.T2CodeMain;
public class Util {
private static Integer configVersion = 5;
private static String requiredT2CodeLibVersion = "12.4";
private static String requiredT2CodeLibVersion = "13.0";
private static String Prefix = "§8[§4C§9GUI§8]";
private static Integer SpigotID = 90671;
private static Integer BstatsID = 10840;
@ -31,7 +29,7 @@ public class Util {
}
public static String getDiscord() {
return T2CodeMain.getDiscord();
return net.t2code.t2codelib.Util.getDiscord();
}
public static Integer getConfigVersion() {

View File

@ -11,7 +11,7 @@ import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
import de.jatitv.commandguiv2.Spigot.system.Permissions;
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
import de.jatitv.commandguiv2.Util;
import net.t2code.lib.Spigot.Lib.messages.send;
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -40,7 +40,7 @@ public class CGuiAPI {
}
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
send.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
T2Csend.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
JoinDisable = disableItemGiveOnJoin;
}