测试版

This commit is contained in:
yaohunya 2024-07-23 02:54:39 +08:00
commit 9f80419c6a
44 changed files with 1845 additions and 0 deletions

View File

@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="DemonShiTu">
<output-path>$PROJECT_DIR$/out/artifacts/DemonShiTu</output-path>
<root id="archive" name="DemonShiTu.jar">
<element id="module-output" name="DemonShiTu" />
</root>
</artifact>
</component>

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# DemonShiTu
- 玩家之间拜师的系统
- 师傅可从中获得收益

Binary file not shown.

57
pom.xml Normal file
View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>DemonShiTu</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>public-rpg</id>
<url>https://repo.aurora-pixels.com/repository/public-rpg/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2</version>
</dependency>
<dependency>
<groupId>me.Demon.DemonPlugin</groupId>
<artifactId>DemonAPI</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.yaohun.playermanage</groupId>
<artifactId>PlayerManage</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>me.clip.placeholderapi</groupId>
<artifactId>PlaceholderAPI</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>me.Demon.ItemReference</groupId>
<artifactId>ItemKuAPI</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>me.Demon.DemonLevels</groupId>
<artifactId>DemonLevels</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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<String, Double> map = new HashMap<>();
for (String sfName : dataManager.getShiFuDataMap().keySet()) {
ShiFuData fuData = dataManager.getTeacherData(sfName);
double shouyi = fuData.getEarnings();
map.put(sfName, shouyi);
}
List<Map.Entry<String, Double>> 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;
}
}

View File

@ -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 "";
}
}

View File

@ -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<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
List<String> 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;
}
}

View File

@ -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<String> 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;
}
}

View File

@ -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<String> tudiList; // 徒弟列表
private long loginTime;
public ShiFuData(String name, int level, double earnings, List<String> 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<String> 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<String> stringList = getTudiList();
stringList.add(tudiName);
setTudiList(stringList);
}
}
public void removeTudiList(String tudiName){
if(isTudiListExit(tudiName)) {
List<String> stringList = getTudiList();
stringList.remove(tudiName);
setTudiList(stringList);
}
}
public void setTudiList(List<String> tudiList) {
this.tudiList = tudiList;
}
}

View File

@ -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());
}
}
}

View File

@ -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<String> 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;
}
}

View File

@ -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<String> 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<String> 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);
}
}

View File

@ -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<String> 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<String> 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<String> tuDiList = shiFuData.getTudiList();
for (String name : tuDiList){
inv.addItem(apprenticeInformation(name));
}
long monthlyTimeLog = dataManager.getMonthlyTimeLog();
// 检查当前时间是否已经是次月并且超过中午12点
if (isNextMonth(monthlyTimeLog) && isAfterNoon()) {
ShiTuAPI.settlementIncome();
System.out.println("[调试 - 师徒] 已自动结算每月师徒收益");
dataManager.setMonthlyTimeLog(System.currentTimeMillis());
}
long everydayTimeLog = dataManager.getEverydayTimeLog();
if(!isSameDay(everydayTimeLog,System.currentTimeMillis())){
System.out.println("[调试 - 师徒] 已清理每日活跃激励奖名单");
dataManager.setActiveReward(new ArrayList<>());
dataManager.setEverydayTimeLog(System.currentTimeMillis());
}
player.openInventory(inv);
}
private static boolean isSameDay(long timestamp1, long timestamp2) {
LocalDate date1 = Instant.ofEpochMilli(timestamp1).atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate date2 = Instant.ofEpochMilli(timestamp2).atZone(ZoneId.systemDefault()).toLocalDate();
return date1.equals(date2);
}
private static boolean isNextMonth(long lastTimeLog) {
Calendar lastCalendar = Calendar.getInstance();
lastCalendar.setTimeInMillis(lastTimeLog);
int lastMonth = lastCalendar.get(Calendar.MONTH);
int currentMonth = Calendar.getInstance().get(Calendar.MONTH);
return currentMonth != lastMonth;
}
private static boolean isAfterNoon() {
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
return hour >= 12;
}
public static ItemStack personalInformation(ShiFuData fuData){
ItemStack item = new ItemStack(449, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§e§l个人收益查看");
List<String> lore = new ArrayList<>();
lore.add("§a§l★§7名称: §6§l"+ fuData.getName());
lore.add("§a§l★§7级别: §6§lLv."+ fuData.getLevel());
lore.add("§a§l★§7徒弟: §6§l"+ fuData.getTudiList().size() +"");
lore.add("§a§l★§7收益: §6§l"+ String.format("%.1f",fuData.getEarnings()) +"师徒币");
lore.add("§a§l★§7最后一次上线: §c"+DemonAPI.LongToStringData(fuData.getLoginTime(),"yyyy年MM月dd日 HH:mm"));
meta.setLore(lore);
item.setItemMeta(meta);
return item;
}
public static ItemStack apprenticeInformation(String name){
ItemStack item = new ItemStack(Material.BOOK);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§a§l★§7名称: §6§l"+name);
List<String> lore = new ArrayList<>();
int levels = (int) DLevelAPI.getOffPlayer_Level(name);
lore.add("§a§l★§7级别: §dLv."+ levels);
int time = DtimeAPI.getTime(name);
lore.add("§a§l★§7今日活跃: §a"+ time+"分钟");
if(ShiTuAPI.isTeacherExit(name)) {
ShiFuData fuDataB = Main.dataManager.getTeacherData(name);
lore.add("§a§l★§7收徒数量: §e" + fuDataB.getTudiList().size() + "");
}else{
lore.add("§a§l★§7收徒数量: §e尚未出师");
}
int rechargeMonth = RechargeAPI.getRechargeData(name, TimeType.MONTHLY);
lore.add("§a§l★§7本月充值: §b" + rechargeMonth + "软妹币");
lore.add(" ");
lore.add("§e§l★§7点击解除师徒关系");
meta.setLore(lore);
item.setItemMeta(meta);
NBTTagCompound nbti = StackLibrary.getNBT(item);
nbti.setString("tdName",name);
return StackLibrary.setNBT(item, nbti);
}
public static ItemStack earningsRefresh(){
ItemStack item = new ItemStack(347, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§7[§6活跃§7] §a徒弟活跃收益");
List<String> Lore = new ArrayList<>();
Lore.add("§7§l★§7点击刷新收益");
meta.setLore(Lore);
item.setItemMeta(meta);
return item;
}
public static ItemStack requestProcessing(){
ItemStack item = new ItemStack(421);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§8« §e处理拜师请求 §8»");
List<String> lore = new ArrayList<>();
lore.add("§a§l★ §7点击进行处理 §a§l★");
meta.setLore(lore);
item.setItemMeta(meta);
return item;
}
}

View File

@ -0,0 +1,140 @@
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.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.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 ThApplyGui implements Listener {
public static String invTitle = "师徒系统 - 处理拜师申请";
@EventHandler
public void onClick(InventoryClickEvent e){
Player p = (Player) e.getWhoClicked();
String sfName = 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 (e.getRawSlot() == 31) {
TeacherGui.OpenGui(p);
p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK,1.6F,1.8F);
}
if(rawSlot >= 0 && rawSlot < 27) {
DataManager dataManager = Main.dataManager;
if(!ShiTuAPI.isTeacherExit(sfName)){
DemonAPI.sendMessage(p,"你需要出师后才能进行操作.",Sound.ENTITY_VILLAGER_NO);
return;
}
ShiFuData fuData = dataManager.getTeacherData(sfName);
NBTTagCompound nbt = StackLibrary.getNBT(item);
if (nbt.hasKey("ApplyName")) {
String name = nbt.getString("ApplyName");
// 获取申请名单 并清理这个玩家 刷新申请列表
List<String> applyList = dataManager.getApplyForList(sfName);
applyList.remove(name);
dataManager.setApplyForList(sfName,applyList);
if(e.getClick() == ClickType.LEFT){
int tudiLimitAmount = 18;
if(fuData.getTudiList().size() >= tudiLimitAmount){
DemonAPI.sendMessage(p,"您当前最多可收<§e§l"+tudiLimitAmount+"名§a>徒弟.",Sound.ENTITY_VILLAGER_NO);
return;
}
// 检测玩家是否已拜师
if(dataManager.isPlayerExitTeacher(name)){
DemonAPI.sendMessage(p,"下手慢了 §e"+name+" §a已经拜其他人为师了.",Sound.ENTITY_VILLAGER_NO);
return;
}
fuData.addTudiList(name); // 将玩家列入徒弟列表
Player player = Bukkit.getPlayer(name);
if (player != null) {
DemonAPI.sendMessage(player,"§6"+sfName+" §a已同意你的拜师请求.");
player.sendTitle("§a拜师成功","§b您的师傅: §f"+sfName);
}
DemonAPI.sendMessage(p,"玩家 §e"+name+" §a已成为你的徒弟.");
}else if(e.getClick() == ClickType.RIGHT){
Player player = Bukkit.getPlayer(name);
if (player != null) {
DemonAPI.sendMessage(player,"§6"+sfName+" §a拒绝了你的拜师请求.");
}
DemonAPI.sendMessage(p,"已婉拒 §e"+name+" §a成为你的徒弟.");
}
ThApplyGui.OpenGui(p);
}
}
}
}
}
public static void OpenGui(Player player){
String sfName = player.getName();
// 检测玩家是否已成为师傅
if(!ShiTuAPI.isTeacherExit(sfName)){
DemonAPI.sendMessage(player,"你需要 §e出师 §a后才能查看.");
return;
}
DataManager dataManager = Main.dataManager;
Inventory inv = Bukkit.createInventory(null,54,invTitle);
// 获取申请拜师名单
List<String> applyList = dataManager.getApplyForList(sfName);
for (String name : applyList){
inv.addItem(showItems(name));
}
for (int i = 27; i < 36; i++) {
inv.setItem(i, DemonAPI.glass(15, "§7[[§a▧§c▧§a▧§7]]"));
}
inv.setItem(31, StackLibrary.Back_book());
player.openInventory(inv);
}
public static ItemStack showItems(String playName){
ItemStack item = new ItemStack(Material.BOOK);
ItemMeta meta = item.getItemMeta();
List<String> lore = new ArrayList<>();
meta.setDisplayName("§a§l★§7名称: §e"+playName);
Player player = Bukkit.getPlayer(playName);
if(player != null) {
lore.add("§a§l★§7状态: §a§l在线");
}else{
lore.add("§a§l★§7状态: §c§l离线");
}
int levels = (int) DLevelAPI.getOffPlayer_Level(playName);
lore.add("§a§l★§7级别: §dLv."+ levels);
int time = DtimeAPI.getTime(playName);
lore.add("§a§l★§7今日活跃: §a"+ time+"分钟");
int rechargeMonth = RechargeAPI.getRechargeData(playName, TimeType.MONTHLY);
lore.add("§a§l★§7本月充值: §b" + rechargeMonth + "软妹币");
lore.add("");
lore.add("§e§l★§7左键点击通过申请");
lore.add("§c§l★§7右键点击拒绝申请");
meta.setLore(lore);
item.setItemMeta(meta);
NBTTagCompound nbt = StackLibrary.getNBT(item);
nbt.setString("ApplyName",playName);
return StackLibrary.setNBT(item,nbt);
}
}

View File

@ -0,0 +1,116 @@
package me.Demon.DemonShiTu.guimanager;
import me.Demon.Compat.VexCompatGui;
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 org.bukkit.Bukkit;
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.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class TudiGui 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);
if(rawSlot == 6){
p.closeInventory();
p.playSound(p.getLocation(), Sound.BLOCK_COMPARATOR_CLICK,1.6F,1.8F);
DataManager dataManager = Main.dataManager;
if(!dataManager.isPlayerExitTeacher(p.getName())){
DemonAPI.sendMessage(p,"你需要拜师后才能解除师徒关系.",Sound.ENTITY_VILLAGER_NO);
return;
}
int level = p.getLevel();
int price = 50000;
if(level >= 90){
price = 1000000;
}else if(level >= 80){
price = 500000;
}else if(level >= 60){
price = 200000;
}else if(level >= 40){
price = 100000;
}
String money_format = new DecimalFormat(",###").format(price);
if(!DemonAPI.hasMoney(p,price)){
DemonAPI.sendMessage(p,"你需要支付§6"+money_format+"金币§a才能解除师徒关系.",Sound.ENTITY_VILLAGER_NO);
return;
}
// 从玩家 p 的账户中扣除金额 price
DemonAPI.takeMoney(p, price);
// 获取玩家 p 的名字
String name = p.getName();
// 根据玩家的名字从数据管理器中获取其师傅的名字
String sfName = dataManager.getTeacherName(name);
// 根据师傅的名字从数据管理器中获取师傅的数据
ShiFuData fuData = dataManager.getTeacherData(sfName);
// 从师傅的数据中移除该玩家徒弟的名字
fuData.removeTudiList(name);
// 保存师傅的数据以反映更改
fuData.SaveData();
Player sfPlayer = Bukkit.getPlayer(sfName);
if(sfPlayer != null){
DemonAPI.sendMessage(sfPlayer,"您的徒弟 §e"+name+" §a已与你解除师徒关系.",Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
}
DemonAPI.sendMessage(p,"成功与 §e"+sfName+" §a解除师徒关系.",Sound.ENTITY_EXPERIENCE_ORB_PICKUP);
}
}
}
public static void OpenGui(Player player){
Inventory inv = Bukkit.createInventory(null,54,invTitle);
inv.setItem(2, StackLibrary.tudiInfoShow());
DataManager dataManager = Main.dataManager;
if(!dataManager.isPlayerExitTeacher(player.getName())){
DemonAPI.sendMessage(player,"你需要拜师后才能查看.",Sound.ENTITY_VILLAGER_NO);
player.closeInventory();
return;
}
String sfName = dataManager.getTeacherName(player.getName());
ShiFuData fuData = dataManager.getTeacherData(sfName);
inv.setItem(6, HeadlSkull(player.getName(),fuData));
player.openInventory(inv);
}
public static ItemStack HeadlSkull(String playName,ShiFuData fuData){
String sfName = fuData.getName();
ItemStack item = new ItemStack(449, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§e§l拜师详情查看");
List<String> lore = new ArrayList<>();
lore.add("§a§l★§7我的名称: §6"+ playName);
lore.add("§a§l★§7师傅名称: §6"+ sfName);
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("§7#等级大于85级后无法获得经验加成Buff");
lore.add(" ");
lore.add("§c§l★§7点击与师傅解除关系");
meta.setLore(lore);
item.setItemMeta(meta);
return item;
}
}

