This repository has been archived by the owner on Sep 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iConomyChestShop version 2.73, supports all major economy plugins, so…
…me fixes and made it more flexible
- Loading branch information
Showing
21 changed files
with
901 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.Acrobot.iConomyChestShop.Chests; | ||
|
||
import org.bukkit.inventory.ItemStack; | ||
|
||
public interface ChestObject { | ||
public ItemStack[] getContents(); | ||
|
||
public void setSlot(int slot, ItemStack item); | ||
public void clearSlot(int slot); | ||
|
||
public void addItem(ItemStack item, int amount); | ||
public void removeItem(ItemStack item, int amount); | ||
|
||
public int amount(ItemStack item); | ||
public boolean hasEnough(ItemStack item, int amount); | ||
public boolean fits(ItemStack item, int amount); | ||
|
||
public int getSize(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.Acrobot.iConomyChestShop.Chests; | ||
|
||
import com.Acrobot.iConomyChestShop.Basic; | ||
import com.Acrobot.iConomyChestShop.ConfigManager; | ||
import com.aranai.virtualchest.VirtualChest; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
/** | ||
* Compatibility with VirtualChests - future relases | ||
* @author Acrobot | ||
*/ | ||
public class GiftPost implements ChestObject{ | ||
private final VirtualChest chest; | ||
|
||
public GiftPost(VirtualChest v){ | ||
this.chest = v; | ||
} | ||
|
||
public ItemStack[] getContents() { | ||
return chest.getContents(); | ||
} | ||
|
||
public void setSlot(int slot, ItemStack item) { | ||
chest.setItem(slot, item); | ||
} | ||
|
||
public void clearSlot(int slot) { | ||
chest.setItem(slot, null); | ||
} | ||
|
||
public void addItem(ItemStack item, int amount) { | ||
item.setAmount(amount); | ||
chest.addItem(item); | ||
} | ||
|
||
public void removeItem(ItemStack item, int amount) { | ||
int type = item.getTypeId(); | ||
boolean checkDurability = true; | ||
if(ConfigManager.getBoolean("allowUsedItemsToBeSold") && type >= 256 && type <= 317){ | ||
checkDurability = false; | ||
} | ||
for (int i = 0; i < chest.usedCases(); i++) { | ||
ItemStack is = chest.getItem(i); | ||
if (is != null) { | ||
short durability = item.getDurability(); | ||
int isAmount = is.getAmount(); | ||
if (is.getTypeId() == type && (!checkDurability || durability == -1 || (is.getDurability() == durability))) { | ||
if (isAmount - amount > 0) { | ||
chest.setItem(i, new ItemStack(type, isAmount - amount, durability)); | ||
return; | ||
} else if (isAmount - amount == 0) { | ||
return; | ||
} else { | ||
amount -= isAmount; | ||
chest.setItem(i, null); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
public int amount(ItemStack item) { | ||
return Basic.getItemAmount(chest.getContents(), item); | ||
} | ||
|
||
public boolean hasEnough(ItemStack item, int amount) { | ||
return amount(item) >= amount; | ||
} | ||
|
||
public boolean fits(ItemStack item, int amount) { | ||
return true; | ||
} | ||
|
||
public int getSize() { | ||
return chest.usedCases(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.