Compare commits
31 Commits
Author | SHA1 | Date |
---|---|---|
|
2f114cca41 | 2 days ago |
|
d0277deeb8 | 2 days ago |
|
a6dff7e243 | 3 days ago |
|
e2e649aef2 | 3 weeks ago |
|
7c7cd51cec | 3 weeks ago |
|
e7f5b00b31 | 3 weeks ago |
|
57ba6e6687 | 3 weeks ago |
|
d168a7afec | 3 weeks ago |
|
92d3e9a2d8 | 3 weeks ago |
|
b45895dff8 | 3 weeks ago |
|
c43a5fd90c | 3 weeks ago |
|
48c06696ef | 3 weeks ago |
|
16123ec578 | 3 weeks ago |
|
7f2b346f7b | 3 weeks ago |
|
c590255d38 | 3 weeks ago |
|
5d646fce48 | 3 weeks ago |
|
5b089a57d8 | 3 weeks ago |
|
87d0f75a4c | 4 weeks ago |
|
6f3da3e3f4 | 4 weeks ago |
|
80255a60eb | 4 weeks ago |
|
f6860e9ab5 | 4 weeks ago |
|
ebbec1f660 | 4 weeks ago |
|
5674b54593 | 4 weeks ago |
|
381afeba89 | 4 weeks ago |
|
19822f7024 | 1 month ago |
|
ed810f31d7 | 1 month ago |
|
b0286e597f | 1 month ago |
|
ddfea4eba6 | 1 month ago |
|
ed86e7b143 | 1 month ago |
|
32c1219bb2 | 1 month ago |
|
326dfae0e9 | 2 months ago |
69 changed files with 3375 additions and 1463 deletions
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Bungee; |
||||
|
||||
import net.md_5.bungee.config.Configuration; |
||||
import net.md_5.bungee.config.ConfigurationProvider; |
||||
import net.md_5.bungee.config.YamlConfiguration; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
public class BConfig { |
||||
|
||||
public static void create() throws IOException { |
||||
File config = new File(BMain.plugin.getDataFolder(), "config.yml"); |
||||
if (!BMain.plugin.getDataFolder().exists()) BMain.plugin.getDataFolder().mkdir(); |
||||
if (!config.exists()) { |
||||
config.createNewFile(); |
||||
} |
||||
Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config); |
||||
|
||||
configuration.set("MySQL.Enable", false); |
||||
configuration.set("MySQL.IP", "localhost"); |
||||
configuration.set("MySQL.Port", 3306); |
||||
configuration.set("MySQL.Database", "database"); |
||||
configuration.set("MySQL.User", "user"); |
||||
configuration.set("MySQL.Password", ""); |
||||
configuration.set("MySQL.SSL", false); |
||||
ConfigurationProvider.getProvider(YamlConfiguration.class).save(configuration, config); |
||||
|
||||
|
||||
BMySQL.Enable = configuration.getBoolean("MySQL.Enable"); |
||||
BMySQL.ip = configuration.getString("MySQL.IP"); |
||||
BMySQL.port = configuration.getInt("MySQL.Port"); |
||||
BMySQL.database = configuration.getString("MySQL.Database"); |
||||
BMySQL.user = configuration.getString("MySQL.User"); |
||||
BMySQL.password = configuration.getString("MySQL.Password"); |
||||
BMySQL.SSL = configuration.getBoolean("MySQL.SSL"); |
||||
|
||||
|
||||
} |
||||
} |
@ -1,107 +0,0 @@
@@ -1,107 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Bungee; |
||||
|
||||
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin; |
||||
import net.t2code.lib.Bungee.Lib.messages.Bsend; |
||||
|
||||
import java.sql.*; |
||||
import java.time.ZoneId; |
||||
import java.util.ArrayList; |
||||
import java.util.Calendar; |
||||
|
||||
public class BMySQL { |
||||
private static Plugin plugin = BMain.plugin; |
||||
protected static Boolean Enable = false; |
||||
|
||||
protected static String ip = "localhost"; |
||||
protected static Integer port = 3306; |
||||
protected static String database; |
||||
protected static String user = "root"; |
||||
protected static String password = ""; |
||||
protected static String url; |
||||
protected static Boolean SSL; |
||||
|
||||
public static void main() { |
||||
Long long_ = Long.valueOf(System.currentTimeMillis()); |
||||
Calendar now = Calendar.getInstance(); |
||||
ZoneId timeZone = now.getTimeZone().toZoneId(); |
||||
Bsend.debug(plugin, "Server TimeZone is : " + timeZone); |
||||
url = "jdbc:mysql://" + ip + ":" + port + "/" + database + "?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=" + timeZone; |
||||
// Europe/Berlin
|
||||
if (SSL) { |
||||
url = url + "&useSSL=true"; |
||||
} else url = url + "&useSSL=false"; |
||||
Bsend.debug(plugin, url); |
||||
try (Connection con = DriverManager.getConnection(url, user, password)) { |
||||
Statement stmt = con.createStatement(); |
||||
stmt.close(); |
||||
Bsend.console(BMain.prefix + " §2MySQL successfully connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); |
||||
} catch (SQLException ex) { |
||||
Bsend.console(BMain.prefix + " §4MySQL not connected." + " §7- §e" + (System.currentTimeMillis() - long_.longValue()) + "ms"); |
||||
Bsend.error(plugin, ex.getMessage() + " --- " + (System.currentTimeMillis() - long_.longValue()) + "ms"); |
||||
} |
||||
} |
||||
|
||||
public static void query(String query) { |
||||
try (Connection con = DriverManager.getConnection(url, user, password)) { |
||||
Statement stmt = con.createStatement(); |
||||
stmt.execute(query); |
||||
stmt.close(); |
||||
} catch (SQLException ex) { |
||||
System.err.println(ex.getMessage()); |
||||
} |
||||
} |
||||
|
||||
|
||||
public static ArrayList<String> selectAll(String query) { |
||||
ArrayList<String> Result = new ArrayList<>(); |
||||
try (Connection con = DriverManager.getConnection(url, user, password)) { |
||||
Statement stmt = con.createStatement(); |
||||
ResultSet rs = stmt.executeQuery(query); |
||||
int columns = rs.getMetaData().getColumnCount(); |
||||
while (rs.next()) { |
||||
Result.add(rs.getString(1)); |
||||
} |
||||
rs.close(); |
||||
stmt.close(); |
||||
} catch (SQLException ex) { |
||||
System.err.println(ex.getMessage()); |
||||
} |
||||
return Result; |
||||
} |
||||
|
||||
public static String select(String query) { |
||||
String Ausgabe = ""; |
||||
try (Connection con = DriverManager.getConnection(url, user, password)) { |
||||
Statement stmt = con.createStatement(); |
||||
ResultSet rs = stmt.executeQuery(query); |
||||
int columns = rs.getMetaData().getColumnCount(); |
||||
while (rs.next()) { |
||||
Ausgabe = String.valueOf(rs.getString(1)); |
||||
} |
||||
rs.close(); |
||||
stmt.close(); |
||||
} catch (SQLException ex) { |
||||
System.err.println(ex.getMessage()); |
||||
} |
||||
return Ausgabe; |
||||
} |
||||
|
||||
public static int count(String query) { |
||||
Integer count = 0; |
||||
try (Connection con = DriverManager.getConnection(url, user, password)) { |
||||
Statement stmt = con.createStatement(); |
||||
ResultSet rs = stmt.executeQuery(query); |
||||
int columns = rs.getMetaData().getColumnCount(); |
||||
while (rs.next()) { |
||||
count++; |
||||
} |
||||
rs.close(); |
||||
stmt.close(); |
||||
} catch (SQLException ex) { |
||||
System.err.println(ex.getMessage()); |
||||
} |
||||
return count; |
||||
} |
||||
} |
@ -1,277 +0,0 @@
@@ -1,277 +0,0 @@
|
||||
package de.jatitv.commandguiv2.Spigot.Listener; |
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Listener.UseItem_Listener.Events; |
||||
import de.jatitv.commandguiv2.Spigot.objects.functions.Function; |
||||
import de.jatitv.commandguiv2.Spigot.cmdManagement.Commands; |
||||
import de.jatitv.commandguiv2.Spigot.objects.slots.Slot; |
||||
import de.jatitv.commandguiv2.Spigot.system.Bungee_Sender_Reciver; |
||||
import de.jatitv.commandguiv2.Spigot.config.languages.SelectMessages; |
||||
import de.jatitv.commandguiv2.Spigot.objects.guis.Gui; |
||||
import de.jatitv.commandguiv2.Spigot.gui.OpenGUI; |
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig; |
||||
import de.jatitv.commandguiv2.Spigot.Main; |
||||
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.replace.Replace; |
||||
import net.t2code.lib.Spigot.Lib.vault.Vault; |
||||
import org.bukkit.Bukkit; |
||||
import org.bukkit.Material; |
||||
import org.bukkit.Sound; |
||||
import org.bukkit.configuration.file.YamlConfiguration; |
||||
import org.bukkit.entity.Player; |
||||
import org.bukkit.event.EventHandler; |
||||
import org.bukkit.event.Listener; |
||||
import org.bukkit.event.inventory.ClickType; |
||||
import org.bukkit.event.inventory.InventoryClickEvent; |
||||
import org.bukkit.plugin.Plugin; |
||||
import org.bukkit.plugin.java.JavaPlugin; |
||||
import org.bukkit.scheduler.BukkitRunnable; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
public class GUIListener implements Listener { |
||||
|
||||
private static String prefix = Util.getPrefix(); |
||||
public static String GUICode; |
||||
private static Plugin plugin = Main.plugin; |
||||
|
||||
@EventHandler |
||||
public void onInventoryClick(InventoryClickEvent e) { |
||||
Player player = (Player) e.getWhoClicked(); |
||||
JavaPlugin plugin = Main.plugin; |
||||
if (e.getInventory() == null) return; |
||||
if (e.getCurrentItem() == null) return; |
||||
for (Gui gui : Main.guiHashMap.values()) { |
||||
if (player.getOpenInventory().getTitle().equals(Replace.replace(prefix, GUICode + gui.guiName)) |
||||
|| (Main.PaPi && player.getOpenInventory().getTitle().equals(Replace.replace(prefix, player, GUICode + gui.guiName)))) { |
||||
e.setCancelled(true); |
||||
for (Slot slot : gui.slots) { |
||||
Function function = Main.functionHashMap.get(slot.function); |
||||
if (e.getSlot() != slot.slot) continue; |
||||
if (slot.permission && !player.hasPermission(slot.permissionToSee)) continue; |
||||
if (slot.permission && !player.hasPermission(slot.permissionToUse)) { |
||||
player.sendMessage(SelectMessages.NoPermissionForItem.replace("[item]", Replace.replace(prefix, function.name)) |
||||
.replace("[perm]", slot.permissionToUse)); |
||||
continue; |
||||
} |
||||
if (e.getCurrentItem().getType() == ItemVersion.getHead() || e.getCurrentItem().getType() == ItemVersion.getGreenWool().getType() || |
||||
e.getCurrentItem().getType() == ItemVersion.getRedWool().getType() || |
||||
e.getCurrentItem().getType() == Material.valueOf(function.item.toUpperCase().replace(".", "_"))) { |
||||
if (!slot.enable) continue; |
||||
if (function.cost_Enable) { |
||||
if (function.command_Enable || function.message_Enable || function.openGUI_Enable || function.serverChange) { |
||||
|
||||
if (!Vault.buy(prefix, player, function.price)) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
} |
||||
}.runTaskLater(plugin, 1L); |
||||
player.sendMessage(SelectMessages.No_money); |
||||
if (SelectConfig.Sound_NoMoney_Enable && SelectConfig.Sound_Enable) |
||||
player.playSound(player.getLocation(), SelectConfig.Sound_NoMoney, 3, 1); |
||||
} else { |
||||
player.sendMessage(SelectMessages.Buy_msg.replace("[itemname]", Replace.replace(prefix, function.name)) |
||||
.replace("[price]", function.price + " " + SelectConfig.Currency)); |
||||
execute(function, slot, player, e, gui); |
||||
} |
||||
} |
||||
} else { |
||||
execute(function, slot, player, e, gui); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static void execute(Function function, Slot slot, Player player, InventoryClickEvent e, Gui gui) { |
||||
if (function.togglePermission) togglePerm(function, gui, player); |
||||
if (function.toggleUseItem) toggleUseItem(player, gui); |
||||
if (function.command_Enable) command(function, player); |
||||
if (function.openGUI_Enable) openGUI(function, player); |
||||
if (function.message_Enable) message(function, player); |
||||
if (function.serverChange) serverChange(function, player); |
||||
if (function.setConfigEnable) setConfig(function, player, e); |
||||
if (SelectConfig.Sound_Enable && SelectConfig.Sound_Click_Enable) sound(function, slot, player, gui); |
||||
} |
||||
|
||||
private static void command(Function slot, Player player) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
} |
||||
}.runTaskLater(plugin, 1L); |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
if (slot.command_BungeeCommand) { |
||||
if (SelectConfig.Bungee) { |
||||
for (String cmd : slot.command) { |
||||
Bungee_Sender_Reciver.sendToBungee(player, cmd.replace("[player]", player.getName()), slot.commandAsConsole); |
||||
} |
||||
} else { |
||||
send.console(prefix + " §4To use bungee commands, enable the Bungee option in the config."); |
||||
send.player(player, prefix + " §4To use bungee commands, enable the Bungee option in the config."); |
||||
} |
||||
} else { |
||||
for (String cmd : slot.command) { |
||||
if (slot.commandAsConsole) { |
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd.replace("[player]", player.getName())); |
||||
} else player.chat("/" + cmd.replace("[player]", player.getName())); |
||||
} |
||||
} |
||||
} |
||||
}.runTaskLater(plugin, 2L); |
||||
} |
||||
|
||||
private static void openGUI(Function slot, Player player) { |
||||
player.closeInventory(); |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
OpenGUI.openGUI(player, slot.openGUI, true); |
||||
} |
||||
}.runTaskLater(plugin, 1L); |
||||
} |
||||
|
||||
private static void message(Function slot, Player player) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
} |
||||
}.runTaskLater(plugin, 1L); |
||||
for (String msg : slot.message) { |
||||
if (Main.PaPi) { |
||||
if (slot.cost_Enable) { |
||||
player.sendMessage(Replace.replacePrice(prefix, player, msg, slot.price + " " + SelectConfig.Currency)); |
||||
} else player.sendMessage(Replace.replace(prefix, player, msg.replace("[prefix]", prefix))); |
||||
} else { |
||||
if (slot.cost_Enable) { |
||||
player.sendMessage(Replace.replacePrice(prefix, msg, slot.price + " " + SelectConfig.Currency)); |
||||
} else player.sendMessage(Replace.replace(prefix, msg.replace("[prefix]", prefix))); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static void serverChange(Function slot, Player player) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
} |
||||
}.runTaskLater(plugin, 1L); |
||||
send.player(player, SelectMessages.onServerChange.replace("[server]", slot.serverChangeServer)); |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
ServerChange.send(player, slot.serverChangeServer); |
||||
} |
||||
}.runTaskLater(Main.plugin, 20L); |
||||
} |
||||
|
||||
private static void setConfig(Function slot, Player player, InventoryClickEvent e) { |
||||
File config = new File(slot.configFilePath); |
||||
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); |
||||
|
||||
if (e.getClick() == ClickType.LEFT) { |
||||
if (slot.configOptionPremat.equals("String")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueLeft); |
||||
} else if (slot.configOptionPremat.equals("Boolean")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueLeft); |
||||
} else if (slot.configOptionPremat.equals("Integer")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueLeft); |
||||
} else if (slot.configOptionPremat.equals("Double")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueLeft); |
||||
} else if (slot.configOptionPremat.equals("List")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueLeft); |
||||
} else { |
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
} |
||||
} |
||||
if (e.getClick() == ClickType.RIGHT) { |
||||
if (slot.configOptionPremat.equals("String")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configStringValueRight); |
||||
} else if (slot.configOptionPremat.equals("Boolean")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configBooleanValueRight); |
||||
} else if (slot.configOptionPremat.equals("Integer")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configIntegerValueRight); |
||||
} else if (slot.configOptionPremat.equals("Double")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configDoubleValueRight); |
||||
} else if (slot.configOptionPremat.equals("List")) { |
||||
yamlConfiguration.set(slot.configOptionPath.replace("/", "."), slot.configListValueRight); |
||||
} else { |
||||
player.sendMessage("§cCheck the Option §6SetConfig/Option/Premat"); //todo
|
||||
} |
||||
} |
||||
try { |
||||
yamlConfiguration.save(config); |
||||
} catch (IOException tac) { |
||||
tac.printStackTrace(); |
||||
} |
||||
if (slot.pluginReloadEnable) { |
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), slot.pluginReloadCommand); |
||||
} |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
} |
||||
}.runTaskLater(plugin, 1L); |
||||
} |
||||
|
||||
private static void sound(Function function, Slot slot, Player player, Gui gui) { |
||||
if (function.customSound_Enable) { |
||||
if (!function.customSound_NoSound) { |
||||
try { |
||||
player.playSound(player.getLocation(), 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) |
||||
.replace("[sound]", "§6GUI: §e" + Replace.replace(prefix, gui.guiName) + "§r §6Slot: §e" + slot.slot + " §6CustomSound: §9" + function.customSound_Sound)); |
||||
player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1); |
||||
} |
||||
} |
||||
} else player.playSound(player.getLocation(), SelectConfig.Sound_Click, 3, 1); |
||||
} |
||||
|
||||
private static void togglePerm(Function function, Gui gui, Player player) { |
||||
if (player.hasPermission(function.togglePermissionPerm)) { |
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermFalse.replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm)); |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
OpenGUI.openGUI(player, gui.key, false); |
||||
} |
||||
}.runTaskLater(plugin, 4L); |
||||
} else |
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), SelectConfig.togglePermTrue.replace("[player]", player.getName()).replace("[perm]", function.togglePermissionPerm)); |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
OpenGUI.openGUI(player, gui.key, false); |
||||
} |
||||
}.runTaskLater(plugin, 4L); |
||||
} |
||||
|
||||
private static void toggleUseItem(Player player, Gui gui) { |
||||
if (Events.useItemHashMap.get(player)) { |
||||
Commands.itemOff(player); |
||||
} else { |
||||
Commands.itemOn(player); |
||||
} |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
player.closeInventory(); |
||||
OpenGUI.openGUI(player, gui.key, false); |
||||
} |
||||
}.runTaskLater(plugin, 2L); |
||||
} |
||||
} |
@ -1,79 +0,0 @@
@@ -1,79 +0,0 @@
|
||||
// This claas was created by JaTiTV
|
||||
|
||||
package de.jatitv.commandguiv2.Spigot.Listener; |
||||
|
||||
import de.jatitv.commandguiv2.Spigot.Main; |
||||
import de.jatitv.commandguiv2.Spigot.config.config.SelectConfig; |
||||
import de.jatitv.commandguiv2.Spigot.system.database.SelectDatabase; |
||||
import de.jatitv.commandguiv2.Util; |
||||
import net.t2code.lib.Spigot.Lib.update.UpdateAPI; |
||||
import org.bukkit.Bukkit; |
||||
import org.bukkit.entity.Player; |
||||
import org.bukkit.event.EventHandler; |
||||
import org.bukkit.event.Listener; |
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent; |
||||
import org.bukkit.event.player.PlayerLoginEvent; |
||||
import org.bukkit.event.server.ServerCommandEvent; |
||||
import org.bukkit.scheduler.BukkitRunnable; |
||||
|
||||
public class PluginEvent implements Listener { |
||||
private static String prefix = Main.prefix; |
||||
|
||||
@EventHandler |
||||
public void onJoinEvent(PlayerLoginEvent event) { |
||||
Player player = event.getPlayer(); |
||||
SelectDatabase.nameCheck(player); |
||||
UpdateAPI.join(Main.plugin,prefix, "commandgui.updatemsg", event.getPlayer(), Util.getSpigot(), Util.getDiscord()); |
||||
} |
||||
|
||||
|
||||
@EventHandler |
||||
public void onClearServer(ServerCommandEvent event) { |
||||
if (SelectConfig.UseItem_KeepAtCommandClear) { |
||||
if (event.getCommand().contains("clear " + event.getCommand().replace("/", "").replace("clear ", ""))) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
try { |
||||
Player player = Bukkit.getPlayer(event.getCommand().replace("/", "").replace("clear ", "")); |
||||
if (player == null){ |
||||
return; |
||||
} |
||||
clearGive(player); |
||||
} catch (Exception ex){ |
||||
ex.printStackTrace(); |
||||
return; |
||||
} |
||||
} |
||||
}.runTaskLater(Main.plugin, 1L); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
@EventHandler |
||||
public void onClearPlayer(PlayerCommandPreprocessEvent event) { |
||||
if (SelectConfig.UseItem_KeepAtCommandClear) { |
||||
if (event.getMessage().toLowerCase().contains("clear")) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
clearGive(event.getPlayer()); |
||||
} |
||||
}.runTaskLater(Main.plugin, 1L); |
||||
} |
||||
if (event.getMessage().toLowerCase().contains("clear " + event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))) { |
||||
new BukkitRunnable() { |
||||
@Override |
||||
public void run() { |
||||
clearGive(Bukkit.getPlayer(event.getMessage().toLowerCase().replace("/", "").replace("clear ", ""))); |
||||
} |
||||
}.runTaskLater(Main.plugin, 1L); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static void clearGive(Player player) { |
||||
ItemChange.itemChange(player, false); |
||||
} |
||||
} |