View File

@ -0,0 +1,48 @@
package me.Demon.DemonShiTu.listener;
import me.Demon.DemonShiTu.Main;
import me.Demon.DemonShiTu.ShiTuAPI;
import me.Demon.DemonShiTu.manager.DataManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.serverct.ersha.jd.AttributeAPI;
import java.util.ArrayList;
import java.util.List;
public class AttributeLoad implements Listener {
@EventHandler
public void loadApStats(PlayerChangedWorldEvent e) {
Player p = e.getPlayer();
String name = p.getName();
// 判断玩家是否有师傅
DataManager dataManager = Main.dataManager;
if (dataManager.isPlayerExitTeacher(name)) {
if(p.getLevel() <= 85) {
String sfName = dataManager.getTeacherName(name);
if(ShiTuAPI.getExpDouble(sfName) >= 1) {
List<String> apStats = new ArrayList<>();
apStats.add("经验加成: " + ShiTuAPI.getExpDouble(sfName) + "%");
AttributeAPI.addAttribute(p, "师徒_ApStats", apStats);
}
}
}
}
@EventHandler
public void onquit(PlayerQuitEvent e) {
Player p = e.getPlayer();
String name = p.getName();
// 判断玩家是否有师傅
DataManager dataManager = Main.dataManager;
if (dataManager.isPlayerExitTeacher(name)) {
if(p.getLevel() <= 85) {
AttributeAPI.deleteAttribute(p, "师徒_ApStats");
}
}
}
}

View File

