Giter Club home page Giter Club logo

drink's Introduction

hi, i'm jonah

full-stack software developer. (i build stuff on the internet)

from Edmonton, currently living in Montréal.

{ website | x | instagram }

drink's People

Contributors

agentmanny avatar itspinger avatar jonahseguin avatar raccoman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

drink's Issues

@Flag not working

I know the Drink API hasn't had an issue made in a while, but I ran into a weird issue recently where I was working on a ban command.

The command basically should run with these args /ban -s[silent]

For some reason, when I try to use the flag argument normally so I run "/ban Skitbet -s test" it has a command usage error.

https://gyazo.com/d031ad5b9d9388d43ad8f91fd48f064d (Here is the code I have from a test command when I was trying to debug this)

https://gyazo.com/3ade4b12fdab4dcd699b4fce67bc57b2 (Here is a video showcasing the issue)

@Cooldown annotation

Extend the drink api to include cooldown annotations for ease of managing cooldowns @Require-like

Per: the time at which the uses gets reset
Rate: the number of times that are allowed the command to be executed in a specific amount of time
BucketType: Which to apply the cooldown on

This is inspired by discord.py cooldowns

BucketTypes:

  • USER - applys a per-user cooldown
  • COMMAND - applys the cooldown globally

Behavior:

When annotated on an @Command annotated method

The cooldown applys on that command with respect to the bucket type, if a player is on cooldown. it will call a handler callback1.

When annotated on the class

Either The cooldown mapping is shared across all sub commands OR Add a mapping as the same as @Cooldown being annotated on all of the sub commands

You can achive this by making a boolean or another annotated @ClassCooldown for example

Footnotes

  1. A cooldown handler is should be a function that takes in (Player, DrinkContainer), (You may also make it return a boolean, if false the cooldown will be neglected)

Improved flag parsing and autocompletion for flags

I'd like to suggest some improvements on flag parsing and the autocompletion of flags. This is more of a collection of issues which are all closely related to one another.
I have written a little report on the current situation and how I think an implementation could look like, hoping make the actual development a bit easier.

Current Behaviour:

First Example:
This example uses three flags of different types
Code:

    public void withFlags(@Sender Player sender, @Flag('s') String stringFlag, @Flag('i') int integerFlag, @Flag('b') boolean booleanFlag) {
        sender.sendMessage(ChatColor.YELLOW + "StringFlag: " + stringFlag + " IntegerFlag: " + integerFlag + " BooleanFlag: " + booleanFlag);
    }

Issues:
Flags cannot be completed:
noflags

In this example, there is always a boolean-value suggested after the second flag, regardless of order:
boolerror
boolerror2

Second Example:
This example uses three booleans:
Code:

    @Command(name = "bflagtest", desc = "A test command with a bunch of boolean flags")
    public void withBooleanFlags(@Sender Player sender, @Flag('a') boolean flag1, @Flag('b') boolean flag2, @Flag('c') boolean flag3) {
        sender.sendMessage(ChatColor.YELLOW + "flag1: " + flag1 + " flag2: " + flag2 + " flag3: " + flag3);
    }

Issues:

In here, the second suggestion is a boolean-value:
image

When having a boolean-flag enclosed in two other boolean-flag, it does not get parsed:
image

Group parsing is not supported:
image

Proposal for expected behaviour:

My idea would be to mimick the behaviour of WorldEdit, as this libary is already inspired and their solution is good.

Tab-Completion of flags
image

Tab-Completion of grouped flags:
image

Ability to group boolean and value flags with one value flag being able to end a group:
image

I know it's a lot to ask for, but it might be something to have on the radar.

Drink recommending without space

If i type "cities join" and i before i type a space there is already showing the options of the next part

iOpHPb7

This is not really a problem until you click TAB because then it replaces the join part since there is no space.

Doesn't let me clone the repo

Bascially when I type the command to clone the repository,
I get an error saying that I don't have access to the repository.
image

License?

I want to use your library in a project of mine but I want to make sure what I'm allowed and not allowed to do with your code

BindingProvider Exception for ENUMS

[02:05:10 ERROR]: Error occurred while enabling GrindCore v1.0 (Is it up to date?)
com.jonahseguin.drink.exception.CommandRegistrationException: Could not register command 'grind-core': No provider bound for ActionType
        at com.jonahseguin.drink.command.DrinkCommandService.register(DrinkCommandService.java:132) ~[GrindCore-1.0.jar:?]
        at net.gemoria.grindcore.GrindCore.loadCommands(GrindCore.java:162) ~[GrindCore-1.0.jar:?]
        at net.gemoria.grindcore.GrindCore.onEnable(GrindCore.java:82) ~[GrindCore-1.0.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[?:git-UniverseSpigot-"fe2588e"]
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[?:git-UniverseSpigot-"fe2588e"]
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[?:git-UniverseSpigot-"fe2588e"]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[?:git-UniverseSpigot-"fe2588e"]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:655) ~[?:git-UniverseSpigot-"fe2588e"]
        at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:566) ~[?:git-UniverseSpigot-"fe2588e"]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:638) ~[?:git-UniverseSpigot-"fe2588e"]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:437) ~[?:git-UniverseSpigot-"fe2588e"]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:316) ~[?:git-UniverseSpigot-"fe2588e"]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1103) ~[?:git-UniverseSpigot-"fe2588e"]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[?:git-UniverseSpigot-"fe2588e"]
        at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: com.jonahseguin.drink.exception.MissingProviderException: No provider bound for ActionType
        at com.jonahseguin.drink.parametric.ProviderAssigner.assignProvidersFor(ProviderAssigner.java:41) ~[GrindCore-1.0.jar:?]
        at com.jonahseguin.drink.command.DrinkCommand.<init>(DrinkCommand.java:47) ~[GrindCore-1.0.jar:?]
        at com.jonahseguin.drink.command.CommandExtractor.extractCommand(CommandExtractor.java:60) ~[GrindCore-1.0.jar:?]
        at com.jonahseguin.drink.command.CommandExtractor.extractCommands(CommandExtractor.java:29) ~[GrindCore-1.0.jar:?]
        at com.jonahseguin.drink.command.DrinkCommandService.register(DrinkCommandService.java:124) ~[GrindCore-1.0.jar:?]

By default Drink supports out of the box Enums for commands parameters, but when using an enum as command parameter it triggers this exception on enable

ActionType is just an enum, this is the command

@Command(name = "data", aliases = {}, desc = "Gestione dati dei giocatori in Cache", usage = "data <ACTION> <DATA> <VALUE>")
@Require(value = "grindcore.admin" ) //, message = "Non hai il permesso di usare il comando!")
public void onData(@Sender CommandSender sender, ActionType actionType, DataType data, Player target, @OptArg int value){

    final OnlineUser user = OnlineUser.adapter(target);
    switch (actionType){
        case SET -> user.setData(data, value);
        case ADD -> user.addData(data, value);
        case REMOVE -> user.removeData(data, value);
    }
    sender.sendMessage("§7[§eGrindCore§7] §fValore da modificare correttamente impostato per -> "  + target.getName());
}

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.