Update arcade games with new crown/gem toggle and flint and steel permission flag

This commit is contained in:
AlexTheCoder 2017-05-04 18:40:57 -04:00
parent 901fecb49a
commit 7b70695e12
4 changed files with 55 additions and 20 deletions

View File

@ -4,8 +4,6 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import net.minecraft.server.v1_8_R3.EntityLiving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -123,7 +121,6 @@ import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
import mineplex.serverdata.Region; import mineplex.serverdata.Region;
import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.SoupAddon;
import nautilus.game.arcade.booster.GameBoosterManager; import nautilus.game.arcade.booster.GameBoosterManager;
import nautilus.game.arcade.command.CancelNextGameCommand; import nautilus.game.arcade.command.CancelNextGameCommand;
@ -168,6 +165,7 @@ import nautilus.game.arcade.managers.lobby.current.NewGameLobbyManager;
import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager; import nautilus.game.arcade.managers.lobby.legacy.LegacyGameLobbyManager;
import nautilus.game.arcade.player.ArcadePlayer; import nautilus.game.arcade.player.ArcadePlayer;
import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.ArcadeShop;
import net.minecraft.server.v1_8_R3.EntityLiving;
public class ArcadeManager extends MiniPlugin implements IRelation public class ArcadeManager extends MiniPlugin implements IRelation
{ {
@ -495,7 +493,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
scoreboard.get(ArcadeScoreboardLine.PLAYERS_NAME).write(C.cYellow + C.Bold + "Players"); scoreboard.get(ArcadeScoreboardLine.PLAYERS_NAME).write(C.cYellow + C.Bold + "Players");
scoreboard.get(ArcadeScoreboardLine.KIT_NAME).write(C.cGray + C.Bold + "Kit"); scoreboard.get(ArcadeScoreboardLine.KIT_NAME).write(C.cGray + C.Bold + "Kit");
scoreboard.get(ArcadeScoreboardLine.GEM_NAME).write(C.cGreen + C.Bold + "Gems");
scoreboard.get(ArcadeScoreboardLine.SERVER_NAME).write(C.cAqua + C.Bold + "Server"); scoreboard.get(ArcadeScoreboardLine.SERVER_NAME).write(C.cAqua + C.Bold + "Server");
scoreboard.get(ArcadeScoreboardLine.SERVER_VALUE).write(_plugin.getConfig().getString("serverstatus.name")); scoreboard.get(ArcadeScoreboardLine.SERVER_VALUE).write(_plugin.getConfig().getString("serverstatus.name"));
} }
@ -520,7 +517,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
scoreboard.get(ArcadeScoreboardLine.PLAYERS_VALUE).write(_gameManager.getValidPlayersForGameStart().size() + "/" + GetPlayerFull()); scoreboard.get(ArcadeScoreboardLine.PLAYERS_VALUE).write(_gameManager.getValidPlayersForGameStart().size() + "/" + GetPlayerFull());
if (GetGame() != null && GetGame().CrownsEnabled)
{
scoreboard.get(ArcadeScoreboardLine.GEM_NAME).write(C.cGold + C.Bold + "Crowns");
scoreboard.get(ArcadeScoreboardLine.GEM_VALUE).write(donationManager.getCrowns(scoreboard.getOwner()));
}
else
{
scoreboard.get(ArcadeScoreboardLine.GEM_NAME).write(C.cGreen + C.Bold + "Gems");
scoreboard.get(ArcadeScoreboardLine.GEM_VALUE).write(donationManager.Get(scoreboard.getOwner()).getBalance(GlobalCurrency.GEM)); scoreboard.get(ArcadeScoreboardLine.GEM_VALUE).write(donationManager.Get(scoreboard.getOwner()).getBalance(GlobalCurrency.GEM));
}
if (GetGame() != null) if (GetGame() != null)
{ {

View File

@ -253,6 +253,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public boolean WorldBoneMeal = false; public boolean WorldBoneMeal = false;
public boolean WorldChunkUnload = false; public boolean WorldChunkUnload = false;
public boolean AllowFlintAndSteel = false;
public int HungerSet = -1; public int HungerSet = -1;
public int HealthSet = -1; public int HealthSet = -1;
@ -316,6 +318,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public final ChatStatData BlankLine = new ChatStatData().blankLine(); public final ChatStatData BlankLine = new ChatStatData().blankLine();
// Gems // Gems
public boolean CrownsEnabled = false;
public double GemMultiplier = 1; public double GemMultiplier = 1;
public boolean GemHunterEnabled = true; public boolean GemHunterEnabled = true;
public boolean GemBoosterEnabled = true; public boolean GemBoosterEnabled = true;
@ -334,6 +338,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
public Location SpectatorSpawn = null; public Location SpectatorSpawn = null;
public boolean FirstKill = true; public boolean FirstKill = true;
public int FirstKillReward = 10;
public String Winner = "Nobody"; public String Winner = "Nobody";
public GameTeam WinnerTeam = null; public GameTeam WinnerTeam = null;

View File

@ -54,6 +54,7 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockGrowEvent; import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
@ -1172,6 +1173,11 @@ public class GameFlagManager implements Listener
if (game.WorldFireSpread) if (game.WorldFireSpread)
return; return;
if (event.getCause() == IgniteCause.FLINT_AND_STEEL && game.AllowFlintAndSteel)
{
return;
}
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -80,7 +80,7 @@ public class GameRewardManager implements Listener
//First Kill //First Kill
if (game.FirstKill) if (game.FirstKill)
{ {
game.AddGems(killer, 10, "First Blood", false, false); game.AddGems(killer, game.FirstKillReward, "First Blood", false, false);
Manager.getPluginManager().callEvent(new FirstBloodEvent(killer)); Manager.getPluginManager().callEvent(new FirstBloodEvent(killer));
@ -191,7 +191,7 @@ public class GameRewardManager implements Listener
} }
// Gem Finder // Gem Finder
if (game.GemHunterEnabled) if (game.GemHunterEnabled && !game.CrownsEnabled)
{ {
int gemFinder = Manager.GetAchievement().get(player, Achievement.GLOBAL_GEM_HUNTER).getLevel(); int gemFinder = Manager.GetAchievement().get(player, Achievement.GLOBAL_GEM_HUNTER).getLevel();
if (gemFinder > 0) if (gemFinder > 0)
@ -216,7 +216,7 @@ public class GameRewardManager implements Listener
} }
} }
if (DoubleGem && game.GemDoubleEnabled) if (DoubleGem && game.GemDoubleEnabled && !game.CrownsEnabled)
gemsToReward += baseGemsEarned; gemsToReward += baseGemsEarned;
Rank rank = Manager.GetClients().Get(player).GetRank(); Rank rank = Manager.GetClients().Get(player).GetRank();
@ -233,17 +233,35 @@ public class GameRewardManager implements Listener
else if (rank.has(Rank.ETERNAL)) else if (rank.has(Rank.ETERNAL))
shardsToReward += baseShardsEarned * 2.5; shardsToReward += baseShardsEarned * 2.5;
if (!game.CrownsEnabled)
{
Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, player, "Earned " + game.GetName(), gemsToReward); Manager.GetDonation().rewardCurrency(GlobalCurrency.GEM, player, "Earned " + game.GetName(), gemsToReward);
}
else
{
Manager.GetDonation().rewardCrowns(gemsToReward, player);
}
if (accountId != -1) if (accountId != -1)
{ {
Manager.GetDonation().rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Earned", shardsToReward); Manager.GetDonation().rewardCurrencyUntilSuccess(GlobalCurrency.TREASURE_SHARD, player, "Earned", shardsToReward);
} }
if (!game.CrownsEnabled)
{
Manager.getTrackManager().getTrack(GemCollectorTrack.class).earnedGems(player, gemsToReward); Manager.getTrackManager().getTrack(GemCollectorTrack.class).earnedGems(player, gemsToReward);
}
//Stats //Stats
if (!game.CrownsEnabled)
{
Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", gemsToReward); Manager.GetStatsManager().incrementStat(player, "Global.GemsEarned", gemsToReward);
Manager.GetStatsManager().incrementStat(player, game.GetName() + ".GemsEarned", gemsToReward); Manager.GetStatsManager().incrementStat(player, game.GetName() + ".GemsEarned", gemsToReward);
} }
else
{
Manager.GetStatsManager().incrementStat(player, "Global.CrownsEarned", gemsToReward);
Manager.GetStatsManager().incrementStat(player, game.GetName() + ".CrownsEarned", gemsToReward);
}
}
private void changeName(Player player, String newName) private void changeName(Player player, String newName)
{ {
@ -274,7 +292,7 @@ public class GameRewardManager implements Listener
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, Manager.IsRewardGems() ? "§f§lGems Earned" : "§f§lGame Stats"); UtilPlayer.message(player, Manager.IsRewardGems() ? (game.CrownsEnabled ? "§f§lCrowns Earned" : "§f§lGems Earned") : "§f§lGame Stats");
UtilPlayer.message(player, ""); UtilPlayer.message(player, "");
int earnedGems = 0; int earnedGems = 0;
@ -294,7 +312,7 @@ public class GameRewardManager implements Listener
String out = ""; String out = "";
if (Manager.IsRewardGems()) if (Manager.IsRewardGems())
out += F.elem(C.cGreen + "+" + (int) (gemCount * game.GemMultiplier) + " Gems") + " for "; out += F.elem((game.CrownsEnabled ? C.cGold : C.cGreen) + "+" + (int) (gemCount * game.GemMultiplier) + (game.CrownsEnabled ? " Crowns" : " Gems")) + " for ";
out += F.elem(amountStr + type); out += F.elem(amountStr + type);
UtilPlayer.message(player, out); UtilPlayer.message(player, out);
@ -313,7 +331,7 @@ public class GameRewardManager implements Listener
int totalGems = earnedGems; int totalGems = earnedGems;
//Gem Finder //Gem Finder
if (game.GemHunterEnabled) if (game.GemHunterEnabled && !game.CrownsEnabled)
{ {
int gemFinder = Manager.GetAchievement().get(player, Achievement.GLOBAL_GEM_HUNTER).getLevel(); int gemFinder = Manager.GetAchievement().get(player, Achievement.GLOBAL_GEM_HUNTER).getLevel();
if (gemFinder > 0) if (gemFinder > 0)
@ -341,7 +359,7 @@ public class GameRewardManager implements Listener
if (extraGems > 0) if (extraGems > 0)
{ {
UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + UtilPlayer.message(player, F.elem((game.CrownsEnabled ? C.cGold : C.cGreen) + "+" + extraGems + (game.CrownsEnabled ? " Crowns" : " Gems")) + " for " +
F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int) (hoursOnline * 20) + "%")); F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int) (hoursOnline * 20) + "%"));
totalGems += extraGems; totalGems += extraGems;
@ -350,7 +368,7 @@ public class GameRewardManager implements Listener
} }
//Double Gem //Double Gem
if (DoubleGem && game.GemDoubleEnabled) if (DoubleGem && game.GemDoubleEnabled && !game.CrownsEnabled)
{ {
UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend")); UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend"));
@ -393,13 +411,13 @@ public class GameRewardManager implements Listener
if (give) if (give)
{ {
UtilPlayer.message(player, F.elem(C.cWhite + "§lYou now have " + UtilPlayer.message(player, F.elem(C.cWhite + "§lYou now have " +
C.cGreen + C.Bold + (Manager.GetDonation().Get(player.getUniqueId()).getBalance(GlobalCurrency.GEM) + totalGems) + " Gems") + C.cWhite + C.Bold + " and " + (game.CrownsEnabled ? (C.cGoldB + (Manager.GetDonation().getCrowns(player) + totalGems) + " Crowns") : (C.cGreenB + (Manager.GetDonation().Get(player.getUniqueId()).getBalance(GlobalCurrency.GEM) + totalGems) + " Gems"))) + C.cWhite + C.Bold + " and " +
F.elem(C.cAqua + C.Bold + (Manager.GetDonation().Get(player.getUniqueId()).getBalance(GlobalCurrency.TREASURE_SHARD) + shards) + " Treasure Shards")); F.elem(C.cAqua + C.Bold + (Manager.GetDonation().Get(player.getUniqueId()).getBalance(GlobalCurrency.TREASURE_SHARD) + shards) + " Treasure Shards"));
} }
else else
{ {
UtilPlayer.message(player, F.elem(C.cWhite + "§lGame is still in progress...")); UtilPlayer.message(player, F.elem(C.cWhite + "§lGame is still in progress..."));
UtilPlayer.message(player, F.elem(C.cWhite + "§lYou may earn more " + C.cGreen + C.Bold + "Gems" + C.cWhite + C.Bold + " when its completed.")); UtilPlayer.message(player, F.elem(C.cWhite + "§lYou may earn more " + (game.CrownsEnabled ? (C.cGoldB + "Crowns") : (C.cGreenB + "Gems")) + C.cWhite + C.Bold + " when it's completed."));
} }
UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, ArcadeFormat.Line);