Skip to content

Commit

Permalink
1.9.6 (Fix)
Browse files Browse the repository at this point in the history
● 몇몇 능력들이 플레이어를 Y 좌표 0으로 이동시키던 오류를 해결하였습니다.
● 교황의 능력이 발동되지 않던 오류가 해결되었습니다.
  • Loading branch information
Daybreak365 committed Aug 6, 2019
1 parent 0725293 commit 455fc69
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 49 deletions.
18 changes: 7 additions & 11 deletions src/DayBreak/AbilityWar/Ability/List/Hermit.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.bukkit.ChatColor;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerMoveEvent;

import DayBreak.AbilityWar.Ability.AbilityBase;
Expand All @@ -15,7 +14,6 @@
import DayBreak.AbilityWar.Utils.Library.EffectLib;
import DayBreak.AbilityWar.Utils.Library.Packet.TitlePacket;
import DayBreak.AbilityWar.Utils.Math.LocationUtil;
import DayBreak.AbilityWar.Utils.Thread.AbilityWarThread;

@AbilityManifest(Name = "헤르밋", Rank = Rank.C, Species = Species.HUMAN)
public class Hermit extends AbilityBase {
Expand Down Expand Up @@ -45,17 +43,15 @@ public boolean ActiveSkill(MaterialType mt, ClickType ct) {

@SubscribeEvent
public void onPlayerMove(PlayerMoveEvent e) {
Player p = e.getPlayer();
if(p.getWorld().equals(getPlayer().getWorld())) {
Participant p = getGame().getParticipant(e.getPlayer());
if(p != null && !getParticipant().equals(p) && getPlayer().getWorld().equals(p.getPlayer().getWorld())) {
if(!LocationUtil.isInCircle(getPlayer().getLocation(), e.getFrom(), Double.valueOf(Distance), true) &&
LocationUtil.isInCircle(getPlayer().getLocation(), e.getTo(), Double.valueOf(Distance), true)) {
if(AbilityWarThread.isGameTaskRunning() && AbilityWarThread.getGame().isParticipating(p)) {
TitlePacket title = new TitlePacket(ChatColor.translateAlternateColorCodes('&', "&8헤르밋"),
ChatColor.translateAlternateColorCodes('&', "&e" + p.getName() + " &f접근중"), 5, 30, 5);
title.Send(getPlayer());
EffectLib.SPEED.addPotionEffect(getPlayer(), 100, 3, true);
EffectLib.INVISIBILITY.addPotionEffect(getPlayer(), 100, 0, true);
}
TitlePacket title = new TitlePacket(ChatColor.translateAlternateColorCodes('&', "&8헤르밋"),
ChatColor.translateAlternateColorCodes('&', "&e" + p.getPlayer().getName() + " &f접근중"), 5, 30, 5);
title.Send(getPlayer());
EffectLib.SPEED.addPotionEffect(getPlayer(), 100, 3, true);
EffectLib.INVISIBILITY.addPotionEffect(getPlayer(), 100, 0, true);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/DayBreak/AbilityWar/Ability/List/TheHighPriestess.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ public void DurationProcess(Integer Seconds) {
for(Location l : new Circle(center, Range).setAmount(Range * 8).setHighestLocation(true).getLocations()) {
ParticleLib.SPELL_INSTANT.spawnParticle(l, 0, 0, 0, 1);
}
for(Player p : LocationUtil.getNearbyEntities(Player.class, center, Range, Range)) {

for(Player p : LocationUtil.getNearbyPlayers(center, Range, Range)) {
if(LocationUtil.isInCircle(center, p.getLocation(), Double.valueOf(Range), true)) {
if(p.equals(getPlayer())) {
EffectLib.REGENERATION.addPotionEffect(p, 100, 0, false);
EffectLib.REGENERATION.addPotionEffect(p, 100, 1, false);
} else {
EffectLib.WITHER.addPotionEffect(p, 100, 0, false);
EffectLib.WITHER.addPotionEffect(p, 100, 0, true);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/DayBreak/AbilityWar/Game/Games/Mode/AbstractGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void registerListener(Listener lis) {
@SuppressWarnings("unused")
private final Firewall fireWall = new Firewall(this);

private AbilitySelect abilitySelect;
private AbilitySelect abilitySelect = null;

private boolean Restricted = true;

Expand Down
12 changes: 4 additions & 8 deletions src/DayBreak/AbilityWar/Game/Manager/GameListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,17 @@ public class GameListener implements Listener {
private AbstractGame game;
private EventCaller eventCaller = new EventCaller();

public GameListener(AbstractGame abstractGame) {
this.game = abstractGame;
public GameListener(AbstractGame game) {
this.game = game;

abstractGame.registerListener(this);
game.registerListener(this);

Bukkit.getPluginManager().registerEvent(EntityDamageEvent.class, this, EventPriority.HIGHEST, eventCaller, AbilityWar.getPlugin());
}

@EventHandler
public void onWeatherChange(WeatherChangeEvent e) {
if(game.isGameStarted()) {
if(AbilityWarSettings.getClearWeather()) {
e.setCancelled(true);
}
}
if(game.isGameStarted() && AbilityWarSettings.getClearWeather()) e.setCancelled(true);
}

@EventHandler
Expand Down
2 changes: 1 addition & 1 deletion src/DayBreak/AbilityWar/Utils/Math/Geometry/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Circle {

public Circle(final Location center, final double radius) {
Validate.NotNull(center);
this.center = center;
this.center = center.clone();
this.radius = radius;
}

Expand Down
69 changes: 46 additions & 23 deletions src/DayBreak/AbilityWar/Utils/Math/LocationUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ public class LocationUtil {

private LocationUtil() {}

public static boolean isInCircle(final Location center, final Location location, final double radius, final boolean flatsurface) {
/**
* Location이 원 안에 위치하는지 확인합니다.
* @param c 원의 중심
* @param l Location
* @param radius 원의 반지름
* @param flatsurface
* true: Y 좌표를 따로 계산하지 않습니다.
* false: Y 좌표 또한 포함하여 계산합니다.
*/
public static boolean isInCircle(final Location c, final Location l, final double radius, final boolean flatsurface) {
final Location center = c.clone();
final Location location = l.clone();

if(flatsurface) {center.setY(0); location.setY(0);}
if(center.getWorld().equals(location.getWorld())) {
double distance = center.distance(location);
Expand Down Expand Up @@ -214,8 +226,40 @@ public static Player getNearestPlayer(Player p) {

public static <E> List<E> getNearbyEntities(Class<E> clazz, Location center, int HorizontalDis, int VerticalDis, Entity exception) {
List<E> entities = new ArrayList<E>();
for (Entity e : center.getWorld().getEntities()) {
Location entityLoc = e.getLocation();
if(NumberUtil.Subtract(Math.abs(entityLoc.getY()), Math.abs(center.getY())) <= VerticalDis) {
if(NumberUtil.Subtract(Math.abs(entityLoc.getX()), Math.abs(center.getX())) <= HorizontalDis
|| NumberUtil.Subtract(Math.abs(entityLoc.getZ()), Math.abs(center.getZ())) <= HorizontalDis) {
if (clazz.isAssignableFrom(e.getClass())) {
if(!e.equals(exception)) {
if (AbilityWarThread.isGameTaskRunning() && e instanceof Player) {
AbstractGame game = AbilityWarThread.getGame();
Player p = (Player) e;
if(game.isParticipating(p)) {
if(game.getDeathManager().isEliminated(p)) continue;
Participant part = game.getParticipant(p);

if (game instanceof TeamGame && exception instanceof Player) {
TeamGame tgame = (TeamGame) game;
Player ex = (Player) exception;
if(game.isParticipating(ex)) {
Participant expart = game.getParticipant(ex);
if(tgame.hasTeam(part) && tgame.hasTeam(expart) && (tgame.getTeam(part).equals(tgame.getTeam(expart)))) continue;
}
}
} else {
continue;
}
}
entities.add(clazz.cast(e));
}
}
}
}
}

//if(ServerVersion.getVersion() >= 9) {
/*if(ServerVersion.getVersion() >= 9) {
for (Entity e : center.getWorld().getNearbyEntities(center, HorizontalDis, VerticalDis, HorizontalDis)) {
if (clazz.isAssignableFrom(e.getClass())) {
if(!e.equals(exception)) {
Expand All @@ -242,28 +286,7 @@ public static <E> List<E> getNearbyEntities(Class<E> clazz, Location center, int
}
}
}
/*
} else {
for (Entity e : center.getWorld().getEntities()) {
Location entityLoc = e.getLocation();
if(NumberUtil.Subtract(Math.abs(entityLoc.getY()), Math.abs(center.getY())) <= VerticalDis) {
if(NumberUtil.Subtract(Math.abs(entityLoc.getX()), Math.abs(center.getX())) <= HorizontalDis
|| NumberUtil.Subtract(Math.abs(entityLoc.getZ()), Math.abs(center.getZ())) <= HorizontalDis) {
if (clazz.isAssignableFrom(e.getClass())) {
if(!exceptions.contains(e)) {
if (e instanceof Player && AbilityWarThread.isGameTaskRunning()) {
AbstractGame game = AbilityWarThread.getGame();
Player player = (Player) e;
if (!game.isParticipating(player) || game.getDeathManager().isEliminated(player)) {
continue;
}
}
entities.add(clazz.cast(e));
}
}
}
}
}
}
*/

Expand Down
2 changes: 1 addition & 1 deletion src/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: AbilityWar
main: DayBreak.AbilityWar.AbilityWar
version: 1.9.5
version: 1.9.6

commands:
abilitywar:
Expand Down

0 comments on commit 455fc69

Please sign in to comment.