#help-development

1 messages · Page 1668 of 1

waxen plinth
#

It can't contain duplicates

winged anvil
#

hmmmmm

#

i like hat

waxen plinth
#

And it can do contains in O(1)

winged anvil
#

that

waxen plinth
#

Meaning it takes the same amount of time no matter how much stuff is in there

eternal oxide
#

You shoudl be using a path not SpawnPoints:

#

just SpawnPoints

lean gull
#

dumb question: how do i fix this?
} else if (arguments[1] == null) {

waxen plinth
#

srjlfgbflgfsbflbjgfbljgfsbl

quaint mantle
#

guys but 8/2 not equals 0

waxen plinth
#

Are you trying to check if the first argument exists

winged anvil
#

LMFAO

waxen plinth
#

Oh my god

quaint mantle
#

yes i know

#

Oh my god this channel sucks

#

you just said

waxen plinth
#

So what is your point

quaint mantle
#

numb % == 0

waxen plinth
#

% is not division

winged anvil
#

remainder

waxen plinth
#

And I said num & 1 == 0

eternal oxide
#
@SuppressWarnings("unchecked")
List<Location> locs = (List<Location>) getConfig().getList("test");```
quaint mantle
#

alright

lean gull
#

so no?

waxen plinth
#

.-.

winged anvil
#

what does that annotation do ?

waxen plinth
#

So what the hell are you trying to do

#

Why would the argument ever be null

lean gull
#

fix error

winged anvil
#

supporess the warning i guess

#

lmao

waxen plinth
#

Oh great

lean gull
#

remember from like a few hours ago?

waxen plinth
#

That really clarifies it

lean gull
#

the bound thing

waxen plinth
#

Yeah you need to check that the array has enough elements

winged anvil
#

lmao

quaint mantle
#

Talk 🧱

lean gull
#

what array

waxen plinth
#

if (arguments.length >= 2)

winged anvil
#

LMAO

#

ok

waxen plinth
#

I'm done

#

God

winged anvil
#

no fuckin way

quaint mantle
#

?learnjava @everyone

undone axleBOT
waxen plinth
#

Can anyone asking for help please have more than 5 brain cells

lean gull
#

i got 2

winged anvil
#

cmon ok I just didnt know what HashSets we're

#

i feel like thats not THAT bad

lean gull
#

wait so what do i do im confusion

quaint mantle
#

its the fsct you didnt know how to call #contains

waxen plinth
#

You were iterating over an entire list to check if it contained something

waxen plinth
#

Then come back to plugins

lean gull
#

anyone help? anybody?

waxen plinth
undone axleBOT
lean gull
#

anybody?

quaint mantle
waxen plinth
#

Is there an emoji for banging your head against a wall

#

Oh this one's perfect

#

Nevermind

paper viper
#

wait how do i

waxen plinth
#

Ask for help

#

Quick

paper viper
#

how do i sysout agian

#

I have

quaint mantle
#

how to take user input

waxen plinth
#

😩 🔫

paper viper
#

System.out.printIn

#

but it not work

eternal oxide
#

@lean gull java if (args.length != 2) { if (args.length < 2) player.sendMessage("Too few"); if (args.length > 2) player.sendMessage("Too many"); return; } //rest of code for two args here.

waxen plinth
#

Try running System.exit(100); before running System.out.println

paper viper
#

Wait what does dat do

waxen plinth
#

Fixes your code

#

Magically

paper viper
#

Ooo

#

finally i dont need dumb IDE

quaint mantle
#

System.out.print("Hi");
System.out.print("Bye");

Why it on same line.

waxen plinth
winged anvil
#
public boolean alreadyAdded(Location location) {
        @SuppressWarnings("unchecked")
        List<Location> locs = (List<Location>) SpawnPoints.getFile().getList("test");
        return locs.contains(location);
    }
```better !?!?!?!?!!?
waxen plinth
#

No

winged anvil
#

ok

waxen plinth
#

You should load it in as a HashSet

quaint mantle
#

not using a set

waxen plinth
#

And then check contains using that

winged anvil
#

thats what elgar sent me

waxen plinth
#

Actually for HashSet you wouldn't even need to check contains

winged anvil
#

ok

waxen plinth
#

It just can't contain duplicates

winged anvil
#

one moment i will google

eternal oxide
#

That code I sent is to load the List from config. You should be keeping the list in memory and not loading it every time

waxen plinth
#

Config should keep it loaded in memory

#

But you should still keep it loaded as a HashSet

eternal oxide
#

yep

quaint mantle
#

when an event happens it goes through the plugin code first before the game right?

#

chatroom

eternal oxide
quaint mantle
#

hmm, then how can i get the bee to not lose it's stinger in the EntityAttackedByEntity event since it is cancellable but i still want the bee to do damage

eternal oxide
#

apply the damage yourself and cancel the event

quaint mantle
#

hmm, ok, i'll try that, ty

#

Hello is there any way to check if number is usable
example:
when i type number 1 in chat i can't type it again i can use other numbers 2 , 3 ,4 etc..
the same thing when i type other number so i can't type it anymore again

#

is there anyway to do that

#

I’d say use a set to track numbers used, sets don’t allow duplicates

waxen plinth
#

^

winged anvil
# waxen plinth ^

thank you for the lesson on HashSets, I was previously using ArrayLists and creating methods to check if locations we're in that list, as previously seen

#

it has been converted

waxen plinth
#

Good

quaint mantle
#
class PlayerNumberChatHandler implements Listener {
    private final Map<UUID, Set<Integer>> playerData = new HashMap<>();

    @EventHandler
    // if the player is registered, handle it
}
waxen plinth
#

computeIfAbsent is OP here

#

Instead of doing playerData.get(uuid) you can do playerData.computeIfAbsent(uuid, k -> new HashSet<>())

quaint mantle
#

if they dont want to register them manually

waxen plinth
#

Yeah

crude sleet
#

Is there a way to move the passenger above the player head? At this point my Amorstand is in my head xD [ImageLink:] https://ibb.co/0JxjX32

#

If I make the armorstand big, the name is too high up, the name of the armorstand should be a little above the head

paper viper
#

^

worldly ingot
#

Multimap<UUID, Integer> playerData = MultimapBuilder.hashKeys().hashSetValues().build();

quaint mantle
#

how do i save data in an entity? like an nbt tag or something

waxen plinth
#

You can do that with PDC

#

Or with tags

#

Or with the scoreboard

quaint mantle
#

pdc?

waxen plinth
#

Take your pick

#

PersistentDataContainer

quaint mantle
#

hmm, i think i'd rather do tags

waxen plinth
#

Mmk

quaint mantle
#

but i'm not really sure how i'd add tags to entities

#

like from the plugin

waxen plinth
#

addTag

#

getTags

#

Or is it addScoreboardTag

#

I forget

#

Yeah it's addScoreboardTag

#

And getScoreboardTags

quaint mantle
#

uhm..... uhhhh ok, maybe i shouldve checked that seems simple enough 😅

#

thanks

waxen plinth
#

👍

subtle kite
#

How can I work with Tab?

#

Like the player list.

waxen plinth
#

Player#setPlayerListHeaderFooter(String, String)

real spear
#

Why wont this return ¯\_(ツ)_/¯

#

I get ¯_(ツ)_/¯ instead

subtle kite
#

you have 2 \

#

on the arm

#

and in java \ is a function or something

real spear
#

"Illegal escape character in string literal" is what it says when I have 1

subtle kite
#

¯_(ツ)_/¯

#

I wonder if you can like "¯ + "" + "(ツ)/¯"

#

or something

real spear
#

Tried that...

worldly ingot
#

In theory, that should work fine. Do you have a chat plugin by chance? Possible that it's replacing the escape character and treating it as its own escape character

#

(in which case you can do \\\\ to prevent that but still sloppy)

#

If you were to print the result of your replaceAll("(?i):shrug:", "¯\\_(ツ)_/¯") it would print out properly

#

For instance,

real spear
#

Yes, but ig Purpur decides that it wants to be special...

#

Lemme try that fix rq

worldly ingot
#

👍

torn oyster
#

do display names show up in death messages by default

#

@worldly ingot sorry for ping

#

do u know

quaint mantle
#

does anyone kno how to remove the item stats

#

on generated items in inventories

#

i.e the +4 attack etc

worldly ingot
#

Actually don't know, lach

hasty prawn
#

Are you opening it at the bottom of all that

quaint mantle
#

i'm scared bc i already have a few made without thinking about it but, is there a way to get a player head model with a plugin without the player having the same skin on? Since the designs still stay even when i change my skin is it saved somewhere where i can access them?

echo basalt
#

but breaks creative mode

#

probably

#

which is removing the data when sending it to the client

quaint mantle
echo basalt
#

but that's last case

quaint mantle
#

or is it just one of those things u live with

echo basalt
#

no one knows what happens behind the scenes at hypixel

#

but I believe they mess with client-side lore

#

just because lore stuff updates when you go across lobbies

#

and also because adding lore to all items is pain

#

so they might do that too

#

it's quite simple to do with protocollib

quaint mantle
echo basalt
#

mojang texture data

#

use gameprofiles and whatever

#

and services like mineskin.org if you want to upload permanent skins

#

basically there's a texture id (uuid), data and signature (base64 strings)

#

toss them on a gameprofile and you have a skin

#

you can then use some hacky reflections or nms to apply it to an itemstack

quaint mantle
#

oh man, i don't think i understand these terms 😓 😅

echo basalt
#

it's like 5:15AM I can't bother explaining them either

quaint mantle
#

oh, well thanks for giving me an idea of where to start

echo basalt
#

just look into how npcs store skin or something

#

and then look at custom textures for skulls

#

should be enough

quaint mantle
#

alrighty, will do

rustic gale
#

How do I remove the block placed in BlockPlaceEvent? Setting the block to air wouldn't work cause I am checking if the block is a bed and then deleting it. since the bed is 2 blocks and I don't know the direction on which it is facing, setting 1 block to air wouldn't. work

young knoll
#

Why not cancel the event

rustic gale
#
 public void onBlockPlace(BlockPlaceEvent event) {
        if (event.getPlayer().getWorld().getEnvironment() == World.Environment.THE_END) {
            if (String.valueOf(event.getBlock().getType()).contains("_BED")) {
                event.setCancelled(true);
            }
        }
    }
#

would this work?

young knoll
#

Yes

quaint mantle
#

i now have the url, but i can't use it in Skull.getCustomSkull() since it's deprecated, and i think i have to use the Material class but i only see enums there and i'm not sure where to use the url

young knoll
#

There are several tutorials on how to make a skull with a URL

prime reef
#

how memory intensive are Spigot AI methods?

waxen plinth
#

You mean setTarget?

#

I'm not even aware of any others

prime reef
#

that is, let's say I switch off mob AI and use spigot methods to "simulate" AI independent of server version, as well as implement additional functionality (skill use, behavior statemachine, etc.)

#

setTarget is the only one I can think of offhand, yeah

#

damn, wish Spigot had more support for AI manipulation. using NMS is a pain.

waxen plinth
#

You could open a feature request

quaint mantle
#

is there a way to get a wool material

#

from a Color object

prime reef
#

and it's complex

#

at the same time, I do think it'd get a fair bit of use

waxen plinth
#

Then open a feature request

prime reef
quaint mantle
#

if a teams color is red i want their wool to turn red

#

i want to set the itemstack when they purchase wool

prime reef
quaint mantle
#

yea

#

chatcolor/color

#

because leather dye is different

#

in looks

prime reef
#

i don't think chatcolor maps directly to dye color but you could write something to map to it

quaint mantle
#

ye was hoping tehre was a cheekier way but thats probs it

prime reef
#

i mean if you REALLY wanted to

#

you could do something silly with names, but ChatColor only has some overlap with DyeColor

#

it'd be more consistent to just set it manually I think

quaint mantle
#

that didnt work

#

haha already tried

#

yeah

prime reef
#

once you've got your dye color, just java new Wool(dyeColor).toItemStack();

quaint mantle
#

its all materials now isnt it

#

ohhh

#

i see

#

ty

prime reef
#

ye ofc

#

I think you can also do Materials

#

I might be a bit behind on the version

#

okay so I searched through the Jira to see if anyone had made similar suggestions and came to 3531

worldly ingot
#

You would have to map ChatColor to Material

#

That's something you can map manually yourself in an immutable Map and reference as necessary

prime reef
#

that's pretty much what I said, albeit with DyeColor rather than Material

worldly ingot
#

Yeah, whatever you want

prime reef
#

but yeah, good clarification

worldly ingot
#

There are ImmutableMaps from Guava, unmodifiable Maps from RT Collections, PES_SadShrug Make a constant

#

ez pz

prime reef
#

Or just use a regular HashMap and set it to private

worldly ingot
#

Well, yeah, private static and final, but as far as best practice is concerned it should also be an immutable Map

#

Also, the Wool class you mentioned above is pre-1.13 MaterialData which is all deprecated now

prime reef
#

okay yeah so I'm out of date

#

you definitely want to use Material

worldly ingot
#

So if they're working in 1.7 - 1.12 or whatever, that's the right approach

prime reef
#

unless you mean immutable keys

#

in which case yeah

worldly ingot
#

Not necessarily true. If you expect to have a map that doesn’t change it should be declared as immutable

#

Can use an EnumMap if you want but you can still change it privately

prime reef
#

should probably clarify that I despise Java, most of the work I do is in C# for game dev and the idea of having to import some library just to meet basic general best practices (not even company-specific) is infuriating

#

like, .NET has that shit built in

#

but that's entirely a personal gripe

worldly ingot
#

Guava is provided by Bukkit already so it’s available at runtime

prime reef
#

oh, is it? that's not so bad then

worldly ingot
#

Or Java’s SDK has an umodifiable collection/map wrapper as well

prime reef
#

I know a guy who shades the entirety of Hikari SQL into his plugin and uses it exactly once

#

It's that kind of thing that has me tearing my hair out over Java culture lmao

#

yeah Java has Unmodifiable versions of some of the collection classes

worldly ingot
#

Yeah, depends on how frequently connections are required

prime reef
#

using an unmodifiable collection for something that should absolutely never be modified at runtime is preferable ofc

#

That actually brings me to something that's been nagging at me - so with the plugin I'm writing, I want to be able to modify certain collections at runtime but return immutable copies of them for other classes to read

#

but the only solution i've got offhand is:

#
  • set a flag whenever the original collection is modified (done through methods)
  • when the collection is requested, regenerate the unmodifiable version if that flag is set, and return the unmodifiable version regardless
#

this is probably just the remainder of college brain doing microoptimizations though

#

the issue i was thinking of was that I didn't want to create a new immutable collection every single access lmao

worldly ingot
#

Nah you're fine. The GC will toss away the instances once the caller's done with them

#

It's not like you're allocating any more memory at all. Just a new pointer to the underlying collection is all and those get cleaned up quickly

#

Obviously make it immutable/unmodifiable if you can on instantiation but if you intend on changing it and just returning a copy, you're fine. No harm in that

prime reef
#

if it's just a new pointer that should be good then, nice

#

thanks, now I can stop worrying I've written something horrific LOL

worldly ingot
#

Java’s inbuilt ones literally just wrap whatever collection you pass to it and delegate it’s calls

#

(Excluding the remove/add calls or whatever in which they throw an exception, obviously)

prime reef
#

alright that makes a lot more sense

#

Does...does Spigot only have the one developer, or is the staff page outdated lmao

worldly ingot
#

Just the one maintainer yes. Though lots of independent contributors

prime reef
#

Alright, looking into the stash rn

waxen plinth
#

Wait you hate java cause you thought it didn't have immutable collections?

prime reef
#

no, I hate java because of the culture around it

waxen plinth
#

What's that

prime reef
#

"how do I [perform single task]"
"import [8 libraries]"

waxen plinth
#

Oh

#

I never found it to be like that

prime reef
#

enterprise java is the single worst thing in software engineering

waxen plinth
#

That's js if you ask me

#

The libraries I mean

prime reef
#

really? most java developers I meet outside of Spigot have been like that

waxen plinth
#

I tend to use very few libraries except my own

prime reef
#

I'm also like that, unless it's something integral to whatever I'm writing, like I'd rather use an SQL library for something heavily focused on SQL

waxen plinth
#

I have my own sql wrapper

prime reef
#

and like I use my own library for plugin development because it streamlines a lot of the annoying boilerplate stuff

waxen plinth
#

I love writing my own libraries

prime reef
#

i'm very glad I wrote mine lmao

#

it's open source but sort of bad so I don't expect anyone else to use it

waxen plinth
#

Especially commands can be super verbose and awful

prime reef
#

recently went and did something to build commands into a tree

waxen plinth
#

Mine is also FOSS if you want to check it out

prime reef
#

I have a feeling we've had a similar convo in the past considering we're friends on discord

waxen plinth
#

I don't recognize you

prime reef
#

yes, this is the same library I remember

#

you were the guy with the command annotations

waxen plinth
#

Hm

prime reef
#

unless my admittedly terrible memory is failing me again

waxen plinth
#

I wouldn't describe it as annotation driven

#

It does use annotations though

#

There are command frameworks built entirely on annotations

#

Mine is done primarily through a file in a custom format

prime reef
waxen plinth
#

Separates command structure from implementation

prime reef
#

Ah yes. github embeds. hang on.

waxen plinth
#

That's the most basic type of command framework I tend to see

#

Delegation, basically

prime reef
#

elaborate a bit?

waxen plinth
#

You still have to handle the args as a String[]

prime reef
#

only thing I did was write a node for a tree structure

waxen plinth
#

Yeah

#

With mine, you essentially just write and annotate a regular method taking the actual types you need

prime reef
#

and the sole reason for that was so I could write 800 subcommands without having to manually go and parse which argument goes where in the parent node

waxen plinth
#

It supports optional arguments, automatic sender and permission checks, context assertions and arguments, flags

#

Advanced command frameworks save a lot of time

#

Mine is not the only one with these features

#

It's mostly the way you use them that is different

#

I see 3 main styles

#

The first is yours

#

Simple format where you extend a command class

#

The second is annotation based

#

The third is builder based

prime reef
#

personal opinion is that none of those are objectively better than the others

waxen plinth
#

It's preference

prime reef
#

pretty much depends entirely on preference, yeah

waxen plinth
#

The first is the most limiting though

#

As you can't really convert arguments

#

I haven't seen another that works like mine, which is using a command file to determine the structure and hooking into annotated methods

#

But that's preference too

#

I just like it

prime reef
#

I honestly wouldn't use something like that, and that's because the plugin I'm working on has a module system where people can write their own commands

#

among other things

waxen plinth
#

Builder style is probably best suited to that

prime reef
#

mind explaining builder style a bit?

waxen plinth
#

You know the builder pattern?

prime reef
#

probably not, refresh my memory

waxen plinth
#

Cloud command framework is builder based

#

It's like

#

new SomethingBuilder().property(value).property(value)...build()

prime reef
#

to be fair I did sit down and hammer this out in like an hour because I needed the functionality quickly LOL

#

oh that

#

so how do people commonly extend that to commands?

waxen plinth
#

Not sure exactly how it works

prime reef
#

builder pattern is great for vectors, messaging, etc. but

waxen plinth
#

Take a look at cloud if you wanna know

prime reef
#

the only thing I'm particularly interested in is that I can specify the parent command and it automatically builds the command tree on launch

waxen plinth
#

I just don't like builder and annotation because they're inefficient

#

In terms of code I mean

#

Much of what you're expressing is effectively metadata

#

Expressing it in your code can be very verbose

#

Expressing it in a custom format designed for it, much less so

prime reef
#

that's pretty much it, yeah, and that's why pretty much everything I write is designed to cut down on the amount of code I have to write

waxen plinth
#

If you're ever interested in trying out my framework let me know

#

As far as minimizing code to implement commands goes I don't think there is a better framework

prime reef
#

I most likely won't, since I've already built a large plugin using mine lmao

#

but I may have a look to see where I can improve things

waxen plinth
#

Want the wiki link?

prime reef
#

not gonna bother explaining what mine does, there's a readme for it

#

already got it, dw

waxen plinth
#

Mmk

#

If you want to use your own I would recommend stepping it up

#

Make it convert arguments

#

That's the single biggest step that saves you the most grief

#

And it's fairly easy to add tab completion once you get there

prime reef
#

convert arguments as in...player names to Player instances?

waxen plinth
#

Tab completion is something I would never bother with when I was doing commands the old way

prime reef
#

ah alright

waxen plinth
#

And custom conversions too

prime reef
#

yeah I've already got something like that for config

waxen plinth
#

Let the plugin supply a converter for a type

#

Great

prime reef
#

though granted

#

I actually just do it reflectively lmao

waxen plinth
#

And from there you can easily let it supply a tab completer for that type

waxen plinth
prime reef
waxen plinth
#

My command framework is reflective, same with my config manager

#

Has to be when working with annotations

prime reef
#

ah alright so you're not using some Java 8 converter pattern

#

cool

waxen plinth
#

Reflection is beautiful

#

What do you mean java 8 converter pattern

prime reef
#

y'know how you can feed in lambda functions into streams?

waxen plinth
#

My command manager lets you provide lambdas

#

Yeah

#

My config manager reflectively instantiates objects and populates their fields from config

#

My command manager only uses reflection to fetch and invoke methods

prime reef
#

basically when writing a converter, you either write some explicit converter bs or you just use reflection

waxen plinth
#

Ah yeah

#

With my config library you either provide a lambda to convert to and from string

prime reef
#

and frankly the former is a pain in the ass and nobody can read it at the end of the day unless they have their head so far into the streams API that they make lambda functions in alphabet soup

waxen plinth
#

Or you use a class annotated with @ConfigMappable whose fields are annotated with @ConfigValue if they have to be saved/loaded from config

prime reef
#

p much the meat and potatoes of it

#

oversimplified example

waxen plinth
#

Lambdas and streams are amazing

#

They're one of my favorite java features

prime reef
#

I enjoy them, but some of the patterns that have sprung up as a result are...irritating lmao

#

if you use them like a normal human being, they're great

waxen plinth
#

Like what

prime reef
#

ever seen someone try to use the factory pattern to make predicates?

#

software gore

waxen plinth
#

Okay yeah that's ugly

prime reef
#

factory pattern in general is one of the worst things I've ever seen

waxen plinth
#

But streams are really powerful and great for reducing code

prime reef
#

I've tried so hard to find a use for it

#

I just can't

waxen plinth
#

Same

prime reef
#

Like. What benefit does it offer over just writing your code like a normal person?

#

Every example I see is like "you can use the factory pattern to generate shapes from a string!" or something

waxen plinth
#

AbstractIntegerFactoryControllerObserverStrategy

prime reef
#

LMAO

#

and it just returns 3

#

no comments

waxen plinth
#

👍

prime reef
waxen plinth
#

Seen it

#

Love it

prime reef
#

i love that they've continued to work on it and implemented spring and gradle for no reason whatsoever

#

@quaint mantle i see you typing smh

waxen plinth
#

Gradle is amazing

#

One of my favorite things about java development

prime reef
#

i'm stuck with maven for spigot, but I use gradle when I can

waxen plinth
#

Why are you stuck with maven

#

I use gradle

quaint mantle
prime reef
#

nah we're just bullshitting

#

dw

#

ask away

quaint mantle
#

ooh ok, soo in the EntitySpawnEvent how can i check if it was spawned with a named spawn egg?

prime reef
quaint mantle
#

if it's possible

waxen plinth
#

SpawnReason maybe?

waxen plinth
quaint mantle
#

Hmm but that'd be an enum wouldn't it?

prime reef
# waxen plinth What's that

basically I just push my library to a maven repo and the other plugin i'm working on automatically pulls it

waxen plinth
#

Then check if it is named

prime reef
#

and I don't have to pay for a repo or anything, github gives you some limited hosting options

waxen plinth
#

I just use jitpack

prime reef
#

jitpack WOULD NOT work for me. not sure why

waxen plinth
#

Are you using spigot or spigot-api

quaint mantle
#

spigot server and plugin*

prime reef
#

you can certainly get the spawn reason

waxen plinth
#

And then check if it's named

prime reef
#

but I think rather than using entityspawnevent

waxen plinth
#

Anh are you using spigot or spigot-api

prime reef
#

what you should do is check for the event where the spawn egg is used instead, since there's no real way to tell from the fields in entityspawnevent

#

me? spigot

#

wait

#

what context?

waxen plinth
#

That's why jitpack won't work then

#

In your pom

prime reef
#

OH

quaint mantle
prime reef
#

Alright, yeah, that's why.

waxen plinth
#

Has to be spigot-api

#

Use that

prime reef
#

There any significant difference between the two?

prime reef
waxen plinth
#

Spigot-api does not

prime reef
#

that's gonna be it then

waxen plinth
#

Spigot is the entire server jar

prime reef
#

that's good to know actually

waxen plinth
#

But it only comes from your m2 cache

#

It's added when you run buildtools

#

But jitpack doesn't have that cached

#

So you have to use spigot-api

#

Either that or somehow run buildtools as part of your build

quaint mantle
#

mmm okay, i'll try and see if i can check with the spawn egg used and see if it's easier

prime reef
#

speaking of NMS, I want to absolutely gut mob AI

#

it's hands down the worst design i've ever seen

waxen plinth
#

👀

#

I haven't looked at it

prime reef
#

are you vaguely familiar with PathfinderGoals?

waxen plinth
#

I try to steer clear of nms for the most part

#

Yes, vaguely

prime reef
#

vaguely is all you need

#

basically, when writing entity AI in the game I'm working on, I used a finite state machine

#

which also worked for movement

#

top left corner - whole thing is managed by a state machine

#

very clean and nice, lets you handle behavior in specific situations

#

ironically one of the few times inheritance is rock-solid as well

#

I actually use inheritance pretty regularly but i'm old fashioned

#

without going on a tangent, though, pathfindergoals are basically just setting a list of goals/priorities for an entity, and they're phenomenally stupid, because they rely so heavily on inheritance that trying to use them outside of the entities they're "supposed" to be used on just flat out doesn't work

#

"PathfinderGoalFollowOwner" won't work if it's not an instance of EntityTameable

waxen plinth
#

Hmm

#

Seems like it should just be follow

prime reef
#

for entities you want a component system

#

yeah no

waxen plinth
#

Not follow owner

prime reef
#

it's only FollowOwner

#

that's how dumb it is

waxen plinth
#

I gotta get to sleep

#

Been nice talking

prime reef
#

Spigot uses interfaces to an extent (Ageable, etc.) but it can't compensate for how Minecraft itself was written lmao

#

I should probably sleep as well, mb

waxen plinth
#

Gnight

prime reef
#

night lmao

burnt current
#

Hey, quick question: If you apply different patterns to a banner, the respective patterns are displayed in the item list of the banner. Is it possible to remove this itemlore and replace it with another one?

quasi flint
#

What packet do i have to send, to make my npc hittable?

#

have been searching the wiki for some time now

#

packets

burnt current
#

so i tried with the itemstack itself and with the banner meta (respectively the variables i saved it in) and it doesn't seem to exist there

#

Ok too bad but thanks anyway

lean gull
#

can anyone help?
errpr: Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getWorld()" because "this.player1" is null
field: private Player player1;
method for getting player:

    public void gamerulesGetPlayer(Player player2) {
        player1 = player2;
    }```
and finally, where the error comes from (there's another line simillar to this in this class):
`else if (player1.getWorld().getGameRuleValue(GameRule.ANNOUNCE_ADVANCEMENTS).equals(false)) {`
#

no i have

#

it's after the method

#

and the method is after the field

opal juniper
#

bruh

#

just cause you coded something after something else

#

that’s not the error

lean gull
#

what is the error then

chrome wagon
#

I also have a error, I updated my Java to a new headless JRE for Java 16. I also updated spigot to 1.7.1 and BuildTools. My error is it doesnt start.

opal juniper
#

the error is, like golden stack said, you are calling methods in the wrong order most likely so it has not been defined

lean gull
#

what do i do then?

chrome wagon
#
ubuntu@ubuntu:~/minecraft$ java -jar -Xms4096M -Xmx4096M spigot-1.17.1.jar
Loading libraries, please wait...
[08:12:10] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[08:12:13] [main/INFO]: Reloading ResourceManager: Default, bukkit
[08:12:19] [Worker-Main-4/INFO]: Loaded 7 recipes
-SKIP LINES-
[08:12:28] [main/INFO]: [STDERR]:       at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:311)
[08:12:28] [main/INFO]: [STDERR]:       at net.minecraft.server.Main.main(Main.java:222)
[08:12:28] [main/INFO]: [STDERR]:       at org.bukkit.craftbukkit.Main.main(Main.java:206)
[08:12:28] [Thread-2/INFO]: Stopping server
[08:12:28] [Thread-2/INFO]: Saving worlds
[08:12:28] [Thread-2/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved
chrome wagon
opal juniper
#

maybe try rebuilding with buildtools?

lean gull
#

can anyone help with my issue too please?

opal juniper
chrome wagon
lean gull
#

he said to print it out when i see it

opal juniper
#

yep

chrome wagon
#

I completely look over the STDERR

lean gull
#

i have no clue what that means

#

o ok

chrome wagon
lean gull
#

ouch

opal juniper
opal juniper
lean gull
#

i put the get player thing before it and it still dunt work

chrome wagon
opal juniper
opal juniper
#

?paste

undone axleBOT
chrome wagon
lean gull
#

no thanks, i like my code not stolen

#

this took me like an hour to make and it's a gamerules gui so people might actually want it

opal juniper
#

whatever

narrow furnace
chrome wagon
#

LMAO

opal juniper
#

xD

lean gull
#

no one wants to be your friend LMAO

#

real funny

#

soo can anybody be helpful here or like nah

opal juniper
#

we want to help you

lean gull
#

clearly

opal juniper
#

and have been trying

lean gull
#

golden, please, shut up.

#

thank you

#

im gonna try to make it in the same line

opal juniper
#

buenny

lean gull
#

what

opal juniper
#

when it says that something isn’t defined

#

it means that you haven’t set it to anything

#

eg

lean gull
#

i have, it's just that it's not in the same line

#

i think that's the problem

opal juniper
#

you have the “private Player player1”

#

but you haven’t assigned to it

lean gull
#

i have, in gamerulesGetPlayer()

chrome wagon
#

When in doubt print it out, just debug your code by printing player 1

opal juniper
#

yes but you may be calling that after the other method meaning that it errors - the jvm don’t lie

lean gull
#

this is the thing in the command

        GamerulesGUI gui = new GamerulesGUI();
        gui.gamerulesGetPlayer(player);
        player.openInventory(gui.getInventory());```
opal juniper
#

ok…

lean gull
#

what do i print

opal juniper
#

can you show us again what was in gamerulesGetPlayer

#

hm

chrome wagon
#

[INFO] Reactor Summary:
[INFO]
[INFO] Spigot-API 1.17.1-R0.1-SNAPSHOT .................... SUCCESS [ 35.410 s]
[INFO] Spigot-Parent dev-SNAPSHOT ......................... SUCCESS [  0.037 s]
[INFO] Spigot 1.17.1-R0.1-SNAPSHOT ........................ SUCCESS [02:57 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:33 min
[INFO] Finished at: 2021-08-29T08:22:27Z
[INFO] ------------------------------------------------------------------------

#

getting closer :)

#

gonna try re-launching

#
ubuntu@ubuntu:~/minecraft$ java -jar -Xms4096M -Xmx4096M spigot-1.17.1.jar
Loading libraries, please wait...
[08:24:12] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[08:24:15] [main/INFO]: Reloading ResourceManager: Default, bukkit
[08:24:20] [Worker-Main-4/INFO]: Loaded 7 recipes
[08:24:28] [main/INFO]: [STDERR]: java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-16-openjdk-arm64/lib/libawt_xawt.so
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2387)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.lang.Runtime.load0(Runtime.java:746)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.lang.System.load(System.java:1857)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:310)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:280)
#
[08:24:28] [main/INFO]: [STDERR]:       at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:280)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2392)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:808)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.lang.System.loadLibrary(System.java:1893)
[08:24:28] [main/INFO]: [STDERR]:       at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1389)
[08:24:28] [main/INFO]: [STDERR]:       at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1387)
[08:24:28] [main/INFO]: [STDERR]:       at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
[08:24:28] [main/INFO]: [STDERR]:       at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1386)
[08:24:28] [main/INFO]: [STDERR]:       at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1419)
[08:24:28] [main/INFO]: [STDERR]:       at java.desktop/java.awt.Component.<clinit>(Component.java:622)
[08:24:28] [main/INFO]: [STDERR]:       at net.minecraft.server.dedicated.DedicatedServer.bh(DedicatedServer.java:524)
[08:24:28] [main/INFO]: [STDERR]:       at net.minecraft.server.Main.lambda$1(Main.java:234)
[08:24:28] [main/INFO]: [STDERR]:       at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:311)
[08:24:28] [main/INFO]: [STDERR]:       at net.minecraft.server.Main.main(Main.java:222)
[08:24:28] [main/INFO]: [STDERR]:       at org.bukkit.craftbukkit.Main.main(Main.java:206)
[08:24:28] [Thread-2/INFO]: Stopping server
[08:24:28] [Thread-2/INFO]: Saving worlds
[08:24:28] [Thread-2/INFO]: ThreadedAnvilChunkStorage: All dimensions are saved
ubuntu@ubuntu:~/minecraft$
lean gull
#

yeah i don't think i'll be getting help anytime soon, i'll skeddadle for now

opal juniper
#

without more context buenny it is hard to know what the issue is

#

idk where you are calling getWorld to cause that error

lean gull
#

bro it's in the first message what do you mean

chrome wagon
#

what version of java do you folks use? Im getting the error with java-16-openjdk-arm64

lean gull
#

?

#

idk i closed intellij

#

anyways yall are toxic baiiii

eager valley
#

hello

#

i need help

#

idk which is better

#

spigot or bungeecord

#

i want to make multiple servers

chrome wagon
quasi flint
#

they are both totally sperate things

chrome wagon
#

would that matter?

quasi flint
#

u need spigot and bungeecord for a server with multiple servers to work

#

bungeecord is the "link" between it

eager valley
opal juniper
quasi flint
#

gimme a sec

#

oh ok

eager valley
quasi flint
#

lemme find smth more

eager valley
#

like

#

is there like just a easier way?

quasi flint
eager valley
#

like just a text tutorial, im too lazy to watch and my eyes are burning like hell

quasi flint
#

maybe a voice tutorial will serve better

#

then the first link

eager valley
#

ohgay

chrome wagon
opal juniper
#

@chrome wagon don’t bother

#

i asked the paper dudes

#

they said it’s ur java install

#

did you install headless?

chrome wagon
#

fgured

#

yes

opal juniper
#

oh

#

no

eager valley
opal juniper
#

you need the normal one

opal juniper
#

apparently

quasi flint
#

its a standalone communication server

#

hope that makes sense

chrome wagon
#

im on a PI without screen so i figured headless I can do another one

#

do you know the name of the working one?

opal juniper
#

ummm err

#

one sec

eager valley
quasi flint
#

read my links please

eager valley
#

"manually"

quasi flint
#

i gave enough examples

eager valley
quasi flint
eager valley
opal juniper
eager valley
opal juniper
#

i don’t use linux xd

quasi flint
#

bruh

#

thats not how that works

opal juniper
#

wait @chrome wagon

#

i have one idea

eager valley
#

its so confusing

quasi flint
#

Its a standalone communication server

opal juniper
#

try adding —nogui to your start file

quasi flint
#

like a bridge

opal juniper
#

as the command to start the server

quasi flint
#

between the two servers

chrome wagon
#

ty

eager valley
quasi flint
#

please read the conversation we had from start to finish

#

and READ THE LINKS

eager valley
#

its simple as that 🤣

quasi flint
#

It´s useless when u dont understand that those things do

quasi flint
eager valley
#

now...one more question

#

how to make multiple server using spigot?

