Skip to content

Commit

Permalink
Tweaks v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MetallicGoat committed Aug 18, 2022
1 parent bd0b1df commit 8742378
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.metallicgoat</groupId>
<artifactId>MBedwarsTweaks</artifactId>
<version>2.0.1-Pre-2</version>
<version>2.0.1</version>

<repositories>
<repository>
Expand Down Expand Up @@ -36,27 +36,27 @@
<version>2.10.10</version>
<scope>provided</scope>
</dependency>
<!--
<dependency>
<groupId>de.marcely.bedwars</groupId>
<artifactId>API</artifactId>
<version>5.0.12</version>
<scope>system</scope>
<systemPath>${basedir}/libs/MBedwars.jar</systemPath>
</dependency>
-->
<dependency>
<groupId>me.metallicgoat.hotbarmanageraddon</groupId>
<artifactId>API</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/libs/HotbarManager-1.0-SNAPSHOT.jar</systemPath>
</dependency>
<!--
<dependency>
<groupId>de.marcely.bedwars</groupId>
<artifactId>API</artifactId>
<version>5.0.11</version>
<version>5.0.13</version>
</dependency>
-->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

public class MBedwarsTweaksPlugin extends JavaPlugin {

public static final int MIN_MBEDWARS_API_VER = 11;
public static final String MIN_MBEDWARS_VER_NAME = "5.0.10";
public static final int MIN_MBEDWARS_API_VER = 13;
public static final String MIN_MBEDWARS_VER_NAME = "5.0.13";

@Getter
private static MBedwarsTweaksPlugin instance;
Expand Down Expand Up @@ -61,9 +61,9 @@ public void onEnable() {

if (Bukkit.getPluginManager().isPluginEnabled("FireBallKnockback")) {
Console.printInfo("I noticed you are using my Fireball jumping addon. " +
"As of 5.0.13, you do not need to anymore! Fireball jumping " +
"is now built into MBedwars, and cooldown + throw effect " +
"features have been added to this addon (MBedwarsTweaks)."
"As of 5.0.13, you do not need it anymore! Fireball jumping " +
"is now built into core MBedwars. Features such as throw cooldown and throw " +
"effects have been added to this addon (MBedwarsTweaks). - MetallicGoat"
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
import de.marcely.bedwars.api.event.player.PlayerIngameRespawnEvent;
import de.marcely.bedwars.api.game.shop.BuyGroup;
import de.marcely.bedwars.api.game.shop.ShopItem;
import de.marcely.bedwars.api.game.shop.product.ShopProduct;
import me.metallicgoat.hotbarmanageraddon.HotbarManagerTools;
import me.metallicgoat.tweaksaddon.MBedwarsTweaksPlugin;
import me.metallicgoat.tweaksaddon.config.ConfigValue;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;

import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -59,22 +54,12 @@ public void onRespawn(PlayerIngameRespawnEvent event) {
if (shopItems == null)
return;

// TODO make better
final Team team = arena.getPlayerTeam(player);

for (ShopItem item : shopItems) {
if(MBedwarsTweaksPlugin.getInstance().isHotbarManagerEnabled()){
for(ShopProduct product : item.getProducts()) {
for(ItemStack itemStack : product.getGivingItems(player, team, arena, 1))
HotbarManagerTools.giveItemsProperly(itemStack, player, item.getPage(), null, true);
}
} else {
Bukkit.getScheduler().runTaskLater(MBedwarsTweaksPlugin.getInstance(), () -> item.getProducts().forEach(shopProduct -> {
arena.setBuyGroupLevel(player, buyGroup, level);
shopProduct.give(event.getPlayer(), event.getArena().getPlayerTeam(player), event.getArena(), 1);
}), 1L);
}
}
for (ShopItem item : shopItems)
ToolSwordHelper.givePlayerShopItem(arena, team, player, item);

arena.setBuyGroupLevel(player, buyGroup, level);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import de.marcely.bedwars.api.game.shop.product.ShopProduct;
import de.marcely.bedwars.api.message.Message;
import de.marcely.bedwars.tools.Helper;
import me.metallicgoat.hotbarmanageraddon.HotbarManagerTools;
import me.metallicgoat.tweaksaddon.MBedwarsTweaksPlugin;
import me.metallicgoat.tweaksaddon.config.ConfigValue;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -161,4 +163,17 @@ public void handleNotification(PlayerBuyInShopEvent e) {
}
});
}

public static void givePlayerShopItem(Arena arena, Team team, Player player, ShopItem item){
if(MBedwarsTweaksPlugin.getInstance().isHotbarManagerEnabled()){
for(ShopProduct product : item.getProducts()) {
for(ItemStack itemStack : product.getGivingItems(player, team, arena, 1))
HotbarManagerTools.giveItemsProperly(itemStack, player, item.getPage(), null, true);
}
} else {
Bukkit.getScheduler().runTaskLater(MBedwarsTweaksPlugin.getInstance(), () -> item.getProducts().forEach(shopProduct -> {
shopProduct.give(player, arena.getPlayerTeam(player), arena, 1);
}), 1L);
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.0.1-Pre-2
version: 2.0.1
name: MBedwarsTweaks
author: MetallicGoat
main: me.metallicgoat.tweaksaddon.MBedwarsTweaksPlugin
Expand Down

0 comments on commit 8742378

Please sign in to comment.