#help-development

1 messages · Page 319 of 1

hasty prawn
#

Yeah I have an api for inventories too but it's not nearly that powerful lol

echo basalt
#

well

#

I made that engine in like

#

2-3 hours?

#

I had a clear idea of what I wanted tho

#

I'm still thinking on how I'll do my new imageboard system

#

I nuked my old one except for a couple classes

#

and made it a standalone project

#

got this far

#

doubt I'll be making 3d games (on minecraft item frames and maps)

#

so there's probably no point in making projections

hasty prawn
#

You are a big nerd

echo basalt
#

I am also a high school student :)

#

that hasn't programmed in over 2 weeks

hasty prawn
#

I haven't in like 3 months SAdGE

#

I miss it but I have like no time anymore

echo basalt
#

I have some travelling to do next week and need the cash

hasty prawn
#

And I'm lazy

echo basalt
#

so I decided to nuke stuff and redo it

regal scaffold
#

How can I get the block the player is looking at at the moment of typing a command?

hasty prawn
#

getTargetBlock

echo basalt
#

or raytraceblocks and add filters :)

#

you can also raytrace to see if there's an entity in front

#

very advanced

#

although I find annoying always having to filter the player itself because it always hits itself if I don't

hasty prawn
#

How do you add filters to rayTraceBlocks

#

I didn't look at the docs that hard tbh

echo basalt
#

actually for blocks you basically can't

#

I think there's an enumset you can use

hasty prawn
#

Ok yeah I didn't think so

echo basalt
#

one common thing I have to do

#

is like

#

I like to mess with client-sided blocks

livid dove
#

just so i dont need to code it, any way to turn off end gateways?

hasty prawn
#

All I see is maxDistance and FluidCollisionMode

echo basalt
#

and I can't just include certain shapes as others in the raytrace

echo basalt
regal scaffold
#

How can I null check that

#

How can I make sure the player is even looking at an item before getTargetBlock

#

Or do I not need to check?

echo basalt
#

break your problem down

#

example:

  • When the player runs a command
  • We check if they're holding X item
  • If they aren't, well good luck
  • Now that they're holding X item, we can check if they're looking at Y block
regal scaffold
#

I need to get a block a player is looking at at the moment of running a command and make sure if it exists it's a chest

#

Not holding, looking at

echo basalt
#

okay

#

you can get the chest with the api methods we gave you

#

what else

regal scaffold
#

I'm just asking if player.getTargetBlock can return null

#

Do I need to check if it exists?

echo basalt
#

middle-click it and read the comments?

sage patio
#

does UTF8 support »?

remote swallow
#

should do

echo basalt
#

uhh

#

no guarantees

#

but it should

#

utf-8 should support most things afaik

#

» is actually a very nice character for messages

sage patio
#

i'm sending a message to a discord webhook and converts the » to ?

echo basalt
#

glad I have it on my keyboard

remote swallow
#

dafuq

glossy venture
remote swallow
#

ive used that on chat formats

#

and discordsrv default is that symobl

glossy venture
#

kinda forgot how to do that though

remote swallow
#

maven or gradle

echo basalt
#

I'd use StringEscapeUtils#escapeJava if you have apache

sage patio
#

maven

wary topaz
remote swallow
#

folow this

hasty prawn
#

Oh wait no it shouldn't be null I lied

regal scaffold
#

Ok this is gonna sound noob so I apologize. I wanna make sure I'm reading this correctly

    /**
     * Gets the block that the living entity has targeted.
     * <p>
     * This method considers all blocks as 1x1x1 in size. To take exact block
     * collision shapes into account, see {@link #getTargetBlockExact(int,
     * FluidCollisionMode)}.
     *
     * @param transparent Set containing all transparent block Materials (set to
     *     null for only air)
     * @param maxDistance this is the maximum distance to scan (may be limited
     *     by server by at least 100 blocks, no less)
     * @return block that the living entity has targeted
     */
    @NotNull
    public Block getTargetBlock(@Nullable Set<Material> transparent, int maxDistance);

Parameters refer as to "settings" for the method.
Returns: States what it returns, in this case a Block that's targeted,

@NotNull means it can return null meaning it does the checks on it's own?

hasty prawn
#

Yeah it won't be null

#

It'll be air

regal scaffold
#

Oh

#

Then another question

#

How do you know the default is gonna be air?

#

If it doesn't say in that part of the docs

wary topaz
#

why would they change it

hasty prawn
#

If they're looking straight up into the sky, what blocks are there?

regal scaffold
#

That's not what I asked, I wanna learn

echo basalt
#

I'd say its null

regal scaffold
#

So it's intuitive

#

you mean

echo basalt
#

because for it to not be null, it must be fully functional

#

as a block

#

actually nvm it says NotNull

#

so what, it returns the player loc?

glossy venture
#

its annotated as Notanill

sterile token
#

Any tutorial for pagination in general, not menus, mainly for paginating commands let say

glossy venture
#

notanill yes my favtorite annotation

hasty prawn
#

No, it returns the AIR block at the max distance.

regal scaffold
#

Yeah yeah I get that. I'm just trying to understand that usually in these cases just use logic? And should be right?

#

I understand there

#

there's air in front. I just wanted to learn how to know what the default would be if @urban grotto was specified.

echo basalt
#

it returns the first element

regal scaffold
#

Gotcha

hasty prawn
#

Weird

regal scaffold
#

And to get to that

#

You go to the GetTargetBlock() definition?

echo basalt
#

yeah

#

I happen to be a big boy

#

and know where to look

#

past the api

regal scaffold
#

Perfect

#

Thanks for explaining ❤️

#

Now, would this be the most efficient way of doing this?

        if (!(player.getTargetBlock(null, 5).getState() instanceof Chest)) {
            sender.sendMessage(translateChatColor(getPrefix() + "&cYou must be looking at a chest!"));
            return;
        }
        Chest chest = (Chest) player.getTargetBlock(null, 5).getState();
#

Or is it better to Block block = getTargetBlock()
Then check what it is

