13
0

No NPC respawning, No Fightservers, Potential portal depth fix
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-11 20:38:09 +01:00
Ursprung aae9b0c267
Commit 7e9fc36a81
3 geänderte Dateien mit 28 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -104,6 +104,14 @@ public class NPC {
display = new Displayable(location, this::show, this::hide);
}
public Location getLocation() {
return location;
}
public UUID getUuid() {
return uuid;
}
private void show(Player player) {
TinyProtocol.instance.sendPacket(player, addPlayerInfo);
TinyProtocol.instance.sendPacket(player, namedSpawn);

Datei anzeigen

@ -31,6 +31,7 @@ import org.bukkit.util.Vector;
import java.util.*;
import java.util.logging.Level;
import java.util.stream.Collectors;
public class FightserverPortal implements PortalHandler, Comparable<FightserverPortal> {
@ -121,15 +122,25 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
}
private void updateNPCs(List<Location> locations, List<NPC> npcs, List<Integer> players) {
npcs.forEach(NPC::delete);
npcs.clear();
List<SteamwarUser> remainingPlayers = players.stream().map(SteamwarUser::get).collect(Collectors.toList());
List<Location> remainingLocations = new ArrayList<>(locations);
npcs.removeIf(npc -> {
SteamwarUser user = SteamwarUser.get(npc.getUuid());
if(remainingPlayers.contains(user)) {
remainingPlayers.remove(user);
remainingLocations.remove(npc.getLocation());
return false;
} else {
npc.delete();
return true;
}
});
for(int i = 0; i < players.size(); i++) {
if(i >= locations.size())
for(SteamwarUser user : remainingPlayers) {
if(remainingLocations.isEmpty())
break;
SteamwarUser user = SteamwarUser.get(players.get(i));
npcs.add(new NPC(locations.get(i), user.getUUID(), user.getUserName()));
npcs.add(new NPC(remainingLocations.remove(0), user.getUUID(), user.getUserName()));
}
}
@ -206,14 +217,13 @@ public class FightserverPortal implements PortalHandler, Comparable<FightserverP
case "waiting":
case "PRE_LEADER_SETUP":
return "Warten auf Spieler";
case "fighting":
return "Kampf läuft seit";
case "PRE_SCHEM_SETUP":
return "Schemauswahl";
case "POST_SCHEM_SETUP":
return "Vorbereitung";
case "PRE_RUNNING":
return "Kampfbeginn in";
case "fighting":
case "RUNNING":
return "Kampf läuft";
case "end":

Datei anzeigen

@ -74,7 +74,7 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
private final Location pos1;
private final Location pos2;
private double depth;
private final double depth;
private final Vector pos1Vector;
private final double yRotation;
@ -120,7 +120,7 @@ public class Portal implements PortalHandler, ConfigurationSerializable {
Vector orientation = pos2.toVector().subtract(pos1.toVector());
this.yRotation = Math.atan2(orientation.getX(), orientation.getZ());
this.pos1Vector = pos1.toVector().subtract(new Vector(depth/2, 0, 0).rotateAroundY(-yRotation));
this.pos1Vector = pos1.toVector().subtract(new Vector(depth/2, 0, 0).rotateAroundY(yRotation));
this.rotatedShape = new Vector(depth == 0.0 ? 1.0 : depth, orientation.getY(), orientation.clone().setY(0).length());
this.handler = handlerConstructor.apply(this);