1.7.2
This commit is contained in:
parent
23384a49df
commit
c782e8d834
4 changed files with 50 additions and 3 deletions
|
|
@ -83,8 +83,12 @@ public class InventoryManager {
|
|||
public void openInventory(InventoryPlayer inventoryPlayer){
|
||||
KitInventory kitInventory = getInventory(inventoryPlayer.getInventoryName());
|
||||
|
||||
String title = kitInventory.getTitle();
|
||||
if(inventoryPlayer.getInventoryName().equals("buy_requirements_inventory") || inventoryPlayer.getInventoryName().equals("preview_inventory")){
|
||||
title = title.replace("%kit%",inventoryPlayer.getKitName());
|
||||
}
|
||||
Inventory inv = Bukkit.createInventory(null,kitInventory.getSlots(),
|
||||
MessagesManager.getColoredMessage(kitInventory.getTitle()));
|
||||
MessagesManager.getColoredMessage(title));
|
||||
|
||||
List<ItemKitInventory> items = kitInventory.getItems();
|
||||
KitItemManager kitItemManager = plugin.getKitItemManager();
|
||||
|
|
|
|||
|
|
@ -117,10 +117,10 @@ public class VerifyManager {
|
|||
}
|
||||
|
||||
public void verifyInventory(KitInventory inventory){
|
||||
//Invalid kit on slot
|
||||
KitsManager kitsManager = plugin.getKitsManager();
|
||||
List<ItemKitInventory> items = inventory.getItems();
|
||||
InventoryManager inventoryManager = plugin.getInventoryManager();
|
||||
int maxSlots = inventory.getSlots();
|
||||
for(ItemKitInventory item : items){
|
||||
String type = item.getType();
|
||||
if(type != null && type.startsWith("kit: ")){
|
||||
|
|
@ -149,6 +149,15 @@ public class VerifyManager {
|
|||
criticalErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Valid slots
|
||||
for(int slot : item.getSlots()){
|
||||
if(slot >= maxSlots){
|
||||
errors.add(new PKInventoryInvalidSlotError("inventory.yml",null,true,slot,
|
||||
inventory.getName(),maxSlots));
|
||||
criticalErrors = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package pk.ajneb97.model.verify;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import pk.ajneb97.utils.JSONMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PKInventoryInvalidSlotError extends PKBaseError{
|
||||
|
||||
private String inventoryName;
|
||||
private int slot;
|
||||
private int maxSlots;
|
||||
|
||||
public PKInventoryInvalidSlotError(String file, String errorText, boolean critical, int slot, String inventoryName, int maxSlots) {
|
||||
super(file, errorText, critical);
|
||||
this.inventoryName = inventoryName;
|
||||
this.slot = slot;
|
||||
this.maxSlots = maxSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(Player player) {
|
||||
List<String> hover = new ArrayList<String>();
|
||||
|
||||
JSONMessage jsonMessage = new JSONMessage(player,prefix+"&7Inventory &c"+inventoryName+" &7has an item on an invalid slot");
|
||||
hover.add("&eTHIS IS AN ERROR!");
|
||||
hover.add("&fSlot &c"+slot+" &fon inventory &c"+inventoryName);
|
||||
hover.add("&fis out of range. Use a range");
|
||||
hover.add("&fbetween 0 and "+maxSlots+".");
|
||||
|
||||
jsonMessage.hover(hover).send();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
main: pk.ajneb97.PlayerKits2
|
||||
version: 1.7.1
|
||||
version: 1.7.2
|
||||
name: PlayerKits2
|
||||
api-version: 1.13
|
||||
softdepend: [Vault,PlaceholderAPI]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue