Skip to content

Commit

Permalink
去除多余的上传操作
Browse files Browse the repository at this point in the history
  • Loading branch information
Kloping committed Oct 21, 2021
1 parent 0482b95 commit f040a7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/main/java/com/hrs/kloping/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import com.hrs.kloping.entity.OCardSet;
import net.mamoe.mirai.contact.Group;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

public class Command {
public static boolean isStarted = false;
Expand Down Expand Up @@ -73,7 +75,7 @@ public static synchronized String joinGame(long qq) {
} else return "游戏未创建或已开启";
}

public static final Map<Long, Map<Card, net.mamoe.mirai.message.data.Image>> listImageMap = new ConcurrentHashMap<>();
public static final Map<Long, List<Card>> listImageMap = new ConcurrentHashMap<>();
public static Table table;

public static synchronized String InitTable(Group group) {
Expand All @@ -83,9 +85,9 @@ public static synchronized String InitTable(Group group) {
if (listImageMap.containsKey(group.getId())) {
table = new Table(group, listImageMap.get(group.getId()));
} else {
Map<Card, net.mamoe.mirai.message.data.Image> map = new ConcurrentHashMap<>();
List<Card> map = new CopyOnWriteArrayList<>();
for (Card card : OCardSet.getCards()) {
map.put(card, Utils.getImageFromCard(card, group));
map.add(card);
}
listImageMap.put(group.getId(), map);
table = new Table(group, map);
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/hrs/kloping/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.mamoe.mirai.contact.Group;
import net.mamoe.mirai.contact.Member;
import net.mamoe.mirai.message.data.At;
import net.mamoe.mirai.message.data.Image;
import net.mamoe.mirai.message.data.Message;
import net.mamoe.mirai.message.data.MessageChainBuilder;

Expand All @@ -20,7 +19,7 @@ public class Table {
public static final Random rand = new Random();
public Group group = null;
public List<Long> players = new CopyOnWriteArrayList<>();
public Map<Card, Image> cards = new ConcurrentHashMap<>();
public List<Card> cards = new CopyOnWriteArrayList<>();
public List<Card> ListCards = new ArrayList<>();
public List<Card> Dcards = new CopyOnWriteArrayList<>();
private Map<Long, List<Card>> playerCards = new ConcurrentHashMap<>();
Expand All @@ -38,11 +37,11 @@ public void destroy() {
this_cards = null;
}

public Table(Group group, Map<Card, Image> imageMap) {
public Table(Group group, List<Card> imagecs) {
destroy();
this.group = group;
this.cards.putAll(imageMap);
for (Card card : cards.keySet()) {
this.cards.addAll(imagecs);
for (Card card : cards) {
this.ListCards.add(card);
}
}
Expand Down

0 comments on commit f040a7b

Please sign in to comment.