Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
thisxiaoyuQAQ authored Aug 6, 2023
1 parent 2a87aa0 commit 6ae3e95
Show file tree
Hide file tree
Showing 32 changed files with 1,233 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Tax/Tax.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/PaperSpigot-1.8.8.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$MODULE_DIR$/../lib/PaperSpigot-1.8.8.jar!/" />
</SOURCES>
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../Vault.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../../Minecraft/服务器/[1.19.2]/plugins/CMI-9.6.1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../P[前置]PlaceholderAPI-2.11.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
3 changes: 3 additions & 0 deletions Tax/out/production/Tax/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: xiaoyu.tax

18 changes: 18 additions & 0 deletions Tax/out/production/Tax/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tax2:
money: 0 #玩家当前多少钱
receive: 1000 #获得的钱
defaultRate: 0.009 #普通玩家
defaultMsg: "&a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate1: 0.008 #权限tax.1
msg1: "&a尊贵的 &8[&aVIP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate2: 0.005 #权限tax.2
msg2: "&a尊贵的 &8[&bMVP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
tax1:
money: 10000 #玩家当前多少钱
receive: 1000 #获得的钱
defaultRate: 0.01 #普通玩家
defaultMsg: "&a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate1: 0.009 #权限tax.1
msg1: "&a尊贵的 &8[&aVIP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate2: 0.007 #权限tax.2
msg2: "&a尊贵的 &8[&bMVP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
Empty file added Tax/out/production/Tax/log.yml
Empty file.
6 changes: 6 additions & 0 deletions Tax/out/production/Tax/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: YuTax
main: xiaoyu.tax
version: 1.1
depend: [Vault]
commands:
tax:
Empty file.
Binary file not shown.
Binary file added Tax/out/production/Tax/xiaoyu/event.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Tax/out/production/Tax/xiaoyu/tax.class
Binary file not shown.
3 changes: 3 additions & 0 deletions Tax/src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: xiaoyu.tax

18 changes: 18 additions & 0 deletions Tax/src/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tax2:
money: 0 #玩家当前多少钱
receive: 1000 #获得的钱
defaultRate: 0.009 #普通玩家
defaultMsg: "&a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate1: 0.008 #权限tax.1
msg1: "&a尊贵的 &8[&aVIP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate2: 0.005 #权限tax.2
msg2: "&a尊贵的 &8[&bMVP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
tax1:
money: 10000 #玩家当前多少钱
receive: 1000 #获得的钱
defaultRate: 0.01 #普通玩家
defaultMsg: "&a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate1: 0.009 #权限tax.1
msg1: "&a尊贵的 &8[&aVIP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
taxRate2: 0.007 #权限tax.2
msg2: "&a尊贵的 &8[&bMVP&8] &a%player% 收到了 %receive% 金币 , 扣除了 %tax% 金币作为税收。 结余 %left% 余额 %money% 税率 %taxRate%"
Empty file added Tax/src/log.yml
Empty file.
6 changes: 6 additions & 0 deletions Tax/src/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: YuTax
main: xiaoyu.tax
version: 1.1
depend: [Vault]
commands:
tax:
Empty file added Tax/src/totalTax.yml
Empty file.
30 changes: 30 additions & 0 deletions Tax/src/xiaoyu/command/reload.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package xiaoyu.command;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import xiaoyu.tax;

import java.io.File;

public class reload implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
Plugin plugin = tax.getPlugin(tax.class);
CommandSender p = commandSender;
if (strings.length == 0){
p.sendMessage("=====税系统=====");
p.sendMessage("/tax reload 重载插件");
//p.sendMessage("/tax top 交税榜");
}
if (commandSender != null && commandSender.hasPermission("tax.reload"))
if (strings.length == 1 && strings[0].equals("reload")) {
plugin.reloadConfig();
YamlConfiguration.loadConfiguration(new File("totalTax.yml"));
commandSender.sendMessage("§a[YuTax]重载成功");
}
return false;
}
}
163 changes: 163 additions & 0 deletions Tax/src/xiaoyu/event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
package xiaoyu;

import com.Zrips.CMI.events.CMIUserBalanceChangeEvent;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import static xiaoyu.tax.economy;

