#help-development

1 messages · Page 1982 of 1

simple anvil
#

Is there a way to hide a crafting recipe, so only the plugin creater can craft it. Or anyone else who knows the recipe

worn tundra
#

Cancel the crafting events if player isn't the wanted one

simple anvil
#

Yea but then the could still see that the crafting recipe is a thing

#

I want no one to be able to see kt

smoky oak
#

Does anyone know how to pass arguments to a lambda function/bukkit runnable?

#
public class EventPlayerMove implements Listener {
    @EventHandler
    public void onMove(PlayerMoveEvent e){
        eventPlayerMoveAsync task = new eventPlayerMoveAsync(e);
        Bukkit.getScheduler().runTaskAsynchronously(Echo.getInstance(),task);}

    class eventPlayerMoveAsync implements Runnable {
        PlayerMoveEvent event;

        public eventPlayerMoveAsync(PlayerMoveEvent e){this.event = e;}

        @Override
        public void run(){}
    }
}

This is a terrible idea, but if anyone has a better one feel free to tell me

ivory sleet
#

?scheduling

undone axleBOT
smoky oak
#

well the reason i am doing it like that up there is so i can pass the event, which isnt something the examples in the tutorial have

ivory sleet
#

Well

#

That’s not especially hard assuming you understand java scoping

brave sparrow
#

What are you planning on doing with the event asynchronously

ivory sleet
#

void on(Object o) {
run(() -> {
doSomethingWith(o);
});
} @smoky oak

#

If you want to make it scalable

#

Then perhaps pass a consumer into the runnable lambda (which gets applied to the event instance)

smoky oak
#

uh well i tried that but it said 'variable already defined in scope'

#

im missing something here

ivory sleet
#

That issue is pretty self explanatory

#

I mean why

#

(It’d probably just yell at you in red fyi)

brave sparrow
#

@smoky oak what are you going to do async with the move event

#

Because you can’t do anything to the player async

ivory sleet
#

^ it’s also not possible to cancel the event if you’re callbacking it after the event invocation itself

brave sparrow
#

^

#

Or modify the world, or any entities, etc

smoky oak
#

I want to check the player movement async to see if I need to do something to the player, this is to prevent it running once per tick on thread-0. If yes, I want to call a sync task with the server, which should happen in like 1/10000 events

sharp flare
#

Bukkit api is not possible on another thread atleast most of them

brave sparrow
#

The overhead involved in running something async every tick is probably higher than just checking whatever it is

smoky oak
#

wait seriously?

brave sparrow
#

What are you doing to be checking

smoky oak
#

velocity vector mainly

#

the issue is that there's no simple way of for example checking if a player is jumping

ivory sleet
#

Yeah almost never in principle

brave sparrow
#

Isn’t there that statistic increment event that goes up when they jump?

#

Or am I crazy

smoky oak
#

wait there is

brave sparrow
#

Either way, basic velocity checking is fine to do on the main thread

#

You’re not gonna kill your server with that

#

Not if he’s only looking for velocity with increasing height

#

As opposed to falling

smoky oak
#

well the problem is that i need to do a check if a player is applicable for a specific movement modification.

#

that results in uh

#

one hashMap check (with player->uuid parsing), one config check

brave sparrow
#

You shouldn’t be reading from the config at runtime

#

Load the values into memory at startup

smoky oak
#

yea im doing that

brave sparrow
#

Checking a hashmap and reading from memory is trivial

smoky oak
#

I'm using a fileConfiguration object for that

brave sparrow
#

It won’t lag

smoky oak
#

using a getter for a static variable in the class implementing JavaPlugin feels somehow like it would be faster than calling this:

private FileConfiguration configFromFile(String file, boolean useResources){
        File read = new File(dataFolder, file);
        if(!read.exists()){
            if(useResources){
                //saveResource(file, false);
                //TODO when publishing return the saveRessource and test it!
                return getBakedConfig(file);
            }
            else{
                read.getParentFile().mkdirs();
                try {
                    read.createNewFile();
                } catch (IOException e) {
                    log(Level.WARNING,"Could not create "+file+"! The plugin will use a empty config!");
                    return new YamlConfiguration();
                }
            }
        }

        try {
            FileConfiguration ret = new YamlConfiguration();
            ret.load(read);
            return ret;
        } catch (IOException e) {
            log(Level.WARNING,"Could not read "+file+"! The plugin will use a empty config!");
            return new YamlConfiguration();
        } catch (InvalidConfigurationException e) {
            log(Level.WARNING,file+" is CORRUPTED! The plugin will use a empty config!");
            return new YamlConfiguration();
        }
    }
brave sparrow
#

Definitely don’t do that lol

#

That’s gonna hit the file system

smoky oak
#

ergo manual caching

#

on a completely different note apparantly strength doesnt exist anymore?

brave sparrow
#

INCREASE_DAMAGE

#

@smoky oak

smoky oak
#

ah

#

thanks

#

why is almost everything else named correctly tho

brave sparrow
#

SLOW_DIGGING

#

That’s mining fatigue

#

Just how stuff ended up being named over the years

#

I’m not sure about the actual origins

smoky oak
#

huh

#

noted

brave sparrow
#

Not in the context of that enum though really

#

Saturation could also mean a lot of things

#

So could Speed

#

Or Slow

worn tundra
#

Don't javadocs describe them?

#

They do

smoky oak
#

im using the autocompletion feature of intelliJ

#

usually thats enough

brave sparrow
#

Slowness effect

#

It makes you walk slower

smoky oak
#

what event gets called when a player sets their spawn

#

PlayerInteractEvent?

#

i want to be able to cancel them setting their spawn

#

i doubt it

#

that wouldnt help either because that would not actually keep their respawnpoint anchored to the old bed

visual tide
#

its just slowness

smoky oak
#

still happens after respawn is set

grim ice
#

@smoky oak Make a bed system

#

and cancel interaction with a bed in the overworld

#

When they interact with a bed cancel the event

#

And do your own handling of sleeping

vocal cloud
grim ice
#

Or that

grim ice
#

Then do what I suggested maybe

smoky oak
#

aha

Block block = event.getClickedBlock();
if (Tag.BEDS.isTagged(block.getType())) {
  Echo.log("Bed cancelled.");
  event.setCancelled(true);}```
vocal cloud
#

A PlayerSetBedSpawnEvent needs to be added lol

smoky oak
#

well that is easy to patch

#

doing a jump event manually is hell

#

how do i get the target a hostile entity is attacking/targeting?

tardy delta
#

EntityTargetEvent?

smoky oak
#

that works i guess

#

also i found out that ExplosoinPrime triggers when a creeper explodes, not when it lights up

#

if a entity with a high resistance effect gets attacked resulting in 0 damage, EntityDamageEvent still triggers right?

vague swallow
#

How can I get the location of a block 5 blocks in the line of sight of a player?

quaint mantle
#

Still having an error with compiling a plugin against bukkit/spigot. The error is Cannot resolve method 'setNameTagVisibility' in 'Team'

  symbol:   method setNameTagVisibility(org.bukkit.scoreboard.TeamNameTagVisibility)
  location: variable curTeam of type org.bukkit.scoreboard.Team```
tender shard
quaint mantle
tender shard
west bone
#

hi, im trying to rotate nms stand im doing it right but i think the packet is wrong, which packet should i send on 1.18

        stand.setYBodyRot(entity.getLocation().getYaw());
        stand.setYHeadRot(entity.getLocation().getYaw());
        stand.setXRot(entity.getLocation().getPitch());
        stand.getBukkitEntity().setRotation(entity.getLocation().getYaw(), entity.getLocation().getPitch());
        for(Player p : showed){
            JeffLib.getNMSHandler().sendPacket(p, new ClientboundSetEntityDataPacket(stand.getId(), stand.getEntityData(), true));
        }```
silent stratus
#

whats the name of the sound which sounds like a boost?

#

like a "pfffff"

misty current
#

should I extend runtimeexception to create an unchecked exception?

quiet ice
#

yes, or any subclass of it

tender shard
misty current
#

okay thanks

tender shard
#

but

#

what do you need an unchecked exception for anyway?

west bone
tender shard
#

did you find the correct packet to rotate the armorstand?

#

it might be the metadata packet

#

not sure though

west bone
#

nope i didnt 😢

misty current
west bone
tender shard
misty current
#

alright

smoky oak
#

for values only important in one class which dont need to be permanent, is a static hashmap in that class the best option?

quiet ice
#

depends on further context

smoky oak
#

uuid -> long (for a cooldown)

raw ibex
#

how to get a Block's namespaced key

young knoll
#

Block#getType#getKey

raw ibex
#

ty

#
        NamespacedKey block = e.getBlock().getType().getKey();
        if(block.contains("sponge")) {
            Player player = e.getPlayer();

            e.setCancelled(true);
        }```
#

why is contains in red/

#

cannot resolve method contains in Namespacedkey

west bone
#

why dont you just e.getblock.gettype == Material.Sponge?

raw ibex
#

oh eya

#

lol

#

thanks

west bone
#

💌

#

i cant use custom emojis 😢

raw ibex
#

ty :)

#

it work

#

i didnt think of dat

tender shard
#

is anyone here bored and has knowldedge about JDA / discord+java? I'm currently writing a tiny trivia / quiz bot and would love people to contribute 😛

#

it's very simple right now but already working

chrome beacon
#

Any specific feature you want to add

tender shard
#

saved into a yaml file

#

erm

#

mysql db I mean

#

or for example, getting categories from some trivia API

#

e.g. "?trivia General Knowledge´ and then it'd query the API to get questions

chrome beacon
#

Sounds like an interessting project but I won't be home for a week

tender shard
#

:<

#

my bot currently just uses yaml files, it works fine, but if someone actually has access to the yaml files they will know all answers

#

so I want it to work with random quiz APIs like the one I sent

#

maybe a simple "import" command would be enough

#

like
?trivia import <category_name> <link_to_api> and then it downloads 1000 questions and puts them in its own DB
or sth like that

#

because the current #bot-commands bot sucks. I already know 50% of the questions by heart in some categories

young knoll
#

Nerd

vague swallow
#

How can I change the pose of an EntityPlayer in 1.18?

tender shard
vague swallow
#

I'm using normal nms

#

I mean

tender shard
#

sorry no idea about the pose

#

but

vague swallow
#

how are you making npcs?

tender shard
#

is there a reason why you don't use mojang mappings?
it'll make your life so much easier

vague swallow
ornate heart
#

Is it possible to move yaml key entries to the top of the file?

When your do FileConfiguration#set, the entries automatically get added to the bottom of the file. I want them to go to the top of the file.

tender shard
ornate heart
#

Unlucky 😢

vague swallow
undone axleBOT
tender shard
#

we'll get it working

chrome beacon
#

Also don't forget to use BuildTools

#

?bt

undone axleBOT
chrome beacon
#

Have you run BuildTools

tender shard
#

looks good. did you run buildtools for 1.18.1 using --remapped option?

vague swallow
tender shard
#

oh I see

#

you don't have the spigot repo

#

in your pom

#

add the regular spigot repo

vague swallow
#

oh

tender shard
#

?maven

undone axleBOT
vague swallow
#

lmao

chrome beacon
#

No need for it?

tender shard
#

for the maven-special-sauce plugin

chrome beacon
#

Anyways I see that you depend on 1.18.1 but the remapper uses 1.18

chrome beacon
tender shard
young knoll
#

0/10 blog

tender shard
#

of course you have to switch from "1.18-R0.1" to "1.18.1-R0.1" @vague swallow

tender shard
young knoll
#

Shh

#

Reading is too much

tender shard
#

then it's people's fault

#

not mine lol

tender shard
#

did you click the "maven reload" button?

vague swallow
#

yes

tender shard
#

?paste your pom.xml again pls

undone axleBOT
vague swallow
tender shard
#

that works fine for me

#

if you just run "mvn compile", does it throw errors? if so, which ones?

vague swallow
#

"Cannot resolve org.spigotmcspigot1.18.1-R0.1-SNAPSHOT "

tender shard
#

oh yeah

vague swallow
#

That's the console output

tender shard
#

that's because you haven't run buildtools for 1.18.1 --remapped

vague swallow
#

ooo I forgot the remapped I think

tender shard
#
java -jar BuildTools.jar --rev 1.18.1 --remapped

even if you think you've already did that, do it again

#

if it has finished, in IntelliJ do File -> Invalidate Caches -> Restart

#

if it still doesn't work, pls show the output of "mvn compile" again pls

vague swallow
#

alr

tender shard
#

alrighty 🙂

vague swallow
#

Well

#

It worked so I don't have errors in the pom.xml anymore

#

@tender shard

#

but I got an error in the dependecies now

tender shard
#

show the full maven output pls

midnight shore
#

Hi! How can i add a Map to a persistentDataContainer? For short, I want to add custom enchantments to an item meta, and i want it to have a name (string) and a level (integer). Is there a way to do this in a single set()? I'm also using @tender shard library "MoreDataTypes".

vague swallow
tender shard
#

in your specific case, I would not worry about using maps and just use STRING_ARRAY in a format like

ench[0] = "UNBREAKING,1";
ench[1] = "FORTUNE,3";
...
#

then just use String.split[] and get your values again

midnight shore
#

ok and then how can i retrieve the level?

midnight shore
#

tysm

tender shard
#

int level = Integer.parseInt(ench[0].split(",")[1]);

vague swallow
tender shard
#

e.g. there is no EntityPlayer anymore

vague swallow
#

yes

tender shard
#

in mojang mappings, e.g. EntityPlayer is called ServerPlayer

vague swallow
#

oh

tender shard
#

yeah you'll have to go through this once

#

but the advantage is:

#

if 1.19, or 1.20, or 1.21 gets released - you do not have to change ANYTHING

vague swallow
#

that's good

tender shard
#

you just have to switch all your stuff to use mojang names now, then you're ready for almost all future updates

midnight shore
#

how can i add an array entry?

vague swallow
vague swallow
tender shard
#

do File -> Invalidate Caches -> Restart

#

but tbh

#

it seems to work

#

what's the actual error message?

#

I see it's underlined in red

#

but

#

it also seems to use it correctly

vague swallow
#

yes

#

that's why I wondered

tender shard
#

tbh I wouldn't worry about that

#

sometimes intellij is a bit slow when you do maven changes

#

if you hover it

#

does it show any error?

vague swallow
tender shard
#

just fuck it then, for real

#

do not worry about it

#

your pom.xml is totally fine

#

just try to import some NMS classes somewhere

vague swallow
tender shard
#

if that works, you're fine to go

#

then do not worry about it

vague swallow
#

but I can't export the plugin because of the error

tender shard
#

export???

vague swallow
#

it just says "not a statement"

tender shard
#

do you use maven artifacts to build your jar?

tender shard
vague swallow
#

I'm using "package"

tender shard
#

show a screenshot or paste the code that's "not a statement"

vague swallow
#

Well I fixed the code errors but now the message is "<identifier> expected"

tender shard
#

show code and full error msg pls

vague swallow
#

<identifier> expected is the full error message

#

and it's still the dependency error

tender shard
#

<identifier> expected, where?

#

seems like you did some stuff like int = 3

#

instead of int a = 3

vague swallow
tender shard
#

full screenshot pls

#

it has NOTHING to do with the maven thing on the right

vague swallow
tender shard
#

no

#

FULL screenshot

#

I can only see 50% of your code

vague swallow
#

sorry

#

gimme a sec

tender shard
#

np lol

vague swallow
tender shard
#

1 sec, gotta do some photoshopping lol

#

I need the full error log

#

one sec

#

click on "Main [package]" there

#

then send the FULL error log from maven again pls

vague swallow
#

like this:

tender shard
#

no

#

as in my screenshot

#

click on the TOP most entry on the left side

#

so it shows the FULL log

vague swallow
tender shard
#

show FOrcePowersListener line 2378

#

I am like 90% sure that you forgot to insert some "variable name" there

#

you probably did some stuff like

String = "asd";

instead of sth like
String asd = "asd";

vague swallow
#

wait

tender shard
#

NO

#

I WILL NOT WAIT

#

I GO HOME NOW

vague swallow
#

sorry you're right, IntelliJ is so slow

tender shard
#

no problem lol

vague swallow
#

It didn't show me many error messages

tender shard
#

but tbh maven exactly told you where the error is 😛

#

yeah you have to click on the correct item in the hierarchy on the left side

#

then you would have known that the problem was in ForcepowersListener in line 2378

#

just remember it for the next time :3 did you get it fixed now?

#

if so what exactly was the problem?

vague swallow
tender shard
#

ugh

#

discord hates me

vague swallow
#

is that... Lightmode???????????

tender shard
#

stop mocking me for that

#

that joke gets old quickly lol

#

I like light mode

#

it's not that depressing

vague swallow
#

no it's just... unfamiliar

#

I've never seen it before

#

OMG IT WORKED

#

THANKS SO MUCH

#

You don't know how much you helped me

#

@tender shard Thaaaaaaaaaaaaaaaaaaaaaaaaanks

fervent gate
#

Would it be bad if I build one massive plugin instead of all small ones. Imagine like 100k lines of code

vague swallow
#

and sorry for wasting your time

tender shard
#

if I helped you, you didn't waste my time

vague swallow
#

how

tender shard
#

?help

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

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

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

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

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

**__ModLog:__**

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

**__Permissions:__**

permissions Command permission management tools.

tender shard
#

here you go

#

there's help above

vague swallow
#

XD

#

but thank you

#

and have a nice day

tender shard
#

I'm not using NPCs etc

fervent gate
tender shard
#

I worked for germany's largest economy server a few years ago, and

#

I can tell you that it's totally not a problem to have 300 plugins running on a single server

vague swallow
tender shard
#

Check out the unix philosophy

#

"Do one thing, and do that one well"

#

A plugin shouldn't handle

  1. bans
  2. chat messages
  3. voting rewards
  4. ....
#

there should be one plugin for each

#

IMHO

#

but that's just my opinion

#

of course you can scram it all into one plugin, but maintaining it might be a pain in the ass

fervent gate
#

Hmm. What about an RPG. Would it be best to keep it all in one plugin (mobs, quests, items, all listeners, etc) or divide them

tender shard
ivory sleet
vague swallow
tender shard
#

english here pls

vague swallow
#

XD

fervent gate
ivory sleet
#

API

tender shard
#

well you definitely NOT want to have a separate "listener" plugin lol

#

you are talkibg about "mobs" and "quests"

ivory sleet
#

Each jar usually exposes a facade of interfaces whose instances are obtainable through the ServiceLoader api that java itself exposes (although in Bukkit ServicesManager might be the favored option)

tender shard
#

are those "mob related quests" or do you have "quests" and "custom mobs"?

fervent gate
tender shard
#

if the latter, make it two separate plugins

#

one for custom mobs, one for quests

tender shard
#

so basically the other plugins can use your mob plugin as dependency

fervent gate
#

I'll need to learn how that works for sure because I would have no idea on how to start that

tender shard
#

well basically all you have to do is to add your mob plugin as <dependency> to your other plugins if you're using maven

#

no idea how it works in gradle

fervent gate
#

Using maven

tender shard
#

and of course add the mob plugin also as depend: in your plugin.yml

fervent gate
#

But then I would have to use the code in the other plugins code

ivory sleet
#

Which is inevitable if you’re composing a set of jars

(What you still want to aim for is loose coupling and robustness)

tender shard
#

erm yeah of course

#

you use "foreign" jar code anyway

#

e.g. you do stuff like "Bukkit.getScheduler()" which is also from another .jar

fervent gate
#

And what about the pom.xml? How would I do that? Repository?

tender shard
#

wdym?

#

imagine you have a plugin called "MyMobPlugin"

#

you have groupId me.bramla and artifactId MobPlugin

fervent gate
#

In order to use the other plugins code, I would have to put something regarding that plugin in the pom right?

ivory sleet
#

Yes

tender shard
#

then you do maven install on that plugin

#

in the other plugin, you add as dependency
<groupId>me.bramla</groupId>
<artifactId>MobPlugin</artifactId>

ivory sleet
#

You need to declare your other plugins’ code to your compile-time classpath/dependencies

tender shard
#

don't wanna be mean but if you don't understand this yet, maybe you should do some more simple stuff first

ivory sleet
#

Usually a single plugin scales relatively well, if it’s merely for a simple spigot server

fervent gate
#

I was thinking of learning along the way really 😬

tender shard
#

yeah sure; i understand

#

but it seemed like you were developing for a large server

fervent gate
#

I mean, I have large ideas that are too hard for me to do as of rn for sure, but I would start with the small things and learn along the way.

tender shard
#

well as a rule of thumbs, one could say:
If your plugin(s) only work together, you can scram it into one .jar file

#

if however they also should work with 1-2 features missing, make every feature a single plugin

#

as said, a ban plugin doesn't need to manage chat formatting

#

so that's 2 different .jars

#

but e.g. a quest plugin and a custom mob plugin are 2 entirely different things

#

even if the quests involve your custom mobs

#

but you probably want to be able to have custom mobs even if you don't want them to be involved in quests

fervent gate
#

I see

vestal moat
#

Anyone know a library that sends plugin messages without need of bungee or anything just sending it to client thats all

ivory sleet
#

Yeah could use redis

tender shard
#

but a library for that? I don't know any

ivory sleet
#

Or namely Kafka/rabbitmq

#

There’s RadioScanner

vestal moat
#

🤣 redis cant be used

ivory sleet
#

But it opens a server socket so it requires a port

tender shard
vestal moat
#

I just want the client to receive the message

vague swallow
#

@tender shard uhm do you know what BlockPosition is now?

vestal moat
#

Why would i connect the client to redis

tender shard
ivory sleet
#

Well then just send a packet to the client?

#

I mean you already have a connection to the player

vestal moat
#

Im not dealing with nms

vestal moat
#

Ive seen a library before

ivory sleet
#

Well it’s not nms

vestal moat
#

I just forgot its name

ivory sleet
#

It’s netty

tender shard
vestal moat
#

Getting the connection is part of nms

ivory sleet
#

Necessarily not

tender shard
#

@vestal moat what are you trying to do exactly?

#

it's probably easier if you just tell what you need to do

vestal moat
#

Im trying to make a client side mod

#

And a few controls by server

tender shard
#

well then use plugin message channels between server<>client, as conclure said

vague swallow
tender shard
vestal moat
#

That's what im doing

#

Mod is ready to receive

#

Server is what im stuck with

ivory sleet
#

Blue Tree look at what for instance Choco did with VeinMiner

vague swallow
ivory sleet
#

It’s a good example when you want custom communication between client and server

tender shard
tender shard
vague swallow
#

yes

#

that was it

tender shard
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

vague swallow
#

thanks

west bone
#

which packet should i send for the map on a packet itemframe 🤔 cause if i dont send the map packet it doesn't show the map but puts the item on the frame

vestal moat
#

I see plugin message packet classes

#

Huh

tender shard
#

sorry I didn't understand anything

midnight shore
midnight shore
tender shard
#

I guess

#

oh wait

#

it's not null

#

but all it's "members" are null

#

do not create an array of length 1000

#

only create an array of the length that you actually use

#

you can't just save a string array like
"unbreaking,3",
null,
null,
null,

#

all the array members must actually have "content"

#

none of it must be null

midnight shore
#

oh

vestal moat
#

Is it actually a good idea to copy his classes

tender shard
vestal moat
#

Veinminer plugin message related ones

#

I never did netty before i have low understanding of it

tender shard
#

you should never copy/paste stuff unless you exactly know what every single line of code does

midnight shore
vestal moat
#

He put javadocs

#

Lmao

#

There is a different between being able to make one and understanding it

tender shard
vague swallow
tender shard
#

nowhere

#

you're on your own when doing NMS stuff

#

there's a reason why bukkit=bukkit and nms=not bukkit

#

there is no API for NMS stuff. you have to dig through the class names etc yourself

vague swallow
#

So do you know what a DataWatcher is now?

tender shard
#

yeah

#

one sec

#

gotta open up my github

tender shard
midnight shore
#

is the converting to array part ok?

#

it looks wierd

tender shard
tender shard
tender shard
#

if you have stuff like "toArray()" it wants you to just pass an empty array object

midnight shore
#

it works!

vague swallow
tender shard
#

what does the DataWatcherRegistry do?

midnight shore
#

the second time it broke

tender shard
#

show ItemBuilder line 91

#

you cannot remove things from a collection while iterating over it

#

you should use an iterator instead

midnight shore
tender shard
#

okay example:

midnight shore
#

ohhh i see

#

so

tender shard
#
for(Strnig l : lore) {
  lore.remove();
}

NOT ALLOWED

#

but the following is fine:

#
Iterator<String> it = lore.iterator();
while(it.hasNext()) {
  String next = it.next();
  next.remove();
}
midnight shore
#

like this?

tender shard
#

no

#

wait

desert loom
tender shard
#

no it wouldn't work

#

that's the same

#

either use an iterator, or create another list<string> to save the lines you wanna remove, or actually CLONE the list instead of just creating a new variable for it

#

you gotta understand this:

#
List a = new List();
List b = a;
// If you now remove something from b, it also gets removed from a - because they are the SAME object - you just have two variables for it
west bone
#

how can i render a map on a packet itemframe 🤔 which packet should i send to player 😢 on 1.18

tender shard
midnight shore
tender shard
#
Iterator<String> it = lore.iterator();
while(it.hasNext()) {
  String line = it.next();
  if(line.contains("§9") it.remove();
}
#

@midnight shore

#

print out what's happening

midnight shore
tender shard
#

looks like you never "reset" the "hasInteracted" variable or the "crtype" variable

tender shard
#

obviously fix the missing )

midnight shore
#

to convert it to a List?

tender shard
midnight shore
#

i'm returning a List, so how can i return a list? 😅 sorry for my baaad english

tender shard
#

obviously you wanna return lore

midnight shore
#

oh

tender shard
#

can't hurt to do so

midnight shore
#

is it the same problem as before?

#

what am I doing there?

#

i have an array and i get it as a list

#

then i remove an entry

#

whats wrong?

#

Why are you talking to my like that?

#

do you think i'm stupid or what?

#

but gets its already an array

desert loom
#

the ArrayList returned by Arrays.asList does not support the remove operation.

eternal oxide
#

asList is immutable

midnight shore
#

i did what you said ?!

#

Okay

eternal oxide
#

What are you trying to do exactly? I'm late to the convo

midnight shore
#

I have an array and I want to remove an entry

hybrid spoke
midnight shore
#

And having it as a list of strings

#

So

eternal oxide
#

List<String> list = new ArrayList(get); gives you an editable List

#

then list.removeIf(...

#

pretty sure List has a removeIf

hasty prawn
#

If I'm reading the docs correctly, when it recalculates the damage with the modifiers it's scales to make sure that any multiplier is preserved.

quiet ice
#

Does IntelliJ have something that is similar to Eclipse External Annotations?

#

nvm, found it.

quaint mantle
quiet ice
#

Why java 9?

quaint mantle
#

Old plugins I have from years ago, just want to compile them to use them on 1.8

quiet ice
#

It's usually either J8, J11, J16 or J17 these days

#

Oh yeah, then you have to use J8 (you can use newer, but you need to know what you are doing)

ancient plank
#

discord spacing isn't kind on my eyes

quaint mantle
quiet ice
#

Minecraft 1.8 is Java 8, same with Minecraft 1.7.10

#

There are a few forks of paperspigot that support newer java versions, but few people are likely to use those

quaint mantle
#

Everything seems to be compiling just fine with the java version set, it is just the missing library/API that I'm confused by.

quiet ice
#

what code do you have?

quaint mantle
#

Just a snippet of the area with the problem or the whole thing?

quiet ice
#

A snippet should suffice, but more is better

tender shard
#

also isn't java 9 dead since like 10 years?

#

you wish

quiet ice
#

Yeah, also give us the pom.xml or the build.gradle file, whatever applies @quaint mantle

faint aspen
#

Anyone with some worldguard expercience?
Isnt this the right way to check if a player can build in a region?

    public void onBlockBreak(BlockPlaceEvent e){
        Player player = e.getPlayer();
        if(!regionContainer.createQuery().testState(BukkitAdapter.adapt(e.getBlockPlaced().getLocation()), getLocalPlayer(player), Flags.BLOCK_PLACE)){
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.RED + "Text"));
        }
    }```
tender shard
young knoll
#

And the fact that it’s called onBlockBreak

#

But it’s a place event

tender shard
#

oh yeah

smoky oak
#

is EnderPearl damage called with the EntityDamageEvent or the EntityDamabeByEntity event? The first one right?

tender shard
#

but erm

#

does an enderpearl ever cause damage?

smoky oak
#

when it teleports you

tender shard
#

isn't that fall damage?

#

I am not sure

#

tbh idk

young knoll
#

I believe it is, yes

tender shard
#

I always thought it was fall damage

young knoll
#

So it’s the normal damage event

tender shard
#

yeah but

smoky oak
#

dammit you're right

tender shard
#

okay then

smoky oak
#

how can i get the ender pearl from that damage event

young knoll
#

You can’t

tender shard
#

it's fall damage, there is no "dameger"

#

damager

#

idk how to spell it

young knoll
#

Second is correct

tender shard
#

what do you need it for?

young knoll
#

If you want to stop ender pearl damage, use the teleport event

smoky oak
#
public class AbilityCreatePearl {
    public static void throwPearl(Player player) {
        player.launchProjectile(EnderPearl.class);
        //FIXME disable damage on teleport with THIS pearl!
    }
}
#

that

tender shard
#

ah yeah

#

just create boolean "disableFallDamage"

#

as a field in your class

#

then cancel the next damage event and reset the bool

left lodge
#

i can confirm that it infact calls EntityDamageByEntity, and you can get the ender pearl as the damager

young knoll
#

The heck

smoky oak
#

HA

#

thanks

young knoll
#

That’s weird

left lodge
#

yea it's wack

tender shard
#

nice

smoky oak
#

but it makes a weird kind of sense

young knoll
#

Because it definitely is fall damage

smoky oak
#

also it makes this so much easier

left lodge
#

the cause is still fall damage

#

like if you do e.getCause()

tender shard
#

that's weird indeed

smoky oak
#

uh oh

#

opposite problem for me now

#

how do i find out if fall damage isnt caused by an ender pearl

#

urgh i guess i can work around that

left lodge
#

what are you trying to do exactly

tender shard
#

sometimes I hate maven

young knoll
#

Gradle

#

:D

tender shard
#

I'd hate that one even more

#

lol

young knoll
#

But the files are so much shorter

tender shard
#

yeah but

#

a zip file is also shorter than a txt

#

but it's definitely not easier to read

young knoll
#

Not with that attitude

tender shard
#

D:

young knoll
#

I find gradle fine to read

tender shard
#

yeah sure, gradle is fine

#

don't wanna start a buildtools war here

#

both are fine tools

smoky oak
#

I have two tags one disabling fall damage entirely and one doing the ender pearl stuff

#

but they're not meant to be applied at once anyways so it's fine

#

the refactoring is simple too

young knoll
#

:D

smoky oak
#

just move all the code in EntityDamageEvent to EntityDamageByEntityEvent

#

and add an if to the check of the fall damage disabling tag

young knoll
#

Tags to disable certain things sounds neat

smoky oak
#

(shouldnt a ender pearl cause magic damage now that i think about it)

#

well I say tags but it's a shady backend that stores two maps, one that does a player -> group and one that does group -> tags

#

and then i check on damage if the player is in a group that has that tag

#

and disable it

crisp arch
#

hello im trying to edit the nbt of an entity with PersistentDataContainer, but every tutorial i've seen only uses PDC to store plugin data

young knoll
#

PDC does not give access to vanilla NBT tags

#

We have the API for that

crisp arch
#

really?

young knoll
#

Yes

crisp arch
#

i thought it was just pdc

young knoll
#

No

#

We have tons of methods to interface with NBT

#

Like getAttribute

crisp arch
#

is it nms?

young knoll
#

Or getHealth

smoky oak
#

almost all you need is in the spigot api

crisp arch
#

theres no way to just edit the nbt?

young knoll
#

No

#

Use the API

crisp arch
#

hm ok

smoky oak
#

guys

#

dont test damage events in creative

young knoll
#

🤔

quaint mantle
# quiet ice Yeah, also give us the pom.xml or the build.gradle file, whatever applies <@4562...
    @EventHandler
    public void onClick(InventoryClickEvent event)
    {
        if (event.getClickedInventory() == null || !(event.getClickedInventory().getHolder() instanceof BlockState))
            return;

        ItemStack item = event.getCurrentItem();

        if (item != null)
        {
            Player p = (Player) event.getWhoClicked();

            if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest)
            {

                SpellType spell = getSpell(item);

                if (spell != null)
                {
                    onSpellLearn(p, spell);

                    event.setCancelled(true);
                    event.setCurrentItem(new ItemStack(Material.AIR));

                    p.playSound(p.getLocation(), Sound.NOTE_STICKS, 0.7F, 0);
                }

            }

            if (item.getType() == Material.BLAZE_ROD
                    && (event.getClickedInventory().getType() != InventoryType.PLAYER || event.getSlot() > 4))
            {

                if (onGainWand(p))
                {
                    event.setCancelled(true);
                    event.setCurrentItem(new ItemStack(Material.AIR));

                    p.playSound(p.getLocation(), Sound.NOTE_STICKS, 0.7F, 0);
                }
            }

        }
    }
#

Error:(1114, 26) java: cannot find symbol
symbol: method getClickedInventory()
location: variable event of type org.bukkit.event.inventory.InventoryClickEvent

#

Sorry I was having dinner

quiet ice
#

Seems legit
And what is your pom.xml and build.gradle?

quaint mantle
#

Is it unusual to not have one?.. I have a .classpath, .project and a DeadLyfe.iml file. This was built so many years ago in Eclipse, back then I knew it like the back of my hand but I returned to development after 7-ish years (I have a family now!) and I forgot everything almost

young knoll
#

Not using a build tool

#

D:

quiet ice
#

Yeah, that is your issue

#

Use either maven or gradle

#

(you could use other build tools such as ant, but don't)

quaint mantle
#

How would I go about implementing Gradle?

young knoll
#

Eclipse uses ant by default

quaint mantle
#

I see, well I am using IntelliJ 2019 now

quiet ice
eternal oxide
#

no its not Ant

quaint mantle
smoky oak
#

can someone tell me how to access the minecraft server code in a readable manner?

young knoll
#

Special source remappy thing

quiet ice
#

I know that the paperweight-examples let you create a paper fork which in turn let you see the server code

#

But I think spigot also decompiles nms, so just run bt

smoky oak
#

hm

smoky oak
#

well what im trying to do is to view the nms code for respawns but when i hit f4 it just shows the constructors of the event and nothing else

quiet ice
#

Yeah, then you may want to use the paperweight-example repo and make your own paper fork

tender shard
smoky oak
#

urgh

#

cant i just view the source somewhere

young knoll
#

Alex should pay us each time we link his blog

young knoll
tender shard
#

lol

quiet ice
undone axleBOT
tender shard
#

didnt even notice you sent it

#

I was afk trying to setup the jitpack / oraxen dependency

quiet ice
#

Alternatively, go with some arbitrary outdated fork of bukkit that can still be found somewhere on github

young knoll
#

Are your plugins updated yet

eternal oxide
#

Look in the Source folder of BuildTools

young knoll
#

:D

tender shard
young knoll
#

L

quiet ice
#

Mine are luckily

young knoll
#

Sadly my next one will need some NMS

#

:c

quiet ice
#

Not using nms is so much nicer

tender shard
tender shard
smoky oak
#

@eternal oxide where can i find that?

tender shard
#

but it's not always possible

young knoll
#

I mean I could make a PR

quiet ice
#

Did you use bt yet?

smoky oak
#

ye

young knoll
#

But I don't really know the proper way to expose what I need

tender shard
#

fun fact

#

md5 never ever merges PRs

#

I once did a PR that was accepted

#

but still he didnt merge it directly

young knoll
#

Yeah he closes them and then commits himself

tender shard
#

he "accepted" the PR, but didn'T merge it and instead somehow just copy all the stuff

young knoll
#

You still get the credit though so meh

tender shard
#

I dont care about credits

#

I just added some javadoc comments

#

I still wonder why he doesnt just click on "merge"

young knoll
#

¯_(ツ)_/¯

quiet ice
#

probably some random tool breaking in the background when the commiter is not md

young knoll
#

He has made some small changes to some of mine when merging

tender shard
#

erm what even does "facet" mean lmao

smoky oak
#

are you shitting me?
the 'respawn() in human entity literally is just 'public void respawn(){}'

young knoll
#

It's an interface

tender shard
#

^

#

It is an interface

#

it doesnt implement anything

young knoll
#

Bukkit is 99% interfaces

unreal quartz
tender shard
#

I always get notified "PR denied" lol

#

when it was actually merged

young knoll
#

I think Choco has had some directly merged

unreal quartz
#

Bitbucket probably doesn't have a way to manually set a PR as merged, annoyingly like GitHub

smoky oak
#

i just want to see the algorythmus determining a player's first spawn position...

young knoll
quiet ice
#

that is nms then

smoky oak
#

thats what im doing right now but what i have found now is only the respawn with anchor or bed

tender shard
#

FOR REAL MICROSOFT CAN YOU PLEASE GET YOUR SHIT TOGETHER

young knoll
#

no

quiet ice
#

what happened?

#

Speaking of ms - I should start migrating my account

#

Eh, It probably can wait

crimson verge
#

i think the deadline is sometime early march iirc

quiet ice
#

11th march

faint aspen
#

Is there a way in spigot to get the translationkey?

crisp arch
#

hello ok so im trying to make an entity walk to a location, do i need nms or is there something in the api im not seeing

smoky oak
#

isnt there a function to set an entity's target?

crisp arch
quaint mantle
crisp arch
#

and its .attack which i dont like

quaint mantle
#

Not even abstract ones, just classes

smoky oak
#

I'm slowly growing insane here... how can i search for viable respawn locations?

lean gull
#

how do i set the player's tablist name to a custom font symbol

quaint mantle
#

Oh wait

#

Im dumb sorry

lapis lark
#

Hello! So i am using

java -jar BuildTools.jar --rev 1.18.2 --remapped

And it not generating local m2 repo 1.18.2-R0.2-SNAPSHOT. Suggestions? Or i am making something wrong

#

All works with versions below

visual tide
#

wouldnt it be 1.18.1-R0.1

lapis lark
#

Well, as i understood it is 1_18_R2 nms

#

Or i am wrong?

quiet ice
#

It's 1.18.2-R-0.1

#

There is no way that there is a second revision out already

lapis lark
#

Thank you

#

I made a little mistake 😅

#

All works now

visual tide
#

the minecraftHash in buildtool's info.json just refers to a sha256 hash of the vanilla jar right

brave sparrow
#

instanceof Projectile

#

No

#

instanceof Projectile

#

Projectile is a type of entity

#

Materials are for items

#

A shot arrow is an entity not an item

#

Projectile is a class

#

Instanceof checks a variable against a class type

#

if (event.getDamager() instanceof Projectile)

fervent gate
#
for (String s : rewardsList) {
    arr = s.split(" ");
    for(String word : arr) {
        if (word.equalsIgnoreCase("player")) {
            word = player.getDisplayName();
            arr.
        }
    }
}

How would I now change the word in arr at the same index with the variable word

brave sparrow
#

You can’t use that type of for loop

fervent gate
#

Ok

brave sparrow
#

Or I guess you could make a separate int variable and increment it

fervent gate
#

I can do with the regular one, but I wanted to try and use that type

brave sparrow
#

If you need to update the backing collection by index you’re better off using the classic for loop

fervent gate
#

Alright, thanks

lean gull
#

i wanna make a punish gui where you do /punish <player> and it opens a gui with punish details, but idk how to save the player's name for the gui, like for example how do i set the gui's name to the inputed player's name

brave sparrow
#

?jd

fervent gate
lean gull
#

yeah but the command class and gui class aren't gonna be the same

fervent gate
lean gull
#

can u even implement command executor and inventoryholder?

#

(in the same class)

fervent gate
#

I don't think you can do these 2, but you don't need to implement InventoryHolder to create a GUI

fervent gate
#

You can just create a new Inventory instance or object

old cloud
brave sparrow
#

The damaging entity cannot simultaneously be a projectile and a player

#

Instanceof

#

If it’s a player then you’re good to go, if it’s a projectile then you have to check the shooter of the projectile to see if that was a player

#

It’s not guaranteed to be

#

So that will error when it isn’t a player

#

@quaint mantle you can’t assume it’s a player

#

You never check

#

Also again, it can’t be both a player and a projectile

#

It can only be one or the other

fervent gate
# lean gull ^^^

I would not implement the InventoryHolder and just the CommandExecutor. Then create a new Inventory in that class.

brave sparrow
#

So you can’t make it a player and then check to see if it’s a projectile

brave sparrow
#

You can’t nest the instanceof player check inside the projectile check

#

But otherwise yes

#

It can’t be a player if it’s a projectile

#

Like I said

#

No

#

It can’t be both

hoary pawn
#

im trying to learn how da hell presistentdataholders work, but i cant seem to understand namespacedkeys?

brave sparrow
#

Separate if statements that aren’t nested

#

But

#

In your case

#

You just want to stop the player shooting themself

#

so you never need to worry if the damager is a player

#

You do however need to make sure e.getEntity() is a player

#

And whether the shooter of the Projectile is a player

fervent gate
#

Wasn't sure, thank you for clarifying.

brave sparrow
#

EntityDamageByEntity is called every time any entity is damaged by any other entity

lean gull
#

what's an abstract class

undone axleBOT
brave sparrow
#

You need to check that event.getEntity() IS a player before you cast it

trail pilot
#

NFTs into MC its that possible?

brave sparrow
#

You can have instanceof inside instanceof

trail pilot
brave sparrow
#

As long as they aren’t conflicting instanceof

trail pilot
#

oh

brave sparrow
#

Either one is fine

#

^

tall dragon
#

it will work fine

brave sparrow
#

instanceof returns a boolean

#

You don’t need to save it to a variable

trail pilot
#

wtf xbox want 10$ for change my stupid gamer tag lmfao

#

anyway

brave sparrow
#

No

lean gull
#

how do i make a function where it changes a hex code to have a & behind every letter

trail pilot
#

talking about NFT into minecraft how i can do?

brave sparrow
#

You can’t do Player p = (Player) getEntity() before you’ve checked to see that it is a player

tall dragon
#

and if you use a boolean, use the primitive type. no need to use the wrapper

lean gull
trail pilot
#

hmm😳

brave sparrow
#

A good variable name should basically convey enough meaning to tell someone looking at it what it’s for without reading the rest of your code

trail pilot
#

@Getter and @Setter is worth to use in plugins?

#

lombok plugin

#

ij idea is bad

tall dragon
#

Player thePlayerInsideMinecraftThatJustShotHimselfWithABowProbablyToBoostHimself = (Player) e.getEntity(); 😉

trail pilot
#

its suggest random thing lel

#

stop say no lmao

#

say again no if

tall dragon
#

alright you win

trail pilot
#

great but its a bit short

tall dragon
#

lil short tho ye

#

lmfao

trail pilot
#

damn

#

DAMN WTF

glossy venture
#

lmfao yeah

#

reminds me of this #general message

supple elk
#

Can my main have a constructor? I'd like to be able to access those variables statically

visual tide
#

ye

glossy venture
#

as long as it doesnt require parameters

supple elk
#

👍

#

actually wait, that still won't let me access those statically

visual tide
#

?di

undone axleBOT
supple elk
#

I'll have to make singletons

glossy venture
golden kelp
#

ellllo coders & not coders
I have an idea for a rest api, its a plugin cum api, so the plugin is used for data gathering and stuff and then the rest api can be accessed to use that data outside of the server, do u think its a good idea or if anyone has done it already?

trail pilot
#

?howtobebetteratcoding

#

bad bot

glossy venture
#

lmao did you look at it

golden kelp
#

oof

supple elk
trail pilot
#

so im a good dev

#

damn

#

les make a spigot 2.0

supple elk
#

and dependency injection in this instance seems quite inconvenient

trail pilot
#

i use alt + F4

#

yes and rename it!

#

😎 real devs

golden kelp
#

So do u think making a plugin which has a REST API, (the API is used outside of the server) so the server data like player data can be accessed outside of the server

trail pilot
#

papermc is sexy

#

papermcspigot 6.9

golden kelp
#

🧻

trail pilot
#

perfect

trail pilot
# golden kelp 🧻

you are an 10+ year developer how the fk abstract class should be used? 😄

golden kelp
#

did- did- you just stalk the heck out of me?

#

oh yea

#

google

#

why does no one spe;llll it right here

trail pilot
#

gitpapyhub best website

golden kelp
#

memes?

trail pilot
golden kelp
#

yea never tried to change it

#

lets do it today ig 😂

trail pilot
#

les goo

#

my github is full of random projects

#

i study this sht at school 😄

#

its really bad

brave sparrow
#

Technically it uses Arduino C

#

Which is a strange mix of C/C++ and Java

trail pilot
#

i study arduino too

brave sparrow
#

Yes but there are some differences that will get you

trail pilot
#

its cool but i dont understand nothing

#

😄

#

easy to code

#

but not the component

#

to die*

#

good

#

im still wating to learn java at school

#

sherlock ??

#

damn bro i thought you dead

#

they gonna teach me how to ctrl + c and ctrl + v

#

that crazy bro!

river oracle
#

Teach yourself Java

brave sparrow
#

They teach you more than some of the people who ask questions in here know

trail pilot
brave sparrow
#

Source: have taught intro Java courses

trail pilot
#

i dont get it

trail pilot
tall dragon
brave sparrow
trail pilot
#

thanks i love you for that suggest!

trail pilot
#

lel

brave sparrow
#

What?

#

Is your school a high school or a university lol

river oracle
trail pilot
#

googled

#

:D

maiden thicket
#

java? whats that? a drink?

brave sparrow
#

That still does not do what you want, no

maiden thicket
#

whats this string you all speak of? i dont sew