Coder Social home page Coder Social logo

peconomy's Introduction

Hi there ๐Ÿ‘‹๐Ÿป

I am a Java developer and Bukkit plugins coder.
See my pinned repositories to browse my opensource projects.

vkontakteBadge telegramBadge twitterBadge youtubeBadge

My activity

Learned Libraries and Frameworks

Name Level Description
Spigot API High API of the Minecraft server software based on Bukkit
Paper API High Extended API based on the Spigot API
ORMLite High Awesome framework for working with databases such as SQLite, MySQL, PostgreSQL
Java FX High The best desktop graphical application framework for Java
Netty IO Medium The async network application framework with high perfomance
Spring Boot Medium The best web application framework for Java
JUnit Medium The unit testing framework for Java

peconomy's People

Contributors

soknight avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

peconomy's Issues

CompletableFuture may swallow exceptions

Introduction

I picked a class in the source code to look at, and came here:

databaseManager.getWallet(name).thenAccept(wallet -> {
if(wallet == null)
wallet = new WalletModel(name);
currenciesManager.getCurrencies().forEach(wallet::loadCurrency);
databaseManager.saveWallet(wallet).join();
});

While this seems like harmless code, it is actually equally harmful as ignoring exceptions, as in the following code:

try {
   // Do stuff
} catch (Throwable ignored) {
  // Exception is lost!
}

Explanation

CompletableFuture is infamous for swallowing exceptions. Run the following code snippet. No exception will be printed:

public class FutureMain {
  public static void main(String[] args) {
    CompletableFuture.supplyAsync(() -> {
        return true;
    }).thenAccept((value) -> {
        throw new RuntimeException();
    });
  }
}

Summary

The issue is that if an exception occurs inside thenAccept, it will not be logged anywhere. For example, this exception will never be shown:

databaseManager.getWallet(name).thenAccept(wallet -> {
  throw new IllegalStateException();
});

Vault hook uses the wrong config

When trying to use PEconomy with Vault, it will always state
[PEconomy] Vault default currency is not specified, ignoring it.
because it tries to look for the vault.currency setting in the wrong config file (it looks in the config.yml instead of the currencies.yml).

When setting the vault.currency setting in the config.yml everything works as intended.

I believe this is caused by this line, which uses the configuration returned by getConfig() instead of the one provided by AbstractConfig#getBukkitConfig().

Plugin apparently not connecting to MySQL

So, I have tried to connect to MySQL and runeed into some problem.

The plugin start initialization and never get done.

This is the config file.

database:
  # Should plugin use MySQL database as data storage?
  # Specify 'true' to use SQLite or 'false' to use MySQL
  use-sqlite: false

  # MySQL configuration
  host: 123.12.12.12
  port: 3306
  name: rh5623
  user: rh5623
  password: **********

Host IP and password omitted.

In the Console (Multicraft) this is the only message:
04.05 07:35:17 [Server] INFO [PEconomy] Loading PEconomy v2.0.2

And then, when trying to run /peco help, I get this:

04.05 07:49:52 [Server] INFO Kaxassa issued server command: /peco help
04.05 07:49:52 [Server] ERROR null
04.05 07:49:52 [Server] INFO org.bukkit.command.CommandException: Cannot execute command 'peco' in plugin PEconomy v2.0.2 - plugin is disabled.
04.05 07:49:52 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchCommand(CraftServer.java:752) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.PlayerConnection.handleCommand(PlayerConnection.java:1826) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.PlayerConnection.a(PlayerConnection.java:1634) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.PacketPlayInChat.a(PacketPlayInChat.java:47) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.TickTask.run(SourceFile:18) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.MinecraftServer.ba(MinecraftServer.java:1076) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.MinecraftServer.executeNext(MinecraftServer.java:1069) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1033) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:950) ~[paper-latest.jar:git-Paper-217]
04.05 07:49:52 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]

When I switch back to use-sqlite: true it runs properly.

By reference, I have two other plugins connected to MySQL (CoreProtect and nLogin).

(My English is a work in progress, also, first time reporting something in GitHub. Sorry for any mistakes).

currency convert

I study English superficially from Russia. In the future, forgive my oblique language.

My idea is to let the player choose (command or menu) which currency he wants to transfer from (accordingly, not free of charge, but with a commission.)

Let's imagine the following situation. We have the main currency, then it can or cannot (depending on the setting) be converted into the second (donate currency) but with the condition (10> 1) and the second currency (50> 500).

/peco convert or /peco convert for 2 currency wallet.

Not respecting config.

The disable vault-hook option on the config is not respected at all. PEconomy is still hooking into vault after the config option has been disabled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.