1.3.1
This commit is contained in:
parent
84ab6c8d96
commit
03f0e1446f
5 changed files with 23 additions and 5 deletions
|
|
@ -203,6 +203,7 @@ public class KitsConfigManager {
|
||||||
String path = "actions."+actionType+"."+currentPos;
|
String path = "actions."+actionType+"."+currentPos;
|
||||||
config.set(path+".action",kitAction.getAction());
|
config.set(path+".action",kitAction.getAction());
|
||||||
config.set(path+".execute_before_items",kitAction.isExecuteBeforeItems());
|
config.set(path+".execute_before_items",kitAction.isExecuteBeforeItems());
|
||||||
|
config.set(path+".count_as_item",kitAction.isCountAsItem());
|
||||||
if(kitAction.getDisplayItem() != null){
|
if(kitAction.getDisplayItem() != null){
|
||||||
kitItemManager.saveKitItemOnConfig(kitAction.getDisplayItem(),config,path+".display_item");
|
kitItemManager.saveKitItemOnConfig(kitAction.getDisplayItem(),config,path+".display_item");
|
||||||
}
|
}
|
||||||
|
|
@ -287,10 +288,11 @@ public class KitsConfigManager {
|
||||||
for(String key : config.getConfigurationSection(mainPath+"actions."+actionType).getKeys(false)){
|
for(String key : config.getConfigurationSection(mainPath+"actions."+actionType).getKeys(false)){
|
||||||
String path = mainPath+"actions."+actionType+"."+key;
|
String path = mainPath+"actions."+actionType+"."+key;
|
||||||
String action = config.getString(path+".action");
|
String action = config.getString(path+".action");
|
||||||
boolean executeBeforeItem = config.contains("execute_before_items") ? config.getBoolean("execute_before_items") : false;
|
boolean executeBeforeItem = config.contains(path+".execute_before_items") ? config.getBoolean(path+".execute_before_items") : false;
|
||||||
|
boolean countAsItem = config.contains(path+".count_as_item") ? config.getBoolean(path+".count_as_item") : false;
|
||||||
KitItem item = config.contains(path+".display_item") ? kitItemManager.getKitItemFromConfig(config,path+".display_item") : null;
|
KitItem item = config.contains(path+".display_item") ? kitItemManager.getKitItemFromConfig(config,path+".display_item") : null;
|
||||||
|
|
||||||
actions.add(new KitAction(action,item,executeBeforeItem));
|
actions.add(new KitAction(action,item,executeBeforeItem,countAsItem));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,12 @@ public class KitsManager {
|
||||||
|
|
||||||
inventoryKitItems++;
|
inventoryKitItems++;
|
||||||
}
|
}
|
||||||
|
ArrayList<KitAction> claimActions = kit.getClaimActions();
|
||||||
|
for(KitAction action : claimActions){
|
||||||
|
if(action.isCountAsItem()){
|
||||||
|
inventoryKitItems++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean enoughSpace = freeSlots < inventoryKitItems;
|
boolean enoughSpace = freeSlots < inventoryKitItems;
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ public class InventoryEditActionsManager {
|
||||||
Kit kit = plugin.getKitsManager().getKitByName(inventoryPlayer.getKitName());
|
Kit kit = plugin.getKitsManager().getKitByName(inventoryPlayer.getKitName());
|
||||||
String type = inventoryPlayer.getInventoryName().replace("edit_chat_add_action_","");
|
String type = inventoryPlayer.getInventoryName().replace("edit_chat_add_action_","");
|
||||||
ArrayList<KitAction> actions = getKitActionsFromType(kit,type);
|
ArrayList<KitAction> actions = getKitActionsFromType(kit,type);
|
||||||
actions.add(new KitAction(message,null,false));
|
actions.add(new KitAction(message,null,false,false));
|
||||||
|
|
||||||
inventoryEditManager.removeInventoryPlayer(inventoryPlayer.getPlayer());
|
inventoryEditManager.removeInventoryPlayer(inventoryPlayer.getPlayer());
|
||||||
openInventory(inventoryPlayer,type);
|
openInventory(inventoryPlayer,type);
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,13 @@ public class KitAction {
|
||||||
private String action;
|
private String action;
|
||||||
private KitItem displayItem;
|
private KitItem displayItem;
|
||||||
private boolean executeBeforeItems;
|
private boolean executeBeforeItems;
|
||||||
|
private boolean countAsItem;
|
||||||
|
|
||||||
public KitAction(String action, KitItem displayItem, boolean executeBeforeItems) {
|
public KitAction(String action, KitItem displayItem, boolean executeBeforeItems, boolean countAsItem) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
this.displayItem = displayItem;
|
this.displayItem = displayItem;
|
||||||
this.executeBeforeItems = executeBeforeItems;
|
this.executeBeforeItems = executeBeforeItems;
|
||||||
|
this.countAsItem = countAsItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAction() {
|
public String getAction() {
|
||||||
|
|
@ -36,4 +38,12 @@ public class KitAction {
|
||||||
public void setExecuteBeforeItems(boolean executeBeforeItems) {
|
public void setExecuteBeforeItems(boolean executeBeforeItems) {
|
||||||
this.executeBeforeItems = executeBeforeItems;
|
this.executeBeforeItems = executeBeforeItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCountAsItem() {
|
||||||
|
return countAsItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountAsItem(boolean countAsItem) {
|
||||||
|
this.countAsItem = countAsItem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
main: pk.ajneb97.PlayerKits2
|
main: pk.ajneb97.PlayerKits2
|
||||||
version: 1.2.2
|
version: 1.3.1
|
||||||
name: PlayerKits2
|
name: PlayerKits2
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend: [Vault,PlaceholderAPI]
|
softdepend: [Vault,PlaceholderAPI]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue