SteamWar/MissileWars
Archiviert
13
0

Add DeathListener

Add Config.test
Add MWTeam color to tablist
Dieser Commit ist enthalten in:
jojo 2020-12-04 21:47:14 +01:00
Ursprung 25f2b27406
Commit 948d472f40
4 geänderte Dateien mit 27 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -53,5 +53,12 @@
<scope>system</scope> <scope>system</scope>
<systemPath>${main.basedir}/lib/WorldEdit-1.15.jar</systemPath> <systemPath>${main.basedir}/lib/WorldEdit-1.15.jar</systemPath>
</dependency> </dependency>
<dependency>
<groupId>steamwar</groupId>
<artifactId>SpigotCore</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${main.basedir}/lib/SpigotCore.jar</systemPath>
</dependency>
</dependencies> </dependencies>
</project> </project>

Datei anzeigen

@ -50,6 +50,8 @@ public class Config {
public static final double MissileChance; public static final double MissileChance;
private static final int EventKampfID;
static { static {
File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml"); File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
if (!configfile.exists()) { if (!configfile.exists()) {
@ -83,5 +85,12 @@ public class Config {
assert blue != null; assert blue != null;
BluePortalZ = blue.getInt("PortalZ"); BluePortalZ = blue.getInt("PortalZ");
BlueSpawn = new Location(Bukkit.getWorlds().get(0), blue.getDouble("SpawnX"), blue.getDouble("SpawnY"), blue.getDouble("SpawnZ"), (float)blue.getDouble("SpawnYaw"), (float)blue.getDouble("SpawnPitch")); BlueSpawn = new Location(Bukkit.getWorlds().get(0), blue.getDouble("SpawnX"), blue.getDouble("SpawnY"), blue.getDouble("SpawnZ"), (float)blue.getDouble("SpawnYaw"), (float)blue.getDouble("SpawnPitch"));
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
} }
public static boolean test() {
return EventKampfID == -1;
}
} }

Datei anzeigen

@ -19,10 +19,9 @@
package de.steamwar.misslewars; package de.steamwar.misslewars;
import org.bukkit.ChatColor; import de.steamwar.comms.packets.TablistNamePacket;
import org.bukkit.GameMode; import de.steamwar.sql.SteamwarUser;
import org.bukkit.Location; import org.bukkit.*;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
@ -95,7 +94,7 @@ public class MWTeam {
} }
public void teamScoreboard(Objective objective) { public void teamScoreboard(Objective objective) {
players.forEach(p -> objective.getScore(getPrefix() + p.getName()).setScore(1)); players.forEach(p -> objective.getScore(getColorCode() + p.getName()).setScore(1));
} }
public int size() { public int size() {
@ -119,6 +118,8 @@ public class MWTeam {
p.setDisplayName(color + p.getName()); p.setDisplayName(color + p.getName());
if (MissileWars.getFightState() == FightState.WAITING && !enemy().players.isEmpty()) if (MissileWars.getFightState() == FightState.WAITING && !enemy().players.isEmpty())
MissileWars.startRound(); MissileWars.startRound();
if (!Config.test())
Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(p.getUniqueId()).getId(), color + p.getName()).send(p), 5);
} }
public void leave(Player p) { public void leave(Player p) {
@ -137,7 +138,7 @@ public class MWTeam {
return MissileWars.getRedTeam(); return MissileWars.getRedTeam();
} }
public String getPrefix(){ public String getColorCode(){
return "§" + color.getChar(); return "§" + color.getChar();
} }

Datei anzeigen

@ -28,11 +28,14 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.util.Vector;
import java.util.EnumSet; import java.util.EnumSet;
public class DeathListener extends BasicListener { public class DeathListener extends BasicListener {
private static Vector ZERO = new Vector(0, 0, 0);
public DeathListener() { public DeathListener() {
super(EnumSet.allOf(FightState.class)); super(EnumSet.allOf(FightState.class));
} }
@ -52,6 +55,7 @@ public class DeathListener extends BasicListener {
return; return;
e.setRespawnLocation(team.getSpawn()); e.setRespawnLocation(team.getSpawn());
e.getPlayer().setVelocity(ZERO);
new SpawnPlatformCreator(p); new SpawnPlatformCreator(p);
} }
} }