Skip to content

Commit

Permalink
Fix spectator ejected by guardian
Browse files Browse the repository at this point in the history
  • Loading branch information
zelytra committed Aug 26, 2021
1 parent 076c401 commit cd5c181
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/fr/zelytra/daedalus/commands/test.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.zelytra.daedalus.commands;

import fr.zelytra.daedalus.Daedalus;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
Expand All @@ -10,10 +11,10 @@ public class test implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {

if(!(sender instanceof Player)){
if (!(sender instanceof Player)) {
return false;
}

Daedalus.getInstance().getGameManager().getTimeManager().episode = Integer.parseInt(args[0]);
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ private void ejection() {
if (isPlayer) {

for (Entity e : nearbyEntities) {

if (e instanceof Player && ((Player) e).getGameMode() != GameMode.SURVIVAL)
continue;

Vector delta = new Vector(e.getLocation().getX() - entity.getLocation().getX(), 0, e.getLocation().getZ() - entity.getLocation().getZ());
double norme = Math.sqrt(Math.pow(delta.getX() + 0.01, 2) + Math.pow(delta.getY() + 0.01, 2) + Math.pow(delta.getZ() + 0.01, 2));
final int coef = 2;
Expand Down

0 comments on commit cd5c181

Please sign in to comment.