Merge pull request #59 from TheMonDon/patch-1

Change Inventory.getName to InventoryView.getTitle (2)
This commit is contained in:
BadBones69 2019-05-07 01:25:54 -04:00 committed by GitHub
commit 59d5987267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -441,7 +441,7 @@ public class GUI implements Listener {
Inventory inv = e.getInventory(); Inventory inv = e.getInventory();
Player player = (Player) e.getPlayer(); Player player = (Player) e.getPlayer();
if(inv != null) { if(inv != null) {
if(inv.getName().contains(Methods.color(config.getString("Settings.Bidding-On-Item")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.Bidding-On-Item")))) {
bidding.remove(player); bidding.remove(player);
} }
} }
@ -454,7 +454,7 @@ public class GUI implements Listener {
Player player = (Player) e.getWhoClicked(); Player player = (Player) e.getWhoClicked();
final Inventory inv = e.getInventory(); final Inventory inv = e.getInventory();
if(inv != null) { if(inv != null) {
if(inv.getName().contains(Methods.color(config.getString("Settings.Categories")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.Categories")))) {
e.setCancelled(true); e.setCancelled(true);
int slot = e.getRawSlot(); int slot = e.getRawSlot();
if(slot <= inv.getSize()) { if(slot <= inv.getSize()) {
@ -479,7 +479,7 @@ public class GUI implements Listener {
} }
} }
} }
if(inv.getName().contains(Methods.color(config.getString("Settings.Bidding-On-Item")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.Bidding-On-Item")))) {
e.setCancelled(true); e.setCancelled(true);
int slot = e.getRawSlot(); int slot = e.getRawSlot();
if(slot <= inv.getSize()) { if(slot <= inv.getSize()) {
@ -546,7 +546,7 @@ public class GUI implements Listener {
} }
} }
} }
if(inv.getName().contains(Methods.color(config.getString("Settings.GUIName")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.GUIName")))) {
e.setCancelled(true); e.setCancelled(true);
final int slot = e.getRawSlot(); final int slot = e.getRawSlot();
if(slot <= inv.getSize()) { if(slot <= inv.getSize()) {
@ -556,14 +556,14 @@ public class GUI implements Listener {
if(item.getItemMeta().hasDisplayName()) { if(item.getItemMeta().hasDisplayName()) {
if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.NextPage.Name")))) { if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.NextPage.Name")))) {
Methods.updateAuction(); Methods.updateAuction();
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
openShop(player, shopType.get(player), shopCategory.get(player), page + 1); openShop(player, shopType.get(player), shopCategory.get(player), page + 1);
playClick(player); playClick(player);
return; return;
} }
if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.PreviousPage.Name")))) { if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.PreviousPage.Name")))) {
Methods.updateAuction(); Methods.updateAuction();
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
if(page == 1) page++; if(page == 1) page++;
openShop(player, shopType.get(player), shopCategory.get(player), page - 1); openShop(player, shopType.get(player), shopCategory.get(player), page - 1);
playClick(player); playClick(player);
@ -571,7 +571,7 @@ public class GUI implements Listener {
} }
if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.Refesh.Name")))) { if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.Refesh.Name")))) {
Methods.updateAuction(); Methods.updateAuction();
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
openShop(player, shopType.get(player), shopCategory.get(player), page); openShop(player, shopType.get(player), shopCategory.get(player), page);
playClick(player); playClick(player);
return; return;
@ -640,7 +640,7 @@ public class GUI implements Listener {
Files.DATA.saveFile(); Files.DATA.saveFile();
player.sendMessage(Messages.ADMIN_FORCE_CENCELLED.getMessage()); player.sendMessage(Messages.ADMIN_FORCE_CENCELLED.getMessage());
playClick(player); playClick(player);
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
openShop(player, shopType.get(player), shopCategory.get(player), page); openShop(player, shopType.get(player), shopCategory.get(player), page);
return; return;
} }
@ -712,7 +712,7 @@ public class GUI implements Listener {
} }
} }
} }
if(inv.getName().contains(Methods.color(config.getString("Settings.Buying-Item")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.Buying-Item")))) {
e.setCancelled(true); e.setCancelled(true);
int slot = e.getRawSlot(); int slot = e.getRawSlot();
if(slot <= inv.getSize()) { if(slot <= inv.getSize()) {
@ -773,7 +773,7 @@ public class GUI implements Listener {
} }
} }
} }
if(inv.getName().contains(Methods.color(config.getString("Settings.Players-Current-Items")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.Players-Current-Items")))) {
e.setCancelled(true); e.setCancelled(true);
int slot = e.getRawSlot(); int slot = e.getRawSlot();
if(slot <= inv.getSize()) { if(slot <= inv.getSize()) {
@ -820,7 +820,7 @@ public class GUI implements Listener {
} }
} }
} }
if(inv.getName().contains(Methods.color(config.getString("Settings.Cancelled/Expired-Items")))) { if(e.getView().getTitle().contains(Methods.color(config.getString("Settings.Cancelled/Expired-Items")))) {
e.setCancelled(true); e.setCancelled(true);
final int slot = e.getRawSlot(); final int slot = e.getRawSlot();
if(slot <= inv.getSize()) { if(slot <= inv.getSize()) {
@ -836,7 +836,7 @@ public class GUI implements Listener {
} }
if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.PreviousPage.Name")))) { if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.PreviousPage.Name")))) {
Methods.updateAuction(); Methods.updateAuction();
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
if(page == 1) page++; if(page == 1) page++;
playClick(player); playClick(player);
openPlayersExpiredList(player, (page - 1)); openPlayersExpiredList(player, (page - 1));
@ -844,7 +844,7 @@ public class GUI implements Listener {
} }
if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.Return.Name")))) { if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.Return.Name")))) {
Methods.updateAuction(); Methods.updateAuction();
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
if(data.contains("OutOfTime/Cancelled")) { if(data.contains("OutOfTime/Cancelled")) {
for(String i : data.getConfigurationSection("OutOfTime/Cancelled").getKeys(false)) { for(String i : data.getConfigurationSection("OutOfTime/Cancelled").getKeys(false)) {
if(data.getString("OutOfTime/Cancelled." + i + ".Seller").equalsIgnoreCase(player.getName())) { if(data.getString("OutOfTime/Cancelled." + i + ".Seller").equalsIgnoreCase(player.getName())) {
@ -866,7 +866,7 @@ public class GUI implements Listener {
} }
if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.NextPage.Name")))) { if(item.getItemMeta().getDisplayName().equals(Methods.color(config.getString("Settings.GUISettings.OtherSettings.NextPage.Name")))) {
Methods.updateAuction(); Methods.updateAuction();
int page = Integer.parseInt(inv.getName().split("#")[1]); int page = Integer.parseInt(e.getView().getTitle().split("#")[1]);
playClick(player); playClick(player);
openPlayersExpiredList(player, (page + 1)); openPlayersExpiredList(player, (page + 1));
return; return;