Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Merge with writeescape's workup
Browse files Browse the repository at this point in the history
Merge with writeescape's workup
  • Loading branch information
PurpleStormCloud authored Feb 24, 2019
2 parents 4530082 + 18dcfd3 commit bf62702
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 134 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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);

}
75 changes: 15 additions & 60 deletions src/main/java/regalowl/hyperconomy/bukkit/BukkitConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.Vector;

import org.bukkit.Material;
import regalowl.hyperconomy.HyperConomy;
import regalowl.hyperconomy.InternalEconomy;
import regalowl.hyperconomy.account.HyperPlayer;
Expand Down Expand Up @@ -102,9 +102,20 @@ public void onLoad() {
public void onEnable() {
this.getLogger().info("[HyperConomy - Lifesupport] Loading native build HyperConomy Lifesupport 1.13+.");
this.getLogger().info("[HyperConomy - Lifesupport] Detected API-133P! Loading!");

hc.enable();

this.addItems();
}

public void addItems() {
for (Material mat:Material.values()){
HItemStack his = hc.getBlankStack();
his.setMaterial(mat.toString());
his.setAmount(1);
hc.getAPI().addItemToEconomy(his,hc.getConsoleEconomy(),hc.getMC().getMinecraftItemName(his));
}
}

@Override
public void onDisable() {
hc.disable(false);
Expand All @@ -126,12 +137,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}
return true;
}







@Override
public HEconomyProvider getEconomyProvider() {
return economyProvider;
Expand Down Expand Up @@ -179,46 +185,14 @@ public void setupHEconomyProvider() {
public boolean useExternalEconomy() {
return useExternalEconomy;
}



@Override
public String getEconomyName() {
if (vaultEconomy != null && useExternalEconomy) {
return vaultEconomy.getName();
}
return "N/A";
}
























//Bukkit Listeners






//MineCraftConnector overrides
@Override
public void unregisterAllListeners() {
Expand Down Expand Up @@ -360,9 +334,6 @@ public boolean canEnchantItem(HItemStack item) {
return false;
}




@Override
public HInventory getInventory(HyperPlayer hp) {
return common.getInventory(hp);
Expand Down Expand Up @@ -470,22 +441,6 @@ public void logSevere(String message) {
log.severe(applyColor(message));
}

















@Override
public boolean isSneaking(HyperPlayer hp) {
Player p = common.getPlayer(hp);
Expand Down
Loading

0 comments on commit bf62702

Please sign in to comment.