update to v2.3.0
This commit is contained in:
@@ -30,20 +30,20 @@ public class MainCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch(args[0].toLowerCase()){
|
switch(args[0].toLowerCase()){
|
||||||
case "parse" : {
|
// case "parse" : {
|
||||||
if(!sender.isOp()) return false;
|
// if(!sender.isOp()) return false;
|
||||||
if(args.length == 2) GroovyManager.invoke("test.groovy", args[1]);
|
// if(args.length == 2) GroovyManager.invoke("test.groovy", args[1]);
|
||||||
else if(args.length == 3) GroovyManager.invoke("test.groovy",args[1],Bukkit.getPlayer(args[2]));
|
// else if(args.length == 3) GroovyManager.invoke("test.groovy",args[1],Bukkit.getPlayer(args[2]));
|
||||||
// List<Entity> entities = p.getNearbyEntities(50,50,50);
|
//// List<Entity> entities = p.getNearbyEntities(50,50,50);
|
||||||
// entities.forEach(entity -> {
|
//// entities.forEach(entity -> {
|
||||||
// if(entity instanceof org.bukkit.entity.EnderDragon){
|
//// if(entity instanceof org.bukkit.entity.EnderDragon){
|
||||||
// org.bukkit.entity.EnderDragon dragon = (org.bukkit.entity.EnderDragon) entity;
|
//// org.bukkit.entity.EnderDragon dragon = (org.bukkit.entity.EnderDragon) entity;
|
||||||
// //dragon.setPhase(CHARGE_PLAYER);
|
//// //dragon.setPhase(CHARGE_PLAYER);
|
||||||
// //SkillManager.launchDragonFireball(dragon,p.getLocation());
|
//// //SkillManager.launchDragonFireball(dragon,p.getLocation());
|
||||||
// SkillManager.callEnderManReinforce(p,3);
|
//// SkillManager.callEnderManReinforce(p,3);
|
||||||
// }
|
//// }
|
||||||
//
|
////
|
||||||
//
|
////
|
||||||
//// if(entity instanceof org.bukkit.entity.EnderDragon){
|
//// if(entity instanceof org.bukkit.entity.EnderDragon){
|
||||||
//// Bukkit.broadcastMessage(entity.getName());//1 Special Ender Dragon
|
//// Bukkit.broadcastMessage(entity.getName());//1 Special Ender Dragon
|
||||||
//// }
|
//// }
|
||||||
@@ -53,10 +53,10 @@ public class MainCommand implements CommandExecutor {
|
|||||||
//// if(entity instanceof ComplexLivingEntity){
|
//// if(entity instanceof ComplexLivingEntity){
|
||||||
//// Bukkit.broadcastMessage(entity.getName());//8 EnderDragon
|
//// Bukkit.broadcastMessage(entity.getName());//8 EnderDragon
|
||||||
//// }
|
//// }
|
||||||
// });
|
//// });
|
||||||
|
//
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
case "action" : {
|
case "action" : {
|
||||||
if(!sender.isOp()){
|
if(!sender.isOp()){
|
||||||
Lang.sendFeedback(sender,Lang.command_no_permission);
|
Lang.sendFeedback(sender,Lang.command_no_permission);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package pers.xanadu.enderdragon.config;
|
|||||||
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import pers.xanadu.enderdragon.EnderDragon;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@@ -10,9 +9,9 @@ import static pers.xanadu.enderdragon.EnderDragon.*;
|
|||||||
|
|
||||||
public class FileUpdater {
|
public class FileUpdater {
|
||||||
public static void update() throws IOException {
|
public static void update() throws IOException {
|
||||||
String respawn_world_name = null;
|
|
||||||
FileConfiguration config_old = plugin.getConfig();
|
FileConfiguration config_old = plugin.getConfig();
|
||||||
if("2.1.0".equals(config_old.getString("version"))){
|
if("2.2.0".equals(config_old.getString("version"))){
|
||||||
Config.saveResource("config.yml","new/config.yml",true);
|
Config.saveResource("config.yml","new/config.yml",true);
|
||||||
File config_new_F = new File(plugin.getDataFolder(),"new/config.yml");
|
File config_new_F = new File(plugin.getDataFolder(),"new/config.yml");
|
||||||
FileConfiguration config_new = YamlConfiguration.loadConfiguration(config_new_F);
|
FileConfiguration config_new = YamlConfiguration.loadConfiguration(config_new_F);
|
||||||
@@ -24,111 +23,26 @@ public class FileUpdater {
|
|||||||
config_new.set("special_dragon_jude_mode",judge_mode);
|
config_new.set("special_dragon_jude_mode",judge_mode);
|
||||||
config_new.set("dragon_setting_file",config_old.getStringList("dragon_setting_file"));
|
config_new.set("dragon_setting_file",config_old.getStringList("dragon_setting_file"));
|
||||||
// auto_respawn
|
// auto_respawn
|
||||||
config_new.set("auto_respawn.task1.enable",config_old.getBoolean("auto_respawn.enable"));
|
config_new.set("auto_respawn",config_old.getConfigurationSection("auto_respawn"));
|
||||||
respawn_world_name = config_old.getString("auto_respawn.world_the_end_name");
|
|
||||||
config_new.set("auto_respawn.task1.world_name",respawn_world_name);
|
|
||||||
config_new.set("auto_respawn.task1.respawn_time",config_old.getString("auto_respawn.respawn_time"));
|
|
||||||
config_new.set("crystal_invulnerable",config_old.getBoolean("auto_respawn.invulnerable"));
|
|
||||||
|
|
||||||
config_new.set("respawn_cd.enable",config_old.getBoolean("respawn_cd.enable"));
|
config_new.set("respawn_cd.enable",config_old.getBoolean("respawn_cd.enable"));
|
||||||
|
config_new.set("crystal_invulnerable",config_old.getBoolean("crystal_invulnerable"));
|
||||||
config_new.set("resist_player_respawn",config_old.getBoolean("resist_player_respawn"));
|
config_new.set("resist_player_respawn",config_old.getBoolean("resist_player_respawn"));
|
||||||
config_new.set("resist_dragon_breath_gather",config_old.getBoolean("resist_dragon_breath_gather"));
|
config_new.set("resist_dragon_breath_gather",config_old.getBoolean("resist_dragon_breath_gather"));
|
||||||
config_new.set("main_gui",config_old.getString("main_gui"));
|
config_new.set("main_gui",config_old.getString("main_gui"));
|
||||||
config_new.set("blacklist_worlds",config_old.getStringList("blacklist_worlds"));
|
config_new.set("blacklist_worlds",config_old.getStringList("blacklist_worlds"));
|
||||||
//item_format.data -> item_format.reward
|
config_new.set("item_format.reward",config_old.getString("item_format.reward"));
|
||||||
config_new.set("item_format.reward",config_old.getString("item_format.data"));
|
|
||||||
|
|
||||||
config_new.set("hook_plugins.MythicLib",config_old.getBoolean("hook_plugins.MythicLib"));
|
config_new.set("hook_plugins.MythicLib",config_old.getBoolean("hook_plugins.MythicLib"));
|
||||||
|
config_new.set("expansion.groovy",config_old.getBoolean("expansion.groovy"));
|
||||||
config_new.set("debug",config_old.getBoolean("debug"));
|
config_new.set("debug",config_old.getBoolean("debug"));
|
||||||
config_new.set("advanced_setting.world_env_fix",config_old.getBoolean("advanced_setting.world_env_fix"));
|
config_new.set("advanced_setting.world_env_fix",config_old.getBoolean("advanced_setting.world_env_fix"));
|
||||||
config_new.set("advanced_setting.save_respawn_status",config_old.getBoolean("advanced_setting.save_respawn_status"));
|
config_new.set("advanced_setting.save_respawn_status",config_old.getBoolean("advanced_setting.save_respawn_status"));
|
||||||
|
config_new.set("save_bossbar",config_old.getBoolean("save_bossbar"));
|
||||||
|
config_new.set("backslash_split.reward",config_old.getBoolean("backslash_split.reward"));
|
||||||
config_new.save(config_new_F);
|
config_new.save(config_new_F);
|
||||||
}
|
}
|
||||||
else Lang.error("The version of config.yml is not supported!");
|
else Lang.error("The version of config.yml is not supported!");
|
||||||
File folder = new File(plugin.getDataFolder(),"setting");
|
|
||||||
if(folder.exists()){
|
|
||||||
File[] files = folder.listFiles();
|
|
||||||
if(files != null){
|
|
||||||
for(File file : files){
|
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
|
|
||||||
String ver = config.getString("version");
|
|
||||||
if(!"2.1.0".equals(ver)) {
|
|
||||||
Lang.error("The version of setting/"+file.getName()+" is not supported!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String name = file.getName();
|
|
||||||
Config.copyFile("setting/"+name,"new/setting/"+name,true);
|
|
||||||
}
|
|
||||||
File new_folder = new File(plugin.getDataFolder(),"new/setting/");
|
|
||||||
files = new_folder.listFiles();
|
|
||||||
if(files != null){
|
|
||||||
for(File file : files){
|
|
||||||
FileOutputStream out = new FileOutputStream(file,true);
|
|
||||||
out.write(("\n\n" +
|
|
||||||
"# the least interval time between injuries (unit:tick, 1tick=0.05s)\n" +
|
|
||||||
"# only supports integer value\n" +
|
|
||||||
"no_damage_tick: 10\n" +
|
|
||||||
"\n" +
|
|
||||||
"attack:\n" +
|
|
||||||
" #the damage modify when this dragon attacks player with body or limb (allow double and negative value)\n" +
|
|
||||||
" damage_modify: 0\n" +
|
|
||||||
"\n" +
|
|
||||||
" #the effect give to player when this ender dragon attacks player with body or limb\n" +
|
|
||||||
" #the format is the same as effect_cloud.potion\n" +
|
|
||||||
" potion_effect:\n" +
|
|
||||||
" - ''\n" +
|
|
||||||
" - ''\n" +
|
|
||||||
" - ''\n" +
|
|
||||||
"\n" +
|
|
||||||
" # the effect give to player when this ender dragon attacks player with body or limb\n" +
|
|
||||||
" # format: (<type>: seconds)\n" +
|
|
||||||
" extra_effect:\n" +
|
|
||||||
" fire: 0\n" +
|
|
||||||
" # \"freeze\" can only be used in server greater than or equal to version 1.17\n" +
|
|
||||||
" freeze: 0\n" +
|
|
||||||
"\n"
|
|
||||||
).getBytes());
|
|
||||||
out.close();
|
|
||||||
FileConfiguration fc = YamlConfiguration.loadConfiguration(file);
|
|
||||||
fc.set("version","2.2.0");
|
|
||||||
fc.set("attack.damage_modify",fc.getDouble("attack_damage_modify"));
|
|
||||||
fc.set("attack_damage_modify",null);
|
|
||||||
fc.get("attack.potion_effect",fc.getStringList("attack_potion_effect"));
|
|
||||||
fc.set("attack_potion_effect",null);
|
|
||||||
fc.save(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String lang_name = config_old.getString("lang","English") + ".yml";
|
|
||||||
FileConfiguration lang_old = lang;
|
|
||||||
if("2.1.0".equals(lang_old.getString("version"))){
|
|
||||||
Config.saveResource("lang/"+lang_name,"new/lang/"+lang_name,true);
|
|
||||||
File lang_new_F = new File(plugin.getDataFolder(),"new/lang/"+lang_name);
|
|
||||||
FileConfiguration lang_new = YamlConfiguration.loadConfiguration(lang_new_F);
|
|
||||||
lang_old.getKeys(true).forEach(key->{
|
|
||||||
Object obj = lang_old.get(key);
|
|
||||||
lang_new.set(key,obj);
|
|
||||||
});
|
|
||||||
lang_new.set("version","2.2.0");
|
|
||||||
lang_new.save(lang_new_F);
|
|
||||||
}
|
|
||||||
else Lang.error("The version of "+lang_name+" is not supported!");
|
|
||||||
|
|
||||||
FileConfiguration data_old = EnderDragon.data;
|
|
||||||
if("2.1.0".equals(data_old.getString("version"))){
|
|
||||||
Config.copyFile("data.yml","new/data.yml",true);
|
|
||||||
File new_data_file = new File(plugin.getDataFolder(),"new/data.yml");
|
|
||||||
FileConfiguration new_data = YamlConfiguration.loadConfiguration(new_data_file);
|
|
||||||
String next_time = new_data.getString("auto_respawn.next_respawn_time");
|
|
||||||
new_data.set("version","2.2.0");
|
|
||||||
if(next_time!=null && respawn_world_name!=null){
|
|
||||||
new_data.set("auto_respawn.task1.world_name",respawn_world_name);
|
|
||||||
new_data.set("auto_respawn.task1.next_respawn_time",next_time);
|
|
||||||
}
|
|
||||||
new_data.save(new_data_file);
|
|
||||||
}
|
|
||||||
else Lang.error("The version of data.yml is not supported!");
|
|
||||||
Lang.info("New config files are generated in plugins/EnderDragon/new.");
|
Lang.info("New config files are generated in plugins/EnderDragon/new.");
|
||||||
Lang.warn("Attention: Please confirm the accuracy before using new config!");
|
Lang.warn("Attention: Please confirm the accuracy before using new config!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ import org.bukkit.entity.EnderDragon;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
/**
|
||||||
|
* Called when a dragon is damaged by a player, including block_explosion.
|
||||||
|
*/
|
||||||
public final class DragonDamageByPlayerEvent extends EntityDamageByEntityEvent {
|
public final class DragonDamageByPlayerEvent extends EntityDamageByEntityEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
private final Player damager;
|
private final Player damager;
|
||||||
private final EnderDragon dragon;
|
private final EnderDragon dragon;
|
||||||
private final DamageCause cause;
|
|
||||||
private final double finalDamage;
|
private final double finalDamage;
|
||||||
|
|
||||||
public DragonDamageByPlayerEvent(final Player damager, final EnderDragon dragon, final DamageCause cause, final double finalDamage) {
|
public DragonDamageByPlayerEvent(final Player damager, final EnderDragon dragon, final DamageCause cause, final double finalDamage) {
|
||||||
super(damager, dragon, cause, finalDamage);
|
super(damager, dragon, cause, finalDamage);
|
||||||
this.damager = damager;
|
this.damager = damager;
|
||||||
this.dragon = dragon;
|
this.dragon = dragon;
|
||||||
this.cause = cause;
|
|
||||||
this.finalDamage = finalDamage;
|
this.finalDamage = finalDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,15 +29,15 @@ public final class DragonDamageByPlayerEvent extends EntityDamageByEntityEvent {
|
|||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void setCancelled(final boolean cancel) {
|
public void setCancelled(final boolean cancel) {
|
||||||
this.cancel = cancel;
|
this.cancel = cancel;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancel;
|
return cancel;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public Player getDamager() {
|
public Player getDamager() {
|
||||||
return damager;
|
return damager;
|
||||||
}
|
}
|
||||||
@@ -46,9 +46,6 @@ public final class DragonDamageByPlayerEvent extends EntityDamageByEntityEvent {
|
|||||||
return dragon;
|
return dragon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DamageCause getDamagerCause() {
|
|
||||||
return cause;
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public double getDamage() {
|
public double getDamage() {
|
||||||
return finalDamage;
|
return finalDamage;
|
||||||
|
|||||||
+7
-3
@@ -7,13 +7,17 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import pers.xanadu.enderdragon.manager.DragonManager;
|
import pers.xanadu.enderdragon.manager.DragonManager;
|
||||||
import pers.xanadu.enderdragon.util.MyDragon;
|
import pers.xanadu.enderdragon.util.MyDragon;
|
||||||
|
/**
|
||||||
public final class DragonRespawnEvent extends CreatureSpawnEvent {
|
* Called when a dragon is spawned, filtered through blacklist.
|
||||||
|
* <p>
|
||||||
|
* Cancelling this event make no changes.
|
||||||
|
*/
|
||||||
|
public final class DragonRespawnPostEvent extends CreatureSpawnEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean cancel = false;
|
private boolean cancel = false;
|
||||||
private final World world;
|
private final World world;
|
||||||
private final MyDragon myDragon;
|
private final MyDragon myDragon;
|
||||||
public DragonRespawnEvent(final EnderDragon dragon,final SpawnReason reason,final MyDragon myDragon) {
|
public DragonRespawnPostEvent(final EnderDragon dragon, final SpawnReason reason, final MyDragon myDragon) {
|
||||||
super(dragon,reason);
|
super(dragon,reason);
|
||||||
world = dragon.getWorld();
|
world = dragon.getWorld();
|
||||||
this.myDragon = myDragon;
|
this.myDragon = myDragon;
|
||||||
@@ -20,13 +20,17 @@ public class DragonBaseHurtListener implements Listener {
|
|||||||
EnderDragon dragon = (EnderDragon) victim;
|
EnderDragon dragon = (EnderDragon) victim;
|
||||||
if(entity instanceof Player){
|
if(entity instanceof Player){
|
||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
pm.callEvent(new DragonDamageByPlayerEvent(player,dragon,e.getCause(),e.getFinalDamage()));
|
DragonDamageByPlayerEvent event = new DragonDamageByPlayerEvent(player,dragon,e.getCause(),e.getFinalDamage());
|
||||||
|
pm.callEvent(event);
|
||||||
|
if(event.isCancelled()) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
else if(entity instanceof Projectile){
|
else if(entity instanceof Projectile){
|
||||||
Projectile projectile = (Projectile) entity;
|
Projectile projectile = (Projectile) entity;
|
||||||
if(!(projectile.getShooter() instanceof Player)) return;
|
if(!(projectile.getShooter() instanceof Player)) return;
|
||||||
Player damager = (Player) projectile.getShooter();
|
Player damager = (Player) projectile.getShooter();
|
||||||
pm.callEvent(new DragonDamageByPlayerEvent(damager,dragon,e.getCause(),e.getFinalDamage()));
|
DragonDamageByPlayerEvent event = new DragonDamageByPlayerEvent(damager,dragon,e.getCause(),e.getFinalDamage());
|
||||||
|
pm.callEvent(event);
|
||||||
|
if(event.isCancelled()) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class DragonDamageByPlayerListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void OnDragonDamageByPlayer(final DragonDamageByPlayerEvent e){
|
public void OnDragonDamageByPlayer(final DragonDamageByPlayerEvent e){
|
||||||
|
if(e.isCancelled()) return;
|
||||||
Player p = e.getDamager();
|
Player p = e.getDamager();
|
||||||
EnderDragon dragon = e.getDragon();
|
EnderDragon dragon = e.getDragon();
|
||||||
double health = dragon.getHealth();
|
double health = dragon.getHealth();
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ public class DragonExplosionHurtListener implements Listener {
|
|||||||
TNTPrimed tnt = (TNTPrimed) entity;
|
TNTPrimed tnt = (TNTPrimed) entity;
|
||||||
if(!(tnt.getSource() instanceof Player)) return;
|
if(!(tnt.getSource() instanceof Player)) return;
|
||||||
Player damager = (Player) tnt.getSource();
|
Player damager = (Player) tnt.getSource();
|
||||||
pers.xanadu.enderdragon.EnderDragon.pm.callEvent(new DragonDamageByPlayerEvent(damager,dragon,e.getCause(),e.getFinalDamage()));
|
DragonDamageByPlayerEvent event = new DragonDamageByPlayerEvent(damager,dragon,e.getCause(),e.getFinalDamage());
|
||||||
|
pm.callEvent(event);
|
||||||
|
if(event.isCancelled()) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,16 +56,15 @@ public class DragonExplosionHurtListener implements Listener {
|
|||||||
if(e.getCause() != EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) return;
|
if(e.getCause() != EntityDamageEvent.DamageCause.BLOCK_EXPLOSION) return;
|
||||||
Entity entity = e.getEntity();
|
Entity entity = e.getEntity();
|
||||||
if(entity instanceof EnderDragon){
|
if(entity instanceof EnderDragon){
|
||||||
//Bukkit.broadcastMessage(e.getFinalDamage()+"awa");
|
|
||||||
EnderDragon dragon = (EnderDragon) entity;
|
EnderDragon dragon = (EnderDragon) entity;
|
||||||
for(UUID uuid : mp.keySet()){
|
for(UUID uuid : mp.keySet()){
|
||||||
PlayerExplodeDragonEvent ped = mp.get(uuid);
|
PlayerExplodeDragonEvent ped = mp.get(uuid);
|
||||||
if(ped == null) continue;
|
if(ped == null) continue;
|
||||||
if(ped.getTime() != time) continue;
|
if(ped.getTime() != time) continue;
|
||||||
if(ped.getEnderDragon().getUniqueId() != dragon.getUniqueId()) continue;
|
if(ped.getEnderDragon().getUniqueId() != dragon.getUniqueId()) continue;
|
||||||
//mp.remove(uuid);
|
DragonDamageByPlayerEvent event = new DragonDamageByPlayerEvent(ped.getPlayer(),dragon,cause,e.getFinalDamage());
|
||||||
pm.callEvent(new DragonDamageByPlayerEvent(ped.getPlayer(),dragon,cause,e.getFinalDamage()));
|
pm.callEvent(event);
|
||||||
//Bukkit.broadcastMessage("final: "+e.getFinalDamage());
|
if(event.isCancelled()) e.setCancelled(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +83,6 @@ public class DragonExplosionHurtListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void clearUID(final UUID uuid){
|
public static void clearUID(final UUID uuid){
|
||||||
mp.remove(uuid);
|
mp.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import pers.xanadu.enderdragon.config.Config;
|
import pers.xanadu.enderdragon.config.Config;
|
||||||
import pers.xanadu.enderdragon.config.Lang;
|
import pers.xanadu.enderdragon.config.Lang;
|
||||||
import pers.xanadu.enderdragon.event.DragonRespawnEvent;
|
import pers.xanadu.enderdragon.event.DragonRespawnPostEvent;
|
||||||
import pers.xanadu.enderdragon.manager.DamageManager;
|
import pers.xanadu.enderdragon.manager.DamageManager;
|
||||||
import pers.xanadu.enderdragon.util.MyDragon;
|
import pers.xanadu.enderdragon.util.MyDragon;
|
||||||
import pers.xanadu.enderdragon.util.Version;
|
import pers.xanadu.enderdragon.util.Version;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import static pers.xanadu.enderdragon.EnderDragon.*;
|
import static pers.xanadu.enderdragon.EnderDragon.*;
|
||||||
@@ -72,7 +73,10 @@ public class DragonSpawnListener implements Listener {
|
|||||||
else if(Version.mcMainVersion >= 12){
|
else if(Version.mcMainVersion >= 12){
|
||||||
getInstance().getBossBarManager().setBossBar(dragon.getWorld(),myDragon.display_name,bossBar_color,bossBar_style);
|
getInstance().getBossBarManager().setBossBar(dragon.getWorld(),myDragon.display_name,bossBar_color,bossBar_style);
|
||||||
}
|
}
|
||||||
Bukkit.getPluginManager().callEvent(new DragonRespawnEvent(dragon,e.getSpawnReason(),myDragon));
|
Bukkit.getPluginManager().callEvent(new DragonRespawnPostEvent(dragon,e.getSpawnReason(),myDragon));
|
||||||
|
if(Config.advanced_setting_save_bossbar){
|
||||||
|
getInstance().getBossBarManager().saveBossBarData(Collections.singletonList(dragon.getWorld()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class PlayerAttackListener implements Listener {
|
|||||||
if(final_damage > 0.0d){
|
if(final_damage > 0.0d){
|
||||||
DragonDamageByPlayerEvent event = new DragonDamageByPlayerEvent(e.getAttacker().getPlayer(),dragon, e.toBukkit().getCause(), final_damage);
|
DragonDamageByPlayerEvent event = new DragonDamageByPlayerEvent(e.getAttacker().getPlayer(),dragon, e.toBukkit().getCause(), final_damage);
|
||||||
pm.callEvent(event);
|
pm.callEvent(event);
|
||||||
|
if(event.isCancelled()) e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,9 +70,6 @@ public class Events<T extends Event> implements Listener, EventExecutor {
|
|||||||
GroovyManager.event_set.add(tmp);
|
GroovyManager.event_set.add(tmp);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
// private static <T extends Event> void register(Class<T> clazz, Events<T> event, EventPriority priority, boolean ignoreCancelled) {
|
|
||||||
// Bukkit.getPluginManager().registerEvent(clazz,event,priority,event,plugin,ignoreCancelled);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(@NotNull Listener listener, @NotNull Event event) {
|
public void execute(@NotNull Listener listener, @NotNull Event event) {
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ public class ColorUtil {
|
|||||||
}
|
}
|
||||||
private static int[] gradient(String start,String end,int length){
|
private static int[] gradient(String start,String end,int length){
|
||||||
int[] color = new int[length];
|
int[] color = new int[length];
|
||||||
int[] rgb1 = MathUtil.hexToInt(start);
|
int[] rgb1 = MathUtil.hex2Int(start);
|
||||||
int[] rgb2 = MathUtil.hexToInt(end);
|
int[] rgb2 = MathUtil.hex2Int(end);
|
||||||
if(length==0){return color;}
|
if(length==0){return color;}
|
||||||
if(length==1){
|
if(length==1){
|
||||||
for(int j=0;j<3;j++){
|
for(int j=0;j<3;j++){
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class MathUtil {
|
|||||||
BigDecimal b2 = new BigDecimal(d2);
|
BigDecimal b2 = new BigDecimal(d2);
|
||||||
return b1.divide(b2,len, RoundingMode.HALF_UP).doubleValue();
|
return b1.divide(b2,len, RoundingMode.HALF_UP).doubleValue();
|
||||||
}
|
}
|
||||||
public static int[] hexToInt(final String hex){
|
public static int[] hex2Int(final String hex){
|
||||||
int[] result = new int[3];
|
int[] result = new int[3];
|
||||||
String s1 = hex.substring(0,2);
|
String s1 = hex.substring(0,2);
|
||||||
String s2 = hex.substring(2,4);
|
String s2 = hex.substring(2,4);
|
||||||
@@ -38,11 +38,11 @@ public class MathUtil {
|
|||||||
result[2] = Integer.parseInt(s3,16);
|
result[2] = Integer.parseInt(s3,16);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public static String locationToString(final Location loc){
|
public static String location2String(final Location loc){
|
||||||
if (loc.getWorld() == null) return "";
|
if (loc.getWorld() == null) return "";
|
||||||
return loc.getWorld().getName()+";"+loc.getX()+";"+loc.getY()+";"+loc.getZ();
|
return loc.getWorld().getName()+";"+loc.getX()+";"+loc.getY()+";"+loc.getZ();
|
||||||
}
|
}
|
||||||
public static Location stringToLocation(final String str){
|
public static Location string2Location(final String str){
|
||||||
final String[] parts = str.split(";");
|
final String[] parts = str.split(";");
|
||||||
if(parts.length != 4) return null;
|
if(parts.length != 4) return null;
|
||||||
final World world = Bukkit.getWorld(parts[0]);
|
final World world = Bukkit.getWorld(parts[0]);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.io.InputStreamReader;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
|
||||||
public class UpdateChecker {
|
public final class UpdateChecker {
|
||||||
public static void checkUpdate(){
|
public static void checkUpdate(){
|
||||||
Lang.info(Lang.plugin_checking_update);
|
Lang.info(Lang.plugin_checking_update);
|
||||||
new BukkitRunnable(){
|
new BukkitRunnable(){
|
||||||
|
|||||||
@@ -67,8 +67,11 @@ blacklist_worlds:
|
|||||||
- 'world'
|
- 'world'
|
||||||
- 'world_nether'
|
- 'world_nether'
|
||||||
|
|
||||||
#生成原因包含在这里的末影龙不被插件监听
|
#由以下原因生成的末影龙不被插件监听
|
||||||
#举例: COMMAND,CUSTOM,DEFAULT
|
#常用选项:COMMAND(原版summon指令生成),CUSTOM(别的插件生成的),DEFAULT(自然生成,包括玩家放置水晶复活的)
|
||||||
|
#你可以在这里找到所有生成原因:
|
||||||
|
#https://bukkit.windit.net/javadoc/org/bukkit/event/entity/CreatureSpawnEvent.SpawnReason.html
|
||||||
|
#写法示例: [COMMAND,CUSTOM]
|
||||||
blacklist_spawn_reason: []
|
blacklist_spawn_reason: []
|
||||||
|
|
||||||
#可选: [default/nbt/advanced]
|
#可选: [default/nbt/advanced]
|
||||||
|
|||||||
@@ -66,8 +66,11 @@ blacklist_worlds:
|
|||||||
- 'world'
|
- 'world'
|
||||||
- 'world_nether'
|
- 'world_nether'
|
||||||
|
|
||||||
#ender_dragon with these spawn reason will be ignored by this plugin.
|
# Ender_dragon spawns with these reasons will be ignored by this plugin.
|
||||||
#example: COMMAND,CUSTOM,DEFAULT
|
# common options: COMMAND(spawn with /summon), CUSTOM(generate by other plugins), DEFAULT(by nature, including end_crystal)
|
||||||
|
# You can find all spawn reasons here:
|
||||||
|
# https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/CreatureSpawnEvent.SpawnReason.html
|
||||||
|
# example: [COMMAND,CUSTOM]
|
||||||
blacklist_spawn_reason: []
|
blacklist_spawn_reason: []
|
||||||
|
|
||||||
#optional: [default/nbt/advanced]
|
#optional: [default/nbt/advanced]
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package expansion.groovy
|
package expansion.groovy
|
||||||
|
|
||||||
|
import groovy.transform.Field
|
||||||
import org.bukkit.Bukkit
|
import org.bukkit.Bukkit
|
||||||
import pers.xanadu.enderdragon.config.Lang
|
|
||||||
|
import static pers.xanadu.enderdragon.EnderDragon.plugin
|
||||||
|
|
||||||
|
@Field static def x=5
|
||||||
|
|
||||||
static void enable(){
|
static void enable(){
|
||||||
// Lang.info("I am a test script written in groovy.")
|
//Bukkit.getLogger().info("static variable test: x="+x)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void test(){
|
|
||||||
Bukkit.broadcastMessage("you runs test()")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -17,3 +17,6 @@ static void test(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user