Then assign to chest if valid

echo basalt
#

I'd reuse the variable

hasty prawn
#

You can use pattern matching to only call getTargetBlock once

regal scaffold
#

I gotta read on patternMatching

echo basalt
#

basically

hasty prawn
#

Basically just makes a variable and auto casts from instanceof

shell galleon
#

@quaint mantle 🙂

quaint mantle
#

hi

#

ok so download the plugin

hasty prawn
#
if(state instanceof Chest chest) {
   chest.doSomethingWithChest();
}
echo basalt
#

instead of

if(!(sender instanceof Player)) {
  ...
  return;
}

Player player = (Player) sender;

->

if(!(sender instanceof Player player)) {
  ...
  return;
}

...
regal scaffold
#

OH

#

That's sick

#

So if it fails

echo basalt
#

java 14+ I'd say

shell galleon
regal scaffold
#

It won't assign it

quaint mantle
regal scaffold
#

That's really cool

shell galleon
quaint mantle
#

is your server web hosted or locally hosted?

shell galleon
#

hosted on a vps

quaint mantle
#

right so go to your vps

#

actually nvm

#

go to your dowloads folder

#

and right click the plugin

#

press copy

#

then go to your vps

#

then go plugins folder

#

then right click and press paste

regal scaffold
#

Is there any prefer naming convention for static methods

remote swallow
#

wont work if its not in file explorer

buoyant viper
quaint mantle
shell galleon
quaint mantle
#

np homie

#

now restart your server and it should be there

sage patio
remote swallow
#

did you reload maven

humble tulip
sage patio
remote swallow
#

?paste ur pom

undone axleBOT
sage patio
echo basalt
sterile token
echo basalt
#

then loop between start and end

#

or sublist

#

but that'd make a copy

#

not sure how much I like

sterile token
echo basalt
#

or you can just... loop

#

but sure whatever

#

up to you

sterile token
#

That why haha

echo basalt
#

I'm more concerned about memory than cpu time in that case

#

maybe a fixed-size array 🤔

sterile token
regal scaffold
#

Question, if isValidTargetBlock(player) returns either a Chest object or null

How can I simplify the declaration?

        if (isValidTargetBlock(player) == null)
            return;
continue

Is this the best way?

        Chest chest = isValidTargetBlock(player);
        if (chest == null)
            return;
sage patio
remote swallow
#

oh i didnt see that you sent it lol

#

how you building

sage patio
#

maven install

remote swallow
#

build with package

humble tulip
regal scaffold
humble tulip
#

why does it return a chest then?

#

it shoudl return a boolean

#

if your method name starts with "is" your method should probably return a boolean

sage patio
#

still replaced the » with ?

remote swallow
#

is the thing in the file or are you adding it after?

sage patio
#

it is in the file

remote swallow
#

im very confused about that lol

sage patio
#

but i'm using new String(String.getBytes(), StandardCharsets.UTF_8)

#

does this cause any problem?

quaint mantle
#

well

remote swallow
#

cant say ive ever seen that

quaint mantle
#

is it red on ur screen? @sage patio

remote swallow
#

you should probably just be able to read it normally

quaint mantle
#

if yes then yes its error if no then no error

sage patio
#

i'm sending that to a discord webhook

remote swallow
#

is it in a config or something?

sage patio
#

config?

remote swallow
#

the arrow

quaint mantle
#

yeah

sage patio
#

its in a toml file

#

if thats a config

remote swallow
#

yeah

quaint mantle
#

you should probably change the pom.xml and make it fix ur dependency

#

thats what i did and boom it works

remote swallow
#

it might be that causing issues

remote swallow
sage patio
#

actually i have a dependency error in my pom.xml

quaint mantle
#

oh

#

to fix that

sage patio
#

i've installed that

quaint mantle
#

go to top right

#

and press the uno reverse card button

#

should be on the left

sage patio
#

which one

remote swallow
#

maven weird

quaint mantle
#

the one on far left

sage patio
quaint mantle
#

k

sage patio
#

and it still says not found

quaint mantle
#

all the issues should be fixed

#

idk bro

#

it worked for me

#

try uninstalling it

#

and re installing it

remote swallow
#

dafuq is that

quaint mantle
#

huh

#

wdym

remote swallow
#

are you a high school it guy

quaint mantle
#

no

remote swallow
#

saiyng "uninstall and reinstall it"

quaint mantle
#

just a dude that doesnt understand jack shit of whats happening

#

i probably have less brain cells then the stuffed animal in my pfp

sage patio
#

do i need that plugin anyway?

quaint mantle
#

nah

#

remember

remote swallow
#

if you have no sources to distrubute probably not

quaint mantle
#

dont remove spigot

quaint mantle
#

but you can remove all the side hoes aka random ass dependencys

#

focus on your main queen

remote swallow
#

doesnt even use spigot KEKW

quaint mantle
#

lmfaooo

quaint mantle
remote swallow
#

?learnjava might help

undone axleBOT
regal scaffold
#

Hey,

Lets say I want the user to be able to type any item in minecraft as a command argument.

For example as in a /give <item> command

quaint mantle
#

er

remote swallow
#

but @sage patio maven is weird and i have got a clue what is not encoding that with utf8, apologies im not more help

quaint mantle
#

honestly

regal scaffold
#

Is there any way to get all the items and the variations, is there a db

sage patio
regal scaffold
sage patio
#

u too iCalling thanks

remote swallow
#

make it the values of the Material.values class

quaint mantle
remote swallow
#

god

quaint mantle
regal scaffold
#

I did check essentials before typing here

#

But

remote swallow
#

one second

quaint mantle
regal scaffold
#

ItemStack stack = ess.getItemDb().get(args[1]);

#

They use that

remote swallow
#

ive got code for it somewgere

quaint mantle
#

so

#

if you have the answer

#

why are you asking the question

white root
quaint mantle
#

what the fuck is kotlin

remote swallow
#

fuck kotlin

white root
#

:kotlin: :stonks:

remote swallow
quaint mantle
#

explain what kotlin is

white root
regal scaffold
#

Because I didn't understand the ess.getItemDb()

white root
quaint mantle
#

which you can learn here

regal scaffold
sage patio
#

You know what? that is not my problem who gonna use » characters or anything causes this problem, i'm disappointed

quaint mantle
#

preach bestie

white root
# quaint mantle explain what kotlin is

Kotlin is a programming language that is fully compatible with Java. It was developed by JetBrains, the company behind the popular Java IDE IntelliJ IDEA, and was officially supported by Google as a first-class language for Android development in 2017. Kotlin is similar to Java in terms of syntax and structure, but it also has some features that Java doesn't have, such as null safety, extension functions, and data classes. It is considered to be a more modern and powerful version of Java.

#

It compiles to the same bytecode as java but with a better syntax and some nice-to-haves on top of that

regal scaffold
#

It uses a »

remote swallow
#
public class ClassName {
    private List<String> MATERIALS = new ArrayList<>();

    public ClassName() {
        for (Material material : Material.values()) MATERIALS.add(material.toString());
    }
}
remote swallow
#

got it

regal scaffold
#

Awww

white root
regal scaffold
#

Thanks epic

hazy parrot
sage patio
regal scaffold
#

Yeah but I fixed it

remote swallow
#

it might be toml or something

white root
quaint mantle
#

i know java

regal scaffold
#

Wait xii

#

I'll show you

sage patio
#

which one

sage patio
#

there is a lot related to chat plugins in you profile

regal scaffold
#

I'll send it here

#

Can you show me your issue again plz

sage patio
#

ok listen
i have a staffchat plugin that sends every staff chat into discord via a webhook

sage patio
#

it gets a message format in a toml file and replaces something

sage patio
regal scaffold
#

In discord or ingame

sage patio
#

in discord

#

and i replace & to "" too

regal scaffold
#

Ohhhh, that's discord then I can't help

#

Sorry

#

I thought you had the problem ingame

sage patio
#

no, thanks anyway

regal scaffold
#

Is it >>

#

Or that character

remote swallow
#

different char

quaint mantle
regal scaffold
#

»

#

That one right?

quaint mantle
#

Captain69Jack

#

what kind of username is this

regal scaffold
sage patio
#

sorry i don't check here ping me

regal scaffold
# sage patio yes

Yeah no idea, making it work ingame is already interesting no clue about discord

sage patio
quaint mantle
#

did you use to be a of creator or sum shit

#

why is the page banned

sage patio
#

which page

remote swallow
sage patio
#

ow Twitter?

quaint mantle
sage patio
#

i've changed that

#

my username

remote swallow
#

mainly so you arent looping of the entire class each time you want a command

sage patio
#

it seems it's not changed in my connections

quaint mantle
#

wait so

sage patio
#

lemme send you the right one

regal scaffold
#

But

quaint mantle
#

wanna do a collab?

regal scaffold
#

Ok wait I think I figured it out

remote swallow
#

when you type new ClassName() you initalize the class

#

there for adding the values to the list

quaint mantle
#

@worldly ingot

#

hes advertisign

#

ban

#

omg

sage patio
#

what

quaint mantle
#

lmfaooo

sage patio
#

for real dude?

#

fuck uxd

quaint mantle
#

LOOOOOOOOOOOOOOOOL

#

im dying rn

sage patio
#

lol

quaint mantle
#

sorry hot chocolate for pinging you

sage patio
#

btw its Sinaw69

quaint mantle
#

OMG BAN

#

ADVREISTYITSING

twilit wharf
#

