#help-development

1 messages · Page 1964 of 1

sterile token
#

I run Intellij Idea with 64gb of ram and 8 threads and no problems having

quaint mantle
sterile token
#

But dont get sad, because every IDE consumes a lot

#

No matter if using Eclipse, Intellij Idea, Neatbeans, VS Code

quaint mantle
#

currently my disk usage is only 3% so im good

tall dragon
#

you can run intellij on 16 gb ram fine as well

quaint mantle
#

VS Code never caused lag for me

wet breach
#

already told you what netbeans does

#

whether you choose to disable it or not is up to you

quaint mantle
#

i'll just use Eclipse

wet breach
#

if you want

#

no one here I think is telling you which to use. All I was doing was just telling you why netbeans was consuming your disk I/O when you were launching it

#

but Disk I/O is hardly a concern though unless you have a low end pc and trying to do a lot of things

quaint mantle
#

my pc is low end

sterile token
#

ChatColor#stripcColor("&eColored string") would would return the string without colors?

young knoll
#

No

sterile token
#

Oh lmao

sterile token
#

Im in problems

young knoll
#

Afaik it only strips the § colors

#

So you’d have to translate them first

#

Or make your own method

sterile token
#

Because i have a custom item with colored name

#

And im saving the item with name non colored

#

So it always will tell me that the item doesnt exists

torn frost
#

is there a plan to add comment support for config for older minecraft version in spigot api?

young knoll
#

Spigot doesn’t support past versions

wet breach
#

can run it through this method and then stripColor the resulting string, but this is generally counter intuitive since the color codes added are of your doing usually

sterile token
torn frost
young knoll
#

See my reply

sterile token
#

Why?

torn frost
wet breach
young knoll
#

There you go then

#

1.18 and above have comment support

#

1.17 and below don’t, and won’t be getting it

sterile token
#

When i develop i create file.yml with the content inside and then using FileHandler class its being created the file with content i assigned, and can add/remove/get/etc

young knoll
#

Move on or handle it yourself

sterile token
arctic moth
#

why does setInvisible work before but not after

torn frost
sterile token
wet breach
young knoll
torn frost
arctic moth
#

so setinvisible isnt in entity

young knoll
#

Check and cast

arctic moth
#

then why does it work in creaturespawnevent

sterile token
#

Tristan, you can read the javadocs

young knoll
#

CreatureSpawnEvent returns a living entity

arctic moth
#

oh

sterile token
#

Not for being mad/critice but imagine if documentation didnt exists, imagine the using apis it would be really hard to use them

arctic moth
#

lol

wet breach
#

the API was just good enough

naive bolt
#

how do i make seconds into ticks? is it seconds * 0.5

sterile token
young knoll
#

Seconds * 20

wet breach
#

divided by 20

#

or multiply

naive bolt
young knoll
#

Yes

#

A tick is 0.05 seconds

#

Or 50ms

sterile token
#

Wait

#

So 20 ticks = 1000 ms?

spiral light
#

yes

sterile token
#

Ah allright

wet breach
#

1000ms = 1 second

young knoll
#

What a crappy site

sterile token
spiral light
#

its not even by mistake lol
they dont know math at all O.o

young knoll
#

Yep

#

“This is possible because the functionality of the game is attained at a fixed rate of 20 ticks per second. This implies that one Minecraft tick will last for 0.5 seconds.”

#

They know it’s 20 tps

#

They just can’t do 1/20

tall dragon
#

maths is hard

spiral light
#

its 12 times in the article wrong xD

quiet ice
#

Okay, and how many ticks are in a sqrt(N/kg/m)

spiral light
#

2

quiet ice
#

Seriously, what the hell. This screams that the author has no idea about minecraft

young knoll
#

¯_(ツ)_/¯

#

Don’t use that site as a source for your minecraft essay

sterile token
#

alexito = mfalex

spiral light
#

what

golden turret
#

it is possible to add null objects to ByteArrayOutputStream, right?

quiet ice
#

what null objects and how adding?

naive bolt
#

how do i make an int into the period for scheduleSyncRepeatingTask with the L

quiet ice
#

You can't really add objects to output streams

#

L? as in long?

naive bolt
#

yea

golden turret
#

BukkitObjectOutputStream

#

sorry

quiet ice
#

Probs long longvalue = (long) intvalue

naive bolt
#

long delay = (long) (time * 20L);

golden turret
#

so, is it possible to add null objects to BukkitObjectOutputStream?

quiet ice
#

in that case the cast is irrelvant

#

Likely, but I'd need to look at the java javadocs

tall dragon
#

yes it is

sterile token
#

Time conversions (seconds/minutes/hours/days/weeks/moths):

Miliseconds

1.000ms = 1s
60.000ms = 1m
3.600.000ms = 1h
86.400.000ms = 1d
604.800.000ms = 1w
2.419.200.000 ms = 1m

Ticks

20 ticks = 1s
1.200 ticks = 1m
72.000 ticks = 1h
1.728.000 ticks = 1d
12.096.000 ticks = 1w
48.384.000 ticks = 1m

sterile token
tall dragon
sterile token
quaint mantle
#

Duration.ofMillis(millis).toWeeks() smh

naive bolt
sterile token
naive bolt
#

wait

#

i was doing + not *

quiet ice
#

(also, why tf is bukkit above java 17 in the google search results)

ivory sleet
#

😅

#

I mean its a pretty simple thing to google

sterile token
ivory sleet
#

may wanna ask md5 then

sterile token
#

Allright

quiet ice
#

It should be common sense to know this

sterile token
#

I will edit it and ticks

quiet ice
#

This is 11th grade knowledge

tall dragon
#

yea

#

you legit learn this in school

ivory sleet
#

and like in code

#

you dont use stuff like 86400 to my knowledge, instead we favor 60*60*24

#

or sth

young knoll
#

The compiler will do the math for you

ivory sleet
#

yeee

quiet ice
#

And javac automagically computes it down to a constant

ancient jackal
#

java makes up for people's shortcomings in math

#

sometimes

quiet ice
#