public class event implements Listener {
File uptax = new File(tax.getInstance().getDataFolder(), "totalTax.yml");
File log = new File(tax.getInstance().getDataFolder(), "log.yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(uptax);
YamlConfiguration logs = YamlConfiguration.loadConfiguration(log);

@EventHandler
public void onMoneyReceived(CMIUserBalanceChangeEvent event) throws IOException {
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = formatter.format(date);
Player p = event.getUser().getPlayer();
//p.sendMessage("开始就爆了");
double oldBalance = event.getFrom(); //原来的钱
double newBalance = event.getTo(); //现在的钱
double amount = newBalance - oldBalance; //拿到的钱
int x=0;
int y;

DecimalFormat df = new DecimalFormat("#.###%");

// 先写免税权 然后看人多少钱 然后看获得多少钱 最后判断会员权限
if(oldBalance<=newBalance){
if (!p.hasPermission("tax.bypass")){
for (x = 100; x>0 ; x--) {
double money = tax.getInstance().getConfig().getDouble("tax"+x+".money");
double receive = tax.getInstance().getConfig().getDouble("tax"+x+".receive");
if (tax.getInstance().getConfig().contains("tax" + x)) {
//p.sendMessage("进x循环");
if (oldBalance >= money){
//p.sendMessage(oldBalance + "大于限定值"+money);
if (amount >= receive){
//p.sendMessage("马上进循环了");
for(y = 100; y >0; y--){
if (tax.getInstance().getConfig().contains("tax" + x+".taxRate"+y) && tax.getInstance().getConfig().contains("tax" + x+".taxMsg"+y)) {
if (p.hasPermission("tax."+y)){
//p.sendMessage("x="+x+" y="+y);

String TA = "tax"+x+".taxRate"+y;
double tax1 = tax.getInstance().getConfig().getDouble(TA);
String MS = "tax"+x+".msg"+y;
String msg = tax.getInstance().getConfig().getString(MS);
String formattax = df.format(tax1);
double taxAmount = amount * tax1; // 计算税额
economy.withdrawPlayer(p, taxAmount); // 从玩家账户中扣除税收
String msg1 = msg.replaceAll("&","§").replaceAll("%player%",p.getName())
.replaceAll("%receive%", String.valueOf(amount)).replaceAll("%tax%", String.valueOf(taxAmount))
.replaceAll("%left%", String.valueOf(amount-taxAmount))
.replaceAll("%money%", String.valueOf(newBalance-taxAmount))
.replaceAll("%taxRate%", formattax);
p.sendMessage(msg1);
config.set(p.getName(), config.getDouble(p.getName())+taxAmount);
config.save(uptax);
logs.set(time,msg1);
logs.save(log);
return;
}
}
}
//p.sendMessage("x="+x+" default");
double tax1 = tax.getInstance().getConfig().getDouble("tax"+x+".defaultRate");
String formattax = df.format(tax1);
String msg = tax.getInstance().getConfig().getString("tax"+x+".defaultMsg");
double taxAmount = amount * tax1; // 计算税额
economy.withdrawPlayer(p, taxAmount); // 从玩家账户中扣除税收
String msg1 = msg.replaceAll("&","§").replaceAll("%player%",p.getName())
.replaceAll("%receive%", String.valueOf(amount)).replaceAll("%tax%", String.valueOf(taxAmount))
.replaceAll("%left%", String.valueOf(amount-taxAmount))
.replaceAll("%money%", String.valueOf(newBalance-taxAmount))
.replaceAll("%taxRate%", formattax);
p.sendMessage(msg1);
config.set(p.getName(), config.getDouble(p.getName())+taxAmount);
config.save(uptax);
logs.set(time,msg1);
logs.save(log);
return;
}
}

}
}
}else{
p.sendMessage("§a§l您有免税权 本次交易不收取税!");
}

}
}


}
/* if (oldBalance <= newBalance){
if (amount >= 50000){
if (player.hasPermission("tax.3")){
double taxAmount = amount * 0.03; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§bMVP§8] §r" + player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。 结余: " + (amount-taxAmount) + "余额"+ (newBalance-taxAmount));
} else if (player.hasPermission("tax.2")) {
double taxAmount = amount * 0.07; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§eSVIP§8] §r"+player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else if (player.hasPermission("tax.1")) {
double taxAmount = amount * 0.09; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§aVIP§8] §r"+player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else {
double taxAmount = amount * 0.15; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage(player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
}
} else if (amount >= 10000) {
if (player.hasPermission("tax.3")){
double taxAmount = amount * 0.02; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§bMVP§8] §r" + player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。 结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else if (player.hasPermission("tax.2")) {
double taxAmount = amount * 0.05; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§eSVIP§8] §r"+player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else if (player.hasPermission("tax.1")) {
double taxAmount = amount * 0.08; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§aVIP§8] §r"+player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else {
double taxAmount = amount * 0.1; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage(player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ "余额"+ (newBalance-taxAmount));
}
}else{
if (player.hasPermission("tax.3")){
double taxAmount = amount * 0.01; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§bMVP§8] §r" + player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。 结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else if (player.hasPermission("tax.2")) {
double taxAmount = amount * 0.03; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§eSVIP§8] §r"+player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else if (player.hasPermission("tax.1")) {
double taxAmount = amount * 0.06; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage("§a尊贵的 §8[§aVIP§8] §r"+player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
} else {
double taxAmount = amount * 0.08; // 计算10%的交税金额
economy.withdrawPlayer(player, taxAmount); // 从玩家账户中扣除税收
player.sendMessage(player.getName() + " §a收到了 " + amount + " 金币,扣除了 " + taxAmount + " 金币作为税收。结余: " + (amount-taxAmount)+ " 余额"+ (newBalance-taxAmount));
}
}
}*/
Loading

0 comments on commit 6ae3e95

Please sign in to comment.