mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 22:22:51 +00:00
Merge remote-tracking branch 'origin/unstable' into unstable
This commit is contained in:
commit
0047bb2e8d
@ -1,5 +1,7 @@
|
||||
package emu.grasscutter.game.inventory;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.INVENTORY_LIMITS;
|
||||
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.common.ItemParamData;
|
||||
@ -20,14 +22,11 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static emu.grasscutter.config.Configuration.INVENTORY_LIMITS;
|
||||
|
||||
public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
|
||||
private final Long2ObjectMap<GameItem> store;
|
||||
private final Int2ObjectMap<InventoryTab> inventoryTypes;
|
||||
@ -455,14 +454,10 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
|
||||
* @return True if the item was removed, false otherwise.
|
||||
*/
|
||||
public synchronized boolean removeItemById(int itemId, int count) {
|
||||
var item = this.getItems().values().stream()
|
||||
.filter(i -> i.getItemId() == itemId)
|
||||
.findFirst();
|
||||
var item = this.getItems().values().stream().filter(i -> i.getItemId() == itemId).findFirst();
|
||||
|
||||
// Check if the item is in the player's inventory.
|
||||
return item.filter(
|
||||
gameItem -> this.removeItem(gameItem, count)
|
||||
).isPresent();
|
||||
return item.filter(gameItem -> this.removeItem(gameItem, count)).isPresent();
|
||||
}
|
||||
|
||||
public synchronized boolean removeItem(GameItem item) {
|
||||
|
@ -26,10 +26,9 @@ import emu.grasscutter.server.game.GameServer;
|
||||
import emu.grasscutter.server.packet.send.*;
|
||||
import emu.grasscutter.utils.Utils;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import lombok.val;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.val;
|
||||
|
||||
public class InventorySystem extends BaseGameSystem {
|
||||
private static final Int2IntMap weaponRefundMaterials = new Int2IntArrayMap();
|
||||
|
@ -41,15 +41,14 @@ import emu.grasscutter.server.packet.send.*;
|
||||
import emu.grasscutter.utils.KahnsSort;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.val;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.val;
|
||||
|
||||
public final class Scene {
|
||||
@Getter private final World world;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package emu.grasscutter.game.world;
|
||||
|
||||
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
|
||||
|
||||
import emu.grasscutter.data.GameData;
|
||||
import emu.grasscutter.data.excels.dungeon.DungeonData;
|
||||
import emu.grasscutter.game.player.Player;
|
||||
@ -22,17 +24,14 @@ import emu.grasscutter.utils.Position;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import lombok.Getter;
|
||||
import lombok.val;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
|
||||
import lombok.Getter;
|
||||
import lombok.val;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class World implements Iterable<Player> {
|
||||
@Getter private final GameServer server;
|
||||
@ -535,14 +534,10 @@ public final class World implements Iterable<Player> {
|
||||
player -> player.getQuestManager().queueEvent(QuestContent.QUEST_CONTENT_GAME_TIME_TICK));
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies all players of the current world time.
|
||||
*/
|
||||
/** Notifies all players of the current world time. */
|
||||
public void updateTime() {
|
||||
this.getPlayers().forEach(p ->
|
||||
p.sendPacket(new PacketPlayerGameTimeNotify(p)));
|
||||
this.getPlayers().forEach(p ->
|
||||
p.sendPacket(new PacketSceneTimeNotify(p)));
|
||||
this.getPlayers().forEach(p -> p.sendPacket(new PacketPlayerGameTimeNotify(p)));
|
||||
this.getPlayers().forEach(p -> p.sendPacket(new PacketSceneTimeNotify(p)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -559,8 +554,7 @@ public final class World implements Iterable<Player> {
|
||||
.forEach(player -> player.setProperty(PlayerProperty.PROP_IS_GAME_TIME_LOCKED, locked));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@NotNull @Override
|
||||
public Iterator<Player> iterator() {
|
||||
return this.getPlayers().iterator();
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ public class PacketPlayerSetPauseRsp extends BasePacket {
|
||||
public PacketPlayerSetPauseRsp(Retcode retcode) {
|
||||
super(PacketOpcodes.PlayerSetPauseRsp);
|
||||
|
||||
this.setData(PlayerSetPauseRsp.newBuilder()
|
||||
.setRetcode(retcode.getNumber()));
|
||||
this.setData(PlayerSetPauseRsp.newBuilder().setRetcode(retcode.getNumber()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user