diff --git a/README.md b/README.md index 29abeaad..68f13cb8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +## Download the latest LifeSupport version from https://github.com/OTGEngineering/OTG-HyperConomy-LifeSupport/releases HyperConomy =========== @@ -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 --------- diff --git a/out/artifacts/HyperConomy_14_jar/HyperConomy-14.jar b/out/artifacts/HyperConomy_14_jar/HyperConomy-14.jar new file mode 100644 index 00000000..de3c9c79 Binary files /dev/null and b/out/artifacts/HyperConomy_14_jar/HyperConomy-14.jar differ diff --git a/pom.xml b/pom.xml index ced80467..be2c5437 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ Articdive-repo - http://ci.articdive.cf/plugin/repository/everything/ + https://nexus.articdive.de/repository/maven-public/ Sonatype-public @@ -34,7 +34,7 @@ org.spigotmc spigot-api - 1.12.2-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT provided diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 00000000..ffe7399e --- /dev/null +++ b/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: regalowl.hyperconomy.bukkit.BukkitConnector + diff --git a/src/main/java/regalowl/hyperconomy/HyperAPI.java b/src/main/java/regalowl/hyperconomy/HyperAPI.java index e72401fe..5376c84d 100644 --- a/src/main/java/regalowl/hyperconomy/HyperAPI.java +++ b/src/main/java/regalowl/hyperconomy/HyperAPI.java @@ -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; @@ -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)) { diff --git a/src/main/java/regalowl/hyperconomy/api/API.java b/src/main/java/regalowl/hyperconomy/api/API.java index e3f72455..ec5648c3 100644 --- a/src/main/java/regalowl/hyperconomy/api/API.java +++ b/src/main/java/regalowl/hyperconomy/api/API.java @@ -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; @@ -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 getServerShopList(); - public ArrayList getPlayerShopList(); + ArrayList getServerShopList(); + ArrayList 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 getEnchantmentHyperObjects(HItemStack stack, String player); + boolean isItemDisplay(HItem item); - public ArrayList getAvailableObjects(String shopname); - public ArrayList getAvailableObjects(String shopname, int startingPosition, int limit); - public ArrayList getAvailableObjects(HyperPlayer p); - public ArrayList 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 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 getAvailableObjects(String shopname); + ArrayList getAvailableObjects(String shopname, int startingPosition, int limit); + ArrayList getAvailableObjects(HyperPlayer p); + ArrayList 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); } diff --git a/src/main/java/regalowl/hyperconomy/bukkit/BukkitCommon.java b/src/main/java/regalowl/hyperconomy/bukkit/BukkitCommon.java index aea5b04b..9b858ee4 100644 --- a/src/main/java/regalowl/hyperconomy/bukkit/BukkitCommon.java +++ b/src/main/java/regalowl/hyperconomy/bukkit/BukkitCommon.java @@ -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; @@ -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]")) { @@ -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; @@ -688,14 +688,7 @@ 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; } @@ -703,7 +696,7 @@ 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) { diff --git a/src/main/java/regalowl/hyperconomy/bukkit/BukkitConnector.java b/src/main/java/regalowl/hyperconomy/bukkit/BukkitConnector.java index 9d8041a9..102fadbe 100644 --- a/src/main/java/regalowl/hyperconomy/bukkit/BukkitConnector.java +++ b/src/main/java/regalowl/hyperconomy/bukkit/BukkitConnector.java @@ -12,6 +12,7 @@ import net.milkbowl.vault.Vault; import net.milkbowl.vault.economy.Economy; +import org.apache.commons.lang.WordUtils; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.GameMode; @@ -42,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; @@ -60,7 +61,7 @@ import regalowl.hyperconomy.minecraft.HItem; import regalowl.hyperconomy.minecraft.HLocation; import regalowl.hyperconomy.minecraft.HSign; - +@SuppressWarnings("deprecation") public class BukkitConnector extends JavaPlugin implements MineCraftConnector, Listener { private HashMap commands = new HashMap(); @@ -69,7 +70,6 @@ public class BukkitConnector extends JavaPlugin implements MineCraftConnector, L private HyperConomy hc; private BukkitListener bl; private BukkitCommon common; - private NBTTools nbt; private boolean vaultInstalled; private boolean useExternalEconomy; @@ -81,7 +81,6 @@ public BukkitConnector() { this.hc = new HyperConomy(this); this.bl = new BukkitListener(this); this.common = new BukkitCommon(hc); - this.nbt = new NBTTools(); useExternalEconomy = false; } @@ -101,8 +100,22 @@ public void onLoad() { } @Override 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); @@ -124,12 +137,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String } return true; } - - - - - - + @Override public HEconomyProvider getEconomyProvider() { return economyProvider; @@ -177,9 +185,6 @@ public void setupHEconomyProvider() { public boolean useExternalEconomy() { return useExternalEconomy; } - - - @Override public String getEconomyName() { if (vaultEconomy != null && useExternalEconomy) { @@ -187,36 +192,7 @@ public String getEconomyName() { } return "N/A"; } - - - - - - - - - - - - - - - - - - - - - - - - - //Bukkit Listeners - - - - - + //MineCraftConnector overrides @Override public void unregisterAllListeners() { @@ -358,9 +334,6 @@ public boolean canEnchantItem(HItemStack item) { return false; } - - - @Override public HInventory getInventory(HyperPlayer hp) { return common.getInventory(hp); @@ -468,22 +441,6 @@ public void logSevere(String message) { log.severe(applyColor(message)); } - - - - - - - - - - - - - - - - @Override public boolean isSneaking(HyperPlayer hp) { Player p = common.getPlayer(hp); @@ -641,7 +598,7 @@ public ChestShop getChestShop(HLocation location) { public boolean canHoldChestShopSign(HLocation l) { Block b = common.getBlock(l); Material m = b.getType(); - if (m == Material.ICE || m == Material.LEAVES || m == Material.SAND || m == Material.GRAVEL || m == Material.SIGN || m == Material.SIGN_POST || m == Material.TNT) { + if (m == Material.ICE || m == Material.OAK_LEAVES || m == Material.SAND || m == Material.GRAVEL || m == Material.SIGN || m == Material.SIGN || m == Material.TNT) { return false; } return true; @@ -664,7 +621,7 @@ public String removeColor(String text) { public HSign getSign(HLocation location) { if (location == null) return null; Block b = common.getLocation(location).getBlock(); - if (b != null && (b.getType().equals(Material.SIGN_POST) || b.getType().equals(Material.WALL_SIGN))) { + if (b != null && (b.getType().equals(Material.SIGN) || b.getType().equals(Material.WALL_SIGN))) { Sign s = (Sign) b.getState(); boolean isWallSign = (b.getType().equals(Material.WALL_SIGN)) ? true:false; ArrayList lines = new ArrayList(); @@ -899,7 +856,8 @@ public ServerConnectionType getServerConnectionType() { public String getMinecraftItemName(HItemStack stack) { ItemStack bukkitStack = common.getItemStack(stack); if (bukkitStack == null) return null; - return nbt.getName(bukkitStack); + String mat = WordUtils.capitalizeFully(bukkitStack.getType().name().replace("_", " ")); + return mat; } diff --git a/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShop.java b/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShop.java index 5e9cf3e6..149f9939 100644 --- a/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShop.java +++ b/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShop.java @@ -7,6 +7,8 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.ItemFrame; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.inventory.meta.MapMeta; import org.bukkit.map.MapRenderer; import org.bukkit.map.MapView; @@ -22,12 +24,12 @@ import regalowl.hyperconomy.transaction.PlayerTransaction; import regalowl.hyperconomy.transaction.TransactionResponse; import regalowl.hyperconomy.transaction.TransactionType; - +@SuppressWarnings("deprecation") public class BukkitFrameShop implements FrameShop, HyperEventListener { private transient HyperConomy hc; - private short mapId; + private int mapId; private TradeObject to; private int tradeAmount; private BukkitFrameShopRenderer fsr; @@ -37,8 +39,7 @@ public class BukkitFrameShop implements FrameShop, HyperEventListener { private BukkitConnector bc; - @SuppressWarnings("deprecation") - public BukkitFrameShop(HyperConomy hc, HLocation l, TradeObject ho, Shop s, int amount) { + private BukkitFrameShop(HyperConomy hc, HLocation l, TradeObject ho, Shop s, int amount) { this.hc = hc; hc.getHyperEventHandler().registerListener(this); if (ho == null) { @@ -62,7 +63,7 @@ public BukkitFrameShop(HyperConomy hc, HLocation l, TradeObject ho, Shop s, int render(); } - public BukkitFrameShop(HyperConomy hc, short mapId, HLocation l, TradeObject ho, Shop s, int amount) { + private BukkitFrameShop(HyperConomy hc, short mapId, HLocation l, TradeObject ho, Shop s, int amount) { this.hc = hc; this.bc = (BukkitConnector)hc.getMC(); hc.getHyperEventHandler().registerListener(this); @@ -79,9 +80,7 @@ public BukkitFrameShop(HyperConomy hc, short mapId, HLocation l, TradeObject ho, this.to = ho; this.tradeAmount = amount; this.s = s; - if (ho != null) { - render(); - } + render(); } @Override @@ -95,7 +94,7 @@ public void handleHyperEvent(HyperEvent event) { } - public short getMapId() { + public int getMapId() { return mapId; } @@ -116,7 +115,7 @@ public void setTradeAmount(int amount) { hc.getSQLWrite().addToQueue("UPDATE hyperconomy_frame_shops SET TRADE_AMOUNT = '" + tradeAmount + "' WHERE ID = '" + mapId + "'"); } - public void render() { + private void render() { Location loc = bc.getBukkitCommon().getLocation(l); if (!loc.getChunk().isLoaded()) { return; @@ -126,15 +125,18 @@ public void render() { delete(); return; } - @SuppressWarnings("deprecation") - MapView mapView = Bukkit.getServer().getMap(mapId); + + MapView mapView = Bukkit.getServer().getMap((short)mapId); for (MapRenderer mr : mapView.getRenderers()) { mapView.removeRenderer(mr); } fsr = new BukkitFrameShopRenderer(hc, to); mapView.addRenderer(fsr); - ItemStack stack = new ItemStack(Material.MAP, 1); - stack.setDurability(mapId); + ItemStack stack = new ItemStack(Material.FILLED_MAP, 1); + + + + //stack.setDurability(mapId); frame.setItem(stack); } @@ -156,7 +158,7 @@ public void sell(HyperPlayer hp) { //render(); } - public ItemFrame getFrame(Location loc) { + private ItemFrame getFrame(Location loc) { for (Entity e : loc.getChunk().getEntities()) if (e instanceof ItemFrame) { if (e.getLocation().getBlock().getLocation().distance(loc) == 0) { @@ -170,13 +172,13 @@ public HLocation getLocation() { return l; } - public Block getAttachedBlock() { + private Block getAttachedBlock() { Location loc = bc.getBukkitCommon().getLocation(l); if (l == null) {return null;} ItemFrame frame = getFrame(loc); if (frame == null) {return null;} - Block b = loc.getBlock().getRelative(frame.getAttachedFace()); - return b; + + return loc.getBlock().getRelative(frame.getAttachedFace()); } public void delete() { diff --git a/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShopHandler.java b/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShopHandler.java index 01b8e95d..011c4c43 100644 --- a/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShopHandler.java +++ b/src/main/java/regalowl/hyperconomy/bukkit/BukkitFrameShopHandler.java @@ -68,8 +68,8 @@ public void run() { economy = s.getEconomy(); } TradeObject ho = em.getEconomy(economy).getTradeObject(dbData.getString("HYPEROBJECT"), s); - BukkitFrameShop fs = new BukkitFrameShop(hc, (short) (int) dbData.getInt("ID"), l, ho, s, dbData.getInt("TRADE_AMOUNT")); - frameShops.put(l, fs); + //BukkitFrameShop fs = new BukkitFrameShop(hc, (int) dbData.getInt("ID"), l, ho, s, dbData.getInt("TRADE_AMOUNT")); + //frameShops.put(l, fs); } dbData.close(); @@ -105,8 +105,8 @@ public void removeFrameShop(HLocation l) { public void createFrameShop(HLocation l, TradeObject ho, Shop s) { HLocation loc = new HLocation(l); loc.convertToBlockLocation(); - BukkitFrameShop fs = new BukkitFrameShop(hc, loc, ho, s, 1); - frameShops.put(loc, fs); + //BukkitFrameShop fs = new BukkitFrameShop(hc, loc, ho, s, 1); + //frameShops.put(loc, fs); } @@ -194,13 +194,14 @@ public void onBlockPlaceEvent(BlockPlaceEvent event) { @EventHandler(priority = EventPriority.NORMAL) public void onBlockBreakEvent(BlockBreakEvent event) { - for (BukkitFrameShop fs:frameShops.values()) { + /*for (BukkitFrameShop fs:frameShops.values()) { Block attached = fs.getAttachedBlock(); if (attached == null) {continue;} if (attached.equals(event.getBlock())) { event.setCancelled(true); } } + */ } @Override diff --git a/src/main/java/regalowl/hyperconomy/bukkit/BukkitListener.java b/src/main/java/regalowl/hyperconomy/bukkit/BukkitListener.java index 11c0ac1f..3c5fba51 100644 --- a/src/main/java/regalowl/hyperconomy/bukkit/BukkitListener.java +++ b/src/main/java/regalowl/hyperconomy/bukkit/BukkitListener.java @@ -61,6 +61,7 @@ import regalowl.hyperconomy.minecraft.HSign; import regalowl.hyperconomy.shop.ChestShop; +@SuppressWarnings("deprecation") public class BukkitListener implements Listener { private BukkitConnector bc; diff --git a/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantment.java b/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantment.java index 4d0e7f42..e9ccfdc3 100644 --- a/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantment.java +++ b/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantment.java @@ -9,7 +9,7 @@ - +@SuppressWarnings("deprecation") public class SerializableEnchantment extends SerializableObject implements Serializable { private static final long serialVersionUID = 4510326523024526205L; private String enchantment; diff --git a/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantmentStorageMeta.java b/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantmentStorageMeta.java index a9b8e1c1..858ed4f5 100644 --- a/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantmentStorageMeta.java +++ b/src/main/java/regalowl/hyperconomy/serializable/SerializableEnchantmentStorageMeta.java @@ -17,7 +17,7 @@ - +@SuppressWarnings("deprecation") public class SerializableEnchantmentStorageMeta extends SerializableItemMeta implements Serializable { private static final long serialVersionUID = -6050487153906386305L; diff --git a/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkEffectMeta.java b/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkEffectMeta.java index 4af0306e..9a94d6e8 100644 --- a/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkEffectMeta.java +++ b/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkEffectMeta.java @@ -44,7 +44,7 @@ public SerializableFireworkEffectMeta(String base64String) { @Override public ItemMeta getItemMeta() { - ItemStack s = new ItemStack(Material.FIREWORK_CHARGE); + ItemStack s = new ItemStack(Material.FIREWORK_STAR); FireworkEffectMeta fem = (FireworkEffectMeta)s.getItemMeta(); fem.setDisplayName(displayName); fem.setLore(lore); diff --git a/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkMeta.java b/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkMeta.java index ab930fc7..7e56bf07 100644 --- a/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkMeta.java +++ b/src/main/java/regalowl/hyperconomy/serializable/SerializableFireworkMeta.java @@ -52,7 +52,7 @@ public SerializableFireworkMeta(String base64String) { @Override public ItemMeta getItemMeta() { - ItemStack s = new ItemStack(Material.FIREWORK); + ItemStack s = new ItemStack(Material.FIREWORK_ROCKET); FireworkMeta fm = (FireworkMeta)s.getItemMeta(); fm.setDisplayName(displayName); fm.setLore(lore); diff --git a/src/main/java/regalowl/hyperconomy/serializable/SerializableSkullMeta.java b/src/main/java/regalowl/hyperconomy/serializable/SerializableSkullMeta.java index ce39a777..7cebf36c 100644 --- a/src/main/java/regalowl/hyperconomy/serializable/SerializableSkullMeta.java +++ b/src/main/java/regalowl/hyperconomy/serializable/SerializableSkullMeta.java @@ -19,6 +19,7 @@ public class SerializableSkullMeta extends SerializableItemMeta implements Seria private String owner; + @SuppressWarnings("deprecation") public SerializableSkullMeta(ItemMeta im) { super(im); if (im instanceof SkullMeta) { @@ -43,9 +44,10 @@ public SerializableSkullMeta(String base64String) { } + @SuppressWarnings("deprecation") @Override public ItemMeta getItemMeta() { - ItemStack s = new ItemStack(Material.SKULL_ITEM); + ItemStack s = new ItemStack(Material.PLAYER_HEAD); SkullMeta sm = (SkullMeta)s.getItemMeta(); sm.setDisplayName(displayName); sm.setLore(lore); diff --git a/src/main/java/regalowl/hyperconomy/util/UpdateChecker.java b/src/main/java/regalowl/hyperconomy/util/UpdateChecker.java index 2cb1276a..624a0fdd 100644 --- a/src/main/java/regalowl/hyperconomy/util/UpdateChecker.java +++ b/src/main/java/regalowl/hyperconomy/util/UpdateChecker.java @@ -12,21 +12,18 @@ import org.json.simple.JSONValue; import regalowl.hyperconomy.HyperConomy; -import regalowl.hyperconomy.account.HyperPlayer; + public class UpdateChecker { private HyperConomy hc; private String currentVersion; private String latestVersion; - private String type = ""; + private boolean dev; private boolean beta; private boolean rb; - private boolean notifyInGame; - private boolean upgradeAvailable = false; - private boolean runningDevBuild = false; public UpdateChecker(HyperConomy hc) { this.hc = hc; @@ -38,13 +35,13 @@ public void runCheck() { dev = hc.getConf().getBoolean("updater.notify-for.dev-builds"); beta = hc.getConf().getBoolean("updater.notify-for.beta-builds"); rb = hc.getConf().getBoolean("updater.notify-for.recommended-builds"); - notifyInGame = hc.getConf().getBoolean("updater.notify-in-game"); + hc.getMC().logInfo("[HyperConomy]Checking for updates..."); new Thread(new Runnable() { public void run() { try { - URL url = new URL("https://api.curseforge.com/servermods/files?projectids=38059"); + URL url = new URL("https://apid.curseforge.com/servermods/files?projectids=38059"); URLConnection conn = url.openConnection(); conn.setReadTimeout(10000); conn.addRequestProperty("User-Agent", "HyperConomy/v"+hc.getMC().getVersion()+" (by RegalOwl)"); @@ -74,28 +71,23 @@ public void run() { acceptableUpgrades.add(nameData); } if (acceptableUpgrades.size() == 0) { - int code = getVersionComparisonCode(currentVersion, latestVersion); - if (code == 1) runningDevBuild = true; + + } else { latestVersion = acceptableUpgrades.get(acceptableUpgrades.size() - 1); - type = getType(latestVersion); + latestVersion = latestVersion.substring(1, latestVersion.indexOf(" ")); - upgradeAvailable = true; + } hc.getMC().runTask(new Runnable() { public void run() { - if (upgradeAvailable) { - if (notifyInGame) notifyAdmins(); - hc.getMC().logInfo("[HyperConomy]A new "+"["+type+"] build (" + latestVersion + ") is available for download."); - } else if (runningDevBuild) { - hc.getMC().logInfo("[HyperConomy]No updates available. You are running a development build."); - } else { - hc.getMC().logInfo("[HyperConomy]No updates available."); - } + + hc.getMC().logInfo("[HyperConomy] You are running 0.975.8Lifesupport, No updates available. This is a development build."); + } }); } catch (SocketTimeoutException te) { - hc.getMC().logInfo("[HyperConomy]Could not connect to server."); + hc.getMC().logInfo("[HyperConomy] Could not connect to server."); } catch (Exception e) { hc.gSDL().getErrorWriter().writeError(e); } @@ -113,20 +105,7 @@ private String getType(String data) { return type; } - private void notifyAdmins() { - hc.getMC().runTaskLater(new Runnable() { - public void run() { - MessageBuilder mb = new MessageBuilder(hc, "NEW_VERSION_AVAILABLE"); - mb.setValue(latestVersion); - mb.setType(" ["+type+"]"); - for (HyperPlayer hp:hc.getMC().getOnlinePlayers()) { - if (hp.hasPermission("hyperconomy.admin")) { - hp.sendMessage(mb.build()); - } - } - } - }, 600L); - } + private int getVersionComparisonCode(String currentVersion, String latestVersion) { try { diff --git a/src/main/resources/defaultObjectData.csv.zip b/src/main/resources/defaultObjectData.csv.zip index dafc32b0..1f328a8a 100644 Binary files a/src/main/resources/defaultObjectData.csv.zip and b/src/main/resources/defaultObjectData.csv.zip differ diff --git a/src/main/resources/defaultObjects.csv.zip b/src/main/resources/defaultObjects.csv.zip index c2c711ba..9a2e9626 100644 Binary files a/src/main/resources/defaultObjects.csv.zip and b/src/main/resources/defaultObjects.csv.zip differ diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index a9f0b709..b9773680 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,8 @@ name: HyperConomy main: regalowl.hyperconomy.bukkit.BukkitConnector -version: 0.975.8 +version: 0.976.0 author: RegalOwl +api-version: 1.13 website: http://dev.bukkit.org/server-mods/hyperconomy/ softdepend: [HeroStronghold, Buycraft, Essentials, Vault] loadbefore: []