Add DeathListener
Add Config.test Add MWTeam color to tablist
Dieser Commit ist enthalten in:
Ursprung
25f2b27406
Commit
948d472f40
7
pom.xml
7
pom.xml
@ -53,5 +53,12 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${main.basedir}/lib/WorldEdit-1.15.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${main.basedir}/lib/SpigotCore.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -50,6 +50,8 @@ public class Config {
|
||||
|
||||
public static final double MissileChance;
|
||||
|
||||
private static final int EventKampfID;
|
||||
|
||||
static {
|
||||
File configfile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
|
||||
if (!configfile.exists()) {
|
||||
@ -83,5 +85,12 @@ public class Config {
|
||||
assert blue != null;
|
||||
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"));
|
||||
|
||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
}
|
||||
|
||||
public static boolean test() {
|
||||
return EventKampfID == -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,10 +19,9 @@
|
||||
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import de.steamwar.comms.packets.TablistNamePacket;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
@ -95,7 +94,7 @@ public class MWTeam {
|
||||
}
|
||||
|
||||
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() {
|
||||
@ -119,6 +118,8 @@ public class MWTeam {
|
||||
p.setDisplayName(color + p.getName());
|
||||
if (MissileWars.getFightState() == FightState.WAITING && !enemy().players.isEmpty())
|
||||
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) {
|
||||
@ -137,7 +138,7 @@ public class MWTeam {
|
||||
return MissileWars.getRedTeam();
|
||||
}
|
||||
|
||||
public String getPrefix(){
|
||||
public String getColorCode(){
|
||||
return "§" + color.getChar();
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,14 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class DeathListener extends BasicListener {
|
||||
|
||||
private static Vector ZERO = new Vector(0, 0, 0);
|
||||
|
||||
public DeathListener() {
|
||||
super(EnumSet.allOf(FightState.class));
|
||||
}
|
||||
@ -52,6 +55,7 @@ public class DeathListener extends BasicListener {
|
||||
return;
|
||||
|
||||
e.setRespawnLocation(team.getSpawn());
|
||||
e.getPlayer().setVelocity(ZERO);
|
||||
new SpawnPlatformCreator(p);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren