#help-development

1 messages · Page 1716 of 1

somber hull
#

i deleted .idea folder

#

and reopened the project

chrome beacon
#

Great :)

quaint mantle
#
if (args.length >= 3) {
                if (args[0].equalsIgnoreCase("addline")) {
                    StringBuilder builder = new StringBuilder();
                    for (int i = 2; i < args.length; i++) {
                        builder.append(args[i]).append(" ");
                    }
                    Utils.addLine(args[1], builder.toString().trim());
                    player.sendMessage(Utils.translate("added line &e" + builder.toString().trim() + " &ato &2" + args[1]));
                    return true;
                }
            }

i want to know what is wrong with this that if i put multiple arguments, nothing happens at all

#

working

#

not working

#

no output and error

maiden briar
#

Is there anywhere a list of ALL NMS classes?

young knoll
#

In the server jar

maiden briar
#

Ok, not anywhere else?

young knoll
#

Not that I know of

maiden briar
#

Ok

#

I am creating an enum of all classes, that's why. I can easily copy it from WinRar

hasty jackal
#

are you sure that that is necessary / a good idea?

maiden briar
#

Yes

hasty jackal
#

"Making an enum of a list of classes" is certainly in the bucket of "definitely not a good idea"

maiden briar
#

It are just 3860 classes

young knoll
#

Bigger than the material enum

maiden briar
#

Yes I know

indigo cave
#

Whats the point of doing that?

maiden briar
#

Easily access the classes

#

Without having to use reflection

lost matrix
maiden briar
#

Yes, but to also allow multiple version support, including 1.17

quiet ice
#

just write it in krakatau assembly, no reflections needed

lost matrix
maiden briar
#

What is krakatau assembly?

quiet ice
#

Reassembler/Disassembler for java bytecode

young knoll
#

Are you going to put the name and package declaration of each class for each version in the enum or something

maiden briar
#

Yes

young knoll
#

How is this better than modules

maiden briar
#

Checking if the class exists in the version, putting it in the enum with supported after the version

young knoll
#

Just sounds 10x harder to maintain than modules

maiden briar
#

Ok then tell me what you would do

quaint mantle
#

How would the index of the slots of a crafting table work?
Would it work like this:

maiden briar
#

I am open for everything

maiden briar
young knoll
#

I would use modules

quaint mantle
#

ok thx

maiden briar
#

An example?

young knoll
#

Trying to think of a good example plugin that uses them

#

Worldedit maybe

maiden briar
#

Ok will look

hasty jackal
#

even if you have a list of classes ... you'd still end up having to write version dependent code. things get moved, change names, use different args, etc.

lost matrix
# maiden briar Starts at 0, but it is any further correct

Just a quick mock up:

@RequiredArgsConstructor
public enum NMSAccess {

  ENTITY_HUMAN("net.minecraft.world.entity.player.EntityHuman");

  private final String className;
  private Class<?> cachedClass;
  private List<Method> cachedMethods;

  public Class<?> getNMSClass() {
    return this.cachedClass == null ? this.loadClass() : this.cachedClass;
  }

  private Class<?> loadClass() {
    try {
      this.cachedClass = Class.forName(this.className);
    } catch (final ClassNotFoundException e) {
      e.printStackTrace();
    }
    return this.cachedClass;
  }

  public List<Method> getMethods() {
    return this.cachedMethods == null ? this.loadMethods() : this.cachedMethods;
  }

  private List<Method> loadMethods() {
    this.cachedMethods = Arrays.asList(this.getNMSClass().getMethods());
    return this.cachedMethods;
  }

}

This could actually be handy.

maiden briar
#

Looks good

lost matrix
#

But you still need versioning on this. So maybe a Map<Version, String> for the class name.

maiden briar
#

Ok good idea thanks

young knoll
#

Guess it isn’t too bad

#

If you only include classes you care about

#

Still gotta get the method you want out of that list tho

maiden briar
#

Ok

tardy delta
#

how can i make a clickable text where i can only click on a part of the text? now i can click on the whole line

#

i have this now

public static void suggestCommandByClickableText(Player player, String begin, String clickableText, String end, String command) {
        messageSpigot(player, new ComponentBuilder()
                .append(colorize(begin))
                .append(suggestCommandByClickableText(clickableText, command))
                .reset()
                .append(colorize(end))
                .create());
    }

public static TextComponent suggestCommandByClickableText(String message, String command) {
        TextComponent textComponent = new TextComponent(colorize(message));
        textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command));
        textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to run command")));
        return textComponent;
    }
lost matrix
#

Yeah this needs a lot of refinement. Maybe a Map<String, Method> and a Map<Class<?>, List<Method>> for return types and so on.

young knoll
#

Still gotta worry about method args changing

lost matrix
young knoll
#

Or the method names changing

lost matrix
young knoll
#

I wish components themselves used a builder pattern

tardy delta
#

i thought appenLegacy(string) would remove the clickevent from that string but it doesnt work

young knoll
#

It would be nice to just be able to .append(new TextComponent(“blah”).color().bold()...)

tardy delta
#

probably nms would work but that goes brr

solid cargo
#

how can i call my custom item

#

for example all items have names like STONE or GRASS
so i want my item to have a name something like SHARP_SIX_BOOK

quaint mantle
#

Material name?

solid cargo
#

yeah

quaint mantle
#

Yiu can't change material name

solid cargo
#

no, i like have a custom itemstack

#

and i want it to have its own id or something

#

so i have this custom craftable itemstack

#

and i want it to have its own id

hoary rover
#

so you want to be able to use something llike Material.YOUR_CUSTOM_ITEM ?

solid cargo
#

yeah

quaint mantle
#

Im getting this error when typing a command to open a crafting table inventory
https://paste.md-5.net/potofimuma.bash
This is my code for it

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (command.getName().equalsIgnoreCase("craftingtable")) {
            if (sender instanceof Player) {
                Player player = (Player) sender;
                Inventory craftingInterface = Bukkit.createInventory(player, InventoryType.CRAFTING, "Crafting");

                player.openInventory(craftingInterface);
            }
            else if (!(sender instanceof Player)){
                System.out.println("Error! You cannot use this command.");
            }
        }
        return true;
    }
hoary rover
# solid cargo yeah

you can't create custom items like that using plugins. you'd need a mod for that. plugins are limited to whatever blocks and items are present in vanilla MC. You could set an NBT tag to your custom id though

solid cargo
#

alright

hasty jackal
quaint mantle
#

damn

hoary rover
solid cargo
hasty jackal
#

None of the code actually does anything to increase the enchantment level

#

it really just copies the enchantments

#

so no wonder that it does not increase the level

solid cargo
#

hm

#

possible fixes?

#

or just deal with it

hasty jackal
#

the fix is to write code that increases the level of the enchantment?

solid cargo
#

that is what i thought

hasty jackal
#

it's like setting the result equal to 1 and wondering why it's not adding another 1; you actually have to do the thing that you want it to do

quaint mantle
shadow night
quaint mantle
#

why .ee?

shadow night
#

It is so

shadow tide
#

With the onTabComplete method, how would I make it only tab complete one argument. My command has two arguments, the first one is a player, and the second one is an integer.

lavish hemlock
#

obviously you can't just do tryitandsee so they have to use the Estonian TLD, .ee

echo basalt
shadow tide
#

this should be easy but I did ```java
if (args[].getLength == 0) {

}

#

but getLength isn't a method

#

so how would I check for length?

tardy delta
#

args.length

#

I have a simple tabcomplete

@Override
    protected List<String> tabComplete(@NotNull String[] args) {
        if (args.length == 1) {
            return StringUtil.copyPartialMatches(args[0], Arrays.asList("help", "accept", "request", "decline"), new ArrayList<>());
        }
        return null;
    }
#

btw this method is called by onTabComplete(...)

#

org.bukkit.util.StringUtil

tardy delta
shadow tide
#

lol

#

I was being dumb

#

I did args[].length not args.length lol

#

What do I return so there are no tab complete options?

#

@tardy delta

tardy delta
#

nothing is new ArrayList<>()

#

player names is null

lean gull
#

i still require help btw

#

(pls)

tardy delta
#

it is possible that bukkit takes the wrong class to deserialize objects in yml?

#

i even dont have a ConfigurationSerialization.registerClass(Home.class) in my code

shadow tide
#

sorry, I meant nothing

#

@tardy delta

eternal oxide
shadow tide
#

no

eternal oxide
shadow tide
#

returning null gives the default playerlist tab complete options lol

eternal oxide
#

Then Fourteen is correct, an empty list

#

it was one or the other 🙂

shadow tide
#

guess I didn't understand what fourteen said

#

this is my code java List<String> onlinePlayers = new ArrayList<>(); for (Player player: Bukkit.getOnlinePlayers()) { onlinePlayers.add(player.getName().toLowerCase()); } if (args.length == 0) { return onlinePlayers; } else { return new ArrayList<>(); } and now no tab complete options are showing up.

eternal oxide
#

So if you type no args you will get all players. If you type any args you get none.

shadow tide
#

but they start at 0

eternal oxide
#

what start at 0?

shadow tide
#

lists and arrays

#

this works java onlinePlayers.contains(args[0].toLowerCase()

#

whatever, I will try args.length == 1

eternal oxide
#

That current code is written so no args = show all players.

#

no

shadow tide
#

ooooh

eternal oxide
#

args[1] is the second arg

shadow tide
#

moment of realization

eternal oxide
#

(args.length == 0) means empty, nothing in it, no args

shadow tide
#

its args.length, so its the length of the list starting at 1

#

lol

#

works yay

eternal oxide
#
List<String> onlinePlayers = new ArrayList<>();
List<String> matches = new ArrayList<>();
StringUtil.copyPartialMatches(arg[0], onlinePlayers, matches);```
#

That will only show players who contain what you are typing

#

well, make the onlinePlayers as you do

wide flicker
eternal oxide
eternal oxide
# shadow tide works yay

This should do it all in one command java List<String> matches = Bukkit.getOnlinePlayers().stream().map(player -> {if (player.getName().toLowerCase().contains(args[0].toLowerCase())) return player.getName();}).collect(Collectors.toList());

#

You will have to switch from using spigot-api to use spigot in your pom to gain access to StringUtil

#

But don;t use that unless you go through it and understand it

quaint mantle
#

Command atocomplete

lost matrix
zenith shard
#

hey, I'm using some file systems to delete the world folder and replace it with a different world folder, it copies the files fine, but when I go on the server it still has all the old world, but restarting the server kicks the changes into effect. Is there any way I can make it do it by itself? I use this.plugin.getServer().unloadWorld("world", false); to unload it and Bukkit.createWorld(new WorldCreator("world")); to load it which I'd expect makes it work but it doesnt

lost matrix
quaint mantle
ivory sleet
#

Be patient

eternal oxide
#

I looked, your question makes no sense

zenith shard
lost matrix
zenith shard
#

yes, I do this.plugin.getServer().unloadWorld("world", false);, delete the world folder, clone a world_TEMPLATE folder and name it world then load it again

eternal oxide
#

Can only be done in your onLoad method of your plugin during startup.

lost matrix
#

You cant unload the main world while the server is running

eternal oxide
#

before the world is loaded

zenith shard
#

I'm trying to make a mini-game world (there are multiple worlds, its running bungee), i just want to be able to reset the world to how it was before another round starts, what's the best way to do that?

eternal oxide
#

by not using the main world

lost matrix
tall dragon
#

@zenith shard you could also just restart the server then?. itl take a bit longer but would work

lost matrix
#

Oh jeah or just do your stuff in the onLoad method and restart the server...

#

Probably better

rigid hazel
#

Is livingEntity.damage(20, player); ignoring armour? If no, how do I damage an entity and ignoring amour?

lost matrix
#

pseudo code

zenith shard
#

can I unload the main world in the onLoad method just using this.plugin.getServer().unloadWorld?

lost matrix
rigid hazel
#

Because I still want that mobs get triggered

lost matrix
rigid hazel
#

But would that work?

#
livingEntity.setHealth(livingEntity.getHealth()-20);
livingEntity.damage(0, player);
eternal oxide
ancient plank
#

I'm gonna unload the main world out of spite now

lost matrix
eternal oxide
#

BUT remember a reload will also fire onLoad and the worlds remain loaded

#

only a clean start has no worlds

rigid hazel
lost matrix
#

You might need to do some more stuff to make sure you handle events from other plugins

rigid hazel
#

yes...

lost matrix
#

^^

rigid hazel
#

I think about it. Maybe I write back later

zenith shard
eternal oxide
#

no

tall dragon
#

when the server stops it will save

lost matrix
#

Bungee log pls

tall dragon
#

also @lost matrix now that i see you here, love your resources on spigot, very informative

lost matrix
#

Hm, i dont see anything odd

rigid hazel
#

What does livingEntity.setLastDamage(); do?

lost matrix
rigid hazel
#

Thanks.

#