@ -0,0 +1,90 @@
package me.Demon.DemonShiTu.listener;
import com.yaohun.aurechargedata.event.RechargeEvent;
import me.Demon.DemonPlugin.DemonAPI;
import me.Demon.DemonShiTu.Main;
import me.Demon.DemonShiTu.data.ShiFuData;
import me.Demon.DemonShiTu.manager.DataManager;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class ChongZhi implements Listener {
@EventHandler
public void onRecharge(RechargeEvent e){
DataManager dataManager = Main.dataManager;
String name = e.getPlayerName();// 充值软妹币的玩家名
// 判断这个玩家是否拜师
if(dataManager.isPlayerExitTeacher(name)){
// 获取这个玩家的师傅名
String sfNameA = dataManager.getTeacherName(name);
// 判断他的师傅是否进行拜师
if(!dataManager.isPlayerExitTeacher(sfNameA)){
// 获取他师傅的等级
ShiFuData shiFuData = dataManager.getTeacherData(sfNameA);
// 若师傅超过15天未上线则不享受此分成
if(shiFuData.isLoginOvertime()){
System.out.println("[调试 - 师徒] 师傅 " + sfNameA + " 因长时间未上线,取消本次分成奖励.");
return;
}
int level = shiFuData.getLevel();
//获取分成比例
double percentage = getPercentage(level);
double incentivePayments = (e.getMoney() * percentage) * 10;
shiFuData.addEarnings(incentivePayments); // 增加师徒币
shiFuData.SaveData(); // 保存数据
System.out.println("[调试 - 师徒] 充值玩家: "+name+" 他的师傅<" + sfNameA + ">获得" + incentivePayments + "师徒币奖励");
Player sfPlayerA = Bukkit.getPlayer(sfNameA);
if(sfPlayerA != null){
DemonAPI.sendMessage(sfPlayerA,"获得徒弟的充值激励收益: §6"+incentivePayments+"师徒币");
}
} else {
// 获取他师傅的等级
ShiFuData shiFuData = dataManager.getTeacherData(sfNameA);
// 若师傅超过7天未上线则不享受此分成
if(shiFuData.isLoginOvertime()){
System.out.println("[调试 - 师徒] 师傅 " + sfNameA + " 因长时间未上线,取消本次分成奖励.");
return;
}
int level = shiFuData.getLevel();
//获取分成比例
double percentage = getPercentage(level);
double incentivePayments = ((e.getMoney() * percentage) * 10 )* 0.5;
shiFuData.addEarnings(incentivePayments); // 增加师徒币
shiFuData.SaveData(); // 保存数据
System.out.println("[调试 - 师徒] 充值玩家: "+name+" 他的师傅<" + sfNameA + ">获得" + incentivePayments + "师徒币奖励");
Player sfPlayerA = Bukkit.getPlayer(sfNameA);
if(sfPlayerA != null){
DemonAPI.sendMessage(sfPlayerA,"获得徒弟的充值激励收益: §6"+incentivePayments+"师徒币");
}
// 获取他师傅的师傅
String sfNameB = dataManager.getTeacherName(sfNameA);
ShiFuData shiFuDataB = dataManager.getTeacherData(sfNameB);
// 若师傅超过7天未上线则不享受此分成
if(shiFuDataB.isLoginOvertime()){
System.out.println("[调试 - 师徒] 师傅 " + sfNameA + " 因长时间未上线,取消本次分成奖励.");
return;
}
shiFuDataB.addEarnings(incentivePayments);// 增加师徒币
System.out.println("[调试 - 师徒] 分成玩家: "+sfNameA+" 他的师傅<" + sfNameB + ">获得" + incentivePayments + "师徒币奖励");
Player sfPlayerB = Bukkit.getPlayer(sfNameB);
if(sfPlayerB != null){
DemonAPI.sendMessage(sfPlayerB,"获得徒弟的充值激励收益: §6"+incentivePayments+"师徒币");
}
}
}
}
public static double getPercentage(int level){
double percentage = 0.05;
if(level == 2){
percentage = 0.1;
}else if(level == 3){
percentage = 0.15;
}else if(level >= 4){
percentage = 0.2;
}
return percentage;
}
}

View File

