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
3 changes: 2 additions & 1 deletion 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-HyperConomy-LifeSupport/releases
HyperConomy
===========

Expand Down Expand Up @@ -44,7 +45,7 @@ Releases
* Recommended builds are marked with [RB] and are generally thought to be stable and bug free.
* Builds marked as [Beta] are as bug free as possible, but often have large code changes which may result in the appearance of new bugs.
* Builds marked as [Dev] are development builds. Development builds may contain bugs as I work on releasing a new [Beta] build. They may also contain fixes for bugs found in [Beta] builds. Use these builds if you're looking for a bug fix, or would like to try out a new feature I've just added. Also, feel free to search for bugs in the development builds. Any help with testing is greatly appreciated! Please create a ticket if you find a bug in a Dev build and I'll fix it as soon as I can.

[![Build Status](https://ci.auranode.com/buildStatus/icon?job=W-HyperConomy)](https://ci.auranode.com/job/W-HyperConomy/)

Add-ons
---------
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<repositories>
<repository>
<id>Articdive-repo</id>
<url>http://ci.articdive.cf/plugin/repository/everything/</url>
<url>https://nexus.articdive.de/repository/maven-public/</url>
</repository>
<repository>
<id>Sonatype-public</id>
Expand All @@ -34,7 +34,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: regalowl.hyperconomy.bukkit.BukkitConnector

22 changes: 10 additions & 12 deletions src/main/java/regalowl/hyperconomy/HyperAPI.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
package regalowl.hyperconomy;

import java.util.ArrayList;










import java.util.UUID;

import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import regalowl.hyperconomy.account.HyperPlayer;
import regalowl.hyperconomy.account.HyperPlayerManager;
import regalowl.hyperconomy.api.API;
Expand Down Expand Up @@ -48,7 +39,14 @@ public String getPlayerShop(HyperPlayer player) {
return shop.getName();
}
}

public double getPrice(Player p, ItemStack item){
String econ = hc.getConsoleEconomy();
HItemStack hItemStack = hc.getBlankStack();
hItemStack.setMaterial(item.getType().toString());
hItemStack.setAmount(item.getAmount());
TradeObject to = getHyperObject(hItemStack,econ);
return to.getSellPriceWithTax(to.getValue(),getHyperPlayer(p.getUniqueId()));
}
public boolean checkHash(String player, String SHA256Hash) {
if (hc.getHyperPlayerManager().hyperPlayerExists(player)) {
if (hc.getHyperPlayerManager().getHyperPlayer(player).getHash().equals(SHA256Hash)) {
Expand Down
77 changes: 38 additions & 39 deletions src/main/java/regalowl/hyperconomy/api/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import java.util.UUID;

import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import regalowl.hyperconomy.account.HyperPlayer;
import regalowl.hyperconomy.inventory.HInventory;
import regalowl.hyperconomy.inventory.HItemStack;
Expand All @@ -24,62 +26,59 @@



public interface API {
public interface API {


public String getDefaultServerShopAccountName();
public Shop getShop(String name);
public ServerShop getServerShop(String name);
public PlayerShop getPlayerShop(String name);
String getDefaultServerShopAccountName();


Shop getShop(String name);
ServerShop getServerShop(String name);
PlayerShop getPlayerShop(String name);


public ArrayList<String> getServerShopList();
public ArrayList<String> getPlayerShopList();
ArrayList<String> getServerShopList();
ArrayList<String> getPlayerShopList();

public HyperPlayer getHyperPlayer(String name);
public HyperPlayer getHyperPlayer(UUID uuid);
public boolean hyperPlayerExists(String name);
public boolean hyperPlayerExists(UUID uuid);
public HyperPlayer createHyperPlayer(String name);
HyperPlayer getHyperPlayer(String name);
HyperPlayer getHyperPlayer(UUID uuid);
boolean hyperPlayerExists(String name);
boolean hyperPlayerExists(UUID uuid);
HyperPlayer createHyperPlayer(String name);
/**
* @param player (name of player)
* @return true if the hash matches the player's hash and false if it doesn't
*/
public boolean checkHash(String player, String hash);
boolean checkHash(String player, String hash);

/**
* @param player (name of player)
* @return The random hash for the specified player. If the player is not in the HyperConomy database it returns ""
*/
public String getSalt(String player);
/**
* @param Item entity
* @return Returns true if the given Item is being used as an ItemDisplay and false if it is not.
*/
public boolean isItemDisplay(HItem item);

public EnchantmentClass getEnchantmentClass(HItemStack stack);
String getSalt(String player);

public TradeObject getHyperObject(String name, String economy);
public TradeObject getHyperObject(String name, String economy, Shop s);
public TradeObject getHyperObject(HItemStack stack, String economy);
public TradeObject getHyperObject(HItemStack stack, String economy, Shop s);
public ArrayList<TradeObject> getEnchantmentHyperObjects(HItemStack stack, String player);
boolean isItemDisplay(HItem item);

public ArrayList<TradeObject> getAvailableObjects(String shopname);
public ArrayList<TradeObject> getAvailableObjects(String shopname, int startingPosition, int limit);
public ArrayList<TradeObject> getAvailableObjects(HyperPlayer p);
public ArrayList<TradeObject> getAvailableObjects(HyperPlayer p, int startingPosition, int limit);
EnchantmentClass getEnchantmentClass(HItemStack stack);

TradeObject getHyperObject(String name, String economy);
TradeObject getHyperObject(String name, String economy, Shop s);
TradeObject getHyperObject(HItemStack stack, String economy);
TradeObject getHyperObject(HItemStack stack, String economy, Shop s);
ArrayList<TradeObject> getEnchantmentHyperObjects(HItemStack stack, String player);

public TransactionResponse buy(HyperPlayer p, TradeObject o, int amount);
public TransactionResponse buy(HyperPlayer p, TradeObject o, int amount, Shop shop);
public TransactionResponse sell(HyperPlayer p, TradeObject o, int amount);
public TransactionResponse sell(HyperPlayer p, TradeObject o, int amount, Shop shop);
public TransactionResponse sellAll(HyperPlayer p);
public TransactionResponse sellAll(HyperPlayer p, HInventory inventory);
ArrayList<TradeObject> getAvailableObjects(String shopname);
ArrayList<TradeObject> getAvailableObjects(String shopname, int startingPosition, int limit);
ArrayList<TradeObject> getAvailableObjects(HyperPlayer p);
ArrayList<TradeObject> getAvailableObjects(HyperPlayer p, int startingPosition, int limit);

public boolean addItemToEconomy(HItemStack stack, String economyName, String requestedName);
TransactionResponse buy(HyperPlayer p, TradeObject o, int amount);
TransactionResponse buy(HyperPlayer p, TradeObject o, int amount, Shop shop);
TransactionResponse sell(HyperPlayer p, TradeObject o, int amount);
TransactionResponse sell(HyperPlayer p, TradeObject o, int amount, Shop shop);
TransactionResponse sellAll(HyperPlayer p);
TransactionResponse sellAll(HyperPlayer p, HInventory inventory);
double getPrice(Player p, ItemStack item);
boolean addItemToEconomy(HItemStack stack, String economyName, String requestedName);

}
17 changes: 5 additions & 12 deletions src/main/java/regalowl/hyperconomy/bukkit/BukkitCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;

import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -123,7 +123,7 @@ protected Sign getSign(HLocation l) {

protected boolean isTransactionSign(HLocation l) {
Block b = getBlock(l);
if (b != null && b.getType().equals(Material.SIGN_POST) || b != null && b.getType().equals(Material.WALL_SIGN)) {
if (b != null && b.getType().equals(Material.SIGN) || b != null && b.getType().equals(Material.WALL_SIGN)) {
Sign s = (Sign) b.getState();
String line3 = ChatColor.stripColor(s.getLine(2)).trim();
if (line3.equalsIgnoreCase("[sell:buy]") || line3.equalsIgnoreCase("[sell]") || line3.equalsIgnoreCase("[buy]")) {
Expand All @@ -135,7 +135,7 @@ protected boolean isTransactionSign(HLocation l) {

protected boolean isInfoSign(HLocation l) {
Block b = getBlock(l);
if (b != null && b.getType().equals(Material.SIGN_POST) || b != null && b.getType().equals(Material.WALL_SIGN)) {
if (b != null && b.getType().equals(Material.SIGN) || b != null && b.getType().equals(Material.WALL_SIGN)) {
Sign s = (Sign) b.getState();
String type = ChatColor.stripColor(s.getLine(2)).trim().replace(":", "").replace(" ", "");
if (SignType.isSignType(type)) return true;
Expand Down Expand Up @@ -688,22 +688,15 @@ protected Item getItem(HItem i) {
if (i == null) return null;
Location l = getLocation(i.getLocation());
if (l == null) return null;
for (Entity e:l.getWorld().getEntities()) {
if (e instanceof Item) {
Item item = (Item)e;
if (item.getEntityId() == i.getId()) {
return item;
}
}
}

return null;
}

protected HItem getItem(Item i) {
if (i == null) return null;
HLocation l = getLocation(i.getLocation());
HItemStack stack = getSerializableItemStack(i.getItemStack());
return new HItem(hc, l, i.getEntityId(), stack);
return new HItem(hc,l, i.getEntityId(), stack);
}

protected boolean chunkContainsLocation(HLocation l, Chunk c) {
Expand Down
Loading