完全错误:
[23:29:01 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'quest' in plugin ExploreRPG v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.14.4.jar:git-Paper-176]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.14.4.jar:git-Paper-176]
at org.bukkit.craftbukkit.v1_14_R1.CraftServer.dispatchCommand(CraftServer.java:739) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.PlayerConnection.handleCommand(PlayerConnection.java:1800) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:1608) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.PacketPlayInChat.a(PacketPlayInChat.java:47) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.TickTask.run(SourceFile:18) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:1013) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:1006) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:990) ~[patched_1.14.4.jar:git-Paper-176]
at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:923) ~[patched_1.14.4.jar:git-Paper-176]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]
Caused by: java.lang.ClassCastException: com.mongodb.BasicDBObject cannot be cast to net.exploremc.explorerpg.controllers.user.QuestProgress
at net.exploremc.explorerpg.controllers.User.getActiveQuests(User.java:148) ~[?:?]
at net.exploremc.explorerpg.commands.QuestCMD.onCommand(QuestCMD.java:23) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.14.4.jar:git-Paper-176]
... 17 more
用户类:
@Entity(value = "users", noClassnameStored = true)
public class User {
@Transient public static HashMap<UUID, User> usersList = new HashMap<>();
@Transient private static Datastore datastore = ExploreRPG.getDatabase().getDatastore();
@Id private String id;
@Transient private Player player;
@Indexed private String uuid;
private List<String> ipHistory = new ArrayList<>();
private List<String> nameHistory = new ArrayList<>();
@Embedded @Property("quests") private HashMap<String, QuestProgress> quests = new HashMap<>(); // This is the problem class
public User(){ }
public User(Player player) {
this.player = player;
this.ipHistory.add(player.getAddress().getHostString());
this.uuid = player.getUniqueId().toString();
this.nameHistory.add(player.getName());
}
public void storeUser() {
datastore.save(this);
}
public void updateUser(){
Query<User> updateQuery = datastore.createQuery(User.class).field("uuid").equal(uuid);
UpdateOperations<User> ops = datastore.createUpdateOperations(User.class)
.set("ipHistory", ipHistory)
.set("nameHistory", nameHistory)
.set("quests", quests);
datastore.update(updateQuery, ops);
}
public static boolean doesUserExist(Player player){
Query<User> query = datastore.find(User.class).field("uuid").equal(player.getUniqueId().toString());
User user = query.first();
return user != null;
}
public static User getUserFromDB(Player player){
Query<User> query = datastore.find(User.class).field("uuid").equal(player.getUniqueId().toString());
User user = query.first();
user.quests = query.first().quests;
user.player = player;
return user;
}
}
导致此错误的实现:
public List<QuestProgress> getActiveQuests(){
List<QuestProgress> activeQuests = new ArrayList<>();
for (QuestProgress quest : quests.values()) {
if(!quest.isCompleted())
activeQuests.add(quest);
}
return activeQuests;
}
MainActivity.java 对不起,我的英语很差。
我正在做一个java项目,我遇到了这个问题,不知道如何修复它。 } 当我尝试运行该程序时,它给出了错误: 线程“main”java.lang.ClassCastException中出现异常:无法将Stock强制转换为java.lang.Comparable 有人知道怎么了吗?
问题内容: 我有。我想使用获得最大结果。这是我的代码: 这是我的: 现在我得到了。怎么了? 问题答案: 您的错误可能在以下行中: 其中query.list()返回BigInteger列表而不是Long列表。尝试将其更改为。
我不是一个设计师,但当我得到这个项目,我不能打开特别的一些屏幕,我认为他们是屏幕,我们只重用一些布局已经创建。不管怎么说谁能帮帮我吗?@override public void onBindViewHolder(@nonnull final ProductsAdapter.ViewHolder holder,final int position){String imageUrl=ProductsL
我有一个用java实现的Web服务项目,它还包含jsp页面。我在我的机器上的jetty 8.1.5上部署它,它可以正常工作。但是当我使用jetty 8.1.3在windows server 2003上部署时,它会出现此异常: 这是完整的跟踪: 知道这个异常是什么吗?以及如何修复它?
在我的应用程序中,我为gcm ccs(xmpp)运行这些代码,代码显示以下错误执行时出错,这是代码: