1
This commit is contained in:
parent
893f99c3e5
commit
7be7c9f09e
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>CommandGUI_V2</artifactId>
|
<artifactId>CommandGUI_V2</artifactId>
|
||||||
<version>2.8.9</version>
|
<version>2.8.10</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>CommandGUI</name>
|
<name>CommandGUI</name>
|
||||||
@ -54,14 +54,15 @@
|
|||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<!-- repo.t2code / T2Code -->
|
<!-- repo.t2code / T2Code -->
|
||||||
<repository>
|
|
||||||
<id>Builders-Paradise</id>
|
|
||||||
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>T2Code</id>
|
<id>T2Code</id>
|
||||||
<url>https://repo.t2code.net/repository/T2Code/</url>
|
<url>https://repo.t2code.net/repository/T2Code/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>Builders-Paradise</id>
|
||||||
|
<url>https://repo.t2code.net/repository/Builders-Paradise/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<!-- placeholderAPI -->
|
<!-- placeholderAPI -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>placeholderapi</id>
|
<id>placeholderapi</id>
|
||||||
@ -71,6 +72,17 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- repo.t2code / T2Code -->
|
<!-- 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>
|
<dependency>
|
||||||
<groupId>net.t2code</groupId>
|
<groupId>net.t2code</groupId>
|
||||||
<artifactId>bungee</artifactId>
|
<artifactId>bungee</artifactId>
|
||||||
@ -96,16 +108,7 @@
|
|||||||
<artifactId>PlugmanGUI</artifactId>
|
<artifactId>PlugmanGUI</artifactId>
|
||||||
<version>3.0</version>
|
<version>3.0</version>
|
||||||
</dependency>
|
</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 -->
|
<!-- placeholderAPI -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.clip</groupId>
|
<groupId>me.clip</groupId>
|
||||||
|
@ -3,7 +3,6 @@ package de.jatitv.commandguiv2.Bungee;
|
|||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ package de.jatitv.commandguiv2.Bungee;
|
|||||||
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
import net.md_5.bungee.api.ProxyServer;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.t2code.lib.Bungee.Lib.messages.Bsend;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot;
|
package de.jatitv.commandguiv2.Spigot;
|
||||||
//s<ds
|
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
import de.jatitv.commandguiv2.Spigot.objects.functions.Function;
|
||||||
import de.jatitv.commandguiv2.Spigot.system.Load;
|
import de.jatitv.commandguiv2.Spigot.system.Load;
|
||||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import de.jatitv.commandguiv2.Spigot.database.MySQL;
|
import de.jatitv.commandguiv2.Spigot.database.MySQL;
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.NMSVersion;
|
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -53,24 +51,25 @@ public final class Main extends JavaPlugin {
|
|||||||
autor = this.getDescription().getAuthors();
|
autor = this.getDescription().getAuthors();
|
||||||
version = this.getDescription().getVersion();
|
version = this.getDescription().getVersion();
|
||||||
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
|
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;
|
legacy = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PluginCheck.pluginCheck("CommandGUI")) {
|
if (T2CpluginCheck.pluginCheck("CommandGUI")) {
|
||||||
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.error( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
send.error(this, "");
|
T2Csend.error( "");
|
||||||
send.error(this, "An older version of the plugin T2C-CommandGUI was found!");
|
T2Csend.error( "An older version of the plugin T2C-CommandGUI was found!");
|
||||||
send.error(this, "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
|
T2Csend.error( "This plugin is now called T2C-CommandGUI and no longer CommandGUI!");
|
||||||
send.error(this, "Please remove the older version (CommandGUI)!");
|
T2Csend.error( "Please remove the older version (CommandGUI)!");
|
||||||
send.error(this, this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
|
T2Csend.error( this.getName() + " version: " + this.getDescription().getVersion() + " could not be loaded!");
|
||||||
send.error(this, "");
|
T2Csend.error( "");
|
||||||
send.error(this, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.error( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
Main.plugin.getPluginLoader().disablePlugin(Main.plugin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||||
if (PluginCheck.papi()) {
|
if (T2CpluginCheck.papi()) {
|
||||||
PaPi = true;
|
PaPi = true;
|
||||||
}
|
}
|
||||||
Load.onLoad(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getSpigotID(), Util.getDiscord(), Util.getBstatsID());
|
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() {
|
public static void addonLoad() {
|
||||||
if (PluginCheck.plotSquaredGUI()) {
|
if (T2CpluginCheck.plotSquaredGUI()) {
|
||||||
PlotSquaredGUI = true;
|
PlotSquaredGUI = true;
|
||||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
|
addonEnable(Bukkit.getPluginManager().getPlugin("PlotSquaredGUI"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PluginCheck.luckyBox()) {
|
if (T2CpluginCheck.luckyBox()) {
|
||||||
LuckyBox = true;
|
LuckyBox = true;
|
||||||
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
|
addonEnable(Bukkit.getPluginManager().getPlugin("T2C-LuckyBox"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PluginCheck.plugManGUI()) {
|
if (T2CpluginCheck.plugManGUI()) {
|
||||||
PlugManGUI = true;
|
PlugManGUI = true;
|
||||||
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
|
addonEnable(Bukkit.getPluginManager().getPlugin("PlugManGUI"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addonEnable(Plugin plugin) {
|
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) {
|
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) {
|
public static void sendTryCatch(Class c, StackTraceElement line) {
|
||||||
send.error(plugin, c.getName() + " Line: " + line.getLineNumber());
|
T2Csend.error(c.getName() + " Line: " + line.getLineNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Plugin shutdown logic
|
// 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();
|
MySQL.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,8 @@ import de.jatitv.commandguiv2.Spigot.sound.Sound;
|
|||||||
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
|
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import io.github.solyze.plugmangui.inventories.PluginListGUI;
|
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.luckyBox.api.LuckyBoxAPI;
|
||||||
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -47,7 +45,7 @@ public class OpenGUI {
|
|||||||
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
player.openInventory((new PluginListGUI(54, 1)).getInventory());
|
||||||
} else {
|
} else {
|
||||||
if (player.hasPermission(Permissions.admin)) {
|
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/");
|
"§6https://spigotmc.org/resources/plugmangui.87599/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +55,7 @@ public class OpenGUI {
|
|||||||
LuckyBoxAPI.openShop(player);
|
LuckyBoxAPI.openShop(player);
|
||||||
} else {
|
} else {
|
||||||
if (player.hasPermission(Permissions.admin)) {
|
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/");
|
"§6https://www.spigotmc.org/resources/luckybox.98154/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +78,7 @@ public class OpenGUI {
|
|||||||
try {
|
try {
|
||||||
Function function = Main.functionHashMap.get(slot.function);
|
Function function = Main.functionHashMap.get(slot.function);
|
||||||
if (function == null) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue;
|
||||||
@ -131,8 +129,8 @@ public class OpenGUI {
|
|||||||
Sound.play(player, SoundEnum.OpenInventory);
|
Sound.play(player, SoundEnum.OpenInventory);
|
||||||
}
|
}
|
||||||
player.openInventory(inventory);
|
player.openInventory(inventory);
|
||||||
send.debug(plugin, "§6" + player.getName() + " §5Open §6" + Replace.replace(prefix, gui.guiName) + " §5" + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms");
|
T2Csend.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)));
|
} 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) {
|
private static void toggleOn(Function function, Slot slot, Player player, Inventory inventory) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.listener;
|
package de.jatitv.commandguiv2.Spigot.listener;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
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.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -42,12 +42,12 @@ public class Bungee_Sender_Reciver implements PluginMessageListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(message));
|
||||||
send.debug(Main.getPlugin(),"stream: "+stream.toString());
|
T2Csend.debug(Main.getPlugin(),"stream: "+stream.toString());
|
||||||
try {
|
try {
|
||||||
String subChannel = stream.readUTF();
|
String subChannel = stream.readUTF();
|
||||||
String input = stream.readUTF();
|
String input = stream.readUTF();
|
||||||
send.debug(Main.getPlugin(),"subChannel: " +subChannel);
|
T2Csend.debug(Main.getPlugin(),"subChannel: " +subChannel);
|
||||||
send.debug(Main.getPlugin(),"input: " +input);
|
T2Csend.debug(Main.getPlugin(),"input: " +input);
|
||||||
switch (subChannel) {
|
switch (subChannel) {
|
||||||
case "join":
|
case "join":
|
||||||
Main.bungeejoinplayers.add(input);
|
Main.bungeejoinplayers.add(input);
|
||||||
|
@ -4,8 +4,9 @@ package de.jatitv.commandguiv2.Spigot.listener;
|
|||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
|
import de.jatitv.commandguiv2.Spigot.system.Permissions;
|
||||||
import de.jatitv.commandguiv2.Util;
|
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.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -18,6 +19,6 @@ public class PluginEvent implements Listener {
|
|||||||
public void onJoinEvent(PlayerLoginEvent event) {
|
public void onJoinEvent(PlayerLoginEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
SelectDatabase.nameCheck(player);
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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.EcoEnum;
|
||||||
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
|
import de.jatitv.commandguiv2.Spigot.enums.FunctionItemEnum;
|
||||||
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
import de.jatitv.commandguiv2.Spigot.enums.FunctionVoteEnum;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -51,7 +51,7 @@ public class Obj_Select {
|
|||||||
String guiName = yamlConfiguration_gui.getString("GUI.Name");
|
String guiName = yamlConfiguration_gui.getString("GUI.Name");
|
||||||
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
Boolean guiFillItemEnable = yamlConfiguration_gui.getBoolean("GUI.FillItem.Enable");
|
||||||
String guiFillItemItem;
|
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");
|
guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.GlassPaneColor");
|
||||||
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
} else guiFillItemItem = yamlConfiguration_gui.getString("GUI.FillItem.Item");
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class Obj_Select {
|
|||||||
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
String function = yamlConfiguration_gui.getString("Slots." + slotKey + ".Function");
|
||||||
Function functionCheck = Main.functionHashMap.get(function);
|
Function functionCheck = Main.functionHashMap.get(function);
|
||||||
if (functionCheck == null) {
|
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");
|
Boolean permRequired = yamlConfiguration_gui.getBoolean("Slots." + slotKey + ".Permission.Required");
|
||||||
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
|
String permSee = yamlConfiguration_gui.getString("Slots." + slotKey + ".Permission.See");
|
||||||
@ -133,7 +133,7 @@ public class Obj_Select {
|
|||||||
try {
|
try {
|
||||||
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
|
ecoModule = EcoEnum.valueOf(yamlConfiguration.getString("Slots.Function.Cost.EcoModule").toUpperCase());
|
||||||
} catch (Exception ex) {
|
} 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)");
|
+ config.getName() + " does not exist. Please use one of the supported modules. (VAULT, ITEM, VOTEPOINTS)");
|
||||||
}
|
}
|
||||||
} else ecoModule = EcoEnum.VAULT;
|
} else ecoModule = EcoEnum.VAULT;
|
||||||
@ -182,7 +182,7 @@ public class Obj_Select {
|
|||||||
try {
|
try {
|
||||||
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
|
functionVotePointsMode = FunctionVoteEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionVotePoints.Mode").toUpperCase());
|
||||||
} catch (Exception ex) {
|
} 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)");
|
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ public class Obj_Select {
|
|||||||
try {
|
try {
|
||||||
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
|
functionItemMode = FunctionItemEnum.valueOf(yamlConfiguration.getString("Slots.Function.FunctionItem.Mode").toUpperCase());
|
||||||
} catch (Exception ex) {
|
} 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)");
|
+ config.getName() + " does not exist. Please use one of the supported modules. (ADD, REMOVE)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.objects.slots.Slot;
|
||||||
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
|
import de.jatitv.commandguiv2.Spigot.enums.SoundEnum;
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Sound {
|
public class Sound {
|
||||||
@ -37,7 +36,7 @@ public class Sound {
|
|||||||
try {
|
try {
|
||||||
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
player.playSound(player.getLocation(), org.bukkit.Sound.valueOf(function.customSound_Sound.toUpperCase().replace(".", "_")), 3, 1);
|
||||||
} catch (Exception e1) {
|
} 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));
|
.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);
|
player.playSound(player.getLocation(), SelectConfig.getSound_Click(), 3, 1);
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,26 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.system;
|
package de.jatitv.commandguiv2.Spigot.system;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
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.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Debug {
|
public class Debug {
|
||||||
|
|
||||||
private static final Plugin plugin = Main.getPlugin();
|
private static final Plugin plugin = Main.getPlugin();
|
||||||
|
|
||||||
public static void debugmsg() {
|
public static void debugmsg() {
|
||||||
send.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
T2Csend.debug(plugin, "§5!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
send.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
T2Csend.debug(plugin, "§3Bukkit Version: §e" + Bukkit.getBukkitVersion());
|
||||||
send.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
T2Csend.debug(plugin, "§3NMS Version: §e" + Bukkit.getServer().getClass().getPackage().getName().replace("org.bukkit.craftbukkit.", ""));
|
||||||
send.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
T2Csend.debug(plugin, "§3Version: §e" + Bukkit.getVersion());
|
||||||
send.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
T2Csend.debug(plugin, "§3Java: §e" + System.getProperty("java.version"));
|
||||||
send.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
T2Csend.debug(plugin, "§3Worlds: §e" + String.valueOf(Bukkit.getServer().getWorlds()));
|
||||||
send.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
|
T2Csend.debug(plugin, String.valueOf(Arrays.asList(Main.getPlugin().getServer().getPluginManager().getPlugins())));
|
||||||
send.debug(plugin, "§5----------------------------------");
|
T2Csend.debug(plugin, "§5----------------------------------");
|
||||||
if (new File(Main.getPath(), "config.yml").exists()) {
|
if (new File(Main.getPath(), "config.yml").exists()) {
|
||||||
File f = new File(String.valueOf(Main.getPath()));
|
File f = new File(String.valueOf(Main.getPath()));
|
||||||
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
File f2 = new File(String.valueOf(Main.getPath() + "/GUIs/"));
|
||||||
@ -36,22 +30,22 @@ public class Debug {
|
|||||||
File[] fileArray3 = f3.listFiles();
|
File[] fileArray3 = f3.listFiles();
|
||||||
if (fileArray != null) {
|
if (fileArray != null) {
|
||||||
for (File config : fileArray) {
|
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) {
|
if (fileArray2 != null) {
|
||||||
for (File config2 : fileArray2) {
|
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) {
|
if (fileArray3 != null) {
|
||||||
for (File config3 : fileArray3) {
|
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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.SQLITE;
|
||||||
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
|
import de.jatitv.commandguiv2.Spigot.enums.StorageEnum;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.T2CodeTemplate;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.plugins.PluginCheck;
|
import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck;
|
||||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI;
|
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
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) {
|
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 {
|
try {
|
||||||
Debug.debugmsg();
|
Debug.debugmsg();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
send.console(prefix + " §8-------------------------------");
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
try {
|
try {
|
||||||
ConfigConverterUnderV5.renameMainFolder();
|
ConfigConverterUnderV5.renameMainFolder();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -97,16 +97,16 @@ public class Load {
|
|||||||
|
|
||||||
if (SelectConfig.getBungee()) {
|
if (SelectConfig.getBungee()) {
|
||||||
if (!Bukkit.getMessenger().isOutgoingChannelRegistered(plugin, "cgui:bungee")) {
|
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");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "cgui:bungee");
|
||||||
}
|
}
|
||||||
if (!Bukkit.getMessenger().isIncomingChannelRegistered(plugin, "cgui:onlinepl")) {
|
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());
|
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "cgui:onlinepl", new Bungee_Sender_Reciver());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PluginCheck.papi()) {
|
if (T2CpluginCheck.papi()) {
|
||||||
new Papi().register();
|
new Papi().register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,14 +137,14 @@ public class Load {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
send.console(prefix + " §8-------------------------------");
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
loadStorage(prefix);
|
loadStorage(prefix);
|
||||||
send.console(prefix + " §8-------------------------------");
|
T2Csend.console(prefix + " §8-------------------------------");
|
||||||
|
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
send.console(prefix + " §2PlaceholderAPI successfully connected!");
|
T2Csend.console(prefix + " §2PlaceholderAPI successfully connected!");
|
||||||
} else {
|
} else {
|
||||||
send.console(prefix + " §4PlaceholderAPI could not be connected / found!");
|
T2Csend.console(prefix + " §4PlaceholderAPI could not be connected / found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -155,12 +155,12 @@ public class Load {
|
|||||||
|
|
||||||
if (SelectConfig.getHelpAlias()) {
|
if (SelectConfig.getHelpAlias()) {
|
||||||
Main.getPlugin().getCommand("commandguihelp").setExecutor(new CmdExecuter_Help());
|
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());
|
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());
|
Main.getPlugin().getCommand("commandgui-item").setExecutor(new CmdExecuter_GUIItem());
|
||||||
send.debug(plugin, "CommandRegister: commandgui-item");
|
T2Csend.debug(plugin, "CommandRegister: commandgui-item");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
AliasRegister.onRegister();
|
AliasRegister.onRegister();
|
||||||
@ -173,28 +173,28 @@ public class Load {
|
|||||||
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(new Events(), Main.getPlugin());
|
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);
|
Bukkit.getServer().getPluginManager().registerEvents(new EventsFrom110(), plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord);
|
T2CupdateAPI.onUpdateCheck(plugin, prefix, spigotID, discord);
|
||||||
Metrics.Bstats();
|
Metrics.Bstats();
|
||||||
Main.addonLoad();
|
Main.addonLoad();
|
||||||
T2CodeTemplate.onLoadFooter(prefix, long_);
|
T2Ctemplate.onLoadFooter(prefix, long_);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadStorage(String prefix) {
|
private static void loadStorage(String prefix) {
|
||||||
try {
|
try {
|
||||||
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
|
SelectDatabase.setStorage(StorageEnum.valueOf(SelectConfig.getStorage()));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
send.error(Main.getPlugin(), "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
T2Csend.error( "The storage medium " + SelectConfig.getStorage() + " is not supported!");
|
||||||
send.error(Main.getPlugin(), "Storage medium " + StorageEnum.SQLITE + " is used.");
|
T2Csend.error("Storage medium " + StorageEnum.SQLITE + " is used.");
|
||||||
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
SelectDatabase.setStorage(StorageEnum.SQLITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (SelectDatabase.getStorage()) {
|
switch (SelectDatabase.getStorage()) {
|
||||||
case MYSQL:
|
case MYSQL:
|
||||||
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||||
MySQL.main();
|
MySQL.main();
|
||||||
try {
|
try {
|
||||||
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
MySQL.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||||
@ -217,11 +217,11 @@ public class Load {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YML:
|
case YML:
|
||||||
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case SQLITE:
|
case SQLITE:
|
||||||
send.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
T2Csend.console(prefix + " §2Storage medium §6" + SelectDatabase.getStorage() + " §2is used.");
|
||||||
try {
|
try {
|
||||||
SQLITE.main();
|
SQLITE.main();
|
||||||
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
SQLITE.query("CREATE TABLE IF NOT EXISTS `gui-item` (" +
|
||||||
|
@ -3,7 +3,7 @@ package de.jatitv.commandguiv2.Spigot.system;
|
|||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui;
|
||||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot;
|
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.permissions.PermissionDefault;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -27,53 +27,53 @@ public class Permissions {
|
|||||||
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
public static final PermissionDefault notOp = PermissionDefault.NOT_OP;
|
||||||
|
|
||||||
public static void onPermRegister() {
|
public static void onPermRegister() {
|
||||||
Register.permission(command, op, plugin);
|
T2Cregister.permission(command, op, plugin);
|
||||||
Register.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
T2Cregister.permissionDescription(command, "Required permission to open GUIs via command", plugin);
|
||||||
|
|
||||||
Register.permission(getGuiItemAtLogin, op, plugin);
|
T2Cregister.permission(getGuiItemAtLogin, op, plugin);
|
||||||
Register.permission(giveItemOther, op, plugin);
|
T2Cregister.permission(giveItemOther, op, plugin);
|
||||||
Register.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
T2Cregister.permissionDescription(getGuiItemAtLogin, "Only players with this permission will receive the GUI item", plugin);
|
||||||
|
|
||||||
Register.permission(useitem, op, plugin);
|
T2Cregister.permission(useitem, op, plugin);
|
||||||
Register.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
T2Cregister.permissionDescription(useitem, "Required permission to use the GUI Item", plugin);
|
||||||
|
|
||||||
Register.permission(useitemToggle, op, plugin);
|
T2Cregister.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.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);
|
T2Cregister.permission(updatemsg, op, plugin);
|
||||||
Register.permissionDescription(updatemsg, "Players with this permission get the update message when joining if an update is available", 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);
|
T2Cregister.permission(bypass, op, plugin);
|
||||||
Register.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
T2Cregister.permissionDescription(bypass, "Bypass to open disabled GUIs", plugin);
|
||||||
|
|
||||||
Register.permission(info, notOp, plugin);
|
T2Cregister.permission(info, notOp, plugin);
|
||||||
Register.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
|
T2Cregister.permissionDescription(info, "Permission to view T2C-CommandGUI info", plugin);
|
||||||
|
|
||||||
Register.permission(player, op, command, true, plugin);
|
T2Cregister.permission(player, op, command, true, plugin);
|
||||||
Register.permission(player, op, getGuiItemAtLogin, true, plugin);
|
T2Cregister.permission(player, op, getGuiItemAtLogin, true, plugin);
|
||||||
Register.permission(player, op, useitem, true, plugin);
|
T2Cregister.permission(player, op, useitem, true, plugin);
|
||||||
Register.permission(player, op, useitemToggle, true, plugin);
|
T2Cregister.permission(player, op, useitemToggle, true, plugin);
|
||||||
Register.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
|
T2Cregister.permissionDescription(player, "All permissions from T2C-CommandGUI for Player", plugin);
|
||||||
|
|
||||||
Register.permission(admin, op, command, true, plugin);
|
T2Cregister.permission(admin, op, command, true, plugin);
|
||||||
Register.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
T2Cregister.permission(admin, op, getGuiItemAtLogin, true, plugin);
|
||||||
Register.permission(admin, op, giveItemOther, true, plugin);
|
T2Cregister.permission(admin, op, giveItemOther, true, plugin);
|
||||||
Register.permission(admin, op, useitem, true, plugin);
|
T2Cregister.permission(admin, op, useitem, true, plugin);
|
||||||
Register.permission(admin, op, useitemToggle, true, plugin);
|
T2Cregister.permission(admin, op, useitemToggle, true, plugin);
|
||||||
Register.permission(admin, op, updatemsg, true, plugin);
|
T2Cregister.permission(admin, op, updatemsg, true, plugin);
|
||||||
Register.permission(admin, op, bypass, true, plugin);
|
T2Cregister.permission(admin, op, bypass, true, plugin);
|
||||||
Register.permission(admin, op, info, true, plugin);
|
T2Cregister.permission(admin, op, info, true, plugin);
|
||||||
Register.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
T2Cregister.permissionDescription(admin, "All permissions from T2C-CommandGUI", plugin);
|
||||||
|
|
||||||
|
|
||||||
for (Gui gui : Main.guiHashMap.values()) {
|
for (Gui gui : Main.guiHashMap.values()) {
|
||||||
Register.permission(command + "." + gui.key, op, plugin);
|
T2Cregister.permission(command + "." + gui.key, op, plugin);
|
||||||
Register.permission(admin, op, command + "." + gui.key, true, plugin);
|
T2Cregister.permission(admin, op, command + "." + gui.key, true, plugin);
|
||||||
for (Slot slot : gui.slots) {
|
for (Slot slot : gui.slots) {
|
||||||
Register.permission(slot.permissionToUse, op, plugin);
|
T2Cregister.permission(slot.permissionToUse, op, plugin);
|
||||||
Register.permission(admin, op, slot.permissionToUse, true, plugin);
|
T2Cregister.permission(admin, op, slot.permissionToUse, true, plugin);
|
||||||
Register.permission(slot.permissionToSee, op, plugin);
|
T2Cregister.permission(slot.permissionToSee, op, plugin);
|
||||||
Register.permission(admin, op, slot.permissionToSee, true, plugin);
|
T2Cregister.permission(admin, op, slot.permissionToSee, true, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
|||||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI;
|
||||||
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import de.jatitv.commandguiv2.api.CGuiAPI;
|
import de.jatitv.commandguiv2.api.CGuiAPI;
|
||||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -44,14 +44,14 @@ public class Events implements Listener {
|
|||||||
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
} else useItemSlotHashMap.put(e.getPlayer().getName(), i);
|
||||||
|
|
||||||
if (CGuiAPI.JoinDisable) {
|
if (CGuiAPI.JoinDisable) {
|
||||||
send.debug(Main.getPlugin(), "JoinDisable");
|
T2Csend.debug(Main.getPlugin(), "JoinDisable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
|
if (e.getPlayer().hasPermission("commandgui.get.guiitem.at.login")) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
send.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
|
T2Csend.debug(Main.getPlugin(), "itemChange: " + e.getPlayer().getName());
|
||||||
ItemChange.itemChange(e.getPlayer(), true);
|
ItemChange.itemChange(e.getPlayer(), true);
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), 20L * 1);
|
}.runTaskLater(Main.getPlugin(), 20L * 1);
|
||||||
@ -149,7 +149,7 @@ public class Events implements Listener {
|
|||||||
|
|
||||||
if (SelectConfig.getUseItem_Enable()) {
|
if (SelectConfig.getUseItem_Enable()) {
|
||||||
if (SelectConfig.getUseItem_PlayerHead_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())) {
|
if (e.getItem().getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
openGUI(e, p);
|
openGUI(e, p);
|
||||||
}
|
}
|
||||||
@ -181,12 +181,12 @@ public class Events implements Listener {
|
|||||||
if (SelectConfig.getUseItemGameModeProtection()) {
|
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,12 +194,12 @@ public class Events implements Listener {
|
|||||||
if (SelectConfig.getUseItemWorldProtection()) {
|
if (SelectConfig.getUseItemWorldProtection()) {
|
||||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ public class Events implements Listener {
|
|||||||
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
|
if (!SelectConfig.getUseItem_Permission() || player.hasPermission("commandgui.useitem")) {
|
||||||
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
|
OpenGUI.openGUI(player, SelectConfig.getUseItem_OpenGUI(), true);
|
||||||
} else {
|
} else {
|
||||||
send.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
T2Csend.player(player,SelectMessages.NoPermissionForUseItem.replace("[perm]", "commandgui.useitem")
|
||||||
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
|
.replace("[gui]", SelectConfig.getUseItem_OpenGUI()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package de.jatitv.commandguiv2.Spigot.useItem;
|
package de.jatitv.commandguiv2.Spigot.useItem;
|
||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
@ -2,7 +2,7 @@ package de.jatitv.commandguiv2.Spigot.useItem;
|
|||||||
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
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.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
|
if (!SelectConfig.getUseItem_GiveOnEveryJoin()) {
|
||||||
send.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "!GiveOnEveryJoin: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@ -51,7 +51,7 @@ public class ItemChange {
|
|||||||
if (pln == null) return;
|
if (pln == null) return;
|
||||||
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
|
if (!SelectConfig.getUseItem_AllowToggle() || pln) {
|
||||||
if (SelectConfig.getUseItem_InventorySlotEnforce() || player.getInventory().getItem(slot - 1) == null) {
|
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);
|
UseItem.giveUseItem(player);
|
||||||
if (setCursor) {
|
if (setCursor) {
|
||||||
setCursor(player, slot);
|
setCursor(player, slot);
|
||||||
@ -71,41 +71,40 @@ public class ItemChange {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
}.runTaskLater(Main.getPlugin(), 1L * 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setCursor(Player player, int slot) {
|
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()) {
|
if (!SelectConfig.getCursor_ToGUIItem_OnLogin()) {
|
||||||
return;
|
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 (SelectConfig.getCursor_ToGUIItem_OnlyOnFirstLogin()) {
|
||||||
if (!player.hasPlayedBefore()) {
|
if (!player.hasPlayedBefore()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
send.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 3 Player: " + player.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 4 Player: " + player.getName());
|
||||||
if (!SelectConfig.getBungee()) {
|
if (!SelectConfig.getBungee()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
send.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 5 Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 6 Player: " + player.getName());
|
||||||
if (SelectConfig.getUseItem_ServerChange()) {
|
if (SelectConfig.getUseItem_ServerChange()) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
player.getInventory().setHeldItemSlot(slot - 1);
|
||||||
send.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 7 Player: " + player.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor 8 Player: " + player.getName());
|
||||||
send.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
T2Csend.debug(Main.getPlugin(), "setCursor bungeejoinplayers: " + Main.bungeejoinplayers);
|
||||||
send.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
|
T2Csend.debug(Main.getPlugin(), "setCursor Player: " + player.getName());
|
||||||
if (Main.bungeejoinplayers.contains(player.getName())) {
|
if (Main.bungeejoinplayers.contains(player.getName())) {
|
||||||
player.getInventory().setHeldItemSlot(slot - 1);
|
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());
|
Main.bungeejoinplayers.remove(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@ package de.jatitv.commandguiv2.Spigot.useItem;
|
|||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import de.jatitv.commandguiv2.Spigot.useItem.Events;
|
|
||||||
import de.jatitv.commandguiv2.Spigot.Main;
|
import de.jatitv.commandguiv2.Spigot.Main;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig;
|
||||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
||||||
import de.jatitv.commandguiv2.Util;
|
import de.jatitv.commandguiv2.Util;
|
||||||
import net.t2code.lib.Spigot.Lib.items.ItemVersion;
|
import net.t2code.t2codelib.SPIGOT.api.items.T2CitemVersion;
|
||||||
import net.t2code.lib.Spigot.Lib.messages.send;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Creplace;
|
||||||
import net.t2code.lib.Spigot.Lib.minecraftVersion.MCVersion;
|
import net.t2code.t2codelib.SPIGOT.api.messages.T2Csend;
|
||||||
import net.t2code.lib.Spigot.Lib.replace.Replace;
|
import net.t2code.t2codelib.SPIGOT.api.minecraftVersion.T2CmcVersion;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -32,7 +31,7 @@ public class UseItem {
|
|||||||
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
if (SelectConfig.getUseItem_InventorySlot_FreeSlot()) {
|
||||||
player.getInventory().addItem(itemStack(player));
|
player.getInventory().addItem(itemStack(player));
|
||||||
} else {
|
} 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));
|
player.getInventory().setItem(slot - 1, itemStack(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,17 +46,17 @@ public class UseItem {
|
|||||||
private static ItemStack itemStack(Player player) {
|
private static ItemStack itemStack(Player player) {
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
if (SelectConfig.getUseItem_PlayerHead_Enable()) {
|
||||||
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()) {
|
||||||
send.player(player, Util.getPrefix() + "§c Playerheads for UseItem are only available from version §61.13§c!");
|
T2Csend.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!");
|
T2Csend.error("Playerheads for UseItem are only available from version 1.13!");
|
||||||
} else {
|
} else {
|
||||||
item = ItemVersion.getHeadIS();
|
item = T2CitemVersion.getHeadIS();
|
||||||
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
SkullMeta playerheadmeta = (SkullMeta) item.getItemMeta();
|
||||||
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
|
playerheadmeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||||
if (SelectConfig.getUseItem_Base64_Enable()) {
|
if (SelectConfig.getUseItem_Base64_Enable()) {
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||||
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||||
profile.getProperties().put("textures", new Property("textures", SelectConfig.getUseItem_Base64value()));
|
profile.getProperties().put("textures", new Property("textures", SelectConfig.getUseItem_Base64value()));
|
||||||
Field profileField = null;
|
Field profileField = null;
|
||||||
@ -75,8 +74,8 @@ public class UseItem {
|
|||||||
} else p = SelectConfig.getUseItem_PlayerName();
|
} else p = SelectConfig.getUseItem_PlayerName();
|
||||||
playerheadmeta.setOwner(p);
|
playerheadmeta.setOwner(p);
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
playerheadmeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||||
} else playerheadmeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
} else playerheadmeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||||
}
|
}
|
||||||
item.setItemMeta(playerheadmeta);
|
item.setItemMeta(playerheadmeta);
|
||||||
}
|
}
|
||||||
@ -85,8 +84,8 @@ public class UseItem {
|
|||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
|
itemMeta.setDisplayName(SelectConfig.getUseItem_Name());
|
||||||
if (Main.PaPi) {
|
if (Main.PaPi) {
|
||||||
itemMeta.setLore(Replace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), player, SelectConfig.getUseItem_Lore()));
|
||||||
} else itemMeta.setLore(Replace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
} else itemMeta.setLore(T2Creplace.replace(Util.getPrefix(), SelectConfig.getUseItem_Lore()));
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
item.setAmount(1);
|
item.setAmount(1);
|
||||||
}
|
}
|
||||||
@ -97,13 +96,13 @@ public class UseItem {
|
|||||||
if (SelectConfig.getUseItemGameModeProtection()) {
|
if (SelectConfig.getUseItemGameModeProtection()) {
|
||||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
if (SelectConfig.getUseItemGameModeMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemGameModeList().contains(player.getGameMode().toString())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
send.player(player, SelectMessages.UseItemDisabledInGameMode);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInGameMode);
|
||||||
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
} else if (!SelectConfig.getUseItemGameModeRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -111,13 +110,13 @@ public class UseItem {
|
|||||||
if (SelectConfig.getUseItemWorldProtection()) {
|
if (SelectConfig.getUseItemWorldProtection()) {
|
||||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("blacklist") && SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
if (SelectConfig.getUseItemWorldMode().equalsIgnoreCase("whitelist") && !SelectConfig.getUseItemWorldList().contains(player.getWorld().getName())) {
|
||||||
if (interact) {
|
if (interact) {
|
||||||
send.player(player, SelectMessages.UseItemDisabledInWorld);
|
T2Csend.player(player, SelectMessages.UseItemDisabledInWorld);
|
||||||
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
} else if (!SelectConfig.getUseItemWorldRemoveItemWhenItIsDisabled()) removeItem(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -126,11 +125,11 @@ public class UseItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void removeItem(Player player) {
|
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++) {
|
for (int iam = 0; iam < player.getInventory().getSize() - 5; iam++) {
|
||||||
ItemStack itm = player.getInventory().getItem(iam);
|
ItemStack itm = player.getInventory().getItem(iam);
|
||||||
if (itm != null) {
|
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())) {
|
if (itm.getItemMeta().getDisplayName().equals(SelectConfig.getUseItem_Name())) {
|
||||||
player.getInventory().remove(itm);
|
player.getInventory().remove(itm);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package de.jatitv.commandguiv2;
|
package de.jatitv.commandguiv2;
|
||||||
|
|
||||||
import net.t2code.lib.Spigot.system.T2CodeMain;
|
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
private static Integer configVersion = 5;
|
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 String Prefix = "§8[§4C§9GUI§8]";
|
||||||
private static Integer SpigotID = 90671;
|
private static Integer SpigotID = 90671;
|
||||||
private static Integer BstatsID = 10840;
|
private static Integer BstatsID = 10840;
|
||||||
@ -31,7 +29,7 @@ public class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getDiscord() {
|
public static String getDiscord() {
|
||||||
return T2CodeMain.getDiscord();
|
return net.t2code.t2codelib.Util.getDiscord();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getConfigVersion() {
|
public static Integer getConfigVersion() {
|
||||||
|
@ -11,7 +11,7 @@ import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages;
|
|||||||
import de.jatitv.commandguiv2.Spigot.system.Permissions;
|
import de.jatitv.commandguiv2.Spigot.system.Permissions;
|
||||||
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
import de.jatitv.commandguiv2.Spigot.database.SelectDatabase;
|
||||||
import de.jatitv.commandguiv2.Util;
|
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.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -40,7 +40,7 @@ public class CGuiAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
public static void disableItemGiveOnJoin(Boolean disableItemGiveOnJoin) {
|
||||||
send.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
|
T2Csend.debug(Main.getPlugin(), "CGuiAPI: " + disableItemGiveOnJoin);
|
||||||
JoinDisable = disableItemGiveOnJoin;
|
JoinDisable = disableItemGiveOnJoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user