Best MockBukkit code snippet using be.seeseemelk.mockbukkit.statistic.StatisticsMock.setStatistic
Source:StatisticsMock.java
...15 private final Map<Statistic, Integer> untypedStatistics = new EnumMap<>(Statistic.class);16 private final Map<Statistic, Map<Material, Integer>> materialStatistics = new EnumMap<>(Statistic.class);17 private final Map<Statistic, Map<EntityType, Integer>> entityStatistics = new EnumMap<>(Statistic.class);18 /**19 * Implementation of {@link org.bukkit.OfflinePlayer#setStatistic(Statistic, int)}20 */21 public void setStatistic(@NotNull Statistic statistic, int amount)22 {23 Validate.isTrue(amount >= 0, "amount must be greater than or equal to 0");24 Validate.isTrue(statistic.getType() == Type.UNTYPED, "statistic must be provided with parameter");25 untypedStatistics.put(statistic, amount);26 }27 /**28 * Implementation of {@link org.bukkit.OfflinePlayer#setStatistic(Statistic, Material, int)}29 */30 public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)31 {32 Validate.isTrue(amount >= 0, "amount must be greater than or equal to 0");33 Validate.isTrue(statistic.getType() == Type.ITEM || statistic.getType() == Type.BLOCK, "statistic must take a material parameter");34 materialStatistics.computeIfAbsent(statistic, k -> new EnumMap<>(Material.class)).put(material, amount);35 }36 /**37 * Implementation of {@link org.bukkit.OfflinePlayer#setStatistic(Statistic, EntityType, int)}38 */39 public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entity, int amount)40 {41 Validate.isTrue(amount >= 0, "amount must be greater than or equal to 0");42 Validate.isTrue(statistic.getType() == Type.ENTITY, "statistic must take an entity parameter");43 entityStatistics.computeIfAbsent(statistic, k -> new EnumMap<>(EntityType.class)).put(entity, amount);44 }45 /**46 * Implementation of {@link org.bukkit.OfflinePlayer#incrementStatistic(Statistic, int)}47 */48 public void incrementStatistic(@NotNull Statistic statistic, int amount)49 {50 Validate.isTrue(amount > 0, "amount must be greater than 0");51 setStatistic(statistic, getStatistic(statistic) + amount);52 }53 /**54 * Implementation of {@link org.bukkit.OfflinePlayer#incrementStatistic(Statistic, Material, int)}55 */56 public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)57 {58 Validate.isTrue(amount > 0, "amount must be greater than 0");59 setStatistic(statistic, material, getStatistic(statistic, material) + amount);60 }61 /**62 * Implementation of {@link org.bukkit.OfflinePlayer#incrementStatistic(Statistic, EntityType, int)}63 */64 public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entity, int amount)65 {66 Validate.isTrue(amount > 0, "amount must be greater than 0");67 setStatistic(statistic, entity, getStatistic(statistic, entity) + amount);68 }69 /**70 * Implementation of {@link org.bukkit.OfflinePlayer#decrementStatistic(Statistic, int)}71 */72 public void decrementStatistic(@NotNull Statistic statistic, int amount)73 {74 Validate.isTrue(amount > 0, "amount must be greater than 0");75 setStatistic(statistic, getStatistic(statistic) - amount);76 }77 /**78 * Implementation of {@link org.bukkit.OfflinePlayer#decrementStatistic(Statistic, Material, int)}79 */80 public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)81 {82 Validate.isTrue(amount > 0, "amount must be greater than 0");83 setStatistic(statistic, material, getStatistic(statistic, material) - amount);84 }85 /**86 * Implementation of {@link org.bukkit.OfflinePlayer#decrementStatistic(Statistic, EntityType, int)}87 */88 public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entity, int amount)89 {90 Validate.isTrue(amount > 0, "amount must be greater than 0");91 setStatistic(statistic, entity, getStatistic(statistic, entity) - amount);92 }93 /**94 * Implementation of {@link org.bukkit.OfflinePlayer#getStatistic(Statistic)}95 */96 public int getStatistic(@NotNull Statistic statistic)97 {98 Validate.isTrue(statistic.getType() == Type.UNTYPED, "statistic must be provided with parameter");99 return untypedStatistics.getOrDefault(statistic, 0);100 }101 /**102 * Implementation of {@link org.bukkit.OfflinePlayer#getStatistic(Statistic, Material)}103 */104 public int getStatistic(@NotNull Statistic statistic, @NotNull Material material)105 {...
setStatistic
Using AI Code Generation
1public void setStatistic(Player player, Statistic statistic, int amount)2public void setStatistic(Player player, Statistic statistic, Material material, int amount)3public void setStatistic(Player player, Statistic statistic, EntityType entityType, int amount)4public int getStatistic(Player player, Statistic statistic)5public int getStatistic(Player player, Statistic statistic, Material material)6public int getStatistic(Player player, Statistic statistic, EntityType entityType)7public int getStatistic(Player player, Statistic statistic)8public int getStatistic(Player player, Statistic statistic, Material material)9public int getStatistic(Player player, Statistic statistic, EntityType entityType)10public int getStatistic(Player player, Statistic statistic)11public int getStatistic(Player player, Statistic statistic, Material material)12public int getStatistic(Player player, Statistic statistic, EntityType entityType)13public int getStatistic(Player player, Statistic statistic)14public int getStatistic(Player player, Statistic statistic, Material material)15public int getStatistic(Player player, Statistic statistic, EntityType entityType)16public int getStatistic(Player player, Statistic statistic)17public int getStatistic(Player player, Statistic statistic, Material material)18public int getStatistic(Player player, Statistic statistic, EntityType entityType)19public int getStatistic(Player player, Statistic statistic)20public int getStatistic(Player player, Statistic statistic, Material material)21public int getStatistic(Player player, Statistic statistic, EntityType entityType)22public int getStatistic(Player player, Statistic statistic)23public int getStatistic(Player player, Statistic statistic, Material material)24public int getStatistic(Player player, Statistic statistic, EntityType entityType)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!