mirror of
https://github.com/tjtanjin/QuickTax.git
synced 2025-02-21 20:31:38 +01:00
feat: Add support for 1.8+ and feature to tax active claims only
This commit is contained in:
parent
e40b85a27b
commit
184da3d796
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
||||
|
||||
<groupId>quicktax</groupId>
|
||||
<artifactId>quicktax</artifactId>
|
||||
<version>1.4.3</version>
|
||||
<version>1.5.0</version>
|
||||
|
||||
<name>QuickTax</name>
|
||||
|
||||
|
@ -24,7 +24,7 @@ import tk.taverncraft.quicktax.Main;
|
||||
* Schedule contains all information related to a single schedule required for starting, stopping and viewing.
|
||||
*/
|
||||
public class Schedule {
|
||||
private static final String[] allowedTypes = {"collectrank", "collectbal", "collectall"};
|
||||
private static final String[] allowedTypes = {"collectrank", "collectbal", "collectactivity", "collectall"};
|
||||
|
||||
String name;
|
||||
boolean enabled;
|
||||
@ -146,6 +146,8 @@ public class Schedule {
|
||||
taxManager.collectAll(Bukkit.getConsoleSender());
|
||||
} else if (this.type.equals("collectrank")) {
|
||||
taxManager.collectRank(Bukkit.getConsoleSender());
|
||||
} else if (this.type.equals("collectactivity")) {
|
||||
taxManager.collectActivity(Bukkit.getConsoleSender());
|
||||
} else {
|
||||
taxManager.collectBal(Bukkit.getConsoleSender());
|
||||
}
|
||||
|
@ -376,7 +376,12 @@ public class TaxManager {
|
||||
|
||||
try {
|
||||
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getUniqueId());
|
||||
double playerClaims = playerData.getAccruedClaimBlocks();
|
||||
double playerClaims;
|
||||
if (main.getConfig().getBoolean("active-claims-only", false)) {
|
||||
playerClaims = playerData.getAccruedClaimBlocks() - playerData.getRemainingClaimBlocks();
|
||||
} else {
|
||||
playerClaims = playerData.getAccruedClaimBlocks();
|
||||
}
|
||||
subtractAmount = getSubtractAmountWithClaims(player, usePercentage, balTaxAmount, playerBal, claimsTaxAmount, playerClaims);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
Bukkit.getLogger().warning(e.getMessage());
|
||||
@ -390,8 +395,11 @@ public class TaxManager {
|
||||
|
||||
if (player.isOnline()) {
|
||||
if (main.getConfig().getBoolean("enable-sound")) {
|
||||
player.getPlayer().getWorld().playSound(player.getPlayer().getLocation(),
|
||||
try {
|
||||
player.getPlayer().getWorld().playSound(player.getPlayer().getLocation(),
|
||||
Sound.valueOf(main.getConfig().getString("play-sound")), 1, 1);
|
||||
} catch(Exception ignored) {
|
||||
}
|
||||
}
|
||||
MessageManager.sendMessage(player.getPlayer(), "player-pay-tax-success",
|
||||
new String[]{"%player%", "%amount%"},
|
||||
@ -446,8 +454,11 @@ public class TaxManager {
|
||||
|
||||
if (player.isOnline()) {
|
||||
if (main.getConfig().getBoolean("enable-sound")) {
|
||||
player.getPlayer().getWorld().playSound(player.getPlayer().getLocation(),
|
||||
try {
|
||||
player.getPlayer().getWorld().playSound(player.getPlayer().getLocation(),
|
||||
Sound.valueOf(main.getConfig().getString("play-sound")), 1, 1);
|
||||
} catch(Exception ignored) {
|
||||
}
|
||||
}
|
||||
MessageManager.sendMessage(player.getPlayer(), "player-pay-tax-success",
|
||||
new String[]{"%player%", "%amount%"},
|
||||
|
@ -4,10 +4,10 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Consumer;
|
||||
|
||||
public class UpdateChecker {
|
||||
|
||||
|
@ -81,6 +81,10 @@ table-name: quicktax
|
||||
# if true, additional tax will be imposed on players depending on the total amount of claimblocks they have
|
||||
tax-claims: false
|
||||
|
||||
# whether to tax based on claimblocks that are used only
|
||||
# applicable only when tax-claims is true as well
|
||||
active-claims-only: false
|
||||
|
||||
# whether to remove all claims belonging to player if player does not have enough money to pay taxes
|
||||
# requires tax-claims to be true as well
|
||||
# test and use this with caution since removing player claims is a destructive action!
|
||||
|
Loading…
Reference in New Issue
Block a user