mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Fix the tax NullPointer issues in CraftBukkit
This commit is contained in:
1 parent
ef3443ecc7
commit
420b825c31
2 files changed
+35
-14
No files matched your search
@@ -1,8 +1,10 @@
|
||||
package org.maxgamer.quickshop.Command;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -440,12 +442,16 @@ public class QS implements CommandExecutor {
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(MsgUtil.getMessage("fee-charged-for-price-change", plugin.getEcon().format(fee)));
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), fee);
|
||||
}
|
||||
try {
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), fee);
|
||||
}
|
||||
}
|
||||
}catch (IOException ex){
|
||||
ex.getMessage();
|
||||
plugin.getLogger().log(Level.WARNING, "QuickShop can't pay fee to player `"+plugin.getConfig().getString("tax-account")+"` account,Are you set the default tax account name to your playername?");
|
||||
}
|
||||
}
|
||||
// Update the shop
|
||||
shop.setPrice(price);
|
||||
shop.setSignText();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -351,11 +353,15 @@ public class ShopManager {
|
||||
shop.onUnload();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), tax);
|
||||
}
|
||||
}
|
||||
}catch (IOException ex){
|
||||
ex.getMessage();
|
||||
plugin.getLogger().log(Level.WARNING, "QuickShop can't pay tax to player `"+plugin.getConfig().getString("tax-account")+"` account,Are you set the default tax account name to your playername?");
|
||||
}
|
||||
/* The shop has hereforth been successfully created */
|
||||
createShop(shop);
|
||||
@@ -495,10 +501,15 @@ public class ShopManager {
|
||||
if (!shop.isUnlimited() || plugin.getConfig().getBoolean("shop.pay-unlimited-shop-owners")) {
|
||||
plugin.getEcon().deposit(shop.getOwner(), total * (1 - tax));
|
||||
if (tax != 0) {
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), total * tax);
|
||||
}
|
||||
try {
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), tax);
|
||||
}
|
||||
}
|
||||
}catch (IOException ex){
|
||||
ex.getMessage();
|
||||
plugin.getLogger().log(Level.WARNING, "QuickShop can't pay tax to player `"+plugin.getConfig().getString("tax-account")+"` account,Are you set the default tax account name to your playername?");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -564,12 +575,16 @@ public class ShopManager {
|
||||
return;
|
||||
}
|
||||
if (tax != 0) {
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), total * tax);
|
||||
}
|
||||
try {
|
||||
for(OfflinePlayer player : Bukkit.getOfflinePlayers()) {
|
||||
if(player.getName().equals(plugin.getConfig().getString("tax-account"))) {
|
||||
plugin.getEcon().deposit(player.getUniqueId(), tax);
|
||||
}
|
||||
}
|
||||
}catch (IOException ex){
|
||||
ex.getMessage();
|
||||
plugin.getLogger().log(Level.WARNING, "QuickShop can't pay tax to player `"+plugin.getConfig().getString("tax-account")+"` account,Are you set the default tax account name to your playername?");
|
||||
}
|
||||
}
|
||||
}
|
||||
// Give them the money after we know we succeeded
|
||||
plugin.getEcon().deposit(p.getUniqueId(), total * (1 - tax));
|
||||
|
||||
Reference in new issue
Block a user