I want to add a section of lore to every crafting recipe, and using tutorials I found online, this was the best supposed method. It doesnt work as intended, and nothing changes on the crafting result. ```java
List<Recipe> recipes = new ArrayList<>();

for (Iterator<Recipe> it = Bukkit.recipeIterator(); it.hasNext(); ) {
Recipe recipe = it.next();

if (recipe.getResult().getItemMeta() == null) {
    System.out.println("Skipped recipe");
    continue;
}

ItemStack item = new ItemConstructor(recipe.getResult())
        .setLore("", ChatColor.translateAlternateColorCodes('&', "§8§lCOMMON"));

if (recipe instanceof ShapedRecipe shapedRecipe) {
    Bukkit.removeRecipe(shapedRecipe.getKey());

    ShapedRecipe newRecipe = new ShapedRecipe(shapedRecipe.getKey(), item);
    newRecipe.shape(shapedRecipe.getShape());
    shapedRecipe.getIngredientMap().forEach((character, itemStack) -> {
        if (itemStack != null) {
            newRecipe.setIngredient(character, itemStack.getType());
        }
    });

    recipes.add(shapedRecipe);
}

if (recipe instanceof ShapelessRecipe shapelessRecipe) {
    Bukkit.removeRecipe(shapelessRecipe.getKey());

    ShapelessRecipe newRecipe = new ShapelessRecipe(shapelessRecipe.getKey(), item);
    shapelessRecipe.getIngredientList().forEach(itemStack -> newRecipe.addIngredient(itemStack.getType()));

    recipes.add(shapelessRecipe);
}

}

for (Recipe recipe : recipes) {
Bukkit.addRecipe(recipe);
}

quaint mantle
#

yeah

#

not making a working class

sterile token
#

Is there any advantage of returning with any of them, or they are different usages and reasons for them?

Optional<Something> getSomething() {
  return Optional.ofNullable(list.stream().filter(() -> {}));
}

Optional<Something> getSomething() {
  return list.stream().filter(() -> {}).findAny();
}

twilit wharf
humble tulip
#

both are the same

twilit wharf
sterile token
#

oh ok

#

I asked because i have seen then in many plugins and i was wondering to know if they where diff way for implementing Optional

twilit wharf
sterile token
#

That is how i understand optional, i didnt used to use it that why and i find really interesting

twilit wharf
sterile token
regal scaffold
#

    @Command(name = "deepstorage")
    public void mainCommand(CommandArguments args) {}

    @Command(name = "deepstorage.item")
    public void getUserSubCommand(CommandArguments args) {}

    @Completer(name = "deepstorage")
    public List<String> mainCommandCompleter(CommandArguments args) {
        return Arrays.asList("item", "user", "admin");
    }

    @Completer(name = "deepstorage.item")
    public List<String> itemCommandCompleter(CommandArguments args) {
        return Arrays.asList("add", "remove");
    }
regal scaffold
upbeat hornet
#
ItemStack cool_item = new ItemStack(Material.COAL_BLOCK, 1)

Is it possible to use a variable instead of Material.COAL_BLOCK. I have a config and would like this to be editable, but I need to either convert a string to a material type or use a material type variable in my config, both of which I don't know how

regal scaffold
sterile token
remote swallow
twilit wharf
remote swallow
sterile token
upbeat hornet
regal scaffold
twilit wharf
twilit wharf
#

polymorphism

sterile token
#

Just wondering to understand the why haha

remote swallow
sterile token
regal scaffold
#

Yeah I noticed but it's simple and it WAS working

#

Save me epic lol

remote swallow
#

i would probably say just use built in command sys from bukkit

regal scaffold
#

Mannn it works so easily and well just this 1 completer thing with issues

twilit wharf
#

I think you can go down the stream, but you cant go up without casting. Like, you can go downwards into what it extends, but then it requires casting to go up. Like ShapedRecipe -> Recipe doesnt require casting, but Recipe -> ShapedRecipe does.

remote swallow
#

just spotted it on their git

regal scaffold
#

I already joined it xd

#

Already asked

twilit wharf
regal scaffold
#

Yeah but

#

I don't know what the issue would be lmao

#

Like why tf would it do that

remote swallow
#

that reminds me

#

i was also gonna add a cmd framework to my lib

twilit wharf
#

well it might be the fact that the autocomplete is for the base command, so it will appear for the whole command, no matter the subcommand

regal scaffold
#

Yeah hmmm

#

Maybe if I do it differently

twilit wharf
#

maybe you can check the args on the main command to know if to send the autocomplete

sterile token
remote swallow
#

hospital is free in the uk

twilit wharf
regal scaffold
#

Man if I gotta switch

#

After all I did with this

twilit wharf
#

it is super simple and straightforward

regal scaffold
#

Im gonna lose it

remote swallow
#

according to @tender shard acf is googl

sterile token
# remote swallow hospital is free in the uk

oh nice, here too, i mean everyone who join our country is protected by public hospitals in case you haven accident, not like some countries where you must pay for medical attention

twilit wharf
remote swallow
#

ratio bozo

twilit wharf
#

but from what I know taxes are lower

#

and supposedly healthcare has more innovation and overall quality because companies compete over clients, instead of the government doing it all, but idk, its all tradeoffs

tender shard
#

show your pom.xml

remote swallow
#

morning alex

#

how was your 1 hour sleep

upbeat hornet
#

Hello where could I find a great documentation/tutorial/video to explain to make great commands (with custom sub commands) thanks

quaint mantle
tender shard
remote swallow
#

?conventions

remote swallow
#

discord works again

#

fuck yea

quaint mantle
#

would that work

#

for like making people but people with that permission

remote swallow
#

"making people"

tender shard
# upbeat hornet Hello where could I find a great documentation/tutorial/video to explain to make...
BukkitWiki

This rather large tutorial aims at getting you started with plugin development in Bukkit. It is in no way a complete tutorial of all possibilities in Bukkit, but rather a general overview of the basics. It starts with making sure you understand Java, sets up your workspace in an IDE, and introduces the essentials of most Bukkit plugins. These tu...

remote swallow
#

you are looping over the players plural on the server, and checking if they have that permission

upbeat hornet
tender shard
buoyant viper
#

what fuckin Mac user wrote the bukkit docs

tender shard
#

mac > your shitty OS

wary topaz
#
        trademenugui.setItem(1,new ItemStack(Material.STAINED_GLASS_PANE));
        player.openInventory(trademenugui);

#
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NoSuchFieldError: STAINED_GLASS_PANE
        at BetterTrades.Menu.Menu.openTradeMenuForPlayer(Menu.java:23) ~[?:?]
        at BetterTrades.Command.Trade.onCommand(Trade.java:25) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.19.3-R0.1-SNAPSHOT.jar:?]
        ... 23 more
>```
tender shard
#

set an api-version in plugin.yml

wary topaz
#

to?

tender shard
#

the lowest version you wanna support

#

or 1.13 for all versions

wary topaz
#

1.8.8?

#

or 1.8.9

#

which one

tender shard
#

for everything older than 1.13, set it to "1.13"

wary topaz
#

tysm

tender shard
#

np

remote swallow
wary topaz
tender shard
#

then show the full stacktrace

wary topaz
river oracle
#

usage?

wary topaz
#

./trade

#

here ill upload it to github

#

gimmie a sec

tender shard
# wary topaz

did you restart the whole server after changing the api-version?

#

and if so, does the server say anything about "legacy material support" during startup?

remote swallow
#

its because STAINED_GLASS_PANE doesnt exist anymore

#

its seperated by colour

tender shard
#

but then it wouldnt have compiled

remote swallow
#

COLOUR_GLASS_PANE or GLASS_PANE

remote swallow
wary topaz
river oracle
humble tulip
#

im bored

wary topaz
humble tulip
#

gonna write a mc server

remote swallow
tender shard
#

ooo hwtf 1.8.8 api

remote swallow
#

thats your issue

river oracle
#

💀 1.8.8 api

remote swallow
#

?main again

remote swallow
#

lower case package names

wary topaz
#

the main problom never affects me

tender shard
#

in proper versions, it's called BLACK_STAINED_GLASS_PANE, GREEN_STAINED_GLASS_PANE etc

remote swallow
#

good practise be like

humble tulip
#

should i use netty if i'm writing a mc server or is there something better?

wary topaz
#

it worked with glass

#

its just the glass pane

humble tulip
#

nah wtf

#

technically i can

#

just create a serversocket and a new thread for each client

river oracle
#

what's funny

wary topaz
#

you gotta change the durability to change the color

river oracle
#

no you don't

wary topaz
#

?

river oracle
#

just use Material.BLACK_STIANED_GLASS_PANE

wary topaz
#

1.8.9

remote swallow
#

most sane people use an actual api version

#

not some bs 1.8

river oracle
#

😂 thats so dumb

#

just use a good API version

remote swallow
#

what do you even need 1.8 for

wary topaz
#

I want to support 1.8 in my plugin though

remote swallow
#

why

river oracle
#

who tf uses 1.8 gross

remote swallow
#

fuck the people that still use it

wary topaz
#

people like that version

remote swallow
#

not your problem

river oracle
#

trust me

wary topaz
#

i like it

#

good for pvp

tender shard
river oracle
#

all the business I have conducted is 1.18+

remote swallow
river oracle
#

I've made $3000+ in above 1.8 versions

#

there's no reason to stay back as a dev

remote swallow
#

can i have some plis

wary topaz
#

okay you guys are right

#

thank you so much

river oracle
#

also if you love the PVP make a proper pvp porting plugin and get people to use their brains and get off that old ass version

humble tulip
#

bro some ppl that hire devs are so cheap

#

i can't ever find work cuz they don't want to pay well

sterile token
river oracle
humble tulip
#

i'm in a few commission teams

sterile token
humble tulip
#

some comissions are for an entire mininigame for 30$

wary topaz
#

i've always wanted to be payed for my work

river oracle
humble tulip
#

like who's making minigames for 25$

river oracle
#

bruh I charged $65 for a system that you mine blocks to gain levels

#

I'd kill myself before charging $25 for a whole ass minigame

humble tulip
#

i charged 60$ to change 1 line of code

#

there was a bug, in an obfuscated plugin and they didn't have the src

humble tulip
#

decompiling gave a ton of errors so i had to recreate abt 6 classes and methods with empty ones

remote swallow
#

i should make a services thread

#

i still need to get paypal or something setup

wary topaz
#

how do you rename a item?

remote swallow
#

change meta

humble tulip
#

set name

remote swallow
#

setDisplayName

humble tulip
#

set item meta

wary topaz
#

getitem meta, .setDisplayname

#

ty

river oracle
#

everyone on services undercharges

humble tulip
river oracle
#

good luck finding any clients

remote swallow
#

meh

#

ill probably lowball

humble tulip
#

no wtf

river oracle
#

😭 wtf

remote swallow
#

not too low

#

dw

river oracle
#

its alreayd too low

humble tulip
#

ah you'll charge 30 for a minigame

remote swallow
#

me about to make a thread for 10$ an hour

#

alex over there charging 100

sterile token
river oracle
wary topaz
#
Inventory trademenugui = Bukkit.createInventory(player,45,"     " + player.getName() + "  Trade Menu");
        ItemStack bsgp = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
        Objects.requireNonNull(bsgp.getItemMeta()).setDisplayName("Sup");
        trademenugui.setItem(1,bsgp);
        player.openInventory(trademenugui);

It just returns the normal glass pane.

remote swallow
#

its minimum wage so

#

tough shit

humble tulip
remote swallow
wary topaz
#

ohhh

#

so ill make a variable with the meta

#

than set it

remote swallow
#

correct

sterile token
#

Bro do you want to see my acf design?

wary topaz
#
Inventory trademenugui = Bukkit.createInventory(player,45,"     " + player.getName() + "  Trade Menu");
        ItemStack bsgp = new ItemStack(Material.BLACK_STAINED_GLASS_PANE);
        ItemMeta bsgpMeta = bsgp.getItemMeta();
        bsgpMeta.setDisplayName("sup");
        bsgp.setItemMeta(bsgpMeta);
        trademenugui.setItem(1,bsgp);
        player.openInventory(trademenugui);

How can I shorten this?

humble tulip
#

get an itembuilder class

#

google it on spigot

wary topaz
#

ty

unkempt peak
#

Honestly item builder should be part of the spigot api by now

remote swallow
unkempt peak
remote swallow
#

heh

#

why wouldi not have a build method

river oracle
#

don't extend itemstack 😭

#

never a good idea to extend ItemStack though

wary topaz
remote swallow
#

it does

#

1.17

#

probably got too high java version features for 1.8

wary topaz
#

o

remote swallow
#

i need to update my item builder

wary topaz
#

import com.mojang.authlib.properties.Property;

#

tf

remote swallow
#

im still using stuff like

remote swallow
#

totally not stolen off illusion

unkempt peak
river oracle
#

its more clear to wrap it or make a separate Builder Object

wary topaz
#

perfecto

unkempt peak
#

I guess that makes sense

unkempt peak
tender shard
#

why would you extend itemstack? what's the advantage of doing that?

thorny fossil
buoyant viper
#

oh wait no its there

thorny fossil
#

xD

buoyant viper
#

wow that texture is light

remote swallow
#

thats what im sayinh

thorny fossil
topaz cape
#

qaefinownfggnn i hate this 😦

pearl glade
#

you for you list and you remove element into you for

tender shard
#

do you all like my naming scheme lmao

pearl glade
#

you can use iterable dans method removeIf or make copy of list

humble tulip
#

EXECUTALBE

#

i'm bored af

sterile token
buoyant viper
#

packets r processed concurrently p sure so most likely

sterile token
buoyant viper
#

two or more things happening at once

sterile token
# buoyant viper

I know what its conrrency, but you have many types, parallel, etc

#

That why i asked u the context

buoyant viper
#

idk

#

id imagine parallel would be the type

sterile token
#

If im not wrong Netty internally performs I/O operations async in the channels

#

I havent already really worked with netty

#

But i know its designed to performs I/O operations single thread and async

thorny fossil
#

If yeah me too

sterile token
thorny fossil
thorny fossil
sterile token
wet breach
#

Also it doesnt need to do I/O itself necessarily since most of it is done on the nic.

sterile token
#

Right its perform NIo operations i know, but the events are push async if im not wrong

wet breach
#

No i meant nic

sterile token
wet breach
#

Nic = network interface card

sterile token
#

I just know that nety do NIO operations and events are pushed async all single threaded

wet breach
#

Most of the packet processing is done on the NIC only time netty has to do anything with the packet is because you told it to.

#

Where netty is handy is its events when packets do come in or get sent as well as setting up queus/workers etc

#

Also you dont have to worry about packet headers all that much and just mainly worrying about the body of the packet as well

sterile token
#

Yes i know how basic netty nowkrs

regal scaffold
#

I get this error but I have not tried using the CloseInventory event at all

sterile token
undone axleBOT
remote swallow
#

give us code

sterile token
#

Doesnt make sense to show just an error and not code 🤔

regal scaffold
#

1 sce

#

What code do you want I never use InventoryClose event?

remote swallow
#

the close inv event code

regal scaffold
#

I don't have any

#

I'm not using that event

remote swallow
#

are you using an inventory framework

regal scaffold
#

Which is why im confused

#

Yes, triumph

remote swallow
#

are you relocating it

regal scaffold
#

Yes

remote swallow
#

?paste ur pom

undone axleBOT
regal scaffold
#

Wait I think I found out

sterile token
#

Provide your inventory link

