测试版
This commit is contained in:
parent
cfc3817073
commit
40544a6ca0
|
@ -1,7 +1,27 @@
|
|||
package me.Demon.DemonLevels;
|
||||
|
||||
import me.Demon.DemonLevels.manage.MobsManage;
|
||||
import me.Demon.DemonLevels.util.ConfigYml;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
|
||||
public static Main plugin;
|
||||
public static boolean Debug = true;
|
||||
|
||||
public static String TypeEvent = "DragonCore";
|
||||
|
||||
public static MobsManage mobsManage;
|
||||
public static ConfigYml configYml;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
File file = new File(getDataFolder(),"Data.yml");
|
||||
FileConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
||||
configYml = new ConfigYml(yml);
|
||||
}
|
||||
}
|
||||
|
|
11
src/main/java/me/Demon/DemonLevels/manage/LevelManage.java
Normal file
11
src/main/java/me/Demon/DemonLevels/manage/LevelManage.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package me.Demon.DemonLevels.manage;
|
||||
|
||||
public class LevelManage {
|
||||
|
||||
private int min;
|
||||
private int max;
|
||||
|
||||
public LevelManage(){
|
||||
|
||||
}
|
||||
}
|
48
src/main/java/me/Demon/DemonLevels/manage/MobsManage.java
Normal file
48
src/main/java/me/Demon/DemonLevels/manage/MobsManage.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package me.Demon.DemonLevels.manage;
|
||||
|
||||
import me.Demon.DemonLevels.Main;
|
||||
import me.Demon.DemonLevels.util.RandomUtil;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class MobsManage {
|
||||
|
||||
private String mmKey;
|
||||
private int minExp;
|
||||
private int maxExp;
|
||||
private boolean randomModel = false;
|
||||
|
||||
public MobsManage(String mmKey,FileConfiguration yml){
|
||||
String expString = yml.getString("MobKillExp."+mmKey);
|
||||
if(expString.contains("~")){
|
||||
String[] strings = expString.split("~");
|
||||
minExp = convertInt(strings[0]);
|
||||
maxExp = convertInt(strings[1]);
|
||||
randomModel = true;
|
||||
}else{
|
||||
minExp = convertInt(expString);
|
||||
maxExp = convertInt(expString);
|
||||
}
|
||||
if(Main.Debug){
|
||||
System.out.println("[日志 - 输出] MM生物: "+mmKey+" Min: "+this.minExp+" Max: "+this.maxExp);
|
||||
}
|
||||
}
|
||||
|
||||
public String getMmKey() {
|
||||
return mmKey;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
if(randomModel){
|
||||
return RandomUtil.getRandomInt(this.minExp,this.maxExp);
|
||||
}
|
||||
return maxExp;
|
||||
}
|
||||
|
||||
private int convertInt(String string){
|
||||
try {
|
||||
return Integer.parseInt(string);
|
||||
} catch (NumberFormatException e) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
53
src/main/java/me/Demon/DemonLevels/util/ConfigYml.java
Normal file
53
src/main/java/me/Demon/DemonLevels/util/ConfigYml.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package me.Demon.DemonLevels.util;
|
||||
|
||||
import me.Demon.DemonLevels.manage.MobsManage;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class ConfigYml {
|
||||
|
||||
private TreeMap<Integer,String> rankTitleMap = new TreeMap<>();
|
||||
private HashMap<String, MobsManage> manageHashMap = new HashMap<>();
|
||||
|
||||
public ConfigYml(FileConfiguration yml){
|
||||
loadRankTitle(yml);
|
||||
}
|
||||
|
||||
public void loadMobExperienceManagement(FileConfiguration yml){
|
||||
ConfigurationSection section = yml.getConfigurationSection("MobKillExp");
|
||||
if(section == null){
|
||||
System.out.println("[错误报告] MobKillExp 配置不存在.");
|
||||
return;
|
||||
}
|
||||
for (String mmKey : section.getKeys(false)){
|
||||
manageHashMap.put(mmKey,new MobsManage(mmKey,yml));
|
||||
}
|
||||
}
|
||||
public void loadRankTitle(FileConfiguration yml){
|
||||
ConfigurationSection section = yml.getConfigurationSection("CustonName");
|
||||
if(section == null){
|
||||
System.out.println("[错误报告] CustonName 配置不存在.");
|
||||
return;
|
||||
}
|
||||
for (String levelKey : section.getKeys(false)){
|
||||
int level = Integer.parseInt(levelKey);
|
||||
String title = section.getString(levelKey);
|
||||
if(title != null){
|
||||
rankTitleMap.put(level,title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getRankTitle(int level) {
|
||||
Map.Entry<Integer, String> entry = rankTitleMap.floorEntry(level);
|
||||
if (entry != null) {
|
||||
return entry.getValue();
|
||||
}
|
||||
return "§7器士";
|
||||
}
|
||||
|
||||
}
|
53
src/main/java/me/Demon/DemonLevels/util/RandomUtil.java
Normal file
53
src/main/java/me/Demon/DemonLevels/util/RandomUtil.java
Normal file
|
@ -0,0 +1,53 @@
|
|||
package me.Demon.DemonLevels.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomUtil {
|
||||
|
||||
public static boolean random(double d) {
|
||||
return d >= new Random().nextFloat();
|
||||
}
|
||||
|
||||
public static boolean isEven(int number) {
|
||||
return number % 2 == 0;
|
||||
}
|
||||
|
||||
public static int getRandomInt(int min, int max) {
|
||||
if (min == max) {
|
||||
return max;
|
||||
}
|
||||
Random r = new Random();
|
||||
int i = min < max ? min : max;
|
||||
int a = min < max ? max : min;
|
||||
return r.nextInt(a - i + 1) + i;
|
||||
}
|
||||
|
||||
public static double getRandomDouble(double min, double max, int scl) {
|
||||
int pow = (int) Math.pow(10, scl);
|
||||
return Math.floor((Math.random() * (max - min) + min) * pow) / pow;
|
||||
}
|
||||
|
||||
public static Location getRandomLocation(World world, double minX, double maxX, double minY, double maxY, double minZ, double maxZ) {
|
||||
double rx = getRandomDouble(minX, maxX, 3);
|
||||
double ry = getRandomDouble(minY, maxY, 3);
|
||||
double rz = getRandomDouble(minZ, maxZ, 3);
|
||||
Location location = new Location(world, rx, ry, rz);
|
||||
return location;
|
||||
}
|
||||
public static Location getRandomLocation(Player zhubo,World world, double minX, double maxX, double minY, double maxY, double minZ, double maxZ) {
|
||||
Location location = zhubo.getLocation().add(getRandomInt(-2,2),0,getRandomInt(-2,2));
|
||||
for (int i = 0; i < 10;i++) {
|
||||
Location loc = new Location(world, getRandomDouble(minX, maxX, 3), getRandomDouble(minY, maxY, 3), getRandomDouble(minZ, maxZ, 3));
|
||||
if (loc.distance(zhubo.getLocation()) <= 50) {
|
||||
location = loc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
}
|
116
src/main/resources/Data.yml
Normal file
116
src/main/resources/Data.yml
Normal file
|
@ -0,0 +1,116 @@
|
|||
CustonName:
|
||||
105: "§9§l极§d§l限§c§l斗§e§l神"
|
||||
100: "§9§l极§d§l限§c§l斗§e§l神"
|
||||
90: "§c封号斗魂"
|
||||
80: "§6魂斗者"
|
||||
70: "§d灵圣"
|
||||
60: "§e灵帝"
|
||||
50: "§c灵王"
|
||||
40: "§6灵宗"
|
||||
30: "§5灵尊"
|
||||
20: "§3大灵师"
|
||||
10: "§2器师"
|
||||
0: "§7器士"
|
||||
NeelUpExp:
|
||||
0: "%level% * 100"
|
||||
5: "%level% * 200"
|
||||
10: "%level% * 400"
|
||||
15: "%level% * 800"
|
||||
20: "%level% * 1000"
|
||||
25: "%level% * 1500"
|
||||
30: "%level% * 5000"
|
||||
35: "%level% * 6500"
|
||||
40: "%level% * 8000"
|
||||
45: "%level% * 10000"
|
||||
50: "%level% * 12000"
|
||||
55: "%level% * 14000"
|
||||
60: "%level% * 15000"
|
||||
65: "%level% * 20000"
|
||||
70: "%level% * 25000"
|
||||
75: "%level% * 100000"
|
||||
80: "%level% * 200000"
|
||||
85: "%level% * 400000"
|
||||
90: "%level% * 600000"
|
||||
95: "%level% * 1200000"
|
||||
100: "%level% * 3000000"
|
||||
105: "%level% * 5000000"
|
||||
110: "%level% * 8000000"
|
||||
115: "%level% * 10000000"
|
||||
MobKillExp:
|
||||
落日森林_10风狒狒: 20~40
|
||||
落日森林_10啮齿鼬: 20~40
|
||||
落日森林_10幽冥狼: 20~40
|
||||
落日森林_10孤竹: 20~40
|
||||
落日森林_10银狼: 20~40
|
||||
落日森林_10金狼: 20~40
|
||||
落日森林_100风灵狼: 80~120
|
||||
落日森林_100鬼藤: 80~120
|
||||
落日森林_100疾风魔狼: 80~120
|
||||
落日森林_100曼陀罗蛇: 80~120
|
||||
落日森林_1000粉红娘娘: 280~320
|
||||
落日森林_1000冰蚕: 280~320
|
||||
落日森林_1000鬼虎: 280~320
|
||||
落日森林_1000人面魔蛛: 280~320
|
||||
落日森林_10000剑齿鱼: 600~800
|
||||
落日森林_10000地穴魔蛛: 600~800
|
||||
星斗森林_10风狒狒: 10~40
|
||||
星斗森林_10啮齿鼬: 10~40
|
||||
星斗森林_10幽冥狼: 10~40
|
||||
星斗森林_10孤竹: 10~40
|
||||
星斗森林_10银狼: 10~40
|
||||
星斗森林_10金狼: 10~40
|
||||
星斗森林_10斑斓猫: 10~40
|
||||
星斗森林_100狼盗: 160~240
|
||||
星斗森林_100风灵狼: 160~240
|
||||
星斗森林_100鬼藤: 160~240
|
||||
星斗森林_100疾风魔狼: 160~240
|
||||
星斗森林_100曼陀罗蛇: 160~240
|
||||
星斗森林_1000粉红娘娘: 360~480
|
||||
星斗森林_1000冰蚕: 360~480
|
||||
星斗森林_1000鬼虎: 360~480
|
||||
星斗森林_1000凤尾鸡冠蛇: 360~480
|
||||
星斗森林_1000四眼鳞甲兽: 360~480
|
||||
星斗森林_1000大地之王: 360~480
|
||||
星斗森林_1000魔暝鹿: 360~480
|
||||
星斗森林_1000人面魔蛛: 360~480
|
||||
星斗森林_10000剑齿鱼: 800~1500
|
||||
星斗森林_10000地穴魔蛛: 800~1500
|
||||
星斗森林_10000疾风魔狼: 800~1500
|
||||
星斗森林_10000镜像兽: 800~1500
|
||||
星斗森林_10000千钧蚁皇: 800~1500
|
||||
星斗森林_10000翠魔鸟: 800~1500
|
||||
星斗森林_10000化蛇: 800~1500
|
||||
星斗森林_10000青影狮鹫: 800~1500
|
||||
经验猪: 2500~5000
|
||||
极寒冰域_1000炽眼猪妖: 500~800
|
||||
极寒冰域_1000三足金乌: 500~800
|
||||
极寒冰域_1000极寒九婴: 500~800
|
||||
极寒冰域_10000镜像兽: 1000~1800
|
||||
极寒冰域_10000冰雪凤凰: 1000~1800
|
||||
冰火两仪眼_10000剑齿鱼: 1200~1800
|
||||
冰火两仪眼_10000地穴魔蛛: 1200~1800
|
||||
冰火两仪眼_10000疾风魔狼: 1200~1800
|
||||
冰火两仪眼_10000镜像兽: 1200~1800
|
||||
冰火两仪眼_10000千钧蚁皇: 1200~1800
|
||||
冰火两仪眼_10000化蛇: 1200~1800
|
||||
冰火两仪眼_10000青影狮鹫: 1200~1800
|
||||
冰火两仪眼_10000暗黑邪神虎: 1200~1800
|
||||
冰火两仪眼_10000冰碧蝎: 1200~1800
|
||||
冰火两仪眼_10000翠魔鸟: 1200~1800
|
||||
冰火两仪眼_奇茸通天菊: 100~800
|
||||
冰火两仪眼_八瓣仙兰: 100~800
|
||||
冰火两仪眼_相思断肠红: 100~800
|
||||
冰火两仪眼_水仙玉肌骨: 100~800
|
||||
杀戮都市_风灵狼: 3000~5000
|
||||
杀戮都市_鬼藤: 3000~5000
|
||||
杀戮都市_疾风魔狼: 3000~5000
|
||||
杀戮都市_曼陀罗蛇: 3000~5000
|
||||
杀戮都市_粉红娘娘: 3000~5000
|
||||
杀戮都市_冰蚕: 3000~5000
|
||||
杀戮都市_鬼虎: 3000~5000c
|
||||
杀戮都市_四眼鳞甲兽: 3000~5000
|
||||
杀戮都市_魔暝鹿: 3000~5000
|
||||
杀戮都市_杀戮暴徒: 5000~7000
|
||||
杀戮都市_堕落暴徒: 4000~6000
|
||||
武魂殿_巡逻魂师: 6000~9000
|
||||
武魂殿_魂师喽啰: 7000~10000
|
Loading…
Reference in New Issue
Block a user