#Does anyone know why my code doesnt work?

1 messages · Page 1 of 1 (latest)

random scarab
#

import mysticsmp.mysticsmp.items.ItemManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class WandCommand implements CommandExecutor {


    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)){
            sender.sendMessage("cant send this, join the gaem lmao");



            return true;
        }
        Player player = (Player) sender;
        if (player.hasPermission("MysticSMP.givewand")) {
            if (cmd.getName().equalsIgnoreCase("givewand")) {
                player.getInventory().addItem(ItemManager.staff);
                player.sendMessage("<Dream> yes
");
            }
        }else {
            player.sendMessage("haha no");
        }



        return true;
    }
}

it doesnt give an error, when you run it it just says: "'givewand"

manic talon
#

?hastebin

#

what's the command

magic veldt
#

you didnt register the command I guess

manic talon
#

?paste

sharp granite
#

bruh

manic talon
#

use that please

random scarab
random scarab
sharp granite
#

🤔 some interesting messages in your code

random scarab
#

dont question it

#

my friend asked for it

sharp granite
magic veldt
#

show your plugin.yml and your main class pls

night finch
#

your command isn't registered because ItemManager.init(); never stops running

#

you have an infinite loop

sharp granite
#

I hate seeing this

random scarab
#

I wouldnt know

night finch
#

createWand loops endlessly so

sharp granite
#

@magic veldt How hard is it to learn ACF?

magic veldt
#

well

#

for simple stuff, quite easy

#

for mediocre stuff, quite hard

#

but then when you wanna do complicated stuff, you already know anything and then its easy again

#

the learning curve is like
Easy -> Way too hard -> I never wanna miss it again

sharp granite
#

I'll stick to my crappy command framework lol

magic veldt
#

switching to ACF was one of the best things I ever did

#

besides coming out lol

sharp granite
#

Idk, I prefer making my own stuff so I understand 100% of it

magic veldt
#

for example, imagine you have a method where you want the pkayer to enter something like /mycommand somePlayer ACACIA_BOAT

#

you can just do this in ACF:

sharp granite
#

I mean my framework does that, maybe with extra steps tho

magic veldt
#
    @Default
    public void onCommand(Player sender, Player anotherPlayer, Material material) {
#

it even would do tab completions for you

sharp granite
#

mine does too 😦

magic veldt
#

e.g. first argument will be tab completed for player names, second argument would also tab complete to valid material names

#

yeah ok

#

sure, if you got a running system, go for it

sharp granite
#

oh so it tabs automatically

magic veldt
#

well it does so many more things

#

hard to explain this in 5 sentences

#

ACF can basically do everything

#

this was just an extremely simple example

#

you could also make it accept your custom data classes, map strings to your custom argument classes, etc

#

do context-specific completions

#

handle subcommands

#

automatically generate help messages

#

etc bla bla

sharp granite
#

yeah alright, mine takes an entire class to make a commmand

#

like so

magic veldt
#

people claim that Cloud is equally as good but I can't agree

magic veldt
#

lemme try to find something where I can show you ACF properly

sharp granite
#

mapSuggestions is pretty cool tho

#

the key will be searched in tab completion and show the value

#

so if you add a flag like -world and then set a list of worlds it will show them

magic veldt
#

?paste

#

fucking bot doesnt work in threads

sharp granite
#

ik its a bitch

magic veldt
sharp granite
#

I need to learn how to make annotations

#

is that what you call them?

magic veldt
#

yep

#

annotations are extremely easy

sharp granite
#

in python isn't it decorators or am I tripping?

magic veldt
#

i dont know much about python

#

i doubt they have something similar

#
/*
 *     Copyright (c) 2022. JEFF Media GbR / mfnalex et al.
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 */

package com.jeff_media.jefflib.internal.annotations;

import com.jeff_media.jefflib.JeffLib;

import javax.annotation.meta.TypeQualifierNickname;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Indicates that the annotated method uses NMS and will only work in a supported Minecraft version after calling {@link JeffLib#enableNMS()}
 */
@Documented
@TypeQualifierNickname
@Retention(RetentionPolicy.RUNTIME)
public @interface NMS {
    /**
     * The minimum version of Minecraft that this feature is supported on
     */
    String value() default "";
}
#

this is an example for a custom annotation

#

it basically only has one String value

#

they are mostly used for reflection

sharp granite
#

hmm

#

I might watch a couple indians explain it later

magic veldt
#

so you can do stuff like that```java
myClazz.getMethod("myMethod").getAnnotations()

#

and then it returns a list of annotation classes

sharp granite
#

noice

magic veldt
#

so yeah annotations requires reflection if you wanna use them for stuff like this

#

i'd go into detail and explain how exactly annotations work and how you could use them, but I already drank like 3/4 bottle of j#germeister and soooo... not today, lol

sharp granite
#

Lol maybe tomorrow

random scarab
magic veldt
#

?notworking

#

WHY DOES THE BOT NOT WORK IN THREADS