Skip to content

Commit

Permalink
Merge pull request #3 from MrEAlderson/master
Browse files Browse the repository at this point in the history
Misc changes
  • Loading branch information
MetallicGoat authored Aug 31, 2024
2 parents 280af11 + 2c6afed commit 20f693b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

public class GenSplitterPlugin extends JavaPlugin {

private static final byte MBEDWARS_API_NUM = 100;
private static final String MBEDWARS_API_NAME = "5.4";
private static final byte MBEDWARS_API_NUM = 111;
private static final String MBEDWARS_API_NAME = "5.4.12";
private static GenSplitterPlugin instance;
private final Server server = getServer();
private GenSplitterAddon addon;
Expand Down
14 changes: 2 additions & 12 deletions src/main/java/me/metallicgoat/gensplitter/events/ItemSplit.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class ItemSplit implements Listener {

private static final Sound PICKUP_SOUND = Helper.get().getSoundByName("ENTITY_ITEM_PICKUP");

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerPickupDropEvent(PlayerPickupDropEvent event) {
if (!event.isFromSpawner() || !ConfigValue.splitterEnabled || event instanceof PlayerPickupDropEventWrapper)
return;
Expand All @@ -31,15 +30,6 @@ public void onPlayerPickupDropEvent(PlayerPickupDropEvent event) {

final Player player = event.getPlayer();
final Arena arena = event.getArena();
final ItemStack clonedStacked = new ItemStack(pickedUpStack.getType());
final ItemMeta im = pickedUpStack.getItemMeta();

if (im == null)
return;

im.setLore(null);
clonedStacked.setAmount(pickedUpStack.getAmount());
clonedStacked.setItemMeta(im);

// give item to all players
final Location collectLocation = player.getLocation();
Expand All @@ -62,7 +52,7 @@ public void onPlayerPickupDropEvent(PlayerPickupDropEvent event) {
continue;

// all good, lets give it him
split.getInventory().addItem(clonedStacked);
split.getInventory().addItem(pickedUpStack);

if (PICKUP_SOUND != null)
collectLocation.getWorld().playSound(collectLocation, PICKUP_SOUND, 1, 1);
Expand Down

0 comments on commit 20f693b

Please sign in to comment.