regal scaffold
#
                                    <pattern>dev.triumphteam.gui</pattern>
                                    <shadedPattern>me.tomisanhues2.deepstorage.gui</shadedPattern> <!-- Replace package here here -->
                                </relocation>```
sterile token
remote swallow
#

whats the dep look like

regal scaffold
#

gui.setDefaultClickAction(event -> event.setCancelled(true));

#

It had to do with that line

remote swallow
#

does the dep in pom.xml has scope provided?

regal scaffold
#

Yeah yeah it's fixed now

#

Oh wait

#

Doesn't have scope

#

But it's working?

remote swallow
#

thats fine

#

deafult scope is compile anyway

regal scaffold
#

Thought so

remote swallow
#

how you building and what jar do you use

regal scaffold
#

Well now it works

#

nono it's working

#

Like perfectly

remote swallow
#

ah

#

one of those relocation things

regal scaffold
#
            GuiItem item = ItemBuilder.from(new ItemStack(Material.matchMaterial(itemName))).asGuiItem();
            item.getItemStack().getItemMeta().setLore(List.of("Amount: " + im.getAmount().get(i)));
            gui.setItem(i + 9, item);
#

Help me out with this

#

Lore isn't getting changed

#

Probably my getItemStack.getItemMeta.setLore isn't ideal xd

remote swallow
#

you dont set the item again

#

itemmeta

regal scaffold
#

Knew

#

I was missing something

#

Any better way of doing that?

regal scaffold
#

Alright I'll just deal with it for now lol

#

This project already got a lot more massive than I had hoped

remote swallow
#

i should fix that item builder

regal scaffold
#

But I gotta say

#

It's sick how it's turning out

tender shard
#

?paste

undone axleBOT
tender shard
regal scaffold
#

@tender shard

#

I gotta tell you

#

Your persistentData thing

#

Is nuts

#

I just stored a Map<String, Object> in it

tender shard
#

?

regal scaffold
#

Perfectly

tender shard
#

oh is nuts a good or a bad thing

regal scaffold
#

And like 4 other things

#

Good

#

Really good

tender shard
#

ah lol thanks

#

I had the idea of the maps and lists stuff in a dream

regal scaffold
#

lololol

#

I dreamt

#

About how to implement my idea

#

with your stuff

#

so....

tender shard
#

😄

#

when my new macbook arrives, I never have to leave my bed again

#

BUT THATS ONLY IN 2 WEEKS D:

remote swallow
#

how are you gonna smoek

tender shard
#

i only smoke when I'm in the living room or outside

#

so

#

I dont

remote swallow
#

withdrawals

tender shard
#

nah I only smoke out of habit

#

sometimes I don't smoke for 48 hours or so

remote swallow
#

damn

tender shard
#

i would never get out of bed just for a cigarette lol

remote swallow
#

wait about going to the toilet

tender shard
#

we dont have toilets in europe

remote swallow
#

when did the uk leave europe

tender shard
#

we just sweat it out

sterile token
#

Hi i need some help

remote swallow
#

ask away

sterile token
#

oh sorry i forget i type enter

#

Im confused with my acf to execute sub command

remote swallow
#

@tender shard resident acf

sterile token
remote swallow
#

ah

sterile token
#

Im coding my acf = alexito command framework

tender shard
#

you should rename that

#

ACF already is a well known command framework

sterile token
#

Right

tender shard
#

aikar's command framework

sterile token
#

kk i will do that

tender shard
#

VCF

remote swallow
sterile token
#

So im confuse writting the sub command logic

tender shard
#

but made by aikar

#

lol

remote swallow
#

most people say akairs though lol

#

i ought to make my own framework

sterile token
#

I have make the next designed 2 classes, called SimpleCommand (Extending this class you will be able to create simple commands with/without arguments), in the other hand **SimpleExecutor ** (Extending this class you will be able to create an executor, where then you can register arguments (extending SimpleCommand) or sub commands (extending SimpleExecutor))

#

I having some troubles to code the sub command logic

#

This my command proccessor class

#

@remote swallow i finished writting the whole question

regal scaffold
#

Another error, this is exactly how my Commands.java file is organized.
https://paste.md-5.net/buronajuma.java
case: /ds

-> mainCommand() is called
Expected output

|

case /ds item
-> getItemSubCommand()
Expected output

|

case /ds item add
Without the ability to recreate exactly when or how it happens:
-> Sometimes getItemSubCommand() wrong method
-> Sometimes addSubCommand() correct method

Completely at random. sometimes it'll start working and do the right one, most of the times it doesn't.

I am beyond confused

https://github.com/Despical/CommandFramework

sterile token
#

Yes that command framework you are using its pretty bad documented

regal scaffold
#

Yes Im aware of that but it's insanely simple and it works (Sometimes)

#

I'm just lost on why sometimes

sterile token
#

That why you should only use proper documented libraries or create your owns, like my case

regal scaffold
#

I appreciate the advice but doesn't really answer the issue at hand.

regal scaffold
tender shard
regal scaffold
#

alex can you give a little glimpse at my issue please

remote swallow
#

i didnt write it

regal scaffold
#

Just off the top, don't wanna take too much of your time

remote swallow
#

what does @Contract actually do

tender shard
sterile token
tender shard
tender shard
#

that means that when the first parameter is not null, the method returns null

#

so IntelliJ would show a "this will throw NPE" warning for this:

myMethod("asd").somethingElse();
remote swallow
#

ahhh

#

so thats why intellij shits on me for anything

tender shard
#

it also has way more features than just that

tender shard
sterile token
tender shard
#

bruh its obviously an example

regal scaffold
tender shard
#

yeah ACF can do everything lol

#

and it's a bit annoying to learn

regal scaffold
#

I just need a single goddamn thing

#

Like what a stupid problem

#

I'm reading through the api but still nothing that would be a flag

remote swallow
#

you could probably use the built in spigot cmd system instead

sterile token
#

Yeah that why i m doing my own command framework because most of them are shity or have shity docs or have weird implementations or etc. So then i dont depend on 3rd parties to update them

remote swallow
#

probably easier lol

regal scaffold
#

@remote swallow I was doing it but it's more writing

#

Like if I solve this 1 problem

tender shard
regal scaffold
#

Im done

#

But it's a problem that doesn't even make sense

#

Why does typing a command think i'm refering to the parent command of itself

sterile token
#

?paste

undone axleBOT
sterile token
#

Long code use paste please

regal scaffold
#

Sorry forgot it's annoying

remote swallow
#

their appears to be so much un-needed stuff on that command

regal scaffold
#

If I can see what's wrong I can just override it

sterile token
regal scaffold
#

To be completely honest

#

Cause I don't know how to exactly

sterile token
remote swallow
#

you can shrink pretty much all of this

regal scaffold
#

I'm new to a lot of this stuff

regal scaffold
sterile token
regal scaffold
#
    @Command(
            name = "example",
            aliases = {"firstAlias", "secondAlias"},
            permission = "example.permission",
            desc = "Sends an example message to sender",
            usage = "/example",
            min = 1,
            max = 5,
            cooldown = 10,
            senderType = Command.SenderType.CONSOLE
    )
tender shard
#

hm all my plugins are at least including 1.5 mb of libraries

#

so I dont care about another 300kb

regal scaffold
#

All the available parameters @remote swallow

#

tbh don't need half of them

#

But I don't think taking the code I need is the right way of approaching this

#

Alright I'm decided

#

I'll make my own

#

But if possible I do need some resources to read

#

All I need is to have @Command
automatic registering

#

Any reads about that much appreciated

sterile token
#

I need a small hand here, im confused with the sub command part
This code is inside my SimpleExecutor class

humble tulip
#

How do you all deal with so many colors

sterile token
sterile token
humble tulip
#

What are you confused abt?

sterile token
atomic swift
#

why Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.OfflinePlayer.getName()" because "p" is null
OfflinePlayer p = Bukkit.getPlayer(uuid);

        try (ResultSet rs = Main.database.query("SELECT * FROM "+Type+" ORDER BY level LIMIT 5 ;")) {
            while (rs.next()) {
                i++;
                Integer level = rs.getInt("level");
                UUID uuid = UUID.fromString(rs.getString("UUID"));
                OfflinePlayer p = Bukkit.getPlayer(uuid);
                ItemBuilder guiItem = ItemBuilder.from(Material.PLAYER_HEAD).setSkullOwner(p);
                guiItem.setName(p.getName() +" - #" + i);
                guiItem.addLore("Level: " + level);
                gui.setItem(info.sokobot.skills.guis.Main.get(i), guiItem.asGuiItem());
            }
        } catch (SQLException ex) {

        }
sterile token
atomic swift
#

i think so to but prob not

atomic swift
#

thats why its OfflinePlayer

sterile token
#

Bukkit#getPlayer() returns null if the player is not online*

humble tulip
sterile token
atomic swift
#

makes sense getOfflinePlayer

humble tulip
#

What's wrong with what you sent?

atomic swift
#

getPlayer i need getOfflinePlayer

sterile token
tender shard
#

can I get rid of that warning somehow without just suppressing it?

atomic swift
#

oh i dont read sometimes

sterile token
#

You can't underestimate when they give you recommendations, because they do it for a reason.

tender shard
sterile token
tender shard
#

oh thats what you are talking about

#

just do BUkkit.getOfflinePlayer

sterile token
#

Yeah i told him that haha

tender shard
#

ok lol

#

i didnt read the above chat

buoyant viper
#

i wana stream dev work but i got nothin to stream to whygodwhy

#

cant do twitch bc its technically cheating...

tender shard
#

wdym its cheating?

buoyant viper
#

its an experiment im just toying with and twitch bans cheater streamers

worldly ingot
#

There's always YouTube

buoyant viper
#

true

tender shard
buoyant viper
#

also true

worldly ingot
#

^ That usually gets you safe as well

buoyant viper
#

it is for educational purposes

#

educating myself on mojangs inner workings of their game

tender shard
#

you can say that you demonstrate how cheating works so that server owners can protect themselves or sth, idk lol

sterile token
atomic swift
#
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)) { sender.sendMessage("Player only command!"); return true;}
        Player player = (Player) sender;
        if (!Linking.IsLinked(player.getUniqueId())) {sender.sendMessage("You havent linked!"); return true;}
        sender.sendMessage("You have now been unlinked!");
        
        Role role = Bot.getShardManager().getGuildById(948866484912922704L).getRoles()
                .stream().filter(r -> r.getId().equals("1064763344596246619")).findFirst().orElse(null);

        Bot.getShardManager().getGuildById(948866484912922704L).removeRoleFromMember(
                Bot.getShardManager().getGuildById(948866484912922704L).getMemberById(
                        Linking.getLinked(player.getUniqueId())), role).queue();

        
        return true;
    }
Caused by: java.lang.IllegalArgumentException: User may not be null
        at net.dv8tion.jda.internal.utils.Checks.notNull(Checks.java:82) ~[skills-0.0.1-SNAPSHOT.jar:?]
        at net.dv8tion.jda.internal.entities.GuildImpl.removeRoleFromMember(GuildImpl.java:1585) ~[skills-0.0.1-SNAPSHOT.jar:?]
        at info.sokobot.skills.commands.Unlink.onCommand(Unlink.java:30) ~[skills-0.0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        ... 21 more
jagged monolith
atomic swift
#

hmm

atomic swift
#

i think im returning the same object which is the mcuuid

#

called it

#

wait nvm

#

idk y

sterile token
atomic swift
#

i want long but cant name it that

#

thats also always my naming conversions

#

i have like lol

#

yep

sterile token
atomic swift
#

and some others

atomic swift
sterile token
atomic swift
#

funny thing is i use it in the other 1

jagged monolith
#

As for the main issue, Are you sure the user actually exists in the linkedUsers database?

sterile token
atomic swift
#

hmm good idea

sterile token
#

LMAO 💀

jagged monolith
sterile token
#

First thing i would do is to check the all the exeptions, that why yo ucatch them

atomic swift
#

ye

sterile token
#

But i understand because you are new to Java and we dont born with knowledges

atomic swift
#

im not new to java

#

naming on those are just as bad

sterile token
atomic swift
#

i never do

#

i use Integer and Boolean

#

its just a habit

regal scaffold
#

I found the problem

#

Now how to fix it

atomic swift
#

how?

regal scaffold
#
[01:19:06] [Server thread/INFO]: TSans_ issued server command: /ds item
[01:19:06] [Server thread/INFO]: Command: org.bukkit.command.PluginCommand(ds, DeepStorage v1.0-SNAPSHOT)
Arguments: []
Sender: CraftPlayer{name=TSans_}
[01:19:09] [Server thread/INFO]: TSans_ issued server command: /ds item add
[01:19:09] [Server thread/INFO]: Command: org.bukkit.command.PluginCommand(ds, DeepStorage v1.0-SNAPSHOT)
Arguments: [add]
Sender: CraftPlayer{name=TSans_}
>
#

/ds item add thinks add is a argument

#

When in reality it's another registered command

sterile token
# atomic swift i never do

Fua bro, if you're going to have this attitude to be a programmer I think it's not the way to go. To be a programmer you really have to do your best, you can't just do it like that. Because you look like an inexperienced rookie.

atomic swift
#

i seem like 1 lol

#

epik

#

at least im following method and class naming

sterile token
atomic swift
#

I agree from my heart

regal scaffold
#

@remote swallow

jagged monolith
# atomic swift how?

What you should do,

Get the output from player.getUniqueID(), then get another output from the getLinked() and maybe print out all of the linked users or check the database manually to double check that it's looking for the correct thing and that it exists

atomic swift
#

wait i forgot about caching

#

lol

dreamy vessel
#

im trying to make mcmmo a soft-dependency for my plugin and have it that when a player gains xp for a skill it checks which skill and sets a scoreboard that displays some of the variables from mcmmo (skill level, skillxp, and skillxpuntilnextlevel). It doesnt need to be my own plugin BTW, especially if its easier to just modify mcmmo's source. anyone willing to help me? (I also have a plugin that can control scoreboards through commands, so i could really just have the plugin run a command based on which skill just gained experience.)

#

could anyone point me in the right direction ?

remote swallow
regal scaffold
#

How to understand why it thinks it's a argument and not a separate command

tender shard
#

why the heck does mockbukkit force to use paper

tender shard
regal scaffold
#
        final Map.Entry<Command, Map.Entry<Method, Object>> entry = this.getAssociatedCommand(cmd.getName(), args);


        if (entry == null) {
            if (anyMatchConsumer != null) {
                anyMatchConsumer.accept(new CommandArguments(sender, cmd, label, args));
            }

            return true;
        }


        final String[] splitted = command.name().split("\\."), newArgs = Arrays.copyOfRange(args, splitted.length - 1, args.length);

        if (args.length >= command.min() + splitted.length - 1 && newArgs.length <= (command.max() == -1 ? newArgs.length + 1 : command.max())) {
            try {
                entry.getValue().getKey().invoke(entry.getValue().getValue(), new CommandArguments(sender, cmd, label, newArgs));
                return true;
            } catch (IllegalAccessException | InvocationTargetException e) {
                e.printStackTrace();
                return true;
            }
        } else {
            sender.sendMessage(SHORT_OR_LONG_ARG_SIZE);
            return true;
        }
#

@jagged monolith

atomic swift
tender shard
#

why the heck does github ALWAYS ask for 2fa codes

#

cant it only ask for this when logging in, ugh

worldly ingot
#

Are you clicking "Remember me"?

tender shard
#

yes, I mean it asks it for certain actions

#

e.g. when transferring a repo from my account to an organization

regal scaffold
#

Any idea @jagged monolith ?

drowsy helm
#

use a command lib ezpz

regal scaffold
#

I am lmao

drowsy helm
#

looks like a hard one lol

regal scaffold
#

It's actually insanely simple there's just an error somewhere

#

Trying to fix it

regal scaffold
#

It's inconsistent too so even harder

tender shard
#

ACF would make this so much easier

#

it handles everything you are doing manually there

#

e.g. checking the args

regal scaffold
#

This already does that

#

The problem is

#

Whenever it feels like it

#

A arg becomes a command

tender shard
#

idk you are manually checking the args length, shifting the array, etc etc

regal scaffold
#

Just hear me out

#

Sometimes, /ds user add TSans_
Will think the command is /ds user and other times /ds user add

#

Like the add can randomly become a argument instead of command

sterile token