quasi flint
#

oh lord he comin

quasi flint
#

XD

eager valley
chrome beacon
#

It's not

quasi flint
#

ITS A STANDALONE SERVER

narrow furnace
#

why do you not read the links?

quasi flint
#

FOR CUMMUNICATION

narrow furnace
#

im confused

quasi flint
#

caps lock hittin different

eager valley
narrow furnace
#

have you clicked any?

quasi flint
#

well than good luck

#

i wont help u

eager valley
grim ice
#

didn't think you're a clown

#

nice talks behind people back

narrow furnace
#

we wont give you help if your lazy

#

which u are

#

so bye

quasi flint
#

if u want to understand yea true

chrome wagon
#
ubuntu@ubuntu:~$ java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 16.0.1+9-Ubuntu-120.04, mixed mode, sharing)
ubuntu@ubuntu:~$

quasi flint
#

but what u are doin now

#

nop

chrome wagon
#

ok gonna try again to launch

quasi flint
#

dont forget the -nogui arg

eager valley
chrome wagon
eager valley
#

okay i will

#

bye

quasi flint
#

its worth a try

chrome wagon
#

👍

eager valley
narrow furnace
#

shut up

quasi flint
#

well but no one will help 😂

chrome beacon
chrome wagon
#

Is starting :)

eager valley
chrome wagon
#

will it auto convert the world to 1.17 or how does that work?

quasi flint
#

the world will convert, but not good

#

will probably breack a 1.16 world to 1.17

chrome wagon
#

I plan to just world edit remove my house and put it in a empty 1.17 world

#

that should fix the fuckery?!

narrow furnace
#

?

quasi flint
#

probably

chrome wagon
#

to be fair yes, but its kinda same thing cuz im the dev for my server and this will help me dev

#

lol

narrow furnace
#

but youre not developing

#

youre servering

chrome wagon
#

im not arguing

#

i agree

quasi flint
#

he is the server

narrow furnace
#

👀

eager valley
#

so one more question

grim ice
#

@narrow furnace by the way

chrome beacon
eager valley
#

Bungeecord or Spigot, which is better?

chrome beacon
#

You need both

#

._.

eager valley
grim ice
#

Do you have any java questions for me?

eager valley
chrome beacon
narrow furnace
#

or hackerrank

chrome wagon
#

thank you all by the way. Seems to be working great. -nogui didnt seem to affect it either.

#

Def was the Java

quasi flint
#

good thing

chrome beacon
#

-nogui shouldn't have a -

#

And should be placed as the last argument

chrome wagon
#

oh I just meant like it didnt need to be added

#

I didnt actually add it

#

my b for confusion

quasi flint
#

Can someone help me real quick: I use this method do decode my PacketPlayInUseEntity, works fine for the Interact, but when i try do it it for the attack, i fail mesarably, for like 2 hours now, can someone help? Method: https://pastebin.com/hVt2q0n6

chrome beacon
chrome wagon
quasi flint
#

yop

opal juniper
#

there are apis for that iirc

chrome beacon
#

^

quasi flint
#

i dont like apis tbh

#

i already got it to work for the interact

opal juniper
#

well - read how they do it ig

quasi flint
#

i just need help with the attack

chrome beacon
#

Saves you a lot of time with code you don't have to maintain

quasi flint
chrome beacon
#

Citizens

opal juniper
#

^

chrome beacon
#

Aight now back to speed running my Java course from school...

opal juniper
#

it is paid on their spigot but you can download from the jenkins

opal juniper
#

what are you learning, imports?

chrome beacon
#

Basics

opal juniper
#

u are lucky tho - i do python

#

i like python

chrome beacon
#

I almost finished entire book in 1 day

opal juniper
#

but java is better

chrome beacon
#

Second day now

opal juniper
#

oh XD

chrome beacon
#

Atm it's graphics with Swing

#

And we have to use Netbeans >.<

