mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 11:57:35 +00:00
Add PlayerLevelItemEvent
This commit is contained in:
parent
314b90e936
commit
76b27df622
@ -441,6 +441,9 @@ public class InventorySystem extends BaseGameSystem {
|
|||||||
// Packets
|
// Packets
|
||||||
player.sendPacket(new PacketStoreItemChangeNotify(weapon));
|
player.sendPacket(new PacketStoreItemChangeNotify(weapon));
|
||||||
player.sendPacket(new PacketWeaponUpgradeRsp(weapon, oldLevel, leftovers));
|
player.sendPacket(new PacketWeaponUpgradeRsp(weapon, oldLevel, leftovers));
|
||||||
|
|
||||||
|
// Call PlayerLevelItemEvent.
|
||||||
|
new PlayerLevelItemEvent(player, oldLevel, weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ItemParam> getLeftoverOres(int leftover) {
|
private List<ItemParam> getLeftoverOres(int leftover) {
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package emu.grasscutter.server.event.player;
|
||||||
|
|
||||||
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
|
import emu.grasscutter.game.player.Player;
|
||||||
|
import emu.grasscutter.server.event.types.PlayerEvent;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public final class PlayerLevelItemEvent extends PlayerEvent {
|
||||||
|
private final int oldLevel;
|
||||||
|
private final GameItem item;
|
||||||
|
|
||||||
|
public PlayerLevelItemEvent(Player player, int oldLevel, GameItem item) {
|
||||||
|
super(player);
|
||||||
|
|
||||||
|
this.oldLevel = oldLevel;
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The item's new level.
|
||||||
|
*/
|
||||||
|
public int getNewLevel() {
|
||||||
|
return this.getItem().getLevel();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user