Skip to content

Commit

Permalink
v1.0.47
Browse files Browse the repository at this point in the history
  • Loading branch information
ZombieStriker authored Sep 20, 2018
1 parent 01526b6 commit 95eef5f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.0.47
Fixed issue where offline-amount is not displaying the correct amount
Fixed issue where offline-amount would stack amount.
Fixed "someone bid" message to include the amount bid, not just the total amount
Added someone bought message for when buy-it-now is used.

1.0.46
Added npcauctions.default PERM
Added npcauctions.openGUIFromCommand PERM. Now you are able to disable the player from being able to use gui command in different worlds
Expand Down
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
main: me.zombie_striker.npcauctions.Main
version: 1.0.46
version: 1.0.47
name: NPCAuctions
api-version: 1.13
commands:
Expand Down
2 changes: 1 addition & 1 deletion src/me/zombie_striker/npcauctions/ConfigHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public enum Keys {
"AuctionEndedSold"), NoBids("AuctionEndedNoBids"), BidIncrease(
"InitialIncreaseBidding"), BiddingStart("InitialStarttingBid"), BiddingDur(
"InitialBiddingDurration"), BiddingBuy("InitialBuyItNow"), VillagersName(
"NPCName"), ItemNext("Item_NextPage"), youbid("youBid"),refundCanceled("refundCanceledAuction"), someonebid("someoneBid"),ItemPrev(
"NPCName"), ItemNext("Item_NextPage"), youbid("youBid"),refundCanceled("refundCanceledAuction"), someonebid("someoneBid"),someonebought("someoneBought"),ItemPrev(
"Item_PrevPage"), ItemAdd("Item_AddItemToAuctionHouse"), ItemCancel(
"Item_CancelExisitngAuction"), IncreaseMin("Min-Increase"),IncreaseMax("Max-Increase"),LoreTime(
"ItemLore_Time_Remaining"), LoreBuyItNow("ItemLore_Buy_it_Now"), loreBuyItNowHow(
Expand Down
17 changes: 12 additions & 5 deletions src/me/zombie_striker/npcauctions/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import me.zombie_striker.npcauctions.ConfigHandler.Keys;
import net.milkbowl.vault.economy.Economy;
import net.minecraft.server.v1_13_R1.AdvancementProgress.a;

import org.bukkit.*;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -50,7 +49,8 @@ public class Main extends JavaPlugin implements Listener {
public static String s_outBid = " You have been outbid!";
public static String s_rejoin_amount = " Since the last time you were on, you have recieved $%amount%!";
public static String s_rejoin_items = " The following auctions had no bidders: ";
public static String s_someoneBid = "%player% has bid %amount% for your %item% auction";
public static String s_someoneBid = "%player% has bid $%bid% ($%amount%) for your %item% auction";
public static String s_someoneBought = "%player% has bought you %item% auction for $%amount%.";
public static String s_youBid = "You have has bid %amount% for the %item% auction";
public static String s_auctionCancelRefund = "The owner of the %item% auction canceled the auction. You have been refunded $%amount%.";

Expand Down Expand Up @@ -203,6 +203,7 @@ public void run() {
s_VillagerName = c.getMessage(Keys.VillagersName, s_VillagerName);
s_outBid = c.getMessage(Keys.OutBid, s_outBid);
s_someoneBid = c.getMessage(Keys.someonebid, s_someoneBid);
s_someoneBought = c.getMessage(Keys.someonebought, s_someoneBought);
s_youBid = c.getMessage(Keys.youbid, s_youBid);
s_auctionCancelRefund = c.getMessage(Keys.refundCanceled, s_auctionCancelRefund);
s_rejoin_amount = c.getMessage(Keys.rejoin_amount, s_rejoin_amount);
Expand Down Expand Up @@ -486,9 +487,12 @@ public void onJoin(final PlayerJoinEvent e) {
@SuppressWarnings("unchecked")
@Override
public void run() {
boolean save = false;
if (getConfig().contains(e.getPlayer().getUniqueId().toString() + ".offlineAmount")) {
e.getPlayer().sendMessage(prefix + s_rejoin_amount.replace("%amount%",
"" + getConfig().getDouble(e.getPlayer().getUniqueId().toString() + ".offlineAmount")));
getConfig().set(e.getPlayer().getUniqueId().toString() + ".offlineAmount", null);
save = true;
}
if (getConfig().contains(e.getPlayer().getUniqueId().toString() + ".recievedItems")) {
List<ItemStack> items = (List<ItemStack>) getConfig()
Expand All @@ -508,8 +512,10 @@ public void run() {
}
e.getPlayer().sendMessage(prefix + s_rejoin_items + sb.toString());
getConfig().set(e.getPlayer().getUniqueId().toString() + ".recievedItems", null);
saveConfig();
save = true;
}
if(save)
saveConfig();
}
}.runTaskLater(this, 2);
}
Expand Down Expand Up @@ -641,6 +647,7 @@ public void onQuit(PlayerQuitEvent e) {
a.ownerOnline = false;
}

@SuppressWarnings("deprecation")
@EventHandler
public void onClick(InventoryClickEvent e) {
try {
Expand Down Expand Up @@ -772,7 +779,7 @@ public void onClick(InventoryClickEvent e) {
Player ofowner = Bukkit.getPlayer(aa.owner);
if (ofowner != null) {
ofowner.sendMessage(prefix
+ s_someoneBid.replace("%player%", e.getWhoClicked().getName())
+ s_someoneBought.replace("%player%", e.getWhoClicked().getName())
.replace("%amount%", "" + aa.buyitnow).replace("%item%",
(aa.is.getItemMeta().hasDisplayName()
? aa.is.getItemMeta().getDisplayName()
Expand Down Expand Up @@ -810,7 +817,7 @@ public void onClick(InventoryClickEvent e) {
if (ofowner != null) {
ofowner.sendMessage(prefix + s_someoneBid
.replace("%player%", e.getWhoClicked().getName())
.replace("%amount%", "" + aa.currentPrice).replace("%item%",
.replace("%amount%", "" + aa.currentPrice).replace("%bid%", ""+aa.biddingPrice).replace("%item%",
(aa.is.getItemMeta().hasDisplayName()
? aa.is.getItemMeta().getDisplayName()
: aa.is.getType().name()) + ".x." + aa.is.getAmount()));
Expand Down
33 changes: 22 additions & 11 deletions src/me/zombie_striker/npcauctions/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public void run() {
*
* @return The plugin specific data.
*/
public JSONObject getPluginData() {
@SuppressWarnings("unchecked")
public JSONObject getPluginData() {
JSONObject data = new JSONObject();

String pluginName = plugin.getDescription().getName();
Expand All @@ -199,7 +200,8 @@ public JSONObject getPluginData() {
*
* @return The server specific data.
*/
private JSONObject getServerData() {
@SuppressWarnings("unchecked")
private JSONObject getServerData() {
// Minecraft specific data
int playerAmount;
try {
Expand Down Expand Up @@ -243,7 +245,8 @@ private JSONObject getServerData() {
/**
* Collects the data and sends it afterwards.
*/
private void submitData() {
@SuppressWarnings("unchecked")
private void submitData() {
final JSONObject data = getServerData();

JSONArray pluginData = new JSONArray();
Expand Down Expand Up @@ -354,7 +357,8 @@ public static abstract class CustomChart {
this.chartId = chartId;
}

private JSONObject getRequestJsonObject() {
@SuppressWarnings("unchecked")
private JSONObject getRequestJsonObject() {
JSONObject chart = new JSONObject();
chart.put("chartId", chartId);
try {
Expand Down Expand Up @@ -395,7 +399,8 @@ public SimplePie(String chartId, Callable<String> callable) {
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
String value = callable.call();
Expand Down Expand Up @@ -426,7 +431,8 @@ public AdvancedPie(String chartId, Callable<Map<String, Integer>> callable) {
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Expand Down Expand Up @@ -470,7 +476,8 @@ public DrilldownPie(String chartId, Callable<Map<String, Map<String, Integer>>>
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
public JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Expand Down Expand Up @@ -519,7 +526,8 @@ public SingleLineChart(String chartId, Callable<Integer> callable) {
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
int value = callable.call();
Expand Down Expand Up @@ -551,7 +559,8 @@ public MultiLineChart(String chartId, Callable<Map<String, Integer>> callable) {
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Expand Down Expand Up @@ -596,7 +605,8 @@ public SimpleBarChart(String chartId, Callable<Map<String, Integer>> callable) {
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Expand Down Expand Up @@ -634,7 +644,8 @@ public AdvancedBarChart(String chartId, Callable<Map<String, int[]>> callable) {
this.callable = callable;
}

@Override
@SuppressWarnings("unchecked")
@Override
protected JSONObject getChartData() throws Exception {
JSONObject data = new JSONObject();
JSONObject values = new JSONObject();
Expand Down

0 comments on commit 95eef5f

Please sign in to comment.