Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cannon supplies kill reward creating client side items #41

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import tc.oc.pgm.api.match.Match;
import tc.oc.pgm.api.player.MatchPlayer;
import tc.oc.pgm.api.player.ParticipantState;
Expand Down Expand Up @@ -46,10 +47,6 @@ public CannonSuppliesMutation(Match match) {
new ItemStack(Material.TNT, 64),
new ItemStack(Material.DIODE, 64)))));

static ItemKit killRewardKit =
new ItemKit(
Maps.newHashMap(), Lists.newArrayList(preventSharing(new ItemStack(Material.TNT, 16))));

@Override
public List<Kit> getKits() {
return spawnKit;
Expand All @@ -74,7 +71,10 @@ public void onDeath(MatchPlayerDeathEvent event) {
if (event.isChallengeKill() && killer != null) {
MatchPlayer player = match.getPlayer(killer.getId());
if (player != null && player.isAlive()) {
player.applyKit(killRewardKit, false);
PlayerInventory inventory = player.getInventory();
if (inventory != null) {
inventory.addItem(preventSharing(new ItemStack(Material.TNT, 16)));
}
}
}
}
Expand Down