opal juniper
#

oh that’s more than just the basics

#

oh

grim ice
#

is understanding the whole oracle java tutorial still beginner level?

opal juniper
#

hmmm kinda

chrome beacon
opal juniper
#

lmao

chrome beacon
#

It's teaching Swing before classes and instances...

tidal skiff
#

how do i check if args[0] is a valid Material?

chrome beacon
#

So yeah...

opal juniper
#

check it’s not null

chrome beacon
#

Everything is static atm

opal juniper
#

we love to see it

#

xD

tidal skiff
opal juniper
#

uh

chrome beacon
#

Material.of(args[0])

#

?

tidal skiff
#

huh

#

oh

#

do u mean valueOf?

#

theres no just Material.of

opal juniper
#

then yes

#

mb

#

Material material = Material.valueOf(args[0]);
if (material == null) return

tidal skiff
opal juniper
eternal night
#

It throw illegal argument exception

#

Hence it never returns null

opal juniper
#

oh

#

i thought it was null

#

my bad

#

so yeah throw a try catch around that

tidal skiff
#

aight

#

thx

eager valley
#

@quasi flint i need help again its not about the like bungeecord or spigot. dm me

quasi flint
#

stop pinging me

#

no i block u

#

have to do things that are more worth it

tidal skiff
#

absolute chad

eager valley
#

idk

quasi flint
#

I cant think when i am getting pinged every 2 minutes

#

U cant fucking help with packets

eager valley
#

well sorry

#

can u help me pls?

quasi flint
#

no

#

no means no

eager valley
#

its just a simple question thats all

#

trust

#

me

#

@chrome beacon can u help me?

tidal skiff
#

bruh just send the question

grim ice
#

@eager valley what do you need help with

grim ice
#

No dms

#

say it here

eager valley
#

i cant send it

#

the pic

grim ice
#

ok dm it

eager valley
#

there is no "fallback_server:" and "default_server:" in config.yml

brazen surge
#

So I try

main: pw.main.PluginWork
main: pw.main.PluginWork.PluginWork
main: PluginWork
main: pw.main
main: src.pw.main.PluginWork
main: src.pw.main.PluginWork.PluginWork
main: .pw.main.PluginWork

grim ice
#

bro wtf

#

do u know what ur even doing

brazen surge
#

I'm trying to run a plugin

grim ice
#

No one will help you with that, google it

brazen surge
#

I google it, but I don't search a answer

#

I do all like tutorial, but it don't works

lean gull
opal sluice
grim ice
#

this is self explanatory

#

lmao

lean gull
#

yes but idk how to fix it

quiet ice
#

gamerulesGetPlayer this is a setter method, not a getter method

#

Either way, are you sure that you invoked that method?

lean gull
#

what's invoked and wdym setter and not getter

#

sorry ma english bad

grim ice
#

?learnjava

undone axleBOT
quiet ice
#

gamerulesGetPlayer has get in it's name, which would usually indicate that it is a getter method (i. e. it should return a field), however in this case it sets a field to a value

grim ice
quiet ice
#

And are you sure that you called gamerulesGetPlayer

quiet ice
grim ice
#

mutator = setter

quiet ice
#

I'm not dum dum

grim ice
#

accessor = getter

#

ye lul

quiet ice
#

Mutate = modify the state of somethin

grim ice
#

yes he might know it

#

@lean gull what's ur language

lean gull
#

hebrew

grim ice
#

oh god

#

nevermind i cant understand that

quiet ice
#

Which is why you should use get and set as those are the most abstract words in the english language

lean gull
#

what do i do doe

grim ice
#

learn java

lean gull
#

hush

quiet ice
#

Are you sure that the player is not null here?

quiet ice
lean gull
#

tis not, it's the sender of the command parsed as a player

grim ice
lean gull
#

what's an npe

quiet ice
#

he knows, but he doesn't know how to resolve

#

NullPointerException

lean gull
#

ye idk what that is

quiet ice
#

Programmer jargon, we like shortening all exceptions

grim ice
#

if(playerthatsupposedtobenull == null) return;

quiet ice
#

NullPointerException = you used the null pointer at a place where you shouldn't use it.

grim ice
#

that will prob solve it

quiet ice
grim ice
#

if it stops working it means you have a logic issue

lean gull
quiet ice
#

Correct, or that you set it to a null value

lean gull
#

my theory was that i'm not using it in the same line

#

so it forgets it after one line

#

would that be correct?

quiet ice
#

Nah, where you set the field is irrelevant, as long as you do it before you use the field

lean gull
#

lemme test my theory 1 sec

quiet ice
#

Your theory is 100% wrong

#

And if it is right, then there is something wrong with your code

lean gull
#

we'll see (you're probably right)

grim ice
#

bro

#

as geol said

#

you're 100.00% wrong

#

;-;

lean gull
#

yeah i was wrong, as expected

grim ice
#

fix your logic theres nothing you can do about it

#

unless someone goes by all your code

#

and checks whats wrong

lean gull
#

how nice and motivitional of you :p

grim ice
#

just send ur code ig

lean gull
#

please stop helping, thank you

grim ice
#

lmao

#

ok

lean gull
#

you're neither helping or being nice

dim bluff
#

hello, is there a quick way to change absolutely all the Material in my plugin to itemStack 🙂

#

I fucked up

lean gull
#

ok so i souted the player variable and it sent this CraftPlayer{name=Buenny} and now i am confused cause it should work

#

i mean the player variable in the command, not in the gui class

#

lemme try to sout it in the gui class

grim ice
dim bluff
#

well I need to change literally all my Material shit to itemStack cuz in 1.8 u cant have ENCHANTED_GOLDEN_APPLE as material....

dim bluff
#

and I've never used itemStack 🙂

grim ice
#

wtf

dim bluff
#

lit

#

well abrely

grim ice
#

new ItemStack(Material)

dim bluff
#

oh

#

wtf

grim ice
#

lol

dim bluff
#

that was hard

#

ok

brazen surge
grim ice
#

i have a few suggestions for you

#

first

#

learn english

#

its hard to learn anything from the internet if you don't know english

#

second, learn java

#

third, watch tutorials

lean gull
#

can anyone help? this is not sending anything to console

    public void gamerulesOpenInvAndSetPlayerVariable(Player player2) {
        player1 = player2;
        player2.openInventory(this.getInventory());
        System.out.println("banana " + player1);
        System.out.println("banana2 " + player2);
    }```
west berry
#

Sheesh lol

grim ice
lean gull
#

did i ask you spesifically?

grim ice
#

Yes, you said 'anyone'

lean gull
#

so...?

grim ice
#

I am infact considered 'one'

lean gull
#

that anyone clearly doesn't include you though

grim ice
#

Haha

#

Let's see anyone helping you with that shit of a attitude

lean gull
#

says the guy with the sh*t of an attitude

grim ice
#

except if it's elgar which you blocked, no one will help you without toxicity

lean gull
#

i unblocked everyone

#

including elgar

grim ice
#

lmao

lean gull
#

well atleast i think i unblocked everyone

grim ice
#

kinda funny

#

well let's see who helps you

lean gull
#

ok