This is usefull.

#

Can I use it like that?:

#
livingEntity.damage(0, player);
livingEntity.setLastDamage(20);```
split lake
#

I have this code where it spawns an entity with a armorstand passenger holding a fishing rod with custommodeldata 1, but when i use a texture pack to retexture the fishing rod to a 3d model it only shows the same fishing rod in a different holding degree, when i give myself a custommodeldata 1 fishing rod the model works normally


    public PassengerButterfly(Location loc) {

        super(EntityTypes.c, ((CraftWorld)loc.getWorld()).getHandle());
        this.setPosition(loc.getX(), loc.getY(), loc.getZ());
        this.setMarker(true);
        this.setInvisible(true);
        ItemStack item = new ItemStack(Material.FISHING_ROD);
        ItemMeta meta = item.getItemMeta();
        meta.setCustomModelData(1);
        meta.setUnbreakable(true);
        ((LivingEntity)this.getBukkitEntity()).getEquipment().setItemInMainHand(new ItemStack(item));```
#

its nms btw

chrome beacon
split lake
#

ooh wait i see it

chrome beacon
#

Also I don't see the point of using NMS here

split lake
#

so i add this right?
item.setItemMeta(meta);

chrome beacon
#

Yeah

split lake
#

okay ty

split lake
#

and some other things

chrome beacon
#

Ah

#

Also why are you creating a copy of item?

split lake
#

to add nbt tags, but from ur question i think that its not needed

lusty cipher
#

can I change the name of an inventory somehow?

next kernel
#

👀 guys, anybody know how to use TranslatableComponent(BungeeChat) on the Sign?

next kernel
arctic moth
#

how do u make an explosion of particles

#

like spawn them in a sphere around the player with their own directional movement

#

ik its probably an algorithm or smth but i cant find it

lusty cipher
arctic moth
#

yo anyone there lol

#

no responses in 20 mins

#

xD

next kernel
tardy delta
eternal oxide
#

of course you do, because you are not doing what you have been told

#

if you don;t register the class Bukkit does not know about it, so you get that error saying so

tardy delta
#

yes i registered it some weeks ago and then i removed it

#

do i need to unregister it?

eternal oxide
#

no

#

you need to register it

tardy delta
#

but i don't want that serialisation anymore cause it's saved in another format now

eternal oxide
#

then stop trying to get from the config using that class

tardy delta
#

i'm not even using that class anymore

eternal oxide
#

the error says you are

tardy delta
#

i dunno most of the times it works and sometimes i get that error when trying to load the config

vale ember
#

what is the EASIEST way to add ench glowing effect to item WITHOUT adding real ench or using nms?

tardy delta
#

lemme now just delete the file and try again

ivory sleet
#

You can use nms to inject an empty ench tag value

#

Or you can add a random enchant and hide it with an item flag

tardy delta
#

he doesnt want that

ivory sleet
#

And?

tardy delta
#

it would be the easiest way but yea

ivory sleet
#

The options are as I listed

tardy delta
#

uhu

ivory sleet
#

The spigot api does not have your best interest in mind

#

But no framework does really

ancient plank
#

just put smth that that object doesn't use on it gg ez

tardy delta
#

smh i'm only supposed to be able to click on the /home list

tacit drift
tardy delta
#

anyways i just want to know how it works

#

?paste

undone axleBOT
tardy delta
#

this doesnt seems to workhttps://paste.md-5.net/itakemugod.cpp

ancient plank
#

make a prefix component and a suffix, then the one you want to be clickable and do that

tardy delta
ancient plank
#

its been a while since ive done it but you need 3 different components for it

#

at least that's what I did

tardy delta
#

i have three now right?

#

.append()
.append()
.append()

#

ah it kinda works but now the clickable component and the last both have the hover event

ivory sleet
#

on the last one

#

set the hover event to null probably

tardy delta
#

what's even the difference between .append(string) and .appendLegacy(string)?

ivory sleet
#

?jd-bcc

maiden briar
#

IntelliJ can't handle enums from more then 7500 lines 😄

ivory sleet
#

oh fourteenrbrush probably legacy format string

#

like when it used to be just colorcodes

#

and not components

tardy delta
#

oh ok

#

i want to create my own builder now smh

mortal hare
#

does anyone remember what's the argument to install paper repo to the maven

#

of paperclip

lost matrix
mortal hare
#

thanks ❤️

tardy delta
#

is it possible that i cant execute async stuff in onDisable?

arctic moth
#

is there a way to maek an explosion effect without it destroying anything or damaging people?

lost matrix
lost matrix
chrome beacon
vivid cave
#

when an item's meta gets updated while i have it in main hand, it bounces
is there a way to remove this item animation?
For example, is there another way to update the item meta in such a way that it doesn't have that effect on the user's end?
or is there a way to change that through datapack?

tardy delta
tardy delta
#

sync*

vivid cave
arctic moth
vivid cave
#

but its not new to 1.17, it has always been like that

arctic moth
#

theres a tnt particle?

chrome beacon
quaint mantle
#

Yellow

lost matrix
quaint mantle
#

i cant understand bukkit crafting api

#

in this example

#

how the item will look like

hasty jackal
#

like the diamond sword recipe just with emeralds instead

lost matrix
vivid cave
quaint mantle
hasty jackal
#

you do realize that you already formatted it the way it will look like in the crafting box?

quaint mantle
#

yes i want it to look like that for example

#

what should i do

lost matrix
#

"GDG", "ESE", "GSG"

quaint mantle
#

oooh so like this

#

and how can i unlock the recipe for a player

lost matrix
# quaint mantle and how can i unlock the recipe for a player

But you should truncate empty columns and rows:

    final ShapedRecipe recipe = new ShapedRecipe(key, result);
    recipe.shape("E", "E", "S");
    recipe.setIngredient('E', Material.EMERALD);
    recipe.setIngredient('S', Material.STICK);
    Bukkit.addRecipe(recipe);
quaint mantle
#

and what is the key ?

#

what should i put

lost matrix
#

final NamespacedKey key = new NamespacedKey(yourPluginInstance, "cool_sword");

quaint mantle
#

ok

solid cargo
#

how can i make my Sidebar consistently update health

tardy delta
#

i tried .reset() but then the whole componentbuilder is resetted
wait what i guess .reset() works on the previous one

solid cargo
#

alright ty mate

lost matrix
#

Probably also PlayerJoinEvent

solid cargo
#

i have it on my join event already

humble heath
#

how do i send a massage to all players that have a permission

tall dragon
#

loop through

#

with an if check

humble heath
#

yes

hasty jackal
humble heath
#

if (P.haspermission(permission){ what dio i put here}

vivid cave
tardy delta
#

execute the message part

vivid cave
#

It gets very annoying because some items are constantly updated, due to animation

humble heath
#

yea but what do i put

vivid cave
#

I fear that this bounce may be created by the client

lost matrix
tall dragon
tall dragon
#

having your own thingy allows for multiple checks

#

but if ur doing it just for a perm i guess thats the superior way yea

humble heath
#

if (command.getName().equalsIgnoreCase("staff"))
if(P.hasPermission("ee.need.staff")){
P.sendMessage(Utilities.color(plugin.getConfig().getString("prefix") + "&3 the Request has been sent for help to a member of staff!"));
if(P.hasPermission("ee.staff")){

            }
        }
tardy delta
#

what

shadow tide
#

how would I take an argument from a command (a string) and make it the type of Player

tardy delta
#

Player player = Bukkit.getPlayer(args[]i)

solid cargo
#

where did the { go in the if (command.getName().equalsIgnoreCase("staff"))

tardy delta
#

then player != null // do something

shadow tide
#

already made sure the player is not null

arctic moth
#

in sendTitle() is the fadein/stay/fadeout in ticks or seconds

tardy delta
#

well there's your answer

solid cargo
#

seconds would be kinda dumb

#

extra conversion to do

tall dragon
#

one simple search

vivid cave
solid cargo
#

any ways i can remove a scoreboards' specific line?

quaint mantle
lost matrix
quaint mantle
#

and what is it

lost matrix
#

A Map<NamespacedKey, String> where the keys are the namespaces of that recipe and the value is the needed permission.

#

Then using the PrepareItemCraftEvent

arctic moth
#

how do you get the player's spawn location

#

ik theres getWorld().spawnLocation()

maiden briar
#

@lost matrix Can you send me the util again?

solid cargo
maiden briar
#

Hm you lost your booster role?

#

I finished making a class parser

arctic moth
#

wait its getBedSpawnLocation lol

lost matrix
quaint mantle
solid cargo
#

ok ig im dying bye lol

quaint mantle
#

you are doing it with a plugin ?

solid cargo
#

now i die

#

bye

quaint mantle
#

use netherboard api

#

and shadowJar or shade it

lost matrix
tardy delta
#

does anyone knows how to override the default ban screen?

#

so i can put custom text

quaint mantle
#

setKickMessage

lost matrix
#
  private final Map<NamespacedKey, String> recipePermissions = new HashMap<>();

  @EventHandler
  public void onPrepare(final PrepareItemCraftEvent event) {
    final Recipe recipe = event.getRecipe();
    if (!(recipe instanceof Keyed keyed)) {
      return;
    }
    final NamespacedKey key = keyed.getKey();
    final String permission = this.recipePermissions.get(key);
    if (permission == null) {
      return;
    }
    if (!event.getView().getPlayer().hasPermission(permission)) {
      event.getInventory().setResult(null);
    }
  }
solid cargo
lost matrix
#

idk i dont use scoreboards

quaint mantle
lost matrix
#

Not all recipes have a NamespacedKey. The ones that do implement Keyed. If they implement Keyed then they are an instance of it and can be cast.

lost matrix
quaint mantle
#

put key, "craft.sheesh"

lost matrix
quaint mantle
ancient plank
#

sheeeeeeesh

forest edge
#

Quick question- anyone know if it is possible to register a listener after the first tick?

quaint mantle
lost matrix
quaint mantle
#

and a tick after onEnable ?

forest edge
#

yep, that answers it, thanks

quaint mantle
tardy delta
#

is there no way to do this? how does it know which event has to go away?

#

nvm got it

#

just casting

dull whale
#

how do I change nbts of my clientsided armorstand like making it invisible?

#

I use WrapperPlayServerSpawnEntity

worldly ingot
dull whale
#

Ive looked for that under the packet functions

worldly ingot
#

is invisible is part of the base entity bitmask

lost matrix
dull whale
#
        WrapperPlayServerSpawnEntity packet = new WrapperPlayServerSpawnEntity();
        packet.setEntityID((int) (Math.random() * Integer.MAX_VALUE));
        packet.setType(EntityType.ARMOR_STAND);
        packet.setUniqueId(UUID.randomUUID());
``` a part of the code
worldly ingot
#

Looks like you'll want to add in the value new WrappedWatchableObject(0, 0x20)

dull whale
worldly ingot
#

No, in addition to

#

send your entity spawn packet, then send your metadata packet

dull whale
#

ok

#

Thanks ill try

tardy delta
#

wdym this is always true?

#

it isnt?

hasty jackal
#

it is, because if it wasn't, the first if would've succeeded

lost matrix
dull whale
#

for example how will I make it both invisible and invulnerable

mortal hare
#

btw

ancient bronze
#

@quaint mantle Emm Hello Dabsh md_5 Chetori ?

lost matrix
quaint mantle
mortal hare
#

idk, i wouldnt trust it and just put it outside the method scope.

quaint mantle
#

!paste

lost matrix
#

?paste

undone axleBOT
solar sable
#
public class MeowCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (cmd.getName().equalsIgnoreCase("Meow")){
            Player p = (Player)sender;
            if (sender instanceof Player) {
                p.sendMessage(ChatColor.RED + "Playing cat meowing sound");
                p.playSound(p.getLocation(), Sound.ENTITY_CAT_BEG_FOR_FOOD, 2F, 1F);
                return true;
            }
        }
        return true;
    }
}
``` i need help a bit here, idk what i did wrong but when i do the command /meow it doesnt make a sound and doesnt send the message "Playing cat meowing sound"
#

also says this as a warning

hasty jackal
#

it's redundant because you check instance of after you've already casted it

#

this it would only reach that line if the cast succeeded, otherwise it would've already thrown an error

#

are you sure you've set this as the executor of the command?

next stratus
#

Best way to store a integer per player?
Likely resolved

ivory sleet
#

Maybe with PDC api?

shy quarry
#

Hello there. :)
Has somebody any experience with giving fake entities (ProtocolLib packets) a potion like invisibility?
This is what I have right now:

        val packet: PacketContainer = protocolManager.createPacket(Play.Server.ENTITY_METADATA)
        packet.modifier.writeDefaults()
        packet.integers.write(0, entityId)
        val dataWatcher = WrappedDataWatcher()
        // This should add the invisibility, but seems to not do anything:
        dataWatcher.setObject(0, Serializer().byteSerializer, (14.toByte()))
        val optional: Optional<*> = Optional.of(WrappedChatComponent.fromText("testNPC").handle)
        dataWatcher.setObject(
            WrappedDataWatcher.WrappedDataWatcherObject(
                2,
                WrappedDataWatcher.Registry.getChatComponentSerializer(true)
            ),
            optional
        )
        packet.watchableCollectionModifier.write(0, dataWatcher.watchableObjects)
        protocolManager.sendServerPacket(player, packet)
vivid cave
mortal hare
#

SetSlot packet

vivid cave
#

aw thank you!

mortal hare
#

np

vivid cave
#

is it a sloth?

#

ur pfp

mortal hare
#

yes

tardy delta
mortal hare
#

it represents my personality

vivid cave
#

aww

vivid cave
#

epic

mortal hare
#

that function will execute every time to replace colors

#

and that's wasteful

#

instead you should create a variable outside the method

#

which uses that utility method, and then return the result from the variable

tardy delta
#

oh

#

uhh

#

if that would matter

mortal hare
#

that's just optimisation, it doesnt matter

#

performance is negligible

tardy delta
#

so like that?

mortal hare
#

well kinda, but you could return the array instead of sending that message inside the utility method, and then sending it manually

#

that way you wouldnt need to replace colors every time

#

Modify Utils.Message() method to return the colored array and then use it inside variable outside the class

#

that way the replacement of the colors would only occur at object creation

tardy delta
#

Utils.message returns a colored array?

mortal hare
#

result array

#

of the replaced colour code messages

ashen flicker
#

Have you thought about having the commands message be handled in a command handler? I mean it can make it a lot easier

tardy delta
#

and also send it?

ashen flicker
#

Yea I mean, if you have your own command handler, then you can have a description for the class, and display that in the home "super" class or whatever. You could display all of the sub classes and their descriptions. You don't have to manually do it in a static array

mortal hare
#
private static final String[] helpMessage = Utils.message(
//"message".. etc
)

and then in method

sender.sendMessage(helpMessage)
tardy delta
#

then i would use Utils.colorize()

mortal hare
#

then use it

#

its a static message it doesnt have anything dynamic

#

eg. player name

#

its not necessary, performance could be the same, as 7smile said JIT compiler could optimise that in runtime, im not sure

vivid cave
# mortal hare ``This packet can only be used to edit the hotbar of the player's inventory if w...

What you linked me to is received from an event right? I mean it's not a method/function right
From what I understand: When an item gets removed or added into an inventory slot, this event gets fired with corresponding packet data/event context
I'm not sure though if it corresponds to my situation:
I continuously update a player's armor color (to animate it). Thing is, when he has it in hand, it keeps bouncing up and down due to being updated animation, and i want to remove this bounce.

tardy delta
#

so just private static final String[] help = Utils.colorize(message)

#

and sender.sendmessage(help)

mortal hare
#

its server sent packet

#

it could never be received

#

its purpose is to send it to the client

mortal hare
vivid cave
#

ok, so I have to send it myself every time i wanna update the armor

#

i mean from the server ofc

mortal hare
#

if you want to have no animation yes, idk maybe there's a better way, but this should work

#

you're doing some kind of rainbow armor or what

vivid cave
#

yep!

mortal hare
#

as far as i know animation only occurs in hotbar

vivid cave
#

Actually it fully works already, u can test it out on my server if ya want

#

i just want to remove that boring bounce

mortal hare
#

this packet should work for that

#

fine

vivid cave
#

alrightie!

mortal hare
#

wow second 8gb ram stick really does the trick for development

#

finally i have no lag running server, intellij and server

#

and chromium

chrome beacon
#

Yeah it helps

#

I usually run 2 clients 1 server Intellij and Chrome with 16gb ram

young knoll
#

I wish I had a second client

#

Well, second account

mortal hare
#

im using mixed ram

chrome beacon
#

~~I use my brothers ~~

mortal hare
#

just because of PANDEMIC

#

i won the russian roulette and found similiar specs ram stick

#

one is from crucial and another one is from kingston

chrome beacon
#

Yeah idk what stuff I have

young knoll
golden turret
young knoll
#

True

chrome beacon
#

Well yeah

#

A Player isn't a String

#

So no casting that

ancient plank
#

wait selling accounts now after the microsoft migration means you gotta sell microsoft accounts and not just mojang accounts! madge

chrome beacon
#

._.

ancient plank
#

sorry for the ping olivo v.v

chrome beacon
#

No problem 🙂

golden turret
#

yes

fringe pawn
#

I know java, but I don't know anything about plugins. How can I write an http server? @golden turret

mortal hare
#

how does http server correlate with spigot plugin development

fringe pawn
#

i write http server in java but how to include plugin????

mortal hare
#

you extends your class by JavaPlugin

#

override onEnable() and/or onDisable method of JavaPlugin super class

#

add plugin.yml which consists of main:, name:, version: yaml keys

#

main key should provide package path to your plugins main class

fringe pawn
#

@mortal hare Is there a chance to pull console with plugin?

lost matrix
lost matrix
mortal hare
#

is that what you're seeking

#

?

fringe pawn
mortal hare
#

bukkit uses logger library

#

where you can probably get the output from there

fringe pawn
mortal hare
#

It uses java's logger

fringe pawn
#

sorry

fringe pawn
#

i wish

#

console output console.txt in real time

mortal hare
#

this.getLogger().addFileHandler()

#

im not expert in logger api

#

but something like this

#

i cant help you much

fringe pawn
mortal hare
#

Intellij IDEA Community edition

fringe pawn
fringe pawn
mortal hare
#

plugin.yml example

main: me.dovias.mypluginname.MyPluginMainClass
name: MyPlugin
version: 1.0-SNAPSHOT
author: Dovias
woeful crescent
#

how do i retrieve the value and signature of a player's skin?

golden turret
#

if yes

woeful crescent
#

yeah

mortal hare
#

my first thought would be to use mojangs auth api

woeful crescent
#

i dont wanna get banned

golden turret
#

see this

mortal hare
#

for what

woeful crescent
#

it happens like every 10m

golden turret
#
        Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            GameProfile profile = ((CraftPlayer) event.getPlayer()).getHandle().getProfile();
            for (Property property : profile.getProperties().get("textures")) {
                try {
                    URL url = new URL(
                            ((Map<String, Object>) ((Map<String, Object>)
                                    new Gson().fromJson(
                                            new String(Base64.decodeBase64(property.getValue())).replace("\n", ""),
                                            Map.class
                                    )
                                            .get("textures"))
                                    .get("SKIN"))
                                    .get("url").toString()
                    );
                    PLAYERS_SKINS.put(
                            event.getPlayer().getUniqueId(),
                            ImageIO.read(url)
                    );
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
    }```
#

i use it at PlayerJoinEvent

woeful crescent
#

will this work in 1.8?

golden turret
#

yes

#

the native

woeful crescent
#

nice

golden turret
#

this code is native of 1.8

#

you can even download the player skin with that

mortal hare
#

that uses the auth api

#

anyways

#

but yeah thats the correct way of doing that

woeful crescent
#

i need the value and signature

golden turret
#

then just change the values used

woeful crescent
#

Huh

#

I mean

#

Would this work?

golden turret
#

idk

#

maybe

#

but it will be in base64

woeful crescent
#

hold on one sec

#

In your code you're iterating through all of the texture properties

#

Is there only 1?

mortal hare
#

if you want to just store it and compare base64 values, its all you need

woeful crescent
#

I need the value and signature

#

Is that what that code will get me in 1.8?

mortal hare
#

it should

golden turret
#

idk

golden turret
#

i saw

mortal hare
#

i havent used 1.8 for years

golden turret
#

the value and signature in the map

mortal hare
#

idk if 1.8 has API differences

#

but i dont think so

#

because 1.7.10 introduced the uuids

stone sinew
#

yes

mortal hare
#

everything can be serialized, question is probably is your class implements serializable interface

#

which simplify things

#

old api

#

but it should be fine in newer versions

#

BlockStateMeta implements ConfigurationSerializable

#

invoking serialize() method you can get a map

#

with all keys and values

fringe pawn
quaint mantle
#

?learnjava

undone axleBOT
mortal hare
#

have you imported the Spigot API

fringe pawn
mortal hare
#

how would IDE know what black magic you're writing then

fringe pawn
mortal hare
#

google

fringe pawn
outer steeple
#

What is wrong with this?

tall dragon
#

capital O

outer steeple
#

oh ok

#

tnks

mortal hare
#

GameTestHarnessTestCommand wtf is this command

#

i found it inside NMS

#

but seems its not used ingame

outer steeple
#

it still shows that there is an error @tall dragon

mortal hare
#

well look for utility methods in google

#

which parses the object into json or anything else

outer steeple
hasty jackal
outer steeple
hasty jackal
#

it's onEnable and @Override

tall dragon
#

^

hasty jackal
#

you switched the capitalization of the wrong O's

outer steeple
#

ohhhhh

#

tnks

#

bruh

hasty jackal
#

you can also just let the IDE generate the right stuff for you

#

alt + insert -> override methods

outer steeple
#

ok

#

tnks

shadow tide
#

there is a bug in my plugin where a player can get infinite hearts by putting the heart item in their offhand and right clicking. The item is supposed to delete itself when you right click but the offhand is not technically the inventory so it doesn't clear

#

here is my item's class

stone sinew
shadow tide
#

huh

stone sinew
#

You have to get which hand is used and get the item from that hand.

young knoll
#

No you don't

#

That is what getItem is for

shadow tide
#

ok

#

then what do I do?

young knoll
#

I usually just set amount on getItem

#

to the current amount - 1

shadow tide
#

?

young knoll
#

Do you want to remove one

#

Or all of it

shadow tide
#

wait nvm

#

got it

shadow tide
young knoll
#

Then yeah, that method works nicely

#

As long as you aren't back in like 1.12

stone sinew
young knoll
#

Long time ago

shadow tide
#

bruh

#

event.getItem

#

dude

young knoll
#

There was a site that allowed you to view what versions a method was available in

#

I wish I remembered what it was

fringe pawn
#

how to send image?

young knoll
#

Verify

#

Or use a image sharing site

fringe pawn
fringe pawn
young knoll
#

I mean it tells you

#

In fact I don't even see a package

fringe pawn
young knoll
#

I believe InteliJ has a plugin to generate a basic setup for you

undone pebble
#

It's called Minecraft Development iirc

fringe pawn
#

why my plugin dont show

#

help me

#

come general-1

solid cargo
#

how can i install netherboard api?

shadow tide
#

how would I make a GUI type thing?

quaint mantle
#

?google "Spigot create gui"

undone axleBOT
shadow tide
#

I just want it to open a chest

quaint mantle
#

?

fringe pawn
golden turret
#

?google how to open a chest

undone axleBOT
golden turret
#

@fringe pawn use something like gradle or maven

fringe pawn
golden turret
#

no

#

hope i helped

arctic moth
#

im trying to make a command with args but whenever i use any args it just shows the usage

arctic moth
#

k

#

um still isnt working

quaint mantle
#

send code

arctic moth
#

rip

#

lol ill screenshot

mortal hare
#

does any of you know how does bukkit command execution work

#

its so strange

#

it seems that bukkit only uses brigadier for tab completion

quaint mantle
mortal hare
#

i need deeper understanding

#

apart from craft implementations

#

from NMS perspective

#

I've spent over 3 hours searching where bukkit hooks into brigadier, and only thing i found that its adding new CommandNode to the datapackResources commandDispatcher

arctic moth
#

lol how do u make text smaller in intellij trying to make a screnshot

mortal hare
#

which seems to be used to sync bukkit commands

#

with brigadier ones

#

the thing is, idk if bukkit uses brigadier apart for tab completion or does it use its own algorithm some sorts

#

to execute the command

#

from what i see it splits the command and does the error checking by themself

#

and ignores brigadier

#
    public int run(CommandContext<CommandListenerWrapper> context) throws CommandSyntaxException {
        return this.server.dispatchCommand(((CommandListenerWrapper)context.getSource()).getBukkitSender(), context.getRange().get(context.getInput())) ? 1 : 0;
    }
#

what's more strange that method has throws CommandSyntaxException which is from brigadier but i cant seem what could throw it

arctic moth
#

can someone help me im trying to use config outside of my main class

#

i tried to do this, but it didnt work

Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("Main");
plugin.reloadConfig();
mortal hare
#

you need to provide plugin name

#

not the main class name

arctic moth
#

o

golden turret
#

@mortal hare

mortal hare
#

?

golden turret
#

i took a look a look time ago

#

and

#

it seems that bukkit uses its own system

mortal hare
#

i seem to think like this too, but i see things like CommandSyntaxException which are thrown by brigadier when dispatching failed, etc

#

idk

#

but i cant find no trace of the logic behind apart from this

#

i would love to use native brigadier

#

but couldnt seem to find a way to modify the thrown error messages

#

without rebuilding the jar

#

because they're very ugly and hard to understand for some people

golden turret
#

gime a minute

#

you want for which version

mortal hare
#

newest 1.17.1

#

there's things like commodore, but its just a mappings utility, nothing more apart from that

golden turret
mortal hare
#

BukkitCommandWrapper class from craftbukkit package

minor ivy
#

Hello, is it possible to compile a .jar with another .jar (jedis) without a maven?
In eclipse *

mortal hare
#

that's what im talking about

#

i successfully registered the command inside the dedicatedServer's command dispatcher

#

but this message is ugly

young knoll
#

Does yours show up as minecraft:command as well :p

mortal hare
#

yes it does, but its a craftbukkit's implementation problem

#

since it uses separate commanddispatcher

#

for packet sending

#

of tab completion

#

it uses CommandDispatcher from DatapackResources inside dedicatedServer

young knoll
#

Blah

#

I kind of want a way around that

mortal hare
#

to sync the bukkit commands with minecraft ones

#

spigot doesnt find Plugin object inside command map and it assumes that inside brigadier is a minecraft command

solid cargo
#

porque?

mortal hare
young knoll
#

Thus, we are Mojang

mortal hare
#

its possible to fix this, but it requires manual deregistration or modification of spigot jar i assume

young knoll
#

Rather annoying

mortal hare
#

have you managed to change that ugly error message

mortal hare
#

thats more annoying for me

golden turret
young knoll
#

Don't think so

#

At least it is consistent with vanilla

mortal hare
#

here's the output from DatapackResources object CommandDispatcher (Inside DedicatedServer.class)

#

it stores the tab completion data for bukkit there

#

you can delete the node with minecraft: prefix there

#

and you're done fixing it, after that you need to resend the packet or use the method which is already provided somewhere i dont remember

#

and "minecraft:yourcommand" is gone

#

i don't understand why craftbukkit team doesnt make their command api deprecated

#

brigadier is way more flexible and more performance friendly

#

since its based on tree structure, and doesnt need to get computed that much

solid cargo
#

?paste

undone axleBOT
solid cargo
#

i clearly have it installed i believe

mortal hare
#

check your logs

solid cargo
#

logs of what

#

ide or server?

mortal hare
#

if the plugin is loaded

#

that you've downloaded

eternal oxide
#

kaboom is not on your server

solid cargo
#

its not loaded

#

the netherboard api is downloaded

solid cargo
#

no appearance of my kaboom plugin :(

mortal hare
#

change dependency name in plugin.yml

#

from Netherboard-Bukkit

#

to Netherboard maybe?

solid cargo
#

ok

#

then it straight up dies

#

maven refuses to reload

mortal hare
#

inside plugin.yml

#

not in the maven

solid cargo
#

ohh

#

sorry

#

nice now it loads 👍

#

istg this server is a live saviour

golden turret
solid cargo
#

👍

golden turret
#

👍

undone pebble
#

👍

mortal hare
#

Bukkit's command API does not use brigadier because md_5 wants to keep backwards compatibility.

#

that sums it up sadly.

quaint mantle
#

fuck backwards compatibility

ivory sleet
mortal hare
#

command API uses a little bit of brigadier, but only for simple tab completion

ivory sleet
#

Maybe the impl

#

but afaik not the api

mortal hare
#

ArgumentCommandNode<CommandListenerWrapper, String> defaultArgs = ((RequiredArgumentBuilder)RequiredArgumentBuilder.argument("args", StringArgumentType.greedyString()).suggests(this).executes(this)).build();

#

that famous tooltip "<args>" lies

#

inside bukkit brigadier impl

#

its hardcoded inside the class

ivory sleet
#

yeah impl exactly

#

not exposed in api

mortal hare
#

its kinda hacky how this brigadier impl works

#

it uses brigadier's greedy string argument type class to bypass tab completion from brigadier (error tooltip)

golden turret
#

how do i avoid the circular error in my case

#

i have 2 modules

#

core and adapter

#

i want to use something in the adapter

ivory sleet
#

make it unidirectional

golden turret
#

and this thing is in core

ivory sleet
#

probably through making everything depending on abstractions

golden turret
#

yes

#

but

#

i want this

#

in the

#

adapter module

#

and the core build.gradle

#

i tried to exclude

#

but doesnt work

ivory sleet
#

I really dont understand what you're trying to do here, maybe im just dumb

golden turret
#

core:
coolpackage.Class
adapter:
coolpackage.aa.AnotherClass

#

core implementation(project(':adapter'))

#

what i want

#

is

#

from the adapter

#

access a class in the core

#

without doing circular error

arctic moth
#

how do you display something in the actionbar

#

like right above the hotbar

vast shale
#

I'm trying to understand this method:

#
    HashMap<List<UUID>, List<UUID>> battles;
    public List<UUID> getBattlePlList(UUID uuid) {
        Entity e = Bukkit.getEntity(uuid);
        for (List<UUID> list:battles.keySet()) {
            if (main.registry.isNPC(e)) {
                if (list.contains(uuid)) return battles.get(list);
            }
            else {
                if (battles.get(list).contains(uuid)) return battles.get(list);
            }
        }
        return null;
    }
#

It returns a List of UUIDs but wouldn't it just return a single UUID?

vague oracle
#

Damn, that looks like it needs to be converted into a class

vast shale
#

Yeah its old code, i'm currently making it into a class. Just trying to understand this so I can better convert it

eternal oxide
#

No it will always return a List<UUID> IF the searched UUID is in either the key or value List

arctic moth
#

how do you stop someone from being on fire

vague oracle
#

set their fire ticks to 0

arctic moth
#

i tried setFireTicks(0) but it didnt work

#

i still catch fire

vague oracle
#

well it depends do they stay in the fire

arctic moth
#

ive also tried setting to invulnerable but after its turned off they catch fire

#

ima try invulnerable + setfireticks

thorn shuttle
#

WTF

#

WHY ARE THEY USING A LIST AS THE KEY

#

THIS IS WRONG

#

:X

arctic moth
#

lol

thorn shuttle
#

(said it out loud, why does my dog look so guilty now?)

arctic moth
thorn shuttle
#

Thinking more about being able to "save" pixelstacker projects. It would require a way to serialize a blueprint in a way that it can be deserialized for future use....

arctic moth
vague oracle
#

This is how I do it

arctic moth
#

btw isnt there a thing where u can wait a tick

vague oracle
#

What version are you on

arctic moth
#

1.17

vague oracle
#

strange, I am and it works fine

arctic moth
#

lol

vague oracle
#

xD

arctic moth
#

lol ignore the timeunit thing ik its shit

#

but idk what the wait tick thing is called

#

i could google it ig

#

but idk why its lagging me back

#

it says it in the logs

#

[18:43:09 WARN]: Can't keep up! Is the server overloaded? Running 8473ms or 169 ticks behind
[18:43:09 WARN]: TristanDaSavage moved too quickly! 12.997392193638632,1.0,21.009445078726685

#

that happens every time i "die"

#

for some reason the stuff heals after invulnerability turns off even tho this is the order

eternal oxide
#

That much lag you are doing something heavy on death

arctic moth
#

lol

#

not rlly

#

and im not seeing any lag ingame

eternal oxide
#

Oh you are sleeping the server on respawn

#

Yeah, NEVER do that

arctic moth
#

thats probably why

#

lol thats what i was saying about how do i do the tick thing

young knoll
#

?scheduling

undone axleBOT
eternal oxide
#

you use teh scheduler to delay code

arctic moth
#

o ye

#

that

#

now i remember

arctic moth
#

cuz it just runs the scheduler a bunch of times but delayed

eternal oxide
#

use teh BukkitRunnable and add a variable outside the run() method

#

a simple Int you can increase every time it executes

#

then do whatever you want in the run() method depending on the int value

paper viper
#

teh

eternal oxide
#

when it reaches a set value call cancel()

arctic moth
# eternal oxide use teh BukkitRunnable and add a variable outside the run() method

so like

for(int i = 5; i > 0; i--) {
            int finalI = i;
            new BukkitRunnable() {
                @Override
                public void run() {
                    player.sendTitle(ChatColor.RED + "You Died", ChatColor.YELLOW + "Respawning in " + ChatColor.RED + finalI, 0, 21, 0);
                    player.sendMessage(ChatColor.YELLOW + "Respawning in " + ChatColor.RED + finalI);
                }
            }.runTaskLater(plugin, 20L);
        }
eternal oxide
#

no

arctic moth
#

god discord what is that indenting

#

lol

eternal oxide
#

not a for loop

arctic moth
#

the for loop is for how many seconds

eternal oxide
#

just an int variable inside the runnable, but outside the run() method

#

no, you do a repeating task

#

you do it all in one runnable

arctic moth
#

lol

arctic moth
#

@eternal oxide

wide coyote
#
new BukkitRunnable() {
    int sec = 5;
    @Override
    public void run() {
        if (sec == 0) {
            this.cancel();
            return;
        }
        player.sendTitle(ChatColor.RED + "You Died", ChatColor.YELLOW + "Respawning in " + ChatColor.RED + sec, 0, 21, 0);
        player.sendMessage(ChatColor.YELLOW + "Respawning in " + ChatColor.RED + sec);
        sec--;
    }
}.runTaskTimer(plugin, 0L, 20L);
eternal oxide
#
        new BukkitRunnable() {
            int i = 5;
            @Override
            public void run() {
                player.sendTitle(ChatColor.RED + "You Died", ChatColor.YELLOW + "Respawning in " + ChatColor.RED + i, 0, 21, 0);
                player.sendMessage(ChatColor.YELLOW + "Respawning in " + ChatColor.RED + i);
                i--;
                if (i == 0) cancel();
            }
        }.runTaskTimer(plugin, 0L, 20L);```
arctic moth
#

thx

#

lol i was thinking something that

steady smelt
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

steady smelt
#

uh hm

#

sori

#

when i opened the project on another computer, this happened

#

btw there is
@Override
on the top

young knoll
#

Have you tried the suggested fix

#

Or just ignoring it

unreal quartz
#

have you tried deleting and reinstalling your OS

#

should fix it

paper viper
#

take it or leave it lol

steady smelt
worldly ingot
#

Just means that the parameters are annotated with @NotNull in the Bukkit interfaces but they're not in your project

#

If you prefixed all of those parameters with @NotNull it would go away

quaint mantle
#

How to return in runTaskAsynchronously?

young knoll
#

You can’t return the outer method inside a task

stone sinew
somber hull
#

I am so confused

#

any idea why my main class public static void main(String[] args){} wont run?
heres my manifest file

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.6.3
Built-By: PC
Build-Jdk: 16.0.2
Main-Class: me.silentprogram.discordbot.MainClass


#

im trying to make an excecutable jar

quaint mantle
#

what is BanList banlist; in java [what does it do]

public class InternalListener implements Listener {
    
    @EventHandler
    public void onPunish(PunishmentEvent e) {
        BanList banlist;
        if (e.getPunishment().getType().equals(PunishmentType.BAN) || e.getPunishment().getType().equals(PunishmentType.TEMP_BAN)) {
            banlist = Bukkit.getBanList(BanList.Type.NAME);
            banlist.addBan(e.getPunishment().getName(), e.getPunishment().getReason(), new Date(e.getPunishment().getEnd()), e.getPunishment().getOperator());
        } else if (e.getPunishment().getType().equals(PunishmentType.IP_BAN) || e.getPunishment().getType().equals(PunishmentType.TEMP_IP_BAN)) {
            banlist = Bukkit.getBanList(BanList.Type.IP);
            banlist.addBan(e.getPunishment().getName(), e.getPunishment().getReason(), new Date(e.getPunishment().getEnd()), e.getPunishment().getOperator());
        }
    }
}

what does BanList banlist do?
also what does the e in (PunishmentEvent e) do?

#

public void onPunish(PunishmentEvent e) {
BanList banlist;

young knoll
#

BanList banlist is a variable declaration

#

And the e is the parameter name of type PunishmentEvent

quaint mantle
young knoll
#

BanList is the type

#

banlist is the name

quaint mantle
#

um

#

lol

#

why

#

is there a difference using =?

young knoll
#

= is for assigning a variable

quaint mantle
#

BanList banlist; is the same as BanList = banlist?

young knoll
#

No

#

BanList banlist creates a new variable of type BanList named banlist

#

BanList = banlist assigns the value of banlist to the variable named BanList

#

However BanList would be a bad variable name as it starts with an upper case letter

quaint mantle
#

looking like a ?learnjava

somber hull
#

?learnjava

undone axleBOT
somber hull
#

This isn’t me being a dude with a stick up my ass. You legit need to watch a few videos or read about basic Java before working with spigot

quaint mantle
opal juniper
quaint mantle
#

He don't know Java

#

But in any case, maybe he will remember what I wrote and will not allow it when he learns the language

#

😋

quaint mantle
#

don't tell this guy I prefer equals for enums