And if not javac, then G2 will

#

And if not G2 we have a problem

ivory sleet
#

maybe jit then lol

young knoll
#

I used to avoid those at first because I thought it would be slower

ivory sleet
#

🥲

quiet ice
#

G2 is the JIT

#

Well, not really, but mostly

ivory sleet
#

oh didnt know it was called that

young knoll
#

But it makes sense that a static equation can be optimized to a constant

tall dragon
sterile token
#

How many ticks would be 1 week?

tall dragon
#

well 1d x7 id imagine eh

sterile token
#

Oh thanks

fast onyx
#

Hey, how may I send a textcomponent?

worldly ingot
#

player.spigot().sendMessage()

fast onyx
#

I got this when trying to send

#

yes sure that's what i'm using

chrome beacon
#

Don't call toString on it

fast onyx
#

i didn't

sterile token
#

?paste

undone axleBOT
sterile token
#

Send code there please

fast onyx
#
TextComponent clickParaVer = new TextComponent(ChatColor.translateAlternateColorCodes('&', config.getString("messages.clickable-message")));
clickParaVer.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, args[0]));
for (Player ptc : Bukkit.getOnlinePlayers()) {
     ptc.spigot().sendMessage(clickParaVer);
   }
#

here you go

sterile token
vocal cloud
#

It's not worth changing over

fast onyx
#

i'm testing the plugin on a test server

#

without bungeecord

#

may that be the problem...?

sterile token
#

I think it should work with or without bungeecord

fast onyx
vocal cloud
#

It would throw an error if it wasn't

sterile token
#

You cannot send text component without Bungeecord?

fast onyx
#

not sure

sterile token
#

I thought that TextComponent was a format that get parsed

ivory sleet
#

I mean

#

its loaded in both bungeecord and spigot

#

however Player.Spigot only exists in spigot

fast onyx
#

so thats not the problem right?

ivory sleet
#

pretty much not the problem, mye

fast onyx
#

any ideas for how to fix xd?

ivory sleet
#

as Olivo pointed out, problem lays in that something calls the toString method

#

and then send the stringed one

fast onyx
#

may be this?

ivory sleet
#

uh

fast onyx
#

don't think so

ivory sleet
#

pretty sure you use some sort of legacy serializer

#

when u want to convert & format to a component

fast onyx
sterile token
#

TextComponent its a serializer and deserializer right?

ivory sleet
#

no

#

?jd-bcc

sterile token
fast onyx
#

k

sterile token
#

Maybe its causing you problems

fast onyx
#

nope same problem

sterile token
#

TextComponent clickParaVer = new TextComponent(config.getString("messages.clickable-message")); clickParaVer.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, args[0])); Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(clickParaVer));

#

Oh hmn

#

Are you also spanish?

fast onyx
#

si

sterile token
#

Oh nice

fast onyx
#

md

sterile token
#

Im spanish too

sterile token
#

I find a sample on github and was exactly the same as his code. And his code doesnt work

ivory sleet
#

hm?

sterile token
#

Btw

#

its time to open a github issue

fast onyx
#

anyone know how to tellraw to everyone?

#

without using the command (for not flood console)

#

because this: {text:"Click Me!", color:"somecolorhere", clickEvent:{action:run_command,value:'/thecommandhere'}} works

eternal oxide
#

Bukkit.getOnlinePlayers().forEach( p -> p.sendMessage ...

sterile token
#

Hmn nice shitty, cannot remove from index

tall dragon
#

why ru using the Integer wrapper instead of its primitive counterpart

tall dragon
#

Integer --> int ?

sterile token
#

Ahh

tall dragon
#

no reason to use the wrapper as far as i can see

sterile token
#

oh ok

#

My bad

chrome beacon
#

Wrapped version should be avoided when possible

mint mesa
#

is this not the correct way to make a player skull? the only option is for me to cast it to SkullMeta however once I do that I get an error saying I cant cast it to skullmeta

#

have I what

sterile token
#

Have you cast it?

mint mesa
#

well like I said

#

I tried to

#

but then it gave me an error

#

Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_8_R3.inventory.CraftMetaItem cannot be cast to org.bukkit.inventory.meta.SkullMeta

sterile token
#

Oh allright

vivid cave
#

Hey guys, so i'm using plugin messaging, it works pretty well except when it comes to sharing messages announcing that a player joins/leaves and that there is only one player online in the server that is being joined/quitted, because of
https://i.imgur.com/XhvwMdq.png
Do you know whether it's possible to create a fake online player? Although I would need to hide them from tablist, do you guys have a tip?

ivory sleet
#

no faking a player wont help it

#

you need to invoke another connection then

mint mesa
#
        at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_311]
        at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_311]
        at me.nuggets.historyplugin.GUIScreens.BanGUI.openBanInventory(BanGUI.java:105) ~[?:?]
        at me.nuggets.historyplugin.events.ClickEvent.onClick(ClickEvent.java:20) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_311]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_311]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_311]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_311]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-21fe707-741a1bd]
        ... 15 more```
```java
for(int i : GlassList) {
             int index = GlassList.get(i); // this one
            inv.setItem(index, glass);
        }```
#

it worked for the first GUI, why does it not work for the second

vivid cave
arctic moth
#

when i do player.spawnParticle(Particle.SMOKE_NORMAL, entity.getLocation(), 1); for some reason the particle gets flung

#

any idea why this happens?

sterile token
#

Event calling should be done at the final right?

hasty prawn
#

Depends

#

If it's cancellable, then no.

#

Otherwise it really depends on what they can change within the event.

wet breach
lunar forge
wet breach
#

alternatively who would you be announcing to that they even joined o.O

sterile token
#

picture 1 - MenuEvent
picture 2 - MenuOpenEvent

vivid cave
sterile token
vivid cave
#

nah im not using any modules guys!

wet breach
hasty prawn
#

And don't open the menu if they cancel it.

sterile token
#

Allright thanks

vivid cave
sterile token
#

I explain your posibilities

wet breach
#

MC clients don't have chat history

sterile token
#

These are your solutions:

1- Using bungee plugin
2- Using plugin message channel
3- Redis/Any other message broker

vivid cave
wet breach
#

either way, if there is no one to receive it or send it to, why do you need to send it anyways?

#

no one is going to read it

sterile token
#

Message Plugin Channel need a player, to receive the message

vivid cave
wet breach
#

and no one is going to even know it was displayed if someone joins afterwards

sterile token
#

But its stupid doing plugin message channel in that way, because you could just use the server instance iselft as a receiver. This is what i think

wet breach
#

it is stupid regardless because they are complaining about not being able to broadcast to an empty server

vivid cave
wet breach
quaint mantle
#

just use redis lol

sterile token
vivid cave
wet breach
#

not sure why that is so hard for you

sterile token
#

Xd

#

I think he is harder than me

wet breach
#

Sounds like you really need to rethink how you are going about this

vivid cave
# wet breach then don't send to that server

there are multiple servers, server A, server B, in a bungee network
server A has 1 player called Alexis, server B has 3 players
Alexis decided to have a pee break, and left the server A, plugin is trying to tell server B than Alexis left the network, but server A can't, because server A doesn't have a sender anymore
But server B would love to know that alexis went for a pee break

quaint mantle
#

it is so easy to do with redis!

vivid cave
wet breach
quaint mantle
#

That's incredibly dumb but ok

vivid cave
#

or my fourth option would be doing what conclure said

#

a fake connection per server

#

idc how bad this design is

#

i don't want to install any other stuff

wet breach
quaint mantle
#

you are doing super dumb things, stop

wet breach
#

making a plugin communicate with itself between servers is far easier then creating fake player connections

#

in fact you don't need NMS for direct plugin communication either

vivid cave
#

i'll reconsider maybe, thank you everyone

wet breach
#

fake player connections are going to require a lot of NMS

vivid cave
quaint mantle
#

You'd jusr spend your time on unreliable workaround dor NOTHING. There is better solutions which is very easy to install.

wet breach
#

alright well you came here for help not the other way around

#

we can only tell you the easier options

sterile token
wet breach
#

whether you choose to use those is up to you. If you want to go the most difficult route so be it, doesn't mean it is the best option even if you think so

vivid cave
#

yes sorry, sorry if i seem rude or sth? 'm french 🙂
Thank you for ur time tho^^

wet breach
#

your nationality isn't a factor

#

I will tell you your way is dumb regardless

vivid cave
#

yes i do agree with you

wet breach
#

anyways have fun you have gotten your answers 🙂

vivid cave
#

thank you!

wet breach
sterile token
#

First i need to call the custom event and then check if it cancelled right?

wet breach
#

but you need a player on a server to use message channels from that server

#

unless you are making a bungee plugin

sterile token
#

Im doing a spigot library

wet breach
#

well idk what you are making lol

sterile token
#

I have my library and now i add it custom events

#

And i was told that before calling button.onClick() check if event was cancelled

#

But i dont know if i first need to call the custom event and then check if its cancelled?

wet breach
#

you first call the event and then check afterwards

sterile token
#

Allright thanks

left swift
#

how can I make the yaw entity look at me?

wet breach
#

yaw entity?

olive lance
#

how do you get the javadocs to show up in intellij

lost matrix
olive lance
#

No

#

but i figured it out

#

I would use maven if i ever wanted to depend on 12 other plugins and 18 libs tho

#

so i will look into that

candid galleon
#

add .yml to the if check

lost matrix
#

Y

olive lance
#

u already checking if it exists just wrong file name

#

where it says "/nickreq" need to be "/nickreq.yml"

#

maybe idk

#

i would try it out tho

waxen plinth
#

use variabl

olive lance
#

sweet

tall dragon
#

by using try, catch

brave sparrow
#

Code

lost matrix
#

You would want to not catch that but check the arrays length.

brave sparrow
#

As in show me the code @quaint mantle

#

The issue is args can be of length 0

#

So there is no args[0] to access

#

You need to check args.length and make sure it’s > 0

arctic moth
#

i put addUnsafeEnchantment but its not actually enchanting the item

brave sparrow
#

What?

worldly ingot
#

Yes, you can access that argument at index zero, but if there is no index zero, you can't get index zero lol

brave sparrow
#

^

worldly ingot
#

Yeah, but what if the array size is zero?

brave sparrow
#

No

#

No you can’t

#

Because nickreq is the command

#

Your first argument will be args[0]

#

The next argument will be args[1]

worldly ingot
#

/nickreq stuff
/<command> <args[0]>

brave sparrow
#

And so on

arctic moth
#

lol i never understood why in coding languages a list starts with [0] instead of 1

arctic moth
#

like it happens in python, java, c#, etc.

brave sparrow
#

Yes

#

Because of pointers

#

say you have a pointer to the beginning of an array of integers

#

*pointer will be the first int

#

*(pointer + 1) will be the second

#

And so on

worldly ingot
#

Yea, you're 1 off. When you run /nickreq stuff, Your args[0] is going to be stuff

#

Not nickreq

#

nickreq is the name of the command, not a command argument

brave sparrow
#

Because if they don’t type in any arguments then args will be empty

#

It’s not one

arctic moth
#

label

worldly ingot
#

It's not an arg. It's a name

brave sparrow
#

It’s the command label

worldly ingot
#

label will be that value, yeah

#

Though you're best to compare against command.getName()

arctic moth
#

but ye everyone renames it to label

worldly ingot
#

Yeah whatever it's called. alias, label, commandLabel

#

The String parameter there lol

brave sparrow
#

You’re not storing args[0]

#

Can we see your code please

#

It’ll be much easier if we can tell you line by line what the problem is

worldly ingot
#

Well if you run /nickreq on its own, you won't have any args[0].

/nickreq -> args.length == 0
/nickreq stuff -> args.length == 1, [stuff]
/nickreq stuff otherstuff -> args.length == 2, [stuff, otherstuff]

brave sparrow
#

^^^

arctic moth
worldly ingot
#

Check the length

brave sparrow
#

Because you’re not checking the length of args

worldly ingot
#

If the length is zero, an argument wasn't sent through

brave sparrow
#

Args is not the same length every time

#

It’s based on whatever the player types in

#

Yes

worldly ingot
#

Mhmm

#

Error message, return false, whatever you want there

arctic moth
#

return

worldly ingot
#

return false is generally the "you didn't write this command properly" flag

#

return true for a successful command

arctic moth
#

lol u do Bukkit.shutDown() to stop the command

#

yes

worldly ingot
#

If you want to send your own message, you'll probably want to return true

#

return false will send a message to the player automatically

#

The usage message, to be specific

arctic moth
worldly ingot
#

Yeah, by default it's just /label

#

But you can change that in the plugin.yml

#

Example

#

(<command> being replaced by whatever the label is)

#

Yep

quaint mantle
#

How can I smoothly fill the blocks around the coordinate?

arctic moth
#

any idea why the enchantment/glint isnt there (yes ik im too lazy to make a glow enchant or any of that)

 public static void createStrengthAmulet() {
        ItemStack sa = new ItemStack(Material.GOLD_NUGGET);
        ItemMeta meta = sa.getItemMeta();

        sa.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);

        meta.setDisplayName(ChatColor.RED + "Strength Amulet");

        List<String> lore = new ArrayList<>();
        lore.add(ChatColor.DARK_PURPLE + "Tier 1");
        lore.add(ChatColor.BLUE + "" + ChatColor.ITALIC + "Legend says it contains mysterious powers that");
        lore.add(ChatColor.BLUE + "" + ChatColor.ITALIC + "cause people to deal more damage");
        meta.setLore(lore);

        meta.getPersistentDataContainer().set(new NamespacedKey(Main.plugin, "strengthamulet"), PersistentDataType.INTEGER, 1);

        sa.setItemMeta(meta);

        strengthamulet = sa;

        ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(Main.plugin, "strengthamulet"), strengthamulet);

        recipe.shape(
                "SSS",
                "SNS",
                "SSS"
        );

        recipe.setIngredient('S', new RecipeChoice.ExactChoice(strengthshard));
        recipe.setIngredient('N', Material.NETHER_STAR);

        Bukkit.addRecipe(recipe);
    }
ancient jackal
#

I'm trying to build somebody else's plugin with gradle to help fix an issue but I keep getting a ClassNotFoundException, even though the dependencies are there
java.lang.NoClassDefFoundError: net/kyori/adventure/text/Component
I tried to look up solutions but they didn't work

worldly ingot
#

The glint will only ever render on the client if the Enchantments NBT has at least one entry

worldly ingot
#

Yes, Bettanation. If your command succeeded you probably want to return true

ancient jackal
#

IntelliJ even recognizes the dependency

arctic moth
#

but it creates this

quaint mantle
#

How can I smoothly fill the blocks around the coordinate?

worldly ingot
#

Yeah because you're returning out of the method

arctic moth
worldly ingot
#
public void myMethod() {
    if (false) {
        return;
    }

    System.out.println("This will never be printed");
}```
arctic moth
#

lol

worldly ingot
#

Your IDE would actually flag that sysout call as dead code

brave sparrow
#

@nova dagger set the enchantment after the meta

worldly ingot
#

I would just use the meta to add the enchantment

brave sparrow
#

yup, discord is wack

arctic moth
#

lol

brave sparrow
#

but yeah the meta is what really contains the enchant

#

so you basically set it on there and then remove it again

worldly ingot
#

ItemStack's enchantment methods are a bit weird

quaint mantle
#

Choco

worldly ingot
#

ItemMeta > ItemStack where possible. I'd really only ever use those ItemStack methods if you were adding just a single enchantment to it and that's it

worldly ingot
arctic moth
#

btw ik this has nothing to do with developing, but how the fuck do i stop mv from changing my gamemode every time i restart/reload the server, change worlds, rejoin, etc.

#

its so annoying

quaint mantle
worldly ingot
#

You probably aren't oped and have the force gamemode option enabled in the server.properties, Tristan

worldly ingot
#

Circle? Square?

arctic moth
worldly ingot
#

Essentials? WorldGuard? Multiverse? Anything else that changes your gamemode?

arctic moth
#

lol

tall dragon
brave sparrow
golden turret
#

could i make a projectile collide with nothing?

golden turret
#

like, it wont collide with blocks adn entities

arctic moth
# brave sparrow wdym

oh im dumb so i changed the order for the other item as well and so the unenchanted one didnt work lol

lost matrix
#

Just gather all the coordinates in a queue and work on them N Blocks per tick

quaint mantle
#

one sec

young knoll
#

You aren’t checking if args[0] exists

tall dragon
#

@lost matrix actually meant to ask you. do you think i could apply workload distribution to my variation of private mines

#

it bassically generates a few blocks inside a cube every like 5 ticks

#

but there could be like 50 of these mines

lost matrix
#

That sounds like this is a splittable workload

tall dragon
waxen plinth
#

retusanf

young knoll
#

args.length >= 1

lost matrix
tall dragon
golden turret
#

hello, how can i make a projectile not collide with blocks and entities?

quaint mantle
lost matrix
young knoll
#

You can just check if it == 1 then

tall dragon
lost matrix
young knoll
#

args[0] requires the length to be at least 1

quaint mantle
lost matrix
# tall dragon ah thats indeed a good one. didnt think of that yet

Another thing you can do is buckets. So you have 5 buckets with regions evenly distributed in them.
Then every tick you tick one bucket and move to the next one. This way the time between regenerations of a region are
still 5 ticks but you dont bulk them in one tick.

tall dragon
#

so say i have a 100 regions. i could split them into 20 buckets. and instead i take 1 bucket every tick

lost matrix
#

Yes. 5 regions per tick > 100 regions every 20 ticks

tall dragon
#

hmm

young knoll
#

Works well for ticking players too

tall dragon
#

alright. il take a look into that as well

#

thanks for the ideas. really appreciate it 👍

lost matrix
#

Depends on your tps really

olive lance
#

Why am I getting a NoSuchElementException using hasNext and next on an iterator?

young knoll
#

At 20 tps, yes

lost matrix
olive lance
#

Yes I called next in a while(iter.hasNext)

#

and got that..

young knoll
#

Let’s see the code

olive lance
#
                Faction factionFromList = plugin.getData().getFactionStrictFacName(iter.next());
                if(factionFromList == null) {
                    iter.remove();
                    continue;
                }```
#

second line throws the error ofc

#

oh shit

#

nvm

lost matrix
#

continue

olive lance
#

spotted it

young knoll
#

Those aren’t the same iterator

olive lance
#

yep

young knoll
#

Yep

#

If args.length == 0 {
send message
return
}

olive lance
#

yes but if thats in onCommand make sure to return true

#

or false to send usage from plugin.yml

lost matrix
#

cmd.getName().equalsIgnoreCase("nickreq") this line is really useless unless you use the executor for several commands

#

How do you register your executor?

olive lance
#

I think maybe only commands registered in plugin.yml if you dont use commandexecutor

#

I would use that tho

lost matrix
#

If its in your JavaPlugin class then it will automatically be registered for every command in your plugim.yml

#

So depends on what you are doing

#

Do you use your "main" class as a CommandExecutor or do you have a separate class for that?

young knoll
#

Which command framework is easier to work with, cloud or ACF

tall dragon
#

your own 🙃

lost matrix
tall dragon
#

how else you gonna execute your code

olive lance
#

Why does everybody want plugins to use relational databases :upside down happy face:

lost matrix
#

To achieve what?

olive lance
#

It does work in that case

#

The executors are so you can have a separate one for every command

lost matrix
#

Do. You. Use. Your. Main. Class. As. A. CommandExecutor.
Ive asked this 3 times now

olive lance
#

i.e separate class

tall dragon
#

thats not what hes asking tho

olive lance
#

does your main class implement CommandExecutor i think is what hes asking

young knoll
#

They do by default

lost matrix
olive lance
#

o

young knoll
#

Okay

lost matrix
#

Im just asking if he overwrites the onCommand method in his JavaPlugin class

young knoll
#

Is your onCommand method in your main class

#

Nothing

#

The main class is the default executor

olive lance
#

you make a class for your command and implement commandexecutor then override onCommand in there, and you dont need to check for command name

young knoll
#

setExecutor is only if you want to use another class for it (which you should)

#

No

#

Also ahhh UpperCamelCase

olive lance
#

your variable nameis capitalized

#

usually it looksLikeThis

#

Commands

tall dragon
#

Commands

olive lance
#

doesnt actually affect anything

young knoll
#

No but that’s not a class

olive lance
#

class name uppercase

young knoll
#

It’s an instance of a class

olive lance
#

variable name lowerCamelCase

lost matrix
#
  1. Why do you have nickreq twice
  2. Why do you have a single executor for every command?
young knoll
#

You can’t setExecutor to a class

#

Can you

olive lance
#

Anyways instead of using one class-Commands you should make a class for every command- SmithingTableCommad NickReqCommand etc

young knoll
#

So it’s not a class, it’s an instance of a class

olive lance
#

and set executor for each one as new SmithingTableCommand etc

#

no reason other than organization

young knoll
#

And it saves the name check

olive lance
#

true

young knoll
#

The instance name should be lower case

#

Because that’s conventions

olive lance
#

then the class and instance have the exact same name

#

you dont want that

#

differentiate

young knoll
#

Naming conventions are the standards for how you name things in java

tall dragon
#

unless its a constant :d

#

they are usally full caps

olive lance
#

ye true

#

i love the full caps constants they make me drool

young knoll
#

Yeah constants are UPPER_SNAKE_CASE

olive lance
#

same

young knoll
#

Same

waxen plinth
#

same

young knoll
#

Agreed

olive lance
#

you should see my first few plugins

young knoll
#

That’s why we have ?learnjava

waxen plinth
#

lj for short

#

naming conventions are easy

#

just +1

young knoll
#

Class
classInstance
CONSTANT_VAR

tall dragon
#

those are lambdas

young knoll
#

-> is a lambda

kind hatch
#

When using the ChatColor class, should I be using the org.bukkit.ChatColor or the net.md_5.bungee.api.ChatColor. I'm updating some old code and was wondering if I could just switch everything to the bungee ChatColor class. I already use the bungee ChatColor for mostly everything as it offers what I need, but is there a valid use case for the Bukkit ChatColor?

olive lance
waxen plinth
#

() -> {}

#

sunglaseg

young knoll
#

I think the Bukkit one has like

tall dragon
young knoll
#

getLastColor and bungee doesn’t

#

But other than that, use bungee

olive lance
#

what about the one thats like x -> x.#

#

yea all one class

waxen plinth
#

you said it brother

lost matrix
olive lance
#

That was from 2015 lol

#

Then i didnt touch java again until like 2020

waxen plinth
#

holy FUCK dude

#

jesus

#

big big method

olive lance
#

What happens when u learn java from bukkit plugin tutorials

waxen plinth
#

use my library 👍

lost matrix
#

Hm. Maybe i can find one of my first code pieces. XD from 2019 i think?

waxen plinth
#

Depends

lost matrix
olive lance
#

ye. i keep all my events in one class tho prob not the best practice

waxen plinth
#

Sometimes you need a class per thing if it's big

#

With my command library you use one method per command

#

I dunno if I would do one event listener per class either

#

With some command libraries you use one class per command

#

Personally I find that really excessive

lost matrix
waxen plinth
#

Damn you seem really good for someone who started in 2019

#

I was born in 2019

olive lance
young knoll
tall dragon
#

true, but look at this horror

#

some are lowercase, some arent

#

whats even going on

olive lance
#

Scary

kind hatch
#

It would be args 1.

#

Arrays start at 0.

olive lance
#

starts count at 0

#

show the code

young knoll
#

nickreq is the command, stuff1 is args[0] stuff2 is args[1]

kind hatch
#

/<command> <arg0> <arg1> <arg2> etc etc.

lost matrix
waxen plinth
#

frendo it'

#

this entire time has been one song I can't believe it

young knoll
#

I definitely don’t get lazy after 10 minutes

#

Don’t know what you are talking about

waxen plinth
#

you know who else is lazy?

young knoll
#

Dead people?

waxen plinth
#

susan

tall dragon
#

why do you check if the cmd is "nickreq" at least 3 times

waxen plinth
#

what is the command used like

#

I can help

kind hatch
#

Gotta be thorough,. lol

tall dragon
#

no its not?

#

its just not. provided you have it in its own class

#

you also check the permission like 4 times

#

why not once

#

at the beginning

olive lance
#

After my 5 year hibernation due to the release of the most horrendous one-class plugin to ever release on spigot, I resurfaced in 2020 after learning that java is not a scripting language and I learned what a clas was: Behold, the next plugin to be released with FOUR COUNT THEM FOUR classes https://paste.md-5.net/elohujiwiy.cs (This is only the main class)

kind hatch
#

Because you are comparing a string which is the input from the user. There is no command lookup, but rather a simple string comparison.

young knoll
#

Hopefully ACF meets what I need for commands

#

Redlib doesn’t :p

unkempt peak
#

Yes

kind hatch
#

Yes, that's how chained if else statements work.

unkempt peak
#

Basically it's saying if not this then if this:

#

What are you trying to do?

kind hatch
#

If you wanted to make your life simpler, you could just make it a guard clause.

if (!cmd.getName().equalsIgnoreCase("nickreq")) {
  return true;
}

That way, none of the code below would run unless the command is equal to "nickreq"

maiden thicket
#

why do people check for cmd

#

in execute

kind hatch
#

You'd probably want to do a permission check as well, but the idea is easier code readability.

maiden thicket
#

cmd name i mean

#

i never do that

ancient jackal
#

how would I go about generating other files in the resources folder into a plugin's data folder, similar to config.yml?

ancient jackal
#

ah, okay thank you

kind hatch
# ancient jackal ah, okay thank you

Keep in mind that you have to manually call saveResource() for every single file you want to write to disk. If you have many files, this could be problematic. Otherwise you may want to look into another solution. I might have one, but I'll have to check.

waxen plinth
#

save resources

#

how does it

kind hatch
#

I'm suggesting you make your code easier to read. Everything you are checking for now is what you want, but the order in which it happens matters.
For example, you may want to check for the command name first. (Using the example I provided earlier)
Then you'd want another check for the permission to use the command.
Then you can get into the nitty gritty of argument checking. (Both length and content)

kind hatch
#

Is that a newer feature, because as of right now, using the 1.18.1 API, there is no saveResources() method in the JavaPlugin class.

waxen plinth
#

you mentionmed it

kind hatch
#

I thought you were suggesting a method, were you not?

waxen plinth
#

you were

#

jej

kind hatch
#

lol, my bad

arctic moth
waxen plinth
#

cause it's a link not code

arctic moth
#

and yes, the event is registered

arctic moth
waxen plinth
#

god that is very arrow code

arctic moth
#

lol

waxen plinth
#

fix

#

early return 💪 🚀

#

business solutions for the fastest customers

arctic moth
#

and yes ik oopsies on the /100 thing

#

but why isnt that working it seems to me like it should work

#

lol im dehydrated so i cant exactly concentrate rn

#

so i have no idea

#

what is wrong

lost matrix
arctic moth
lost matrix
#

A whole pyramid fits there...

arctic moth
#

lol

waxen plinth
quaint mantle
#

Yo I got another question now.

So I made a GUI. And ehm, well everything is working smoothly. But I've made an @event handler. And it triggers the event when the player drops an item. It opens up the GUI. But I don't want it to do that. Instead I want it to open when the player presses the 'e' button on the keyboard. And then it opens the GUI.

How do I go about doing that?? Also a little slight other question. What is the keyword e???? I've used it in my plugin from watching a tutorial, but I have no idea what e is...

waxen plinth
#

You can't

quaint mantle
#

Oh buggerrrrrrr D:

waxen plinth
#

you can't open their player inventory for them

#

They have to

arctic moth
kind hatch
#

You can do it with the offhand.

arctic moth
#

oh inventory?

ancient jackal
#

go to their house and press E

waxen plinth
#

that's so true it would work

arctic moth
#

idk if u need to cancel the event

kind hatch
lost matrix
# waxen plinth neofetch

You are saying strange things today. I have no idea what any of that meant: "neofetch | frendo it | sunglaseg' | retusanf"

kind hatch
#

I see that Redempt is a fellow linux user. very pog

waxen plinth
#

HE DOESN'T KNOW!!!!!!!!

#

yeshj arch btw

arctic moth
#

but u can detect when their inventory opens

#

if its binded to e

lost matrix
waxen plinth
#

oh trust me

#

I'm no vegan

#

I've seen blood

#

I've caused blood

arctic moth
waxen plinth
#

I've enraptured a crocquette

arctic moth
#

ok its still an arrow

#

lol

#

but less

sterile token
#

For building a dependency injector would you do it async or sync?

waxen plinth
#

a dependency injector which does what exactly

arctic moth
#

most of the time sync is the better choice

#

but ye it depends

lost matrix
#

In the sense of

waxen plinth
#

arch arch arch arch

arctic moth
#

or an arch

#

lol

waxen plinth
#

archj

ancient jackal
#

it is a trapezoid

arctic moth
#

sure

sterile token
# waxen plinth a dependency injector which does what exactly

Instead of doing:

ClassName class = new ClassName();

public ClassName getClassName() {
return clas;
}

public void test() {
getClassName().methodName()
}

I would transform to so there is no need to do getters and setters:

@Injector
ClassName class;

public void test() {
class.methodName();
}

waxen plinth
#

who

sterile token
#

So it should be sync?*

#

Allright thanks

waxen plinth
#

who said that

lost matrix
sterile token
#

How do i change discord rich presence configuration?

waxen plinth
#

with the p[ower of music

sterile token
#

cuz it doesnt say how many hours i have been working on the project

arctic moth
#

still trapezoid fuck

#

lol im so dehydrated i have a headache but im too lazy to get water

sterile token
#

Im so lazy that i put a mini fridge en my bedroom, so i dont need to go down for taken water

hybrid spoke
#

i've just bought an mini fridge for the leds

arctic moth
#

i havent drank in about 4-5 hours

#

yes grammar

#

wait is that correct grammar

#

im confussed

sterile token
#

I wont lie, i think i haven't been went outside my bedroom since thursday

#

I just go outside for taking food Lmao

lost matrix
waxen plinth
#

float your way out

arctic moth
#

lol pasting be like

waxen plinth
#

oh my god

waxen plinth
#

DRY

#

?dry

#

is that a thing

#

no

#

well

#

ever heard of a FUNCTION?

arctic moth
#

yes

#

but im a dumbass

waxen plinth
#

use

#

use the dumbass

hybrid spoke
arctic moth
#

that is the most perfectly shaped arrow i have ever seen

arctic moth
#

someone needs to make arrow-shaped code to spawn arrows in the shape of an arrow

#

kinda like the donut code

dusk flicker
#

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

drifting sonnet
#

Hi

#

@dusk flicker

#

hru?

#

Do you code plugins?

hybrid spoke
#

?ask

#

?services

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

dusk flicker
#

no

drifting sonnet
#

sorry for bothering

#

Just saw your status and figured i'd ask

hybrid spoke
#

he made spigot

#

javacord

#

and mongodb

lost matrix
#

in fact he made java

ancient jackal
#

not only did he made them, he born them

lost matrix
#

invented programming

ancient jackal
#

invented god

hybrid spoke
#

he's the owner of stackoverflow

hybrid spoke
dusk flicker
#

why are you exposing me

ancient jackal
#

oh I meant like God

hybrid spoke
#

there is no other god than me

ancient jackal
#

Rack is notch

hybrid spoke
#

dont disrespect rack like that

#

notch is rack

ancient jackal
#

that's straight disrespect

#

Rack is more than just notch

hybrid spoke
#

rack is notch²

young knoll
#

Anyone else get a DM from them

hybrid spoke
#

from rack?

ancient jackal
#

Rack is secretly all of us

young knoll
hybrid spoke
#

oh no

#

but i dont think any1 can dm me

#

not sure

young knoll
#

Interestingly they stopped replying when I linked them the services forum

arctic moth
young knoll
#

Are you using 1 for the amplifier

young knoll
#

Because potion levels start at 0

#

Just like arrays

arctic moth
young knoll
#

Yes

#

Why do potions do that but enchants don’t? Because Mojank

arctic moth
#

lol

#

so player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 11, item.getItemMeta().getPersistentDataContainer().get(ItemManager.strengthamuletkey, PersistentDataType.INTEGER) - 1));

#

god that looks like shit with discords formatting

young knoll
#

Sure

arctic moth
#

and i still have no idea why nothing happens when absorbing xp

young knoll
#

Is it duration then amplifier

#

I never remember

arctic moth
#

yep

young knoll
#

11 ticks of strength

#

Lul

arctic moth
#

it loops every 10 ticks

young knoll
#

Ah

arctic moth
#

and 10 makes it freak out

young knoll
#

So we’re remaking EcoTalismans :p

arctic moth
#

i have no idea what that is but sure

young knoll
#

Some premium plugin that adds effect talismans

arctic moth
#

well this is a custom plugin for some kids smp so ¯_(ツ)_/¯

hybrid spoke
#

did they pay for it?

arctic moth
#

no not rlly im the only dev that hasnt been paid in like the past half year

young knoll
#

Sounds like a good time to yeet outta there

arctic moth
#

im also the only one working on the smp side of things, the others (and i) work on the shitty discord bots

#

lol

valid solstice
#

Is it possible to create a shaded recipe by making the Materials needed in a recipe as ItemStack?

young knoll
#

RecipeChoice.ExactChoice

hybrid spoke
#

ah

valid solstice
arctic moth
young knoll
arctic moth
#

inferior language

valid solstice
arctic moth
#

lmao the amount of worlds

#

theres 3 more but theyre above

#

rip whatever host hes using

#

why does he want like 7 worlds

wet breach
#

nothing wrong with having a bunch of worlds on a server

arctic moth
young knoll
#

A world by itself isn’t that intensive

#

Especially if you disable spawn chunks

wet breach
#

I mean technically the whole proxy server switching is just a manipulation of what the client perceives as world 😛

arctic moth
young knoll
#

Yeah proxies for mc are interesting when you get into how they work

valid solstice
#

Is there a way to adjust the damage that World#createExplosion gives off to entities?

young knoll
#

You’d have to use an event

wet breach
#

if you can't find a setting dealing with explosions or tnt in the configs there are plenty of plugins that allow this

#

oh right api wise you can do it too

young knoll
#

Basically gotta check if the damage cause is an explosion and the damagee is near where the explosion happened

arctic moth
valid solstice
#

but wouldn't that generalize all explosions caused by tnts?

#

i just want it to work in World#createExplosion

young knoll
#

Hence why you gotta use a location

wet breach
#

there are plenty of ways to narrow it down to what you are wanting, but I mean you are not being very specific either lol

valid solstice
#

just reduce the damage cause by World#createExplosion

#

it isn't that complicated xD

#

but i'll try what you guys told me

#

Thanks

wet breach
#

well that method should take in parameters

#

in what kind of explosion you want

young knoll
#

There is no parameter for entity damage multiplier

ancient jackal
#

is there a way to get whether an entity is hostile or not?

worldly ingot
#

You can check if the entity instanceof Monster

ancient jackal
#

ah, I did not know that existed

worldly ingot
#

That will cover all hostile mobs except for slimes I believe

young knoll
#

Mojankkkk

sterile token
#

Who mentione that was building a DI framework? Please dm me if you are building DI framework

young knoll
#

CMI isn’t going to translate messages you send directly to players

#

And?

#

Yes

sterile token
#

You can use:

public class Chat {
  
  public static String style(String input) {
    return ChatColor.translateAlternateColorCodes('&', text); 
  }

  public static List<String> style(List<String> input) {
    return input.stream().map(Chat::style).collect(Collectors.toList());
  }
}
young knoll
#

They literally said they dont want to translate the colors

sterile token
#

Hmn

#

So he didnt explain good

#

So what you want?

#

Send messages to player?

#

for sending messages without color: Player#sendMessage(text)

hasty prawn
#

If you use p.sendMessage, it won't be colored. If you use /msg, it's probably based on CMI permissions.

#

I assume CMI has coloring permissions, and if the sender has those perms then the message would be colored

sterile token
#

What its CMI?

#

For questions not related to plugin programming use #help-server

hasty prawn
#

It's a plugin

young knoll
#

Probably language barrier

hasty prawn
#

We all tell people to go to the right channels. Not just helpers.

#

You are a miserable person to help lol

waxen plinth
#

if this is how you treat the people that you are asking for help

#

you may find you're not getting help much longer

hasty prawn
#

^

drifting sonnet
#

@waxen plinth @hasty prawn @quaint mantle guys. I'd like to apologize for the shit that you guys have gone through these fast few minutes. Noone needs to help him, let him figure it out on his own. If he's too dumb to understand, don't be too dumb to give in

waxen plinth
#

I only just got here

dawn hazel
#

what the hell

drifting sonnet
#

sorry

waxen plinth
#

Just move on

hasty prawn
#

Poor Verano got the worst of it lol

dawn hazel
#

dont cause drama. you got your help. move along

olive lance
#

Switches will always be as fast as if not faster than hash maps

#

Fact or cap

dawn hazel
#

i like how you put a clown emoji on my message like its going to personally affect me

#

boo hoo

hasty prawn
#

Eh lets just drop this please

dawn hazel
#

im not getting roped into an argument

olive lance
#

Someone told me to change my switch statement into a hash map one time in here a long time ago

waxen plinth
#

Well it can be preferable if there are a lot of values

young knoll
#

Clearly a massive if else if chain is the best

olive lance
#

Now is a massive if else chain any slower than a switch

dawn hazel
#

use a switch statement

young knoll
#

Switch’s should be faster

dawn hazel
#

wait no

#

they dont work the same

young knoll
#

Since they just do one check and then jump to a label

dawn hazel
#

a switch statement is not similar to an if else statement

sterile token
#

What its better from developer view Annotated or extending classes?

dawn hazel
#

a switch statement is dividing code into different cases and executing the case specified when the switch is called

sterile token
#

Elaborate it please

#

I dont wanna lost any opinions

hasty prawn
#

Some developers might prefer using annotations, some might like using extended classes.

sterile token
#

Yeah, i fell that annotation sometimes make code like "strange", in other hand its shorter than extending classes

valid solstice
#

how do i compare 2 itemstack objects without comparing their durabilites

waxen plinth
#

My library has a way to do that

valid solstice
tranquil viper
#
    @SuppressWarnings("unchecked")
    public static void copyContents(PersistentDataHolder donor, PersistentDataHolder receiver) {
        Preconditions.checkArgument(donor != null && receiver != null);
        PersistentDataContainer donorContainer = donor.getPersistentDataContainer();
        PersistentDataContainer receiverContainer = receiver.getPersistentDataContainer();
        for (NamespacedKey key : donorContainer.getKeys()) {

                if(donorContainer.has(key, PersistentDataType.LONG)) {
                    receiverContainer.set(key, PersistentDataType.LONG.getClass().cast(PersistentDataType.LONG),  Objects.requireNonNull(donorContainer.get(key, PersistentDataType.LONG)));
                }

        }
    }
#

Anyone know where to go from here? I'm a bit confused as to why this isn't working

hybrid spoke
#

isn't there a way to just get this by the chunk object

hybrid spoke
#

whats the expected result?

tranquil viper
#

I'm trying to copy the cotents of one data holder to another

hybrid spoke
#

im not sure, i've never made anything clientsided. but forge api says there is a chunk object

#

what size are we talking about? like how many non-air-blocks?

#

or like the KB size of the region file?

hybrid spoke
#

and you have to simulate it yourself since you can't access the region file

#

first google result literally

tranquil viper
#

🤦

#

thank you

hybrid spoke
#

n

#

p

sterile token
#

What do you think?

waxen plinth
#

I think lombok bad

sterile token
#

Hmn

hybrid spoke
sterile token
#

bad?

waxen plinth
#

Bad.

sterile token
#

why?

#

Lmao

#

Does loombook execute something on the IDE when you add it as dependency?

brave sparrow
#

It has to yeah

#

Otherwise the IDE doesn’t know what to do with the Lombok stuff

sterile token
#

Oh

rare pike
#

Does anyone know how to install java 17?

sterile token
rare pike
waxen plinth
#

Pog

waxen plinth
#

I think you need a special repo for it or something

sterile token
#

Yes

#

You need to add a custom repo for downloading it

dawn hazel
#

anyone know how the method to disable a bungee plugin

sterile token
#

You have to do it via reflections

hexed hatch
#

Lombok just seems so pointless to me

sterile token
#

Is there any other any simple library. For stop doing ClassName getters and setters?

tranquil viper
#

What replaced EntityType.fromName()

#

since that is deprecated ^

drifting sonnet
#

@tranquil viper

#

dms

hardy swan
#

Isnt EntityType an enum

#

You can always use valueOf

dawn hazel
tranquil viper
#

forgot it was an enum im kinda braindead

hardy swan
lost matrix
# hexed hatch Lombok just seems so pointless to me

How so? For me it is a massive time saver. And it makes my code super compact.
The only downside is that it hides some code that is only present during compile time.
But if you've worked with JavaEE then you'll know that this can also be beneficial.

#

For example this class im currently writing delomboked would not be 50 lines but over 200 lines. Would have to scroll to see all the content.

merry kindle
#

Is the Spigot code open source on github?

lost matrix
#

?stash