Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
## Download the latest LifeSupport version from https://github.com/OTGEngineering/OTG-HyperMerchant-LifeSupport/releases
HyperMerchant
=============

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public void onEnable() {
}

try {
active_enchant = new ActiveEnchant(111); //< this is your custom wrapper (a class that extends an EnchantmentWrapper with the needed stuff and returns
active_enchant = new ActiveEnchant("hypermerchantWrapper"); //< this is your custom wrapper (a class that extends an EnchantmentWrapper with the needed stuff and returns
EnchantmentWrapper.registerEnchantment(active_enchant); //<this is used to register the enchantment.
} catch (IllegalArgumentException e){

Expand Down
14 changes: 5 additions & 9 deletions src/main/java/grokswell/hypermerchant/ManageMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.citizensnpcs.api.npc.NPC;

import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.GameMode;
import org.bukkit.ChatColor;
import org.bukkit.Material;
Expand All @@ -31,7 +30,6 @@
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scheduler.BukkitRunnable;

import regalowl.hyperconomy.HyperConomy;
import regalowl.hyperconomy.HyperAPI;
import regalowl.hyperconomy.shop.PlayerShop;
import regalowl.hyperconomy.tradeobject.TradeObject;
Expand Down Expand Up @@ -63,7 +61,6 @@ public class ManageMenu implements Listener, MerchantMenu {
private ItemStack[] optionIcons;
private ShopTransactions shop_trans;
private ItemStack sorting_icon;
private HyperConomy hc;
ArrayList<String> status_list;
String economy_name;
HyperToBukkit hypBuk;
Expand Down Expand Up @@ -129,7 +126,6 @@ public ManageMenu(String name, int size, HyperMerchantPlugin plgn,CommandSender
this.inventory = Bukkit.createInventory(player, size, this.inventory_name);

hyplay = hyperAPI.getHyperPlayer(player.getName());
hc = HMP.hc;

economy_name = hyperAPI.getShop(this.shopname).getEconomy();

Expand Down Expand Up @@ -208,7 +204,7 @@ public void loadPage() {
TradeObject ho = hyperAPI.getHyperObject(item_name, economy_name, hyperAPI.getShop(shopname));
if (ho == null) {
stock=0;
stack=new ItemStack(Material.AIR, 1, (short) 0);
stack=new ItemStack(Material.AIR, 1);
value=0;
cost=0;

Expand Down Expand Up @@ -237,10 +233,10 @@ public void loadPage() {
value = ho.getSellPriceWithTax(1.0, hyplay);
cost = ho.getBuyPriceWithTax(1.0);

stack = new ItemStack(Material.POTION, 1, (short) 0);
stack = new ItemStack(Material.POTION);

} else {
stack = new ItemStack(Material.AIR, 1, (short) 0);
stack = new ItemStack(Material.AIR, 1);
}

String buy_dynamic = Utils.formatText(L.II_DYNAMIC, null);
Expand Down Expand Up @@ -276,7 +272,7 @@ public void loadPage() {

ItemStack stack;
while (count < size-9) {
stack = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.SILVER.getWoolData());
stack = new ItemStack(Material.LIGHT_GRAY_STAINED_GLASS_PANE, 1);
this.setOption(count, stack, " ", " ");
count++;
}
Expand Down Expand Up @@ -431,7 +427,7 @@ public void itemRefresh(int slot, TradeObject ho) {
stack = (new EnchantIcons()).getIcon(ho.getDisplayName(), ho.getEnchantmentLevel());
}
else if (ho.getType()==TradeObjectType.EXPERIENCE) {
stack = new ItemStack(Material.POTION, 1, (short) 0);
stack = new ItemStack(Material.POTION, 1);
}
else {
stack = hypBuk.getItemStack(ho.getItemStack(1));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/grokswell/hypermerchant/MerchantMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public int Hire(String npcname, String npctype, String shopname, Location locati
}

if (l.getBlock().getType() != Material.AIR) {
l = utils.getFirstBlockAboveGround(l);
l = Utils.getFirstBlockAboveGround(l);
}

this_npc = npcReg.createNPC(EntityType.valueOf(npc_type.toUpperCase()), npcname);
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/grokswell/hypermerchant/ShopMenu.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package grokswell.hypermerchant;

import static java.lang.System.out;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -10,7 +8,6 @@
import net.citizensnpcs.api.npc.NPC;

import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.GameMode;
import org.bukkit.ChatColor;
import org.bukkit.Material;
Expand Down Expand Up @@ -184,7 +181,7 @@ public void loadPage() {

if (ho == null) {
stock=0;
stack=new ItemStack(Material.AIR, 1, (short) 0);
stack=new ItemStack(Material.AIR, 1);
value=0;
cost=0;

Expand Down Expand Up @@ -217,10 +214,10 @@ public void loadPage() {
value = ho.getSellPriceWithTax(1.0, hp);
cost = ho.getBuyPriceWithTax(1.0);

stack = new ItemStack(Material.POTION, 1, (short) 0);
stack = new ItemStack(Material.POTION, 1);

} else {
stack = new ItemStack(Material.AIR, 1, (short) 0);
stack = new ItemStack(Material.AIR, 1);
}

//String status = "";
Expand All @@ -247,7 +244,7 @@ public void loadPage() {

ItemStack stack;
while (count < size-9) {
stack = new ItemStack(Material.STAINED_GLASS_PANE, 1, DyeColor.SILVER.getWoolData());
stack = new ItemStack(Material.LIGHT_GRAY_STAINED_GLASS_PANE,1);
this.setOption(count, stack, " ", " ");
count++;
}
Expand Down Expand Up @@ -398,7 +395,7 @@ public void itemRefresh(int slot, TradeObject ho) {
stack = (new EnchantIcons()).getIcon(ho.getDisplayName(), ho.getEnchantmentLevel());
}
else if (ho.getType()==TradeObjectType.EXPERIENCE) {
stack = new ItemStack(Material.POTION, 1, (short) 0);
stack = new ItemStack(Material.POTION, 1);
}
else {
stack = hypBuk.getItemStack(ho.getItemStack(1));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/grokswell/hypermerchant/ShopStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public ArrayList<String> Sort(Integer sort_by) {
}

catch (Exception e) {
sender.sendMessage(Utils.formatText(L.G_SHOP_OPEN_FAIL, null));
sender.sendMessage(Utils.formatText(Language.G_SHOP_OPEN_FAIL, null));
return null;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/grokswell/hypermerchant/ShopTransactions.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;

import regalowl.hyperconomy.api.HEconomyProvider;
Expand All @@ -29,6 +28,7 @@
import regalowl.hyperconomy.tradeobject.TradeObjectType;
import regalowl.hyperconomy.transaction.TransactionResponse;

@SuppressWarnings("deprecation")
public class ShopTransactions {
ArrayList<ArrayList<String>> pages = new ArrayList<ArrayList<String>>();
int items_count;
Expand Down Expand Up @@ -122,6 +122,7 @@ public ItemStack SellItem(ItemStack item_stack, String menu_item_name){
}

// PLAYER SELLS ENCHANT TO SHOP

public ItemStack SellSingleEnchant(ItemStack item_stack, String enchant) {
//out.println("SellSingleEnchant");
HItemStack hi = bukCon.getBukkitCommon().getSerializableItemStack(item_stack);
Expand Down Expand Up @@ -150,6 +151,7 @@ public ItemStack SellSingleEnchant(ItemStack item_stack, String enchant) {
ItemStack stack = new ItemStack(item_stack.clone());
if (keep_enchants.size()>0) {
for (TradeObject e : keep_enchants){

stack.addUnsafeEnchantment(Enchantment.getByName(e.getEnchantment().getEnchantmentName()), e.getEnchantmentLevel());
}
}
Expand Down Expand Up @@ -388,10 +390,8 @@ else if (ho.getType() == TradeObjectType.ITEM) {
//PLAYER-MANAGER ADDS SOMETHING TO SHOP
public ItemStack AddItemStack(ItemStack item_stack) {
//out.println("AddItemStack: "+item_stack);
HItemStack hi = bukCon.getBukkitCommon().getSerializableItemStack(item_stack);
PlayerShop pshop=hyperAPI.getPlayerShop(this.shopname);
HyperEconomy he = hc.getDataManager().getEconomy(pshop.getEconomy());
TradeObject ho = hyplay.getHyperEconomy().getTradeObject(hi);



if (item_stack.getType()==Material.ENCHANTED_BOOK) {
ItemStack return_item = this.AddEnchantedBook(item_stack);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/grokswell/util/ActiveEnchant.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//Thanks to Captain Bern for this class
public class ActiveEnchant extends EnchantmentWrapper {

public ActiveEnchant(int id) {
public ActiveEnchant(String id) {
super(id);
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/grokswell/util/Blacklist.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/grokswell/util/EnchantIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else if (ename.contains("thorns")) {
}

else if (ename.contains("efficiency")) {
stack = new ItemStack(Material.IRON_SPADE);
stack = new ItemStack(Material.IRON_SHOVEL);
stack.addEnchantment(Enchantment.DIG_SPEED, elevel);
}

Expand All @@ -39,12 +39,12 @@ else if (ename.contains("respiration")) {
}

else if (ename.contains("silktouch") ) {
stack = new ItemStack(Material.IRON_SPADE);
stack = new ItemStack(Material.IRON_SHOVEL);
stack.addEnchantment(Enchantment.SILK_TOUCH, elevel);
}

else if (ename.contains("fortune")) {
stack = new ItemStack(Material.IRON_SPADE);
stack = new ItemStack(Material.IRON_SHOVEL);
stack.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, elevel);
}

Expand Down Expand Up @@ -139,7 +139,7 @@ else if (ename.contains("frost_walker")) {
}

else {
stack = new ItemStack(Material.CARROT_STICK);
stack = new ItemStack(Material.CARROT_ON_A_STICK);
stack.addEnchantment(Enchantment.MENDING, 1);
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/grokswell/util/HyperToBukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import regalowl.hyperconomy.inventory.HItemStack;
import regalowl.hyperconomy.minecraft.HLocation;


public class HyperToBukkit {


Expand All @@ -18,7 +19,7 @@ public Location getLocation(HLocation hl){

public ItemStack getItemStack(HItemStack hi){
Material mat = Material.getMaterial(hi.getMaterial());
ItemStack stack = new ItemStack(mat, hi.getAmount(), hi.getDurability());
ItemStack stack = new ItemStack(mat, hi.getAmount());
return stack;
}
}
4 changes: 2 additions & 2 deletions src/main/java/grokswell/util/MenuButtonData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;

Expand All @@ -16,6 +15,7 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

@SuppressWarnings("deprecation")
public class MenuButtonData {
private static File dataFolder;
private HyperMerchantPlugin plugin;
Expand Down Expand Up @@ -171,7 +171,7 @@ private void setMenuButtonItemStacks() {
help4 = new ItemStack(Material.getMaterial(menuButtonData.getString("help4.material")));
help4.setDurability(Short.parseShort(menuButtonData.getString("help4.data")));
setItemNameAndLore(help4, menuButtonData.getString("help4.name"), ParseLore(menuButtonData.getString("help4.lore")));

help5 = new ItemStack(Material.getMaterial(menuButtonData.getString("help5.material")));
help5.setDurability(Short.parseShort(menuButtonData.getString("help5.data")));
setItemNameAndLore(help5, menuButtonData.getString("help5.name"), ParseLore(menuButtonData.getString("help5.lore")));
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/menubuttons.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
first_page:
material: STAINED_GLASS_PANE
material: WHITE_STAINED_GLASS_PANE
data: 14
name: First Page
lore: Go to the first page.
back:
material: STAINED_GLASS_PANE
material: WHITE_STAINED_GLASS_PANE
data: 5
name: Back 1
lore: Go back to the previous page.
Expand Down Expand Up @@ -36,12 +36,12 @@ help5:
name: Switch Sorting Mode
lore: Left-click switch sorting mode,Right-click toggle zero stock
forward:
material: STAINED_GLASS_PANE
material: WHITE_STAINED_GLASS_PANE
data: 5
name: Forward 1
lore: Go to the next page.
last_page:
material: STAINED_GLASS_PANE
material: WHITE_STAINED_GLASS_PANE
data: 14
name: Last page
lore: Go to the last page.
Expand All @@ -56,7 +56,7 @@ sell_price:
name: Sell Price
lore: How much others pay you:,Click this button and then,click items to change price.,Click something else when finished.,Right click items for dynamic pricing
status:
material: REDSTONE_COMPARATOR
material: COMPARATOR
data: 0
name: Set Status
lore: Click this button and then,Click items to change their status.,Click something else when finished.
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: HyperMerchant
main: grokswell.hypermerchant.HyperMerchantPlugin
version: 1.6.2-dev
version: 1.6.4
api-version: 1.13
description: Inventory menu to be used with HyperConomy shops and NPC trait for Citizens2.
author: Grokswell
authors: [Grokswell]
Expand Down