@ -0,0 +1,86 @@
package me.Demon.DemonShiTu.listener;
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.ItemKuAPI;
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.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
public class itemUse implements Listener {
@EventHandler
public void onUseJoin(PlayerInteractEvent e){
Player p = e.getPlayer();
String name = p.getName();
ItemStack item = p.getInventory().getItemInMainHand();
if(e.getHand() == EquipmentSlot.HAND) {
Action action = e.getAction();
if (action == Action.LEFT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
ItemStack needStack = ItemKuAPI.getItems("出师令", 1);
if(DemonAPI.isMainHandItemsLore(p,needStack,1)){
// 判断这个玩家是否已有师傅档案
if(ShiTuAPI.isTeacherExit(name)){
DemonAPI.sendMessage(p,"你已经出师了,无法使用此道具.");
return;
}
if (item.getAmount() == 1) {
p.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
} else {
item.setAmount(item.getAmount() - 1);
}
// 创建出师档案
DataManager dataManager = Main.dataManager;
dataManager.createTeacherData(name);
DemonAPI.sendMessage(p,"成功注册出师档案,已完成 §e§l出师");
Bukkit.broadcastMessage("§6[§c公告§6] §a玩家 §e"+p.getName()+" §a使用了 §r"+needStack.getItemMeta().getDisplayName()+" §a成功出师,开始收徒。");
}
}
}
}
@EventHandler
public void onUseDissolve(PlayerInteractEvent e){
Player p = e.getPlayer();
String name = p.getName();
ItemStack item = p.getInventory().getItemInMainHand();
if(e.getHand() == EquipmentSlot.HAND) {
Action action = e.getAction();
if (action == Action.LEFT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
ItemStack needStack = ItemKuAPI.getItems("解除令", 1);
if (DemonAPI.isMainHandItemsLore(p, needStack, 1)) {
DataManager dataManager = Main.dataManager;
// 判断这个玩家是否已有师傅档案
if (dataManager.isPlayerExitTeacher(name)) {
DemonAPI.sendMessage(p, "你还没有拜过师,无法使用此道具.");
return;
}
if (item.getAmount() == 1) {
p.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
} else {
item.setAmount(item.getAmount() - 1);
}
String sfName = dataManager.getTeacherName(name);// 获取这个玩家的师傅名
ShiFuData fuData = dataManager.getTeacherData(sfName);// 获取这个玩家的师傅档案
if (fuData == null) {
DemonAPI.sendMessage(p, "师傅的档案数据出现异常.§7#" + sfName);
return;
}
fuData.removeTudiList(name); // 将玩家从徒弟列表踢出.
fuData.SaveData(); // 保存数据
DemonAPI.sendMessage(p,"已经和 §e"+sfName+" §a解除师徒关系.");
}
}
}
}
}

View File

