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UHeX$ZR|7+C$>>~X>(f(?O{XQJM{to8<-&Okc
os(+eszuHkC6W|xosQ=Zdlaqu5t(71f0rW8h**RCBzk-4NKlOB*`2YX_
literal 0
HcmV?d00001
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..a51cf97
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,57 @@
+
+
+ 4.0.0
+
+ org.example
+ DemonShiTu
+ 1.0-SNAPSHOT
+
+
+ 8
+ 8
+
+
+
+
+ public-rpg
+ https://repo.aurora-pixels.com/repository/public-rpg/
+
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.12.2
+
+
+ me.Demon.DemonPlugin
+ DemonAPI
+ 1.2.0
+
+
+ com.yaohun.playermanage
+ PlayerManage
+ 1.0.1
+
+
+
+ me.clip.placeholderapi
+ PlaceholderAPI
+ 2.9.2
+
+
+ me.Demon.ItemReference
+ ItemKuAPI
+ 1.0.0
+
+
+ me.Demon.DemonLevels
+ DemonLevels
+ 1.0.0
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/me/Demon/DemonShiTu/Event/DshituEvent.java b/src/main/java/me/Demon/DemonShiTu/Event/DshituEvent.java
new file mode 100644
index 0000000..42c8bc1
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/Event/DshituEvent.java
@@ -0,0 +1,33 @@
+package me.Demon.DemonShiTu.Event;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class DshituEvent extends Event {
+
+ private static HandlerList handlers = new HandlerList();
+ private Player player;
+ private String ShiFuName;
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+ public DshituEvent(Player player, String ShiFuName) {
+ this.player = player;
+ this.ShiFuName = ShiFuName;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public String getShiFuName() {
+ return ShiFuName;
+ }
+
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/Main.java b/src/main/java/me/Demon/DemonShiTu/Main.java
new file mode 100644
index 0000000..9988b7f
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/Main.java
@@ -0,0 +1,74 @@
+package me.Demon.DemonShiTu;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonShiTu.command.AdminCmd;
+import me.Demon.DemonShiTu.command.MainCmd;
+import me.Demon.DemonShiTu.guimanager.*;
+import me.Demon.DemonShiTu.listener.AttributeLoad;
+import me.Demon.DemonShiTu.listener.ChongZhi;
+import me.Demon.DemonShiTu.listener.itemUse;
+import me.Demon.DemonShiTu.manager.DataManager;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
+public class Main extends JavaPlugin {
+
+ public static Main plugin;
+ public static DataManager dataManager;
+
+ @Override
+ public void onEnable() {
+ plugin = this;
+ DemonAPI.sendConsoleMessage("§f[§6!§f] §aDemonShiTu (2.2.0) §f开始加载");
+ dataManager = new DataManager();
+ getCommand("st").setExecutor(new MainCmd());
+ getCommand("stadmin").setExecutor(new AdminCmd());
+ getServer().getPluginManager().registerEvents(new LookDataGui(),this);
+ getServer().getPluginManager().registerEvents(new TeacherGui(),this);
+ getServer().getPluginManager().registerEvents(new OnlineTeacherGui(),this);
+ getServer().getPluginManager().registerEvents(new ThApplyGui(),this);
+ getServer().getPluginManager().registerEvents(new TudiGui(),this);
+
+ getServer().getPluginManager().registerEvents(new JoinEvent(),this);
+
+ getServer().getPluginManager().registerEvents(new ChongZhi(),this);
+ getServer().getPluginManager().registerEvents(new AttributeLoad(),this);
+ getServer().getPluginManager().registerEvents(new itemUse(),this);
+ if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
+ new ShituExpansion(this).register();
+ DemonAPI.sendConsoleMessage("§f[§a!§f] §fPlaceholderAPI §8> §6完成");
+ }
+ DemonAPI.sendConsoleMessage("§f[§6!§f] §aDemonShiTu §f加载完成,祝你使用愉快!");
+ DemonAPI.sendConsoleMessage("§f[§6!§f] §b极光像素工作室出品");
+ }
+
+ @Override
+ public void onDisable() {
+ dataManager.SaveDataManager();
+ DemonAPI.sendConsoleMessage("§f[§6!§f] §aDemonShiTu §f卸载完成,欢迎下次使用!");
+ }
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command cmd, String Command, String[] args) {
+ if (Command.equalsIgnoreCase("stopen") && (sender instanceof Player)) {
+ //判断玩家是否是师傅 若是 则打开 师傅界面
+ String name = sender.getName();
+ Player player = (Player) sender;
+ if (ShiTuAPI.isTeacherExit(name)) {
+ TeacherGui.OpenGui(player);
+ } else {
+ if (dataManager.isPlayerExitTeacher(name)) {
+ TudiGui.OpenGui(player);
+ } else {
+ OnlineTeacherGui.OpenGui(player);
+ sender.sendMessage("======== §7[§6师徒系统§7] §f========");
+ sender.sendMessage("§7/st <玩家名> §6: 让某名玩家成为你的师傅");
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/ShiTuAPI.java b/src/main/java/me/Demon/DemonShiTu/ShiTuAPI.java
new file mode 100644
index 0000000..32f6f51
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/ShiTuAPI.java
@@ -0,0 +1,91 @@
+package me.Demon.DemonShiTu;
+
+import me.Demon.Compat.VexCompatGui;
+import me.Demon.DemonBanK.BankAPI;
+import me.Demon.DemonShiTu.data.ShiFuData;
+import me.Demon.DemonShiTu.manager.DataManager;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public abstract class ShiTuAPI {
+
+
+ public static void settlementIncome(){
+ DataManager dataManager = Main.dataManager;
+ dataManager.setMonthlyTimeLog(System.currentTimeMillis());
+ Bukkit.broadcastMessage("§e§l★ §a师徒激励计划-收益结算");
+ for (String sfName : dataManager.getShiFuDataMap().keySet()){
+ ShiFuData fuData = dataManager.getTeacherData(sfName);
+ //获取玩家的收益
+ double shouyi = fuData.getEarnings();
+ if(shouyi >= 10) {
+ //获取需要支付给玩家多少软妹币
+ int coins = (int) (shouyi * 0.1);
+ fuData.setEarnings(0);
+ if(coins >= 100){
+ Bukkit.broadcastMessage("§c§l★ §a玩家 §e"+sfName+" §a通过上月激励计划获得 §b"+coins+"软§f(额外奖励20软)");
+ coins = coins + 20;
+ }else{
+ Bukkit.broadcastMessage("§c§l★ §a玩家 §e"+sfName+" §a通过上月激励计划获得 §b"+coins+"软");
+ }
+ BankAPI.addCoins(sfName,coins);
+ }
+ }
+ dataManager.SaveDataManager();
+ }
+
+ public static void revenueTopList(CommandSender sender){
+ DataManager dataManager = Main.dataManager;
+ HashMap map = new HashMap<>();
+ for (String sfName : dataManager.getShiFuDataMap().keySet()) {
+ ShiFuData fuData = dataManager.getTeacherData(sfName);
+ double shouyi = fuData.getEarnings();
+ map.put(sfName, shouyi);
+ }
+ List> list = new ArrayList<>(map.entrySet());
+ list.sort((o1, o2) -> o2.getValue().compareTo(o1.getValue()));
+ sender.sendMessage("§e§l★ §a师徒激励计划-收益排行榜");
+ int rank = 1;
+ for (int i = 0; i < list.size(); i++) {
+ String sfName = list.get(i).getKey();
+ double money = list.get(i).getValue()*0.1;
+ ShiFuData fuData = dataManager.getTeacherData(sfName);
+ sender.sendMessage("§a§l★ §7第 §e" + rank + " §7名: §e" + sfName + " §f收益: §6"+new DecimalFormat(",###.##").format(money)+"元 §f徒弟: §e"+fuData.getTudiList().size()+"名");
+ ++rank;
+ }
+ }
+
+ /*
+ * 判断这个玩家是否成为师傅
+ * */
+ public static boolean isTeacherExit(String sfName){
+ DataManager dataManager = Main.dataManager;
+ if(dataManager.getTeacherData(sfName) != null){
+ return true;
+ }
+ return false;
+ }
+
+
+ public static double getExpDouble(String shifu){
+ int top = VexCompatGui.getTop_self(shifu);
+ if(top <= 1){
+ return 50.0;
+ }else if(top <= 3){
+ return 30.0;
+ }else if(top <= 6){
+ return 20.0;
+ }else if(top <= 10){
+ return 10.0;
+ }else if(top <= 30){
+ return 5.0;
+ }
+ return 0.0;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/ShituExpansion.java b/src/main/java/me/Demon/DemonShiTu/ShituExpansion.java
new file mode 100644
index 0000000..73e6f0a
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/ShituExpansion.java
@@ -0,0 +1,57 @@
+package me.Demon.DemonShiTu;
+
+import me.Demon.DemonShiTu.data.ShiFuData;
+import me.Demon.DemonShiTu.manager.DataManager;
+import me.clip.placeholderapi.expansion.PlaceholderExpansion;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.Plugin;
+
+public class ShituExpansion extends PlaceholderExpansion {
+ private Plugin plugin;
+
+ public ShituExpansion(Plugin plugin) {
+ this.plugin = plugin;
+ }
+
+ @Override
+ public boolean persist() {
+ return true;
+ }
+
+ @Override
+ public boolean canRegister() {
+ return true;
+ }
+
+ @Override
+ public String getAuthor() {
+ return plugin.getDescription().getAuthors().toString();
+ }
+
+ @Override
+ public String getIdentifier() {
+ return "shitu";
+ }
+
+ @Override
+ public String getVersion() {
+ return plugin.getDescription().getVersion();
+ }
+
+ @Override
+ public String onPlaceholderRequest(Player player, String indentifier) {
+ DataManager dataManager = Main.dataManager;
+ if (indentifier.equalsIgnoreCase("shifu")) {
+ return ""+dataManager.getTeacherName(player.getName());
+ }else if (indentifier.equalsIgnoreCase("amount")) {
+ return ""+dataManager.getApprenticeList(player.getName()).size();
+ }else if (indentifier.equalsIgnoreCase("level")) {
+ if(dataManager.getTeacherData(player.getName()) == null){
+ return "0";
+ }
+ ShiFuData shiFuData = dataManager.getTeacherData(player.getName());
+ return ""+shiFuData.getLevel();
+ }
+ return "";
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/command/AdminCmd.java b/src/main/java/me/Demon/DemonShiTu/command/AdminCmd.java
new file mode 100644
index 0000000..651b286
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/command/AdminCmd.java
@@ -0,0 +1,103 @@
+package me.Demon.DemonShiTu.command;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonShiTu.Main;
+import me.Demon.DemonShiTu.ShiTuAPI;
+import me.Demon.DemonShiTu.data.ShiFuData;
+import me.Demon.DemonShiTu.guimanager.LookDataGui;
+import me.Demon.DemonShiTu.manager.DataManager;
+import org.bukkit.Bukkit;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabCompleter;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class AdminCmd implements CommandExecutor , TabCompleter {
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if (!sender.isOp()) {
+ return true;
+ }
+ if(args.length == 0){
+ sender.sendMessage("§r");
+ sender.sendMessage("§e------- ======= §6拜师系统 - 管理员 §e======= -------");
+ sender.sendMessage("§2/stadmin top §f- §2查看师徒排行");
+ sender.sendMessage("§2/stadmin jiesuan §f- §2结算师徒收益");
+ sender.sendMessage("§2/stadmin lookall §f- §2查看所有师傅档案");
+ sender.sendMessage("§2/stadmin delete §e[玩家名] §f- §2删除师傅档案");
+ sender.sendMessage("§2/stadmin kick §e[玩家名] §f- §2将玩家踢出徒弟列表");
+ sender.sendMessage("§2/stadmin save §f- §2保存师徒数据");
+ sender.sendMessage("§e------- ======= §6拜师系统 - 管理员 §e======= -------");
+ sender.sendMessage("§r");
+ return true;
+ }
+ if(args.length == 1 && args[0].equalsIgnoreCase("save")){
+ Main.dataManager.SaveDataManager();
+ DemonAPI.sendMessage(sender,"玩家数据已保存.");
+ return true;
+ }
+ if(args.length == 1 && args[0].equalsIgnoreCase("jiesuan")){
+ ShiTuAPI.settlementIncome();
+ DemonAPI.sendMessage(sender,"已结算上月师徒收益.");
+ return true;
+ }
+ if(args.length == 1 && args[0].equalsIgnoreCase("top")){
+ ShiTuAPI.revenueTopList(sender);
+ return true;
+ }
+ if(args.length == 1 && args[0].equalsIgnoreCase("lookall")){
+ LookDataGui.OpenGui((Player) sender);
+ return true;
+ }
+ if(args.length == 2 && args[0].equalsIgnoreCase("delete")){
+ String sfname = args[1];
+ DataManager dataManager = Main.dataManager;
+ if(!ShiTuAPI.isTeacherExit(sfname)){
+ DemonAPI.sendMessage(sender,"玩家 §e"+sfname+" §a并未出师.");
+ return true;
+ }
+ dataManager.removeShiFuData(sfname);
+ dataManager.SaveDataManager();
+ DemonAPI.sendMessage(sender,"玩家 §e"+sfname+" §a的出师档案已清理.");
+ return true;
+ }
+ if(args.length == 2 && args[0].equalsIgnoreCase("kick")){
+ String name = args[1];
+ DataManager dataManager = Main.dataManager;
+ if(!dataManager.isPlayerExitTeacher(name)){
+ DemonAPI.sendMessage(sender,"玩家 §e"+name+" §a并未拜师.");
+ return true;
+ }
+ String sfName = dataManager.getTeacherName(name);
+ ShiFuData fuData = dataManager.getTeacherData(sfName);
+ fuData.removeTudiList(name); // 从师傅的数据中移除该玩家(徒弟)的名字
+ fuData.SaveData(); // 保存师傅的数据以反映更改
+ DemonAPI.sendMessage(sender,"玩家 §e"+name+" §a已从 §b"+sfName+" §a的徒弟列表脱离.");
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, Command command, String label, String[] args) {
+ List completions = new ArrayList<>();
+ if(args.length == 1){
+ completions.add("top");
+ completions.add("jiesuan");
+ completions.add("lookall");
+ completions.add("delete");
+ completions.add("kick");
+ completions.add("save");
+ }else if(args.length == 2){
+ String[] onlinePlayers = Bukkit.getOnlinePlayers().stream().map(HumanEntity::getName).toArray(String[]::new);
+ completions.addAll(Arrays.asList(onlinePlayers));
+ }
+ return completions;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/command/MainCmd.java b/src/main/java/me/Demon/DemonShiTu/command/MainCmd.java
new file mode 100644
index 0000000..766579f
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/command/MainCmd.java
@@ -0,0 +1,75 @@
+package me.Demon.DemonShiTu.command;
+
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonShiTu.Event.DshituEvent;
+import me.Demon.DemonShiTu.Main;
+import me.Demon.DemonShiTu.ShiTuAPI;
+import me.Demon.DemonShiTu.guimanager.OnlineTeacherGui;
+import me.Demon.DemonShiTu.manager.DataManager;
+import org.bukkit.Bukkit;
+import org.bukkit.Sound;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class MainCmd implements CommandExecutor {
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if(!(sender instanceof Player)){return true;}
+ Player p = (Player) sender;
+ if(args.length == 0){
+ sender.sendMessage("§r");
+ sender.sendMessage("§e------- ======= §6斗魂学院等级系统 §e======= -------");
+ sender.sendMessage("§2/st open §f- §2查看在线师傅名单");
+ sender.sendMessage("§2/st §e[师傅名] §f- §2向其他玩家拜师");
+ sender.sendMessage("§e------- ======= §6斗魂学院等级系统 §e======= -------");
+ sender.sendMessage("§r");
+ return true;
+ }
+ if(args.length == 1 && args[0].equalsIgnoreCase("open")){
+ OnlineTeacherGui.OpenGui(p);
+ return true;
+ }else{
+ String name = p.getName();
+ String sfName = args[0];
+ long joinTime = p.getFirstPlayed();// 获取玩家加入服务器的时间
+ // 计算玩家已加入服务器超过多少天 (当前时间 - 加入时间)
+ int joinDay = (int) ((System.currentTimeMillis() - joinTime) / 1000 / (24*60*60));
+ // 超过天数的阈值
+ int maxJoinDays = 15;
+ if(joinDay >= maxJoinDays){
+ DemonAPI.sendMessage(p,"非常抱歉,你已经加入服务器§e<"+maxJoinDays+"天>§a已经不能拜师了.", Sound.ENTITY_VILLAGER_NO);
+ return true;
+ }
+ // 判断玩家是否已经出师
+ if(ShiTuAPI.isTeacherExit(name)){
+ DemonAPI.sendMessage(p,"非常抱歉,你已 §e出师 §a无法成为其他人的徒弟.", Sound.ENTITY_VILLAGER_NO);
+ return true;
+ }
+ DataManager dataManager = Main.dataManager;
+ // 判断玩家是否已经拜师
+ if(dataManager.isPlayerExitTeacher(name)){
+ DemonAPI.sendMessage(p,"非常抱歉,每名玩家只能拜一位师傅.", Sound.ENTITY_VILLAGER_NO);
+ return true;
+ }
+ List applicationList = dataManager.getApplyForList(sfName);// 获取申请列表
+ if(applicationList.contains(name)){
+ DemonAPI.sendMessage(p,"你已经发送过拜师请求,请耐心等待对方同意。", Sound.ENTITY_VILLAGER_NO);
+ return true;
+ }
+ applicationList.add(name);// 将玩家加入申请列表
+ dataManager.setApplyForList(sfName,applicationList); // 刷新申请列表
+ DemonAPI.sendMessage(p,"成功发送拜师请求,请耐心等待对方同意。",Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ Player sfPlayer = Bukkit.getPlayer(sfName);
+ if(sfPlayer != null){
+ DemonAPI.sendMessage(sfPlayer,"您新收到有一条拜师请求等待处理.",Sound.ENTITY_VILLAGER_YES);
+ }
+ DshituEvent event = new DshituEvent(p,sfName);
+ Bukkit.getPluginManager().callEvent(event);
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/data/ShiFuData.java b/src/main/java/me/Demon/DemonShiTu/data/ShiFuData.java
new file mode 100644
index 0000000..bedfe52
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/data/ShiFuData.java
@@ -0,0 +1,99 @@
+package me.Demon.DemonShiTu.data;
+
+import me.Demon.DemonShiTu.Main;
+import org.bukkit.configuration.file.FileConfiguration;
+
+import java.util.List;
+
+public class ShiFuData {
+
+ private String name; // 师傅名
+ private int level; // 师傅等级
+ private double earnings; // 徒弟收益
+ private List tudiList; // 徒弟列表
+ private long loginTime;
+
+ public ShiFuData(String name, int level, double earnings, List apprenticeList, long loginTime){
+ this.name = name;
+ this.level = level;
+ this.earnings = earnings;
+ this.tudiList = apprenticeList;
+ this.loginTime = loginTime;
+ }
+
+ public void SaveData(){
+ FileConfiguration yml = Main.plugin.getConfig();
+ yml.set("ShiTuData."+name,null);
+ yml.set("ShiTuData."+name+".level",level);
+ yml.set("ShiTuData."+name+".shouyi",earnings);
+ yml.set("ShiTuData."+name+".loginTime",loginTime);
+ yml.set("ShiTuData."+name+".tudi",tudiList);
+ Main.plugin.saveConfig();
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public double getEarnings() {
+ return earnings;
+ }
+
+ public void setEarnings(double earnings) {
+ this.earnings = earnings;
+ }
+
+ public void addEarnings(double earnings){
+ this.earnings += earnings;
+ }
+
+ public long getLoginTime() {
+ return loginTime;
+ }
+
+ public boolean isLoginOvertime(){
+ // 最后一次记录时间距离现在时间超过15天 返回true
+ // 获取当前时间的时间戳
+ long currentTime = System.currentTimeMillis();
+ // 7天的毫秒数
+ long fifteenDaysInMillis = 15L * 24 * 60 * 60 * 1000;
+ // 检查上次登录时间是否超过15天
+ return (currentTime - this.loginTime) > fifteenDaysInMillis;
+ }
+
+ public void setLoginTime(long loginTime) {
+ this.loginTime = loginTime;
+ }
+
+ public List getTudiList() {
+ return tudiList;
+ }
+ public boolean isTudiListExit(String tudiName){
+ if(getTudiList().contains(tudiName)){
+ return true;
+ }
+ return false;
+ }
+ public void addTudiList(String tudiName){
+ if(!isTudiListExit(tudiName)) {
+ List stringList = getTudiList();
+ stringList.add(tudiName);
+ setTudiList(stringList);
+ }
+ }
+ public void removeTudiList(String tudiName){
+ if(isTudiListExit(tudiName)) {
+ List stringList = getTudiList();
+ stringList.remove(tudiName);
+ setTudiList(stringList);
+ }
+ }
+
+ public void setTudiList(List tudiList) {
+ this.tudiList = tudiList;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/guimanager/JoinEvent.java b/src/main/java/me/Demon/DemonShiTu/guimanager/JoinEvent.java
new file mode 100644
index 0000000..f9e7bf1
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/guimanager/JoinEvent.java
@@ -0,0 +1,23 @@
+package me.Demon.DemonShiTu.guimanager;
+
+import me.Demon.DemonShiTu.Main;
+import me.Demon.DemonShiTu.ShiTuAPI;
+import me.Demon.DemonShiTu.data.ShiFuData;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+
+public class JoinEvent implements Listener {
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent e){
+ Player p = e.getPlayer();
+ String sfName = p.getName();
+ // 判断玩家是否是师傅
+ if(ShiTuAPI.isTeacherExit(sfName)){
+ ShiFuData fuData = Main.dataManager.getTeacherData(sfName);
+ fuData.setLoginTime(System.currentTimeMillis());
+ }
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/guimanager/LookDataGui.java b/src/main/java/me/Demon/DemonShiTu/guimanager/LookDataGui.java
new file mode 100644
index 0000000..469152d
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/guimanager/LookDataGui.java
@@ -0,0 +1,77 @@
+package me.Demon.DemonShiTu.guimanager;
+
+import me.Demon.Compat.VexCompatGui;
+import me.Demon.DemonLevels.api.DLevelAPI;
+import me.Demon.DemonOnlineTime.DtimeAPI;
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonShiTu.Main;
+import me.Demon.DemonShiTu.ShiTuAPI;
+import me.Demon.DemonShiTu.data.ShiFuData;
+import me.Demon.DemonShiTu.manager.DataManager;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LookDataGui implements Listener {
+
+ public static String invTitle = "师徒系统 - 查看所有师傅数据";
+
+ @EventHandler
+ public void onClick(InventoryClickEvent e){
+ Player p = (Player) e.getWhoClicked();
+ Inventory inv = e.getInventory();
+ int rawSlot = e.getRawSlot();
+ ItemStack item = e.getCurrentItem();
+ if(inv != null && inv.getTitle().equalsIgnoreCase(invTitle)){
+ e.setCancelled(true);
+ }
+ }
+
+ public static void OpenGui(Player player){
+ Inventory inv = Bukkit.createInventory(null,54,invTitle);
+ for (int i = 0; i < 9; i++) {
+ inv.setItem(i, DemonAPI.glass(15,"§a§l↓↓§6已出师的玩家列表§a§l↓↓"));
+ }
+ DataManager dataManager = Main.dataManager;
+ for (String sfName : dataManager.getShiFuDataMap().keySet()){
+ ShiFuData shiFuData = dataManager.getTeacherData(sfName);
+ inv.addItem(ShiFuSkull(shiFuData));
+ }
+ for (int i = 45; i < 54; i++) {
+ inv.setItem(i, DemonAPI.glass(15,"§a§l↑↑§6已出师的玩家列表§a§l↑↑"));
+ }
+ player.openInventory(inv);
+ }
+
+ public static ItemStack ShiFuSkull(ShiFuData fuData){
+ String sfName = fuData.getName();
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§b§l★§7名称: §6§l"+fuData.getName());
+ List lore = new ArrayList<>();
+ int levels = (int) DLevelAPI.getOffPlayer_Level(sfName);
+ lore.add("§a§l★§7级别: §dLv."+ levels);
+ int time = DtimeAPI.getTime(sfName);
+ lore.add("§a§l★§7今日活跃: §a"+ time+"分钟");
+ lore.add("§a§l★§7本月收益: §6" + String.format("%.1f",fuData.getEarnings()) + "师徒币");
+ lore.add("§a§l★§7收徒数量: §e" + fuData.getTudiList().size() + "名");
+ int top = VexCompatGui.getTop_self(sfName);
+ lore.add("§a§l★§7战力排行: §b" + top + "名");
+ lore.add("§a§l★§7经验加成: §d"+ShiTuAPI.getExpDouble(sfName)+"%");
+ lore.add("§a§l★§7最后一次上线: §c"+DemonAPI.LongToStringData(fuData.getLoginTime(),"yyyy年MM月dd日 HH:mm"));
+ lore.add(" ");
+ lore.add("§9§l★ §6SHIFT+左键 §7点击结算他的收益");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ return item;
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/guimanager/OnlineTeacherGui.java b/src/main/java/me/Demon/DemonShiTu/guimanager/OnlineTeacherGui.java
new file mode 100644
index 0000000..3bb9f63
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/guimanager/OnlineTeacherGui.java
@@ -0,0 +1,131 @@
+package me.Demon.DemonShiTu.guimanager;
+
+import me.Demon.Compat.VexCompatGui;
+import me.Demon.DemonLevels.api.DLevelAPI;
+import me.Demon.DemonOnlineTime.DtimeAPI;
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonShiTu.Event.DshituEvent;
+import me.Demon.DemonShiTu.Main;
+import me.Demon.DemonShiTu.ShiTuAPI;
+import me.Demon.DemonShiTu.data.ShiFuData;
+import me.Demon.DemonShiTu.manager.DataManager;
+import me.Demon.DemonShiTu.util.StackLibrary;
+import net.minecraft.server.v1_12_R1.NBTTagCompound;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.ClickType;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class OnlineTeacherGui implements Listener {
+
+ public static String invTitle = "师徒系统 - 活跃的大师(在线的则会显示)";
+
+ @EventHandler
+ public void onClick(InventoryClickEvent e){
+ Player p = (Player) e.getWhoClicked();
+ String name = p.getName();
+ Inventory inv = e.getInventory();
+ int rawSlot = e.getRawSlot();
+ ItemStack item = e.getCurrentItem();
+ if(inv != null && inv.getTitle().equalsIgnoreCase(invTitle)){
+ e.setCancelled(true);
+ if(!DemonAPI.itemIsNull(item) && !DemonAPI.itemIsLore(item)) {
+ if (rawSlot >= 9 && rawSlot < inv.getSize() - 9) {
+ if (e.getClick() != ClickType.SHIFT_LEFT) {
+ DemonAPI.sendMessage(p, "请按下 §eSHIFT+左键 §a进行拜师.", Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ p.closeInventory();
+ long joinTime = p.getFirstPlayed();// 获取玩家加入服务器的时间
+ // 计算玩家已加入服务器超过多少天 (当前时间 - 加入时间)
+ int joinDay = (int) ((System.currentTimeMillis() - joinTime) / 1000 / (24 * 60 * 60));
+ // 超过天数的阈值
+ int maxJoinDays = 15;
+ if (joinDay >= maxJoinDays) {
+ DemonAPI.sendMessage(p, "非常抱歉,你已经加入服务器§e<" + maxJoinDays + "天>§a已经不能拜师了.", Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ // 判断玩家是否已经出师
+ if (ShiTuAPI.isTeacherExit(name)) {
+ DemonAPI.sendMessage(p, "非常抱歉,你已 §e出师 §a无法成为其他人的徒弟.", Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ DataManager dataManager = Main.dataManager;
+ // 判断玩家是否已经拜师
+ if (dataManager.isPlayerExitTeacher(name)) {
+ DemonAPI.sendMessage(p, "非常抱歉,每名玩家只能拜一位师傅.", Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ NBTTagCompound nbt = StackLibrary.getNBT(item);
+ if (nbt.hasKey("sfName")) {
+ String sfName = nbt.getString("sfName");
+ List applicationList = dataManager.getApplyForList(sfName);// 获取申请列表
+ if (applicationList.contains(name)) {
+ DemonAPI.sendMessage(p, "你已经发送过拜师请求,请耐心等待对方同意。", Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ applicationList.add(name);// 将玩家加入申请列表
+ dataManager.setApplyForList(sfName, applicationList); // 刷新申请列表
+ DemonAPI.sendMessage(p, "成功发送拜师请求,请耐心等待对方同意。", Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ Player sfPlayer = Bukkit.getPlayer(sfName);
+ if (sfPlayer != null) {
+ DemonAPI.sendMessage(sfPlayer, "您新收到有一条拜师请求等待处理.", Sound.ENTITY_VILLAGER_YES);
+ }
+ DshituEvent event = new DshituEvent(p, sfName);
+ Bukkit.getPluginManager().callEvent(event);
+ }
+ }
+ }
+ }
+ }
+
+ public static void OpenGui(Player player){
+ Inventory inv = Bukkit.createInventory(null,54,invTitle);
+ DataManager dataManager = Main.dataManager;
+ for (String sfName : dataManager.getShiFuDataMap().keySet()){
+ Player sfPlayer = Bukkit.getPlayer(sfName);
+ if(sfPlayer != null) {
+ ShiFuData shiFuData = dataManager.getTeacherData(sfName);
+ inv.addItem(ShiFuSkull(shiFuData));
+ }
+ }
+ for (int i = 0; i < 9; i++) {inv.setItem(i, DemonAPI.glass(15,"§a§l↓↓§6已出师的玩家列表§a§l↓↓"));}
+ for (int i = 45; i < 54; i++) {inv.setItem(i, DemonAPI.glass(15,"§a§l↑↑§c当日在线60分钟才会显示§a§l↑↑"));}
+ inv.setItem(4,StackLibrary.tudiInfoShow());
+ player.openInventory(inv);
+ }
+
+ public static ItemStack ShiFuSkull(ShiFuData fuData){
+ String sfName = fuData.getName();
+ ItemStack item = new ItemStack(Material.BOOK);
+ ItemMeta meta = item.getItemMeta();
+ meta.setDisplayName("§b§l★§7名称: §6§l"+sfName);
+ List lore = new ArrayList<>();
+ int levels = (int) DLevelAPI.getOffPlayer_Level(sfName);
+ lore.add("§a§l★§7级别: §dLv."+ levels);
+ int time = DtimeAPI.getTime(sfName);
+ lore.add("§a§l★§7今日活跃: §a"+ time+"分钟");
+ lore.add("§a§l★§7收徒数量: §e" + fuData.getTudiList().size() + "名");
+ int top = VexCompatGui.getTop_self(sfName);
+ lore.add("§a§l★§7战力排行: §b" + top + "名");
+ lore.add("§a§l★§7经验加成: §d"+ShiTuAPI.getExpDouble(sfName)+"%");
+ lore.add("§a§l★§7最后一次上线: §c"+DemonAPI.LongToStringData(fuData.getLoginTime(),"yyyy年MM月dd日 HH:mm"));
+ lore.add(" ");
+ lore.add("§9§l★ §6SHIFT+左键 §7点击拜他为师");
+ meta.setLore(lore);
+ item.setItemMeta(meta);
+ NBTTagCompound nbt = StackLibrary.getNBT(item);
+ nbt.setString("sfName",sfName);
+ return StackLibrary.setNBT(item,nbt);
+ }
+}
diff --git a/src/main/java/me/Demon/DemonShiTu/guimanager/TeacherGui.java b/src/main/java/me/Demon/DemonShiTu/guimanager/TeacherGui.java
new file mode 100644
index 0000000..baec928
--- /dev/null
+++ b/src/main/java/me/Demon/DemonShiTu/guimanager/TeacherGui.java
@@ -0,0 +1,275 @@
+package me.Demon.DemonShiTu.guimanager;
+
+import com.yaohun.aurechargedata.api.RechargeAPI;
+import com.yaohun.aurechargedata.util.TimeType;
+import me.Demon.DemonLevels.api.DLevelAPI;
+import me.Demon.DemonMonethyCard.api.CardAPI;
+import me.Demon.DemonOnlineTime.DtimeAPI;
+import me.Demon.DemonPlugin.DemonAPI;
+import me.Demon.DemonShiTu.Main;
+import me.Demon.DemonShiTu.ShiTuAPI;
+import me.Demon.DemonShiTu.data.ShiFuData;
+import me.Demon.DemonShiTu.manager.DataManager;
+import me.Demon.DemonShiTu.util.StackLibrary;
+import net.minecraft.server.v1_12_R1.NBTTagCompound;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Sound;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.time.DayOfWeek;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+public class TeacherGui implements Listener {
+
+ public static String invTitle = "师徒系统 - 管理系统";
+
+ @EventHandler
+ public void onClick(InventoryClickEvent e){
+ Player player = (Player) e.getWhoClicked();
+ String sfName = player.getName();
+ Inventory inv = e.getInventory();
+ int rawSlot = e.getRawSlot();
+ ItemStack item = e.getCurrentItem();
+ if(inv != null && inv.getTitle().equalsIgnoreCase(invTitle)){
+ e.setCancelled(true);
+ DataManager dataManager = Main.dataManager;
+ if(e.getRawSlot() == 5){
+ // 获取徒弟列表
+ ShiFuData fuData = dataManager.getTeacherData(sfName);
+ List tudiList = fuData.getTudiList();
+ if(tudiList.size() < 1) {
+ DemonAPI.sendMessage(player,"你还没有收徒喔,无法获得任何收益。",Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ int time = DtimeAPI.getTime(sfName);
+ if(time < 60) {
+ DemonAPI.sendMessage(player,"需要在线达到<§e§l60分钟§a>才能领取收益。",Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ int sfLevel = fuData.getLevel(); // 获取师傅的等级
+ double defaultBonus = 5; // 默认奖金
+ // 根据师傅的等级设置奖金
+ if (sfLevel == 2) {
+ defaultBonus = 10;
+ } else if (sfLevel == 3) {
+ defaultBonus = 15;
+ } else if (sfLevel == 4) {
+ defaultBonus = 20;
+ } else if (sfLevel >= 5) {
+ defaultBonus = 30;
+ }
+ int needTime = 180; // 活跃所需在线时间(分钟)
+ double addMoney = 0; // 粉丝收益(元)
+ // 遍历徒弟名单
+ for (String name : tudiList) {
+ if (!dataManager.isActiveReward(name)) { // 检查徒弟是否已领取活跃奖励
+ int onlineTime = DtimeAPI.getTime(name); // 获取徒弟的在线时间
+
+ // 如果徒弟在线时间达到要求
+ if (onlineTime >= needTime) {
+ List activeRewardList = dataManager.getActiveReward(); // 获取活跃奖励名单
+ activeRewardList.add(name); // 将徒弟添加到活跃奖励名单中
+ dataManager.setActiveReward(activeRewardList); // 更新活跃奖励名单
+ addMoney += defaultBonus; // 累计奖金
+ }
+ }
+ }
+ // 如果累计奖金不足 1 元
+ if (addMoney < 1) {
+ DemonAPI.sendMessage(player, "暂时还没有任何徒弟活跃收益可领取...等等再来吧...", Sound.ENTITY_VILLAGER_NO);
+ return;
+ }
+ // 获取当前日期的星期
+ DayOfWeek currentDayOfWeek = LocalDate.now().getDayOfWeek();
+ // 如果今天是周一至周五,奖金提高30%
+ if (currentDayOfWeek != DayOfWeek.SATURDAY && currentDayOfWeek != DayOfWeek.SUNDAY) {
+ addMoney *= 1.3;
+ }
+ //判断玩家是否是月卡用户 并且还有时间
+ String yueka_text = "";
+ if(CardAPI.isCardHaoHua(sfName)){
+ addMoney *= 1.2;
+ yueka_text = "§7(§e豪华月卡§7) ";
+ }else if(CardAPI.isCardJingDian(sfName)){
+ addMoney *= 1.1;
+ yueka_text = "§7(§b经典月卡§7) ";
+ }
+ // 获取这个师傅上面是否还有师傅
+ if(!dataManager.isPlayerExitTeacher(sfName)){
+ fuData.addEarnings(addMoney);
+ fuData.SaveData();
+ DemonAPI.sendMessage(player,"成功领取徒弟活跃收益: §6"+addMoney+"师徒币"+yueka_text,Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ System.out.println("[师徒] 活跃激励 玩家 <" + sfName + ">获得" + addMoney + "师徒币奖励");
+ }else{
+ double newMoney = (addMoney / 2);
+ fuData.addEarnings(newMoney);
+ fuData.SaveData();
+ DemonAPI.sendMessage(player,"成功领取徒弟活跃收益: §6"+newMoney+"师徒币"+yueka_text,Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ String sfNameB = dataManager.getTeacherName(sfName);
+ ShiFuData fuDataB = dataManager.getTeacherData(sfNameB);
+ fuDataB.addEarnings(newMoney);
+ fuDataB.SaveData();
+ Player shifuBPlayer = Bukkit.getPlayer(fuDataB.getName());
+ if(shifuBPlayer != null){
+ DemonAPI.sendMessage(shifuBPlayer,"获得徒弟的活在线跃激励收益: §6"+newMoney+"师徒币",Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ }
+ System.out.println("[师徒] 活跃激励 玩家<" + sfName + ">和<"+sfNameB+">各获得" + newMoney + "师徒币奖励");
+ }
+ TeacherGui.OpenGui(player);
+ }
+ if(rawSlot == 7){
+ ThApplyGui.OpenGui(player);
+ player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK,1.6F,1.8F);
+ }
+ if(rawSlot >= 18 && rawSlot < inv.getSize()){
+ if(DemonAPI.itemIsNull(item)){return;}
+ NBTTagCompound nbt = StackLibrary.getNBT(item);
+ if(nbt.hasKey("tdName")){
+ String name = nbt.getString("tdName");
+ // 根据师傅的名字从数据管理器中获取师傅的数据
+ ShiFuData fuData = dataManager.getTeacherData(sfName);
+ // 从师傅的数据中移除该玩家(徒弟)的名字
+ fuData.removeTudiList(name);
+ // 保存师傅的数据以反映更改
+ fuData.SaveData();
+ Player tDPlayer = Bukkit.getPlayer(name);
+ if (tDPlayer != null) {
+ DemonAPI.sendMessage(tDPlayer,"您的师傅 §e" + name + " §a已与你解除师徒关系。",Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ }
+ DemonAPI.sendMessage(player,"成功与 §e" + name + " §a解除师徒关系。",Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
+ TeacherGui.OpenGui(player);
+ }
+ }
+ }
+ }
+
+ public static void OpenGui(Player player){
+ Inventory inv = Bukkit.createInventory(null,54,invTitle);
+ for (int i = 0; i < 9; i++) {
+ int data = (int) (Math.random() * 6);
+ inv.setItem(i, DemonAPI.glass(data,"§r "));
+ }
+ for (int i = 9; i < 18; i++) {
+ inv.setItem(i, DemonAPI.glass(15,"§a§l↓↓§6徒弟列表§a§l↓↓"));
+ }
+ DataManager dataManager = Main.dataManager;
+ ShiFuData shiFuData = dataManager.getTeacherData(player.getName());
+ inv.setItem(1,StackLibrary.teacherInfoShow());
+ inv.setItem(3,personalInformation(shiFuData));
+ inv.setItem(5,earningsRefresh());
+ inv.setItem(7,requestProcessing());
+ List