mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Added lives support for game types
This commit is contained in:
parent
4163fc8905
commit
ec90e59297
@ -68,7 +68,7 @@ public class MainCommand extends BRCommand {
|
|||||||
MessageUtil.sendCenteredMessage(sender, "&4" + D[2] + "&f" + X[2] + L[2]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + D[2] + "&f" + X[2] + L[2]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4" + D[3] + "&f" + X[3] + L[3]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + D[3] + "&f" + X[3] + L[3]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&4" + D[4] + "&f" + X[4] + L[4]);
|
MessageUtil.sendCenteredMessage(sender, "&4" + D[4] + "&f" + X[4] + L[4]);
|
||||||
MessageUtil.sendCenteredMessage(sender, "&b&l####### " + messageConfig.getMessage(Messages.CMD_MAIN_WELCOME) + "&7 v" + plugin.getDescription().getVersion() + " &b&l#######");
|
MessageUtil.sendCenteredMessage(sender, "&b&l###### " + messageConfig.getMessage(Messages.CMD_MAIN_WELCOME) + "&7 v" + plugin.getDescription().getVersion() + " &b&l######");
|
||||||
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
|
||||||
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs));
|
||||||
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_HELP));
|
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(Messages.CMD_MAIN_HELP));
|
||||||
|
@ -74,40 +74,40 @@ public interface GameType {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mobWaves
|
* @param mobWaves
|
||||||
* the mobWaves to set
|
* enable / disable mob waves
|
||||||
*/
|
*/
|
||||||
public void setMobWaves(boolean mobWaves);
|
public void setMobWaves(boolean mobWaves);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the rewards
|
* @return if players get rewards after the dungeon
|
||||||
*/
|
*/
|
||||||
public boolean hasRewards();
|
public boolean hasRewards();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param rewards
|
* @param rewards
|
||||||
* the rewards to set
|
* enable / disable rewards
|
||||||
*/
|
*/
|
||||||
public void setRewards(boolean rewards);
|
public void setRewards(boolean rewards);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the showTime
|
* @return if players shall see how long they play
|
||||||
*/
|
*/
|
||||||
public boolean getShowTime();
|
public boolean getShowTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param showTime
|
* @param showTime
|
||||||
* the showTime to set
|
* set if players shall see how long they play
|
||||||
*/
|
*/
|
||||||
public void setShowTime(boolean showTime);
|
public void setShowTime(boolean showTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the build
|
* @return if players can build
|
||||||
*/
|
*/
|
||||||
public boolean canBuild();
|
public boolean canBuild();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param build
|
* @param build
|
||||||
* the build to set
|
* enable / disable building
|
||||||
*/
|
*/
|
||||||
public void setBuild(boolean build);
|
public void setBuild(boolean build);
|
||||||
|
|
||||||
@ -122,4 +122,15 @@ public interface GameType {
|
|||||||
*/
|
*/
|
||||||
public void setGameMode(GameMode gameMode);
|
public void setGameMode(GameMode gameMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if players lose lives
|
||||||
|
*/
|
||||||
|
public boolean hasLives();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lives
|
||||||
|
* set if the gametype uses player lives
|
||||||
|
*/
|
||||||
|
public void setLives(boolean lives);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,21 +23,21 @@ import org.bukkit.GameMode;
|
|||||||
*/
|
*/
|
||||||
public enum GameTypeDefault implements GameType {
|
public enum GameTypeDefault implements GameType {
|
||||||
|
|
||||||
ADVENTURE("Adventure", "Adventure", false, false, false, true, false, true, GameMode.ADVENTURE),
|
ADVENTURE("Adventure", "Adventure", false, false, false, true, false, true, GameMode.ADVENTURE, true),
|
||||||
ADVENTURE_TIME_IS_RUNNING("Adventure - Time is Running", "Adventure TiR", false, false, false, true, true, true, GameMode.ADVENTURE),
|
ADVENTURE_TIME_IS_RUNNING("Adventure - Time is Running", "Adventure TiR", false, false, false, true, true, true, GameMode.ADVENTURE, true),
|
||||||
APOCALYPSE_LAST_MAN_STANDING("Apocalypse", "Apocalypse LMS", true, true, true, true, false, false, GameMode.SURVIVAL),
|
APOCALYPSE_LAST_MAN_STANDING("Apocalypse", "Apocalypse LMS", true, true, true, true, false, false, GameMode.SURVIVAL, true),
|
||||||
APOCALYPSE_LIMITED_MOBS("Apocalypse - Limited Mobs", "Apc Limited", true, true, true, true, false, false, GameMode.SURVIVAL),
|
APOCALYPSE_LIMITED_MOBS("Apocalypse - Limited Mobs", "Apc Limited", true, true, true, true, false, false, GameMode.SURVIVAL, true),
|
||||||
APOCALYPSE_TIME_IS_RUNNING("Apocalypse - Time is Running", "Apocalypse TiR", true, true, true, true, true, false, GameMode.SURVIVAL),
|
APOCALYPSE_TIME_IS_RUNNING("Apocalypse - Time is Running", "Apocalypse TiR", true, true, true, true, true, false, GameMode.SURVIVAL, true),
|
||||||
PVE_LAST_MAN_STANDING("Player versus Environment - Last Man Standing", "PvE LMS", false, false, true, true, false, false, GameMode.SURVIVAL),
|
PVE_LAST_MAN_STANDING("Player versus Environment - Last Man Standing", "PvE LMS", false, false, true, true, false, false, GameMode.SURVIVAL, true),
|
||||||
PVE_LIMITED_MOBS("Player versus Environment - Limited Mobs", "PvE Limited", false, false, true, true, false, false, GameMode.SURVIVAL),
|
PVE_LIMITED_MOBS("Player versus Environment - Limited Mobs", "PvE Limited", false, false, true, true, false, false, GameMode.SURVIVAL, true),
|
||||||
PVE_TIME_IS_RUNNING("Player versus Environment - Time is Running", "PvE TiR", false, false, true, true, true, false, GameMode.SURVIVAL),
|
PVE_TIME_IS_RUNNING("Player versus Environment - Time is Running", "PvE TiR", false, false, true, true, true, false, GameMode.SURVIVAL, true),
|
||||||
PVP_FACTIONS_BATTLEFIELD("Player versus Player - Factions Battlefield", "FactionsPvP", true, false, false, false, false, false, GameMode.SURVIVAL),
|
PVP_FACTIONS_BATTLEFIELD("Player versus Player - Factions Battlefield", "FactionsPvP", true, false, false, false, false, false, GameMode.SURVIVAL, true),
|
||||||
PVP_LAST_MAN_STANDING("Player versus Player - Last Man Standing", "PvP LMS", true, false, false, false, false, false, GameMode.SURVIVAL),
|
PVP_LAST_MAN_STANDING("Player versus Player - Last Man Standing", "PvP LMS", true, false, false, false, false, false, GameMode.SURVIVAL, true),
|
||||||
QUEST("Quest", "Quest", false, false, false, true, false, false, GameMode.SURVIVAL),
|
QUEST("Quest", "Quest", false, false, false, true, false, false, GameMode.SURVIVAL, true),
|
||||||
QUEST_TIME_IS_RUNNING("Quest - Time is Running", "Quest TiR", false, false, false, true, true, false, GameMode.SURVIVAL),
|
QUEST_TIME_IS_RUNNING("Quest - Time is Running", "Quest TiR", false, false, false, true, true, false, GameMode.SURVIVAL, true),
|
||||||
TEST("Test", "Test", false, false, false, false, true, true, GameMode.SURVIVAL),
|
TEST("Test", "Test", false, false, false, false, true, true, GameMode.SURVIVAL, false),
|
||||||
TUTORIAL("Tutorial", "Tutorial", false, false, false, true, false, false, GameMode.SURVIVAL),
|
TUTORIAL("Tutorial", "Tutorial", false, false, false, true, false, false, GameMode.SURVIVAL, false),
|
||||||
DEFAULT("Default", "Default", false, false, false, true, false, false, GameMode.SURVIVAL);
|
DEFAULT("Default", "Default", false, false, false, true, false, false, GameMode.SURVIVAL, true);
|
||||||
|
|
||||||
private String displayName;
|
private String displayName;
|
||||||
private String signName;
|
private String signName;
|
||||||
@ -48,8 +48,9 @@ public enum GameTypeDefault implements GameType {
|
|||||||
private boolean showTime;// TODO: Implementing
|
private boolean showTime;// TODO: Implementing
|
||||||
private boolean build;// TODO: Testing
|
private boolean build;// TODO: Testing
|
||||||
private GameMode gameMode;// TODO: Testing
|
private GameMode gameMode;// TODO: Testing
|
||||||
|
private boolean lives;
|
||||||
|
|
||||||
GameTypeDefault(String displayName, String signName, boolean playerVersusPlayer, boolean friendlyFire, boolean mobWaves, boolean rewards, boolean showTime, boolean build, GameMode gameMode) {
|
GameTypeDefault(String displayName, String signName, boolean playerVersusPlayer, boolean friendlyFire, boolean mobWaves, boolean rewards, boolean showTime, boolean build, GameMode gameMode, boolean lives) {
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
this.signName = signName;
|
this.signName = signName;
|
||||||
this.playerVersusPlayer = playerVersusPlayer;
|
this.playerVersusPlayer = playerVersusPlayer;
|
||||||
@ -59,6 +60,7 @@ public enum GameTypeDefault implements GameType {
|
|||||||
this.showTime = showTime;
|
this.showTime = showTime;
|
||||||
this.build = build;
|
this.build = build;
|
||||||
this.gameMode = gameMode;
|
this.gameMode = gameMode;
|
||||||
|
this.lives = lives;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -151,4 +153,14 @@ public enum GameTypeDefault implements GameType {
|
|||||||
this.gameMode = gameMode;
|
this.gameMode = gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasLives() {
|
||||||
|
return lives;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLives(boolean lives) {
|
||||||
|
this.lives = lives;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,14 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gameWorld.getGame() != null) {
|
||||||
|
if (!gameWorld.getGame().getType().hasLives()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
|
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
|
||||||
|
|
||||||
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
if (dPlayer.getLives() == 0 && dPlayer.isReady()) {
|
||||||
@ -308,21 +316,23 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DPlayer.getByPlayer(player).isReady()) {
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
if (dPlayer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dPlayer.isReady()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
|
||||||
GameWorld gameWorld = GameWorld.getByWorld(dPlayer.getWorld());
|
GameWorld gameWorld = GameWorld.getByWorld(dPlayer.getWorld());
|
||||||
|
|
||||||
if (dPlayer != null) {
|
for (Material material : gameWorld.getConfig().getSecureObjects()) {
|
||||||
for (Material material : gameWorld.getConfig().getSecureObjects()) {
|
if (material == event.getItemDrop().getItemStack().getType()) {
|
||||||
if (material == event.getItemDrop().getItemStack().getType()) {
|
event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DROP));
|
||||||
MessageUtil.sendMessage(player, messageConfig.getMessage(Messages.ERROR_DROP));
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +341,6 @@ public class PlayerListener implements Listener {
|
|||||||
public void onRespawn(PlayerRespawnEvent event) {
|
public void onRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
DPlayer dPlayer = DPlayer.getByPlayer(player);
|
||||||
|
|
||||||
if (dPlayer == null) {
|
if (dPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user