@ -0,0 +1,162 @@
package me.Demon.DemonShiTu.manager;
import me.Demon.DemonPlugin.DemonAPI;
import me.Demon.DemonShiTu.Main;
import me.Demon.DemonShiTu.data.ShiFuData;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class DataManager {
private long monthlyTimeLog;
private long everydayTimeLog;
private HashMap<String, ShiFuData> shiFuDataMap = new HashMap<>();
private HashMap<String, List<String>> apprenticeList = new HashMap<>();
private HashMap<String, List<String>> applyForList = new HashMap<>();
private List<String> activeReward = new ArrayList<>();
public DataManager(){
FileConfiguration yml = Main.plugin.getConfig();
monthlyTimeLog = yml.getLong("monthlyTimeLog");
everydayTimeLog = yml.getLong("everydayTimeLog");
ConfigurationSection section = yml.getConfigurationSection("ShiTuData");
if(section == null) {return;}
for (String shifuName : section.getKeys(false)){
int level = section.getInt(shifuName+".level");
double shouyi = section.getDouble(shifuName+".shouyi");
long loginTime = section.getLong(shifuName+".loginTime");
if(loginTime < 0){
loginTime = System.currentTimeMillis();
}
List<String> stringList = section.getStringList(shifuName+".tudi");
shiFuDataMap.put(shifuName,new ShiFuData(shifuName,level,shouyi,stringList,loginTime));
apprenticeList.put(shifuName,stringList);
}
DemonAPI.sendConsoleMessage("§f[§a!§f] §f每月结算 §8> §6"+DemonAPI.LongToStringData(monthlyTimeLog,"yyyy年MM月"));
DemonAPI.sendConsoleMessage("§f[§a!§f] §f每日刷新 §8> §6"+DemonAPI.LongToStringData(everydayTimeLog,"MM月dd日"));
DemonAPI.sendConsoleMessage("§f[§a!§f] §f师傅档案 §8> §6"+shiFuDataMap.size()+"");
DemonAPI.sendConsoleMessage("§f[§a!§f] §f活跃奖励 §8> §6"+activeReward.size()+"");
}
public void SaveDataManager(){
FileConfiguration yml = Main.plugin.getConfig();
yml.set("monthlyTimeLog",monthlyTimeLog);
yml.set("everydayTimeLog",everydayTimeLog);
yml.set("activeReward",null);
yml.set("activeReward",activeReward);
for (String sfName : shiFuDataMap.keySet()){
ShiFuData fuData = shiFuDataMap.get(sfName);
if(fuData.isLoginOvertime()){
// yml.set("ShiTuData."+sfName,null);
System.out.println("[调试 - 师徒] 由于玩家 "+sfName+" 长时间未上线,他的师徒档案已清理.");
}
fuData.SaveData();
}
System.out.println("[调试 - 师徒] 活跃收益 "+activeReward.size()+"");
System.out.println("[调试 - 师徒] 已保存 "+shiFuDataMap.size()+" 师傅的数据档案");
}
public long getMonthlyTimeLog() {
return monthlyTimeLog;
}
public void setMonthlyTimeLog(long monthlyTimeLog) {
this.monthlyTimeLog = monthlyTimeLog;
}
public long getEverydayTimeLog() {
return everydayTimeLog;
}
public void setEverydayTimeLog(long everydayTimeLog) {
this.everydayTimeLog = everydayTimeLog;
}
public HashMap<String, ShiFuData> getShiFuDataMap() {
return shiFuDataMap;
}
public void removeShiFuData(String sfName) {
this.shiFuDataMap.remove(sfName);
FileConfiguration yml = Main.plugin.getConfig();
yml.set("ShiTuData."+sfName,null);
Main.plugin.saveConfig();
}
public List<String> getApplyForList(String sfName) {
List<String> stringList = new ArrayList<>();
if(this.applyForList.get(sfName) == null){
return stringList;
}
stringList.addAll(applyForList.get(sfName));
return stringList;
}
public void setApplyForList(String sfName,List<String> applyForList) {
this.applyForList.put(sfName,applyForList);
}
// 获取学徒列表
public List<String> getApprenticeList(String name){
if(this.apprenticeList.get(name) != null){
return apprenticeList.get(name);
}
return new ArrayList<>();
}
public boolean isActiveReward(String name){
if(activeReward.contains(name)){
return true;
}
return false;
}
public List<String> getActiveReward() {
return activeReward;
}
public void setActiveReward(List<String> activeReward) {
this.activeReward = activeReward;
}
public ShiFuData getTeacherData(String sfName){
if(this.shiFuDataMap.get(sfName) != null){
return shiFuDataMap.get(sfName);
}
return null;
}
public boolean isPlayerExitTeacher(String name){
for (String teacherName : this.apprenticeList.keySet()){
List<String> stringList = this.apprenticeList.get(teacherName);
if(stringList.contains(name)){
return true;
}
}
return false;
}
public String getTeacherName(String name){
for (String teacherName : this.apprenticeList.keySet()){
List<String> stringList = this.apprenticeList.get(teacherName);
if(stringList.contains(name)){
return teacherName;
}
}
return "";
}
public void createTeacherData(String sfName){
int level = 1;
double shouyi = 0.0;
long loginTime = System.currentTimeMillis();
List<String> stringList = new ArrayList<>();
shiFuDataMap.put(sfName,new ShiFuData(sfName,level,shouyi,stringList,loginTime));
apprenticeList.put(sfName,stringList);
shiFuDataMap.get(sfName).SaveData();
}
}

View File

@ -0,0 +1,79 @@
package me.Demon.DemonShiTu.util;
import net.minecraft.server.v1_12_R1.NBTTagCompound;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class StackLibrary{
public static NBTTagCompound getNBT(ItemStack Equipment) {
net.minecraft.server.v1_12_R1.ItemStack nmsEquipment = CraftItemStack.asNMSCopy(Equipment);
return nmsEquipment.hasTag() && nmsEquipment.getTag() != null ? nmsEquipment.getTag() : new NBTTagCompound();
}
public static ItemStack setNBT(ItemStack item, NBTTagCompound nbtEquipment) {
net.minecraft.server.v1_12_R1.ItemStack nmsEquipment = CraftItemStack.asNMSCopy(item);
nmsEquipment.setTag(nbtEquipment);
return CraftItemStack.asBukkitCopy(nmsEquipment);
}
public static ItemStack tudiInfoShow(){
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§6§l师徒激励计划§6玩法介绍");
List<String> lore = new ArrayList<>();
lore.add("§a§l★§7师傅 = §a玩家A");
lore.add("§a§l★§7徒弟 = §b玩家B");
lore.add("§d§l★§7师徒系统经验加成参考: ");
lore.add("§7- [§a玩家A§7]战力排行§e第一名§7[§b玩家B§7]可获: §d经验加成50% §r");
lore.add("§7- [§a玩家A§7]战力排行§e前三名§7[§b玩家B§7]可获: §d经验加成30%");
lore.add("§7- [§a玩家A§7]战力排行§e前六名§7[§b玩家B§7]可获: §d经验加成20%");
lore.add("§7- [§a玩家A§7]战力排行§e前十名§7[§b玩家B§7]可获: §d经验加成10%");
lore.add("§7- [§a玩家A§7]战力排行§e前30名§7[§b玩家B§7]可获: §d经验加成5%");
lore.add("§c温馨提示:§b徒弟的等级大于90级后将不享有经验加成。");
meta.setLore(lore);
item.setItemMeta(meta);
NBTTagCompound nbti = getNBT(item);
nbti.setString("stex","cailiao_124");
return setNBT(item, nbti);
}
public static ItemStack teacherInfoShow(){
ItemStack item = new ItemStack(Material.PAPER);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§6§l师徒激励计划§6玩法介绍");
List<String> lore = new ArrayList<>();
lore.add("§a§l★§7师傅 = §a玩家A");
lore.add("§a§l★§7徒弟 = §b玩家B");
lore.add("§a§l★§7徒弟的徒弟 = §c玩家C");
lore.add("§d§l★§7玩法大致介绍: ");
lore.add("§7- [§b玩家B§7]拜[§a玩家A§7]为师傅,然后[§b玩家B§7]每日§3在线游玩3小时§7以上");
lore.add("§7- [§a玩家A§7]就能获得§620的师徒币§7作为奖励若[§b玩家B§7]有任意充值");
lore.add("§7- [§a玩家A§7]还能获得§e20%的等价师徒币§7作为奖励依次类推[§c玩家C§7]");
lore.add("§7- 拜玩家[§b玩家B§7]为师当[§b玩家B§7]获得收益的时候,[§a玩家A§7]可获取");
lore.add("§7- [§b玩家B§7]收益的§e50%§7作为§6激励计划§7平分收益若§4解除师徒§7关系");
lore.add("§7- [§b玩家B§7]将不再与[§a玩家A§7§7]平分§6激励计划§7的收益。");
lore.add("§7- 每周一至周五师徒币会额外增加§e[30%]§7的收益。");
lore.add("§d§l✪§7此系统正在测试阶段,若有意见可向客服反馈.");
meta.setLore(lore);
item.setItemMeta(meta);
NBTTagCompound nbti = getNBT(item);
nbti.setString("stex","cailiao_124");
return setNBT(item, nbti);
}
public static ItemStack Back_book(){
ItemStack item = new ItemStack(340);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(" §8« §e返回主页 §8»");
List<String> lore = new ArrayList<>();
lore.add("§a§l★ §7返回师徒主页 §a§l★");
meta.setLore(lore);
item.setItemMeta(meta);
return item;
}
}

View File

View File

@ -0,0 +1,9 @@
name: DemonShiTu
main: me.Demon.DemonShiTu.Main
depend:
- DemonAPI
version: 2.2.0
commands:
st:
stopen:
stadmin:

View File

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
name: DemonShiTu
main: me.Demon.DemonShiTu.Main
depend:
- DemonAPI
version: 2.2.0
commands:
st:
stopen:
stadmin: