Implement some chat colors/messages, coin drops, lobby lifecycle

This commit is contained in:
Torrie Fischer 2022-05-11 22:55:36 +02:00
parent 793b25251c
commit 9890936154
12 changed files with 216 additions and 51 deletions

44
TODO.md
View File

@ -12,18 +12,22 @@
[X] Config reload [X] Config reload
[X] Leave games [X] Leave games
[X] Join games [X] Join games
[ ] Lobby with instructions [X] Drop back to lobby on game over
[ ] Drop back to lobby on game over [X] Grist drops
[ ] Grist drops [ ] Chat colors + clickables
[ ] Item shoppes [ ] Title colors
[ ] Command tab completion [ ] Command tab completion
[ ] Lobby with instructions
[ ] Item shoppes
[ ] Mob category AI
[ ] Indestructible weapons/armor
[ ] Never hungry
# Scaled waves # Scaled waves
[ ] Limit ranged mobs and Ravagers to non-bomb-carrier state [ ] Limit ranged mobs and Ravagers to non-bomb-carrier state
[ ] Weaker mobs, more of them [ ] Weaker mobs, more of them
[ ] Mob categories [ ] Mob AI categories
[ ] Spawnpoint categories
# UX # UX
@ -32,17 +36,19 @@
[X] Stage titles [X] Stage titles
[X] EXPLOSIONS [X] EXPLOSIONS
[X] Bomb model [X] Bomb model
[ ] Pretty bomb model [X] "Player $X is ready" message in chat
[ ] "Player $X is ready" message in chat [X] Clickable /ready in chat
[ ] Colored titles [ ] Post-Round summary in chat
[ ] Clickable join links in /list [ ] Clickable join links in /list
[ ] Sidebar
[ ] Coin pickup messages in action bar
[ ] Target catches on fire more it is lit
[ ] Colored titles
[ ] Clickable /leave action [ ] Clickable /leave action
[ ] Clickable /ready in chat
[ ] Countdown while in warmup [ ] Countdown while in warmup
[ ] Countdown shrinks w/ every /ready player [ ] Countdown shrinks w/ every /ready player
[ ] Target catches on fire more it is lit
[ ] Sidebar
[ ] List of mobs in next wave [ ] List of mobs in next wave
[ ] Pretty bomb model
# Social # Social
@ -71,6 +77,7 @@
[X] Randomized spawn locations [X] Randomized spawn locations
[X] Weighted distributions [X] Weighted distributions
[X] Batch overlap [X] Batch overlap
[ ] Spawnpoint categories
[ ] Scripted batch overlap/timings [ ] Scripted batch overlap/timings
[ ] Scripted spawn locations [ ] Scripted spawn locations
[ ] Scripted waypoint paths [ ] Scripted waypoint paths
@ -87,26 +94,29 @@
[X] /join games [X] /join games
[X] /ready [X] /ready
[X] /leave games [X] /leave games
[ ] /restart games
[X] Spectator mode on death [X] Spectator mode on death
[X] Player readiness starts countdown [X] Player readiness starts countdown
[ ] Game is automatically closed some time after game over [X] Game is automatically closed some time after game over
[ ] Return to lobby on leave/close [X] Return to lobby on leave/close
[X] Restore health+hunger on respawn/game start
[ ] /restart games
[ ] Instancing [ ] Instancing
[ ] Restore health+hunger on respawn/game start
[ ] Respawn during games [ ] Respawn during games
[ ] Player revival items [ ] Player revival items
[ ] Clear inventory on join/leave
# Powerups # Powerups
[ ] Enchantments
[ ] Better items
[ ] Coin pickup range [ ] Coin pickup range
[ ] Coin boost [ ] Coin boost
[ ] Knockback on weapons [ ] Knockback on weapons
[ ] Damage boost [ ] Damage boost
[ ] Speed boost [ ] Speed boost
[ ] Health boost [ ] Health boost
[ ] Repair barriers
# Fantasy # Fantasy
[ ] Totems/turrets/stationary weapons [ ] Totems/turrets/stationary weapons
[ ] Repair barriers

View File

@ -37,6 +37,12 @@
<version>1.18.2-R0.1-SNAPSHOT</version> <version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -9,9 +9,10 @@ import org.bukkit.entity.Player;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.logging.Level; import java.util.logging.Level;
@ -76,6 +77,21 @@ public class Plugin extends JavaPlugin {
getServer().getPluginManager().registerEvents(m_handler, this); getServer().getPluginManager().registerEvents(m_handler, this);
} }
public void onDisable() {
getLogger().info("Unloading games...");
for(GameRunner runner : m_runningGames.values()) {
runner.requestTransition(GameRunner.Stage.Idle);
}
for(Player player : m_playerGames.keySet()) {
m_playerGames.get(player).removePlayer(player);
returnPlayerToLobby(player);
}
m_runningGames.clear();
m_playerGames.clear();
m_handler.clear();
m_arenas.clear();
}
public void reloadArenas() { public void reloadArenas() {
getLogger().info("Loading arenas..."); getLogger().info("Loading arenas...");
saveDefaultConfig(); saveDefaultConfig();
@ -87,6 +103,7 @@ public class Plugin extends JavaPlugin {
} }
for(Player player : m_playerGames.keySet()) { for(Player player : m_playerGames.keySet()) {
m_playerGames.get(player).removePlayer(player); m_playerGames.get(player).removePlayer(player);
returnPlayerToLobby(player);
} }
m_runningGames.clear(); m_runningGames.clear();
m_playerGames.clear(); m_playerGames.clear();
@ -133,6 +150,15 @@ public class Plugin extends JavaPlugin {
return ret; return ret;
} }
public void returnPlayerToLobby(Player p) {
Configuration config = new Configuration(getConfig());
World lobby = getServer().getWorld(config.getLobbyName());
if (lobby == null) {
lobby = new WorldCreator(config.getLobbyName()).generateStructures(false).createWorld();
}
p.teleport(lobby.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
}
public GameRunner getRunnerForPlayer(Player p) { public GameRunner getRunnerForPlayer(Player p) {
GameRunner ret = null; GameRunner ret = null;
if (m_playerGames.containsKey(p)) { if (m_playerGames.containsKey(p)) {

View File

@ -49,7 +49,7 @@ public class JoinGameCommand implements TabExecutor {
} }
m_plugin.addPlayerToArena(arenaName, player); m_plugin.addPlayerToArena(arenaName, player);
} else { } else {
sender.sendMessage("Only players may use htis command."); sender.sendMessage("Only players may use this command.");
} }
return true; return true;
} }

View File

@ -26,6 +26,7 @@ public class LeaveGameCommand implements CommandExecutor {
return true; return true;
} }
runner.removePlayer(player); runner.removePlayer(player);
m_plugin.returnPlayerToLobby(player);
} else { } else {
sender.sendMessage("Only players may use htis command."); sender.sendMessage("Only players may use htis command.");
} }

View File

@ -18,6 +18,11 @@ public class Configuration {
m_root = rootConfig; m_root = rootConfig;
} }
public String getLobbyName() {
ConfigurationSection lobbyConf = m_root.getConfigurationSection("lobby");
return lobbyConf.getString("world");
}
public Collection<String> getMapNames() { public Collection<String> getMapNames() {
ConfigurationSection mapList = m_root.getConfigurationSection("maps"); ConfigurationSection mapList = m_root.getConfigurationSection("maps");
return mapList.getKeys(false); return mapList.getKeys(false);

View File

@ -5,8 +5,14 @@ import gg.malloc.defense.model.Game;
import gg.malloc.defense.model.Spawner; import gg.malloc.defense.model.Spawner;
import gg.malloc.defense.model.Waypoint; import gg.malloc.defense.model.Waypoint;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.ComponentBuilder;
import gg.malloc.defense.ui.BombCarrier; import gg.malloc.defense.ui.BombCarrier;
import gg.malloc.defense.ui.BossBars; import gg.malloc.defense.ui.BossBars;
import gg.malloc.defense.ui.Items;
import gg.malloc.defense.Plugin; import gg.malloc.defense.Plugin;
@ -31,6 +37,7 @@ import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier; import org.bukkit.attribute.AttributeModifier;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class GameRunner { public class GameRunner {
Arena m_arena; Arena m_arena;
@ -56,6 +63,7 @@ public class GameRunner {
TickTask m_fuseTask; TickTask m_fuseTask;
TickTask m_countdownTask; TickTask m_countdownTask;
TickTask m_lobbyReturnTask;
TickTask m_bombSmokeTask; TickTask m_bombSmokeTask;
TickTask m_bombCrackleTask; TickTask m_bombCrackleTask;
@ -91,14 +99,36 @@ public class GameRunner {
if (m_warmupCountdown == 0) { if (m_warmupCountdown == 0) {
requestTransition(Stage.Playing); requestTransition(Stage.Playing);
} else { } else {
m_bars.update(); BaseComponent[] message = new ComponentBuilder()
broadcastMessage("Starting game in " + m_warmupCountdown); .append("Starting game in ").color(ChatColor.LIGHT_PURPLE)
.append("" + m_warmupCountdown).color(ChatColor.AQUA).bold(true)
.create();
broadcastMessage(message);
m_warmupCountdown--; m_warmupCountdown--;
m_bars.setCountdownProgress((double)m_warmupCountdown / 10.0); m_bars.setCountdownProgress((double)m_warmupCountdown / 10.0);
m_bars.update(); m_bars.update();
} }
}, 20); }, 20);
m_lobbyReturnTask = new TickTask(m_plugin, () -> {
if (m_gameEndCountdown == 0) {
for(Player p : new ArrayList<Player>(m_players.getPlayers())) {
removePlayer(p);
m_plugin.returnPlayerToLobby(p);
}
requestTransition(Stage.Idle);
} else {
BaseComponent[] message = new ComponentBuilder()
.append("Game is ending in ").color(ChatColor.LIGHT_PURPLE)
.append("" + m_gameEndCountdown).color(ChatColor.RED).bold(true)
.create();
broadcastMessage(message);
m_gameEndCountdown--;
m_bars.setCountdownProgress((double)m_gameEndCountdown / 30.0);
m_bars.update();
}
}, 20);
m_bombSmokeTask = new TickTask(m_plugin, () -> { m_bombSmokeTask = new TickTask(m_plugin, () -> {
Location targetLoc = getLocation(m_arena.bombTarget()); Location targetLoc = getLocation(m_arena.bombTarget());
m_world.spawnParticle(Particle.SMOKE_LARGE, targetLoc, 35, 4, 2, 4); m_world.spawnParticle(Particle.SMOKE_LARGE, targetLoc, 35, 4, 2, 4);
@ -111,6 +141,7 @@ public class GameRunner {
} }
int m_warmupCountdown = 0; int m_warmupCountdown = 0;
int m_gameEndCountdown = 0;
public void handleEntityRetargeting(EntityTargetEvent evt) { public void handleEntityRetargeting(EntityTargetEvent evt) {
m_mobs.handleEntityRetarget(evt); m_mobs.handleEntityRetarget(evt);
@ -129,12 +160,23 @@ public class GameRunner {
m_world.strikeLightningEffect(getLocation(m_arena.bombTarget())); m_world.strikeLightningEffect(getLocation(m_arena.bombTarget()));
m_world.playSound(getLocation(m_arena.bombTarget()), Sound.ENTITY_GENERIC_EXPLODE, SoundCategory.NEUTRAL, 1.3f, 1.0f); m_world.playSound(getLocation(m_arena.bombTarget()), Sound.ENTITY_GENERIC_EXPLODE, SoundCategory.NEUTRAL, 1.3f, 1.0f);
m_world.spawnParticle(Particle.EXPLOSION_HUGE, getLocation(m_arena.bombTarget()), 8, 5, 2, 5); m_world.spawnParticle(Particle.EXPLOSION_HUGE, getLocation(m_arena.bombTarget()), 8, 5, 2, 5);
BaseComponent[] message = new ComponentBuilder()
.append("The bomb blew up!").color(ChatColor.RED).bold(true)
.create();
broadcastMessage(message);
requestTransition(Stage.GameOver); requestTransition(Stage.GameOver);
m_bombSmokeTask.start(); m_bombSmokeTask.start();
m_bombCrackleTask.start(); m_bombCrackleTask.start();
} }
} else if (evt.getEntity() instanceof Player) { } else if (evt.getEntity() instanceof Player) {
Player player = (Player)evt.getEntity(); Player player = (Player)evt.getEntity();
if (evt instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent entityEvt = (EntityDamageByEntityEvent)evt;
if (entityEvt.getDamager() instanceof Player) {
evt.setCancelled(true);
return;
}
}
if (m_players.contains(player) && player.getHealth() - evt.getFinalDamage() <= 0) { if (m_players.contains(player) && player.getHealth() - evt.getFinalDamage() <= 0) {
evt.setCancelled(true); evt.setCancelled(true);
handlePlayerDeath(player); handlePlayerDeath(player);
@ -151,6 +193,7 @@ public class GameRunner {
m_players.requestTransitionForAll(PlayerManager.State.Idle); m_players.requestTransitionForAll(PlayerManager.State.Idle);
m_fuseTask.stop(); m_fuseTask.stop();
m_countdownTask.stop(); m_countdownTask.stop();
m_lobbyReturnTask.stop();
return true; return true;
} }
@ -162,7 +205,13 @@ public class GameRunner {
} }
m_players.setReady(p, false); m_players.setReady(p, false);
} }
broadcastTitle("Warmup", "Prepare yourself for wave " + m_waves.currentWaveNum()); BaseComponent[] message = new ComponentBuilder()
.append("Click").color(ChatColor.LIGHT_PURPLE)
.append("[Here]").color(ChatColor.GOLD)
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/malloc-defense:ready"))
.append(" when ready.").color(ChatColor.LIGHT_PURPLE)
.create();
broadcastMessage(message);
m_mobs.clear(); m_mobs.clear();
return true; return true;
} }
@ -171,8 +220,24 @@ public class GameRunner {
setPlayerReady(p, !m_players.isReady(p)); setPlayerReady(p, !m_players.isReady(p));
} }
void clearReadyState() {
for(Player p : m_players.getPlayers()) {
setPlayerReady(p, false);
}
}
public void setPlayerReady(Player p, boolean isReady) { public void setPlayerReady(Player p, boolean isReady) {
m_players.setReady(p, isReady); if (isReady != m_players.isReady(p)) {
if (isReady) {
BaseComponent[] message = new ComponentBuilder()
.append(p.getName()).bold(true)
.append(" is ready!").color(ChatColor.AQUA).italic(true)
.create();
}
m_players.setReady(p, isReady);
}
m_bars.update();
broadcastMessage(message);
if (m_players.isEveryoneReady()) { if (m_players.isEveryoneReady()) {
requestTransition(Stage.Countdown); requestTransition(Stage.Countdown);
} }
@ -197,19 +262,15 @@ public class GameRunner {
m_countdownTask.stop(); m_countdownTask.stop();
m_fuseTask.start(); m_fuseTask.start();
spawnNextBatch(); spawnNextBatch();
broadcastTitle("Wave " + m_waves.currentWaveNum());
return true; return true;
} }
private boolean enterGameOver() { private boolean enterGameOver() {
broadcastTitle("Game Over!"); m_gameEndCountdown = 60;
broadcastMessage("The bomb blew up!"); m_lobbyReturnTask.start();
m_countdownTask.stop(); m_countdownTask.stop();
m_fuseTask.stop(); m_fuseTask.stop();
m_mobs.clear(); m_mobs.clear();
for(Player p : new ArrayList<Player>(m_players.getPlayers())) {
removePlayer(p);
}
return true; return true;
} }
@ -218,7 +279,7 @@ public class GameRunner {
} }
private void spawnNextBatch() { private void spawnNextBatch() {
broadcastMessage("Spawning batch " + m_waves.currentBatchNum()); m_log.info("Spawning batch " + m_waves.currentBatchNum());
Spawner spawner = new GameSpawner(m_world, m_arena, m_mobs, m_players); Spawner spawner = new GameSpawner(m_world, m_arena, m_mobs, m_players);
m_waves.currentWave().spawnBatch(spawner, m_waves.currentBatchNum()); m_waves.currentWave().spawnBatch(spawner, m_waves.currentBatchNum());
m_bars.update(); m_bars.update();
@ -228,7 +289,12 @@ public class GameRunner {
if (m_players.requestTransition(player, PlayerManager.State.Dead)) { if (m_players.requestTransition(player, PlayerManager.State.Dead)) {
m_world.strikeLightningEffect(player.getLocation()); m_world.strikeLightningEffect(player.getLocation());
if (!m_players.isAnyoneAlive()) { if (!m_players.isAnyoneAlive()) {
broadcastMessage("Everyone is dead :("); BaseComponent[] message = new ComponentBuilder()
.append("Everyone is ").color(ChatColor.LIGHT_PURPLE)
.append("DEAD").color(ChatColor.RED).bold(true)
.append(" :(").color(ChatColor.LIGHT_PURPLE)
.create();
broadcastMessage(message);
requestTransition(Stage.GameOver); requestTransition(Stage.GameOver);
} else { } else {
m_log.info("Remaining players " + m_players.remainingPlayers()); m_log.info("Remaining players " + m_players.remainingPlayers());
@ -239,11 +305,23 @@ public class GameRunner {
public void handleEntityDeath(Entity entity) { public void handleEntityDeath(Entity entity) {
boolean wasCarrier = m_mobs.isBombCarrier(entity); boolean wasCarrier = m_mobs.isBombCarrier(entity);
if (m_mobs.killMob(entity)) { if (m_mobs.killMob(entity)) {
int coinsToDrop = 300;
while(coinsToDrop > 0) {
int droppedCoins = Math.min(coinsToDrop, 64);
ItemStack coins = Items.makeCoins();
coins.setAmount(droppedCoins);
coinsToDrop -= 64;
m_world.dropItem(entity.getLocation(), coins);
}
m_bars.update(); m_bars.update();
if (m_mobs.remainingMobs() <= 3) { if (m_mobs.remainingMobs() <= 3) {
m_log.info("Starting next batch!"); m_log.info("Starting next batch!");
if (m_waves.isLastBatch()) { if (m_waves.isLastBatch()) {
if (m_waves.isLastWave()) { if (m_waves.isLastWave()) {
BaseComponent[] message = new ComponentBuilder()
.append("You Won!").color(ChatColor.LIGHT_PURPLE).bold(true)
.create();
broadcastMessage(message);
requestTransition(Stage.GameOver); requestTransition(Stage.GameOver);
} else if (m_mobs.empty()) { } else if (m_mobs.empty()) {
requestTransition(Stage.Warmup); requestTransition(Stage.Warmup);
@ -262,7 +340,6 @@ public class GameRunner {
if (m_stage == stage) { if (m_stage == stage) {
return false; return false;
} }
m_log.info("Game state: " + stage);
switch(stage) { switch(stage) {
case Idle: case Idle:
return enterIdle(); return enterIdle();
@ -303,12 +380,28 @@ public class GameRunner {
m_log.info("Game transition: " + m_stage + " -> " + stage); m_log.info("Game transition: " + m_stage + " -> " + stage);
m_stage = stage; m_stage = stage;
m_bars.update(); m_bars.update();
for(Player p : m_players.getPlayers()) {
sendStageTitle(p);
}
return true; return true;
} }
m_log.severe("Failed to complete transition: " + m_stage + " -> " + stage); m_log.severe("Failed to complete transition: " + m_stage + " -> " + stage);
return false; return false;
} }
void sendStageTitle(Player p) {
switch(m_stage) {
case Warmup:
p.sendTitle("Warmup", "Prepare yourself for wave " + m_waves.currentWaveNum(), 10, 70, 20);
break;
case Playing:
p.sendTitle("Wave " + m_waves.currentWaveNum(), "", 10, 70, 20);
break;
case GameOver:
p.sendTitle("Game over!", "", 10, 70, 20);
}
}
public void addPlayer(Player p) { public void addPlayer(Player p) {
if (m_players.contains(p)) { if (m_players.contains(p)) {
return; return;
@ -319,7 +412,12 @@ public class GameRunner {
if (m_players.requestTransition(p, PlayerManager.State.Playing)) { if (m_players.requestTransition(p, PlayerManager.State.Playing)) {
p.teleport(m_world.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); p.teleport(m_world.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN);
} }
broadcastMessage(p.getName() + " has joined the game"); BaseComponent[] message = new ComponentBuilder()
.append(p.getName()).bold(true)
.append("Has joined the game").color(ChatColor.AQUA)
.create();
broadcastMessage(message);
sendStageTitle(p);
if (m_stage == Stage.Idle) { if (m_stage == Stage.Idle) {
requestTransition(Stage.Warmup); requestTransition(Stage.Warmup);
} }
@ -331,6 +429,12 @@ public class GameRunner {
m_players.removePlayer(p); m_players.removePlayer(p);
if (m_players.isEmpty()) { if (m_players.isEmpty()) {
requestTransition(Stage.Idle); requestTransition(Stage.Idle);
} else {
BaseComponent[] message = new ComponentBuilder()
.append(p.getName()).bold(true)
.append("Has left the game").color(ChatColor.AQUA)
.create();
broadcastMessage(message);
} }
} }
@ -344,9 +448,9 @@ public class GameRunner {
} }
} }
void broadcastMessage(String string) { void broadcastMessage(BaseComponent[] component) {
for(Player p : m_world.getPlayers()) { for(Player p : m_world.getPlayers()) {
p.sendMessage(string); p.spigot().sendMessage(component);
} }
} }
} }

View File

@ -62,7 +62,7 @@ public class PlayerManager {
//m_log.fine("Respawning player " + player); //m_log.fine("Respawning player " + player);
player.setGameMode(Bukkit.getDefaultGameMode()); player.setGameMode(Bukkit.getDefaultGameMode());
player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()); player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
player.setFoodLevel(10); player.setFoodLevel(20);
return true; return true;
} }
@ -109,6 +109,7 @@ public class PlayerManager {
//m_log.info("Removing player " + player); //m_log.info("Removing player " + player);
requestTransition(player, State.Idle); requestTransition(player, State.Idle);
m_playerStates.remove(player); m_playerStates.remove(player);
m_playerReadyStates.remove(player);
return true; return true;
} }

View File

@ -15,23 +15,15 @@ public class BombCarrier {
public LivingEntity inHand() { public LivingEntity inHand() {
EntityEquipment equipment = m_entity.getEquipment(); EntityEquipment equipment = m_entity.getEquipment();
equipment.setItemInOffHand(makeBombHelmet()); equipment.setItemInOffHand(Items.makeBombHelmet());
//equipment.setItemInOffHandDropChance(0.0f); //equipment.setItemInOffHandDropChance(0.0f);
return m_entity; return m_entity;
} }
public LivingEntity onHead() { public LivingEntity onHead() {
EntityEquipment equipment = m_entity.getEquipment(); EntityEquipment equipment = m_entity.getEquipment();
equipment.setHelmet(makeBombHelmet()); equipment.setHelmet(Items.makeBombHelmet());
//equipment.setHelmetDropChance(0.0f); //equipment.setHelmetDropChance(0.0f);
return m_entity; return m_entity;
} }
static ItemStack makeBombHelmet() {
ItemStack bombItem = new ItemStack(Material.CARVED_PUMPKIN);
ItemMeta meta = bombItem.getItemMeta();
meta.setCustomModelData(33197);
bombItem.setItemMeta(meta);
return bombItem;
}
} }

View File

@ -108,7 +108,10 @@ public class BossBars {
m_gameBar.setColor(BarColor.RED); m_gameBar.setColor(BarColor.RED);
m_gameBar.setProgress(1.0); m_gameBar.setProgress(1.0);
m_gameBar.setTitle("Game Over!"); m_gameBar.setTitle("Game Over!");
m_waveBar.setVisible(false); m_waveBar.setVisible(true);
m_waveBar.setColor(BarColor.BLUE);
m_waveBar.setTitle("Returning to lobby...");
m_waveBar.setProgress(m_countdownProgress);
m_bombBar.setVisible(false); m_bombBar.setVisible(false);
break; break;
} }

View File

@ -1,14 +1,29 @@
package gg.malloc.defense.engine; package gg.malloc.defense.ui;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.Material; import org.bukkit.Material;
import de.tr7zw.nbtapi.NBTItem;
import de.tr7zw.nbtapi.NBTCompound;
public class Items { public class Items {
static ItemStack makeBombHelmet() { public static ItemStack makeCoins() {
ItemStack coinItem = new ItemStack(Material.IRON_NUGGET);
ItemMeta meta = coinItem.getItemMeta();
meta.setCustomModelData(93197);
coinItem.setItemMeta(meta);
NBTItem nbt = new NBTItem(coinItem);
nbt.addCompound("malloc").setInteger("coinValue", 1);
return nbt.getItem();
}
public static ItemStack makeBombHelmet() {
ItemStack bombItem = new ItemStack(Material.CARVED_PUMPKIN); ItemStack bombItem = new ItemStack(Material.CARVED_PUMPKIN);
ItemMeta meta = bombItem.getItemMeta(); ItemMeta meta = bombItem.getItemMeta();
meta.setCustomModelData(0); meta.setCustomModelData(33197);
bombItem.setItemMeta(meta); bombItem.setItemMeta(meta);
return bombItem; return bombItem;
} }

View File

@ -1,3 +1,5 @@
lobby:
world: world
maps: maps:
quarry: quarry:
target: target: