Achievement Base

This commit is contained in:
Sam 2017-10-23 18:38:15 +01:00 committed by Alexander Meech
parent ab882fac18
commit 8632212297
5 changed files with 53 additions and 3 deletions

View File

@ -1375,6 +1375,12 @@ public enum Achievement
"I",
new String[] {"II","III","IV","V","X"},
AchievementCategory.MOBA),
CAKE_WARS_KILLS("Cake Slayer", 5000,
new String[]{"Cake Wars.Kills"},
new String[]{"+1 for each kill"},
new int[]{50,100,200,400,1000},
AchievementCategory.CAKE_WARS),
;
private String _name;

View File

@ -242,7 +242,19 @@ public enum AchievementCategory
MOBA("Heroes of GWEN", null,
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, null, StatDisplay.fromGame("Gold Earned", GameDisplay.MOBA, "GoldEarned")},
Material.PRISMARINE_SHARD, 0, GameCategory.CLASSICS, null, false, GameDisplay.MOBA.getGameId());
Material.PRISMARINE_SHARD, 0, GameCategory.CLASSICS, null, false, GameDisplay.MOBA.getGameId()),
CAKE_WARS("Cake Wars", null,
new StatDisplay[]
{
StatDisplay.WINS,
StatDisplay.GAMES_PLAYED,
null,
StatDisplay.KILLS,
StatDisplay.DEATHS,
StatDisplay.GEMS_EARNED,
},
Material.CAKE, 0, GameCategory.ARCADE, null, false, GameDisplay.CakeWars.getGameId());
private String _name;
private String[] _statsToPull;

View File

@ -20,7 +20,7 @@ public class KitCakeBuilder extends ProgressingKit
{
"Get extra blocks to build with!",
"",
"Receive " + C.cGreen + "1" + C.cWhite + " wool block every " + C.cGreen + "4" + C.cWhite + " seconds",
receiveItem("Wool Block", 1, 4, 32),
};
private static final Perk[] PERKS =

View File

@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -29,7 +31,7 @@ public class PerkPassiveWoolGain extends Perk
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (UtilPlayer.isSpectator(player) || !hasPerk(player))
if (UtilPlayer.isSpectator(player) || !hasPerk(player) || player.getInventory().contains(Material.WOOL, 32))
{
continue;
}

View File

@ -7,11 +7,13 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilItem.ItemCategory;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
@ -30,6 +32,12 @@ public class CakeResourcePage extends ShopPageBase<ArcadeManager, CakeResourceSh
private static final ItemStack CLOSE_ITEM = new ItemBuilder(Material.BARRIER)
.setTitle(C.cRedB + "Close")
.build();
private static final ItemCategory[] REMOVE_ON_BUY =
{
ItemCategory.SWORD,
ItemCategory.PICKAXE,
ItemCategory.AXE
};
final CakeWars _game;
final CakeResource _resource;
@ -173,6 +181,15 @@ public class CakeResourcePage extends ShopPageBase<ArcadeManager, CakeResourceSh
}
else
{
for (ItemCategory category : REMOVE_ON_BUY)
{
if (UtilItem.is(giveItem, category))
{
removeCategory(player, category);
break;
}
}
UtilInv.insert(player, giveItem);
}
@ -187,4 +204,17 @@ public class CakeResourcePage extends ShopPageBase<ArcadeManager, CakeResourceSh
}
}
}
private void removeCategory(Player player, ItemCategory category)
{
PlayerInventory inventory = player.getInventory();
for (int i = 0; i < inventory.getSize(); i++)
{
if (UtilItem.is(inventory.getItem(i), category))
{
inventory.setItem(i, null);
}
}
}
}