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

Creating Bank Account with same name as username #109

Open
jargener opened this issue Apr 29, 2021 · 3 comments
Open

Creating Bank Account with same name as username #109

jargener opened this issue Apr 29, 2021 · 3 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@jargener
Copy link

If someone does /bank create USERNAME then it will break their accounts as there is then two accounts (Personal + a bank account) with the same name

@pavog
Copy link
Owner

pavog commented Apr 29, 2021

Hi and thank you for reporting this issue.
It is possible to have a personal account (cash) and a bank account with the same name and this should not break anything.
As far as I know, there are checks for using a personal account or a bank account for every action in craftconomy.
Can you tell me what exactly happens when there are two accounts with the same name and what breaks on your system?

Note: Normally the CommandHandler for /bank create <name> should check if there is already a bank account for that name.

@jargener
Copy link
Author

jargener commented Apr 29, 2021

It will error in console, and commands like /money won't work. You also can't send money to that person as that also causes a error in console. Given a example of when one of our playerbase did this below and the errors you get:

[Tue, 6. Apr 2021 19:25:33 UTC INFO] Tarzandrewx3 issued server command: /bank create Tarzandrewx3
[Tue, 6. Apr 2021 19:25:58 UTC INFO] Tarzandrewx3 issued server command: /bank deposit Tarzandrewx3 all#
[Tue, 6. Apr 2021 19:26:20 UTC INFO] Tarzandrewx3 issued server command: /money
[Tue, 6. Apr 2021 19:26:20 UTC WARN] org.h2.jdbc.JdbcSQLDataException: Scalar subquery contains more than one row; SQL statement:
[Tue, 6. Apr 2021 19:26:20 UTC WARN] SELECT * FROM cc3_balance WHERE cc3_balance.username_id = (SELECT id FROM cc3_account WHERE name =?) AND worldName=? [90053-199]
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.message.DbException.getJdbcSQLException(DbException.java:587)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.message.DbException.getJdbcSQLException(DbException.java:427)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.message.DbException.get(DbException.java:205)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.message.DbException.get(DbException.java:181)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.message.DbException.get(DbException.java:170)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.expression.Subquery.getValue(Subquery.java:49)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.index.IndexCondition.getCurrentValue(IndexCondition.java:138)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.index.IndexCursor.prepare(IndexCursor.java:108)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.index.IndexCursor.find(IndexCursor.java:154)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.table.TableFilter.next(TableFilter.java:475)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1882)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.result.LazyResult.hasNext(LazyResult.java:101)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.result.LazyResult.next(LazyResult.java:60)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.dml.Select.queryFlat(Select.java:742)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.dml.Select.queryWithoutCache(Select.java:884)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:151)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.dml.Query.query(Query.java:435)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.dml.Query.query(Query.java:397)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.CommandContainer.query(CommandContainer.java:145)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.command.Command.executeQuery(Command.java:202)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:115)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.greatmancode.craftconomy3.storage.sql.SQLStorageEngine.getAllWorldBalance(SQLStorageEngine.java:342)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.greatmancode.craftconomy3.account.Account.getAllWorldBalance(Account.java:127)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.greatmancode.craftconomy3.commands.money.MainCommand.execute(MainCommand.java:37)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.greatmancode.craftconomy3.tools.commands.SubCommand.executeCommand(SubCommand.java:97)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.greatmancode.craftconomy3.tools.commands.SubCommand.execute(SubCommand.java:60)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at com.greatmancode.craftconomy3.tools.commands.bukkit.BukkitCommandReceiver.onCommand(BukkitCommandReceiver.java:63)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:806)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2021)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1832)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1785)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:47)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:5)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1133)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1126)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeAll(IAsyncTaskHandler.java:95)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1262)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:997)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:174)
[Tue, 6. Apr 2021 19:26:20 UTC WARN] at java.base/java.lang.Thread.run(Thread.java:834)
[Tue, 6. Apr 2021 19:26:30 UTC INFO] Tarzandrewx3 issued server command: /money
[Tue, 6. Apr 2021 19:26:30 UTC WARN] org.h2.jdbc.JdbcSQLDataException: Scalar subquery contains more than one row; SQL statement:
[Tue, 6. Apr 2021 19:26:30 UTC WARN] SELECT * FROM cc3_balance WHERE cc3_balance.username_id = (SELECT id FROM cc3_account WHERE name =?) AND worldName=? [90053-199]
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.message.DbException.getJdbcSQLException(DbException.java:587)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.message.DbException.getJdbcSQLException(DbException.java:427)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.message.DbException.get(DbException.java:205)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.message.DbException.get(DbException.java:181)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.message.DbException.get(DbException.java:170)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.expression.Subquery.getValue(Subquery.java:49)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.index.IndexCondition.getCurrentValue(IndexCondition.java:138)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.index.IndexCursor.prepare(IndexCursor.java:108)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.index.IndexCursor.find(IndexCursor.java:154)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.table.TableFilter.next(TableFilter.java:475)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.dml.Select$LazyResultQueryFlat.fetchNextRow(Select.java:1882)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.result.LazyResult.hasNext(LazyResult.java:101)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.result.LazyResult.next(LazyResult.java:60)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.dml.Select.queryFlat(Select.java:742)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.dml.Select.queryWithoutCache(Select.java:884)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.dml.Query.queryWithoutCacheLazyCheck(Query.java:151)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.dml.Query.query(Query.java:435)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.dml.Query.query(Query.java:397)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.CommandContainer.query(CommandContainer.java:145)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.command.Command.executeQuery(Command.java:202)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:115)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.greatmancode.craftconomy3.storage.sql.SQLStorageEngine.getAllWorldBalance(SQLStorageEngine.java:342)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.greatmancode.craftconomy3.account.Account.getAllWorldBalance(Account.java:127)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.greatmancode.craftconomy3.commands.money.MainCommand.execute(MainCommand.java:37)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.greatmancode.craftconomy3.tools.commands.SubCommand.executeCommand(SubCommand.java:97)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.greatmancode.craftconomy3.tools.commands.SubCommand.execute(SubCommand.java:60)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at com.greatmancode.craftconomy3.tools.commands.bukkit.BukkitCommandReceiver.onCommand(BukkitCommandReceiver.java:63)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:806)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2021)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1832)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1785)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:47)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:5)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1133)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1126)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1087)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1001)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:174)
[Tue, 6. Apr 2021 19:26:30 UTC WARN] at java.base/java.lang.Thread.run(Thread.java:834)
[Tue, 6. Apr 2021 19:26:45 UTC INFO] Tarzandrewx3 issued server command: /money Tarzandrewx3

@pavog
Copy link
Owner

pavog commented Apr 29, 2021

Ok, thanks for the details. I will keep this error in mind and dig deeper in the near future and hopefully solve the problem.
A quick solution for you would be to manually delete the duplicated account from the database.

@pavog pavog added the Type: Bug Something isn't working label Apr 29, 2021
@pavog pavog self-assigned this Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants