First release version
Dieser Commit ist enthalten in:
Ursprung
47c8153fe0
Commit
efdfbaef43
5
pom.xml
5
pom.xml
@ -50,11 +50,6 @@
|
||||
<artifactId>Spigot</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>SpigotCore</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>WorldEdit</artifactId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
WaitingTime: 600
|
||||
ItemTime: 300
|
||||
ShieldFlyTime: 100
|
||||
PlatformTime: 30
|
||||
EndTime: 600
|
||||
|
||||
Arena:
|
||||
@ -15,9 +16,13 @@ Red:
|
||||
SpawnX: 0
|
||||
SpawnY: 0
|
||||
SpawnZ: 0
|
||||
SpawnYaw: 0
|
||||
SpawnPitch: 0
|
||||
|
||||
Blue:
|
||||
PortalZ: 60
|
||||
SpawnX: 0
|
||||
SpawnY: 0
|
||||
SpawnZ: 0
|
||||
SpawnYaw: 0
|
||||
SpawnPitch: 0
|
||||
|
@ -24,6 +24,7 @@ public class Config {
|
||||
public static final int BluePortalZ;
|
||||
|
||||
public static final int WaitingTime;
|
||||
public static final int PlatformTime;
|
||||
public static final int ItemTime;
|
||||
public static final int ShieldFlyTime;
|
||||
public static final int EndTime;
|
||||
@ -37,6 +38,7 @@ public class Config {
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(configfile);
|
||||
WaitingTime = config.getInt("WaitingTime");
|
||||
PlatformTime = config.getInt("PlatformTime");
|
||||
ItemTime = config.getInt("ItemTime");
|
||||
ShieldFlyTime = config.getInt("ShieldFlyTime");
|
||||
EndTime = config.getInt("EndTime");
|
||||
|
@ -10,13 +10,12 @@ import java.util.Objects;
|
||||
/**
|
||||
* Modified Version of the Fight-System Scoreboard
|
||||
*/
|
||||
public class FightScoreboard {
|
||||
class FightScoreboard {
|
||||
|
||||
private FightScoreboard(){}
|
||||
|
||||
private static final Scoreboard scoreboard = Objects.requireNonNull(Bukkit.getScoreboardManager()).getMainScoreboard();
|
||||
private static final Objective objective;
|
||||
private static int index = 0;
|
||||
|
||||
static{
|
||||
if(scoreboard.getObjective("AAA") == null)
|
||||
@ -25,14 +24,15 @@ public class FightScoreboard {
|
||||
objective = scoreboard.getObjective("AAA");
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
static void init(){
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(MissileWars.getPlugin(), () -> {
|
||||
objective.unregister();
|
||||
scoreboard.registerNewObjective("AAA", "BBB", "MissleWars");
|
||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
objective.setDisplayName("§eSpieler");
|
||||
|
||||
MWTeam fightTeam = getIndexDisplay();
|
||||
teamScoreboard(fightTeam);
|
||||
teamScoreboard(MissileWars.getBlueTeam());
|
||||
teamScoreboard(MissileWars.getRedTeam());
|
||||
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(player -> player.setScoreboard(scoreboard));
|
||||
@ -44,20 +44,6 @@ public class FightScoreboard {
|
||||
}
|
||||
|
||||
private static void teamScoreboard(MWTeam fightTeam){
|
||||
objective.setDisplayName(fightTeam.getColoredName());
|
||||
fightTeam.getPlayers().forEach(p -> {
|
||||
objective.getScore(fightTeam.getPrefix() + p.getName()).setScore(1);
|
||||
});
|
||||
}
|
||||
|
||||
private static MWTeam getIndexDisplay() {
|
||||
if(index == 0) {
|
||||
index = 1;
|
||||
return MissileWars.getRedTeam();
|
||||
}else{
|
||||
index = 0;
|
||||
return MissileWars.getBlueTeam();
|
||||
fightTeam.getPlayers().forEach(p -> objective.getScore(fightTeam.getPrefix() + p.getName()).setScore(1));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,10 @@ public class MWTeam {
|
||||
|
||||
static {
|
||||
ItemMeta bowMeta = Objects.requireNonNull(bow.getItemMeta());
|
||||
bowMeta.addEnchant(Enchantment.ARROW_FIRE, 1, false);
|
||||
bowMeta.addEnchant(Enchantment.ARROW_FIRE, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.ARROW_KNOCKBACK, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.KNOCKBACK, 1, true);
|
||||
bowMeta.addEnchant(Enchantment.DAMAGE_ALL, 2, true);
|
||||
bowMeta.setUnbreakable(true);
|
||||
bow.setItemMeta(bowMeta);
|
||||
}
|
||||
@ -58,7 +61,7 @@ public class MWTeam {
|
||||
public void join (Player p) {
|
||||
players.add(p);
|
||||
p.teleport(spawn);
|
||||
Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> p.setGameMode(GameMode.SURVIVAL), 1);
|
||||
p.setGameMode(GameMode.SURVIVAL);
|
||||
p.getInventory().setItem(0, bow);
|
||||
sbteam.addPlayer(p);
|
||||
p.setDisplayName(color + p.getName());
|
||||
|
64
src/de/steamwar/misslewars/SpawnPlatformCreator.java
Normale Datei
64
src/de/steamwar/misslewars/SpawnPlatformCreator.java
Normale Datei
@ -0,0 +1,64 @@
|
||||
package de.steamwar.misslewars;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class SpawnPlatformCreator {
|
||||
|
||||
private final Player player;
|
||||
private final Location spawn;
|
||||
private final BukkitTask task;
|
||||
|
||||
private Block currentBlock;
|
||||
private int ticks;
|
||||
|
||||
public SpawnPlatformCreator(Player player){
|
||||
this.player = player;
|
||||
MWTeam team = MissileWars.getTeam(player);
|
||||
if(team == null)
|
||||
this.spawn = Config.BlueSpawn;
|
||||
else
|
||||
this.spawn = team.getSpawn();
|
||||
ticks = Config.PlatformTime;
|
||||
currentBlock = null;
|
||||
task = Bukkit.getScheduler().runTaskTimer(MissileWars.getPlugin(), this::createPlatform, 0, 1);
|
||||
}
|
||||
|
||||
private void createPlatform(){
|
||||
Location playerLoc = player.getLocation();
|
||||
playerLoc.setY(spawn.getY() - 1);
|
||||
|
||||
if(currentBlock == null || !currentBlock.getLocation().equals(playerLoc)){
|
||||
if(currentBlock != null){
|
||||
if(currentBlock.getType() == Material.OBSIDIAN)
|
||||
currentBlock.setType(Material.AIR);
|
||||
currentBlock = null;
|
||||
}
|
||||
|
||||
Block newBlock = playerLoc.getBlock();
|
||||
if(newBlock.getType() == Material.AIR){
|
||||
newBlock.setType(Material.OBSIDIAN);
|
||||
currentBlock = newBlock;
|
||||
}
|
||||
}
|
||||
|
||||
if(currentBlock != null && player.getLocation().getY() - 1 < currentBlock.getY())
|
||||
player.teleport(playerLoc.add(0, 1, 0));
|
||||
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Spawnplattform§8: §c§l" + String.format("%.2f", ticks / 20f) + "§8s"));
|
||||
|
||||
if(ticks == 0){
|
||||
if(currentBlock != null && currentBlock.getType() == Material.OBSIDIAN)
|
||||
currentBlock.setType(Material.AIR);
|
||||
|
||||
task.cancel();
|
||||
}
|
||||
ticks--;
|
||||
}
|
||||
}
|
@ -5,7 +5,6 @@ import de.steamwar.misslewars.FightState;
|
||||
import de.steamwar.misslewars.MissileWars;
|
||||
import de.steamwar.misslewars.StateDependent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@ -20,11 +19,16 @@ public class EndCountdown extends StateDependent {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), () -> {
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
p.kickPlayer(null);
|
||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::kickPlayer, Config.EndTime);
|
||||
}
|
||||
|
||||
private void kickPlayer(){
|
||||
if(Bukkit.getOnlinePlayers().isEmpty()){
|
||||
Bukkit.shutdown();
|
||||
}else{
|
||||
Bukkit.getOnlinePlayers().iterator().next().kickPlayer(null);
|
||||
task = Bukkit.getScheduler().runTaskLater(MissileWars.getPlugin(), this::kickPlayer, 10);
|
||||
}
|
||||
}, Config.EndTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,8 +18,10 @@ public class Fireball extends SpecialItem {
|
||||
public boolean handleUse(Player p) {
|
||||
org.bukkit.entity.Fireball fb = p.launchProjectile(org.bukkit.entity.Fireball.class);
|
||||
fb.setVelocity(fb.getVelocity().multiply(2));
|
||||
fb.setDirection(p.getLocation().getDirection());
|
||||
p.playSound(p.getLocation(), Sound.ITEM_FIRECHARGE_USE, 100, 1);
|
||||
fb.setIsIncendiary(true);
|
||||
fb.setYield(3f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -66,11 +66,11 @@ public class Missile extends SpecialItem {
|
||||
|
||||
double yaw = (p.getLocation().getYaw() + 360f) % 360;
|
||||
if(yaw > 45 && yaw <= 135) {
|
||||
aT = aT.rotateY(90);
|
||||
aT = aT.rotateY(270);
|
||||
}else if(yaw > 135 && yaw <= 225) {
|
||||
aT = aT.rotateY(180);
|
||||
}else if(yaw > 225 && yaw <= 315) {
|
||||
aT = aT.rotateY(270);
|
||||
aT = aT.rotateY(90);
|
||||
}
|
||||
|
||||
v = v.subtract(dimensions.getX()/2, dimensions.getY() + 2, -2).subtract(offset);
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
@ -47,4 +48,9 @@ public class ArenaListener extends BasicListener {
|
||||
public void onItemDrop(PlayerDropItemEvent e){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHunger(FoodLevelChangeEvent e){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package de.steamwar.misslewars.listener;
|
||||
import de.steamwar.misslewars.FightState;
|
||||
import de.steamwar.misslewars.MWTeam;
|
||||
import de.steamwar.misslewars.MissileWars;
|
||||
import de.steamwar.misslewars.SpawnPlatformCreator;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
@ -19,6 +21,7 @@ public class DeathListener extends BasicListener {
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent e) {
|
||||
e.setDeathMessage(null);
|
||||
Bukkit.broadcastMessage(e.getEntity().getDisplayName() + " §cstarb");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -29,5 +32,6 @@ public class DeathListener extends BasicListener {
|
||||
return;
|
||||
|
||||
e.setRespawnLocation(team.getSpawn());
|
||||
new SpawnPlatformCreator(p);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -29,7 +30,7 @@ import java.util.Objects;
|
||||
|
||||
public class ItemListener extends BasicListener {
|
||||
|
||||
private static final File shield = new File(MissileWars.getPlugin().getDataFolder(), "shield.schematic");
|
||||
private static final File shield = new File(MissileWars.getPlugin().getDataFolder(), "shield.schem");
|
||||
private static final World world = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||
private static final Clipboard clipboard;
|
||||
private static final BlockVector3 offset;
|
||||
@ -54,6 +55,9 @@ public class ItemListener extends BasicListener {
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if(e.getAction() != Action.RIGHT_CLICK_BLOCK && e.getAction() != Action.RIGHT_CLICK_AIR)
|
||||
return;
|
||||
|
||||
if(SpecialItem.handleUse(item, e.getPlayer())){
|
||||
item.setAmount(item.getAmount()-1);
|
||||
e.getPlayer().updateInventory();
|
||||
|
@ -21,6 +21,7 @@ public class WaitingListener extends BasicListener {
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageEvent e){
|
||||
if(e.getCause() != EntityDamageEvent.DamageCause.VOID)
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren