#help-development

1 messages · Page 1938 of 1

undone axleBOT
grim ice
mortal hare
#

click on the general compiler section

grim ice
#

isnt actually mine but yes

tender shard
#

it's actually enabled for me

#

but

#

it doesn't add anything to the code

naive bolt
#

im confused why result.entity[0] is null

tender shard
#

as you saw in my screenshot

#

does it maybe only work when not using maven?

grim ice
mortal hare
#

so maybe its only for intellij internal build system

tender shard
#

because tbf who compiles by clicking on "export"

mortal hare
#

and when you compile with maven and gradle it doesnt work?

ivory sleet
#

As said

hasty prawn
ivory sleet
#

Build automation tools manage this

tender shard
#

did you reload the maven changes after changing the pom?

naive bolt
#

it is

ivory sleet
#

for instance you must declare annotationProcessor with gradle if given library is to be used as one dovidas

hasty prawn
#

No...?

ivory sleet
#

Undoubtedly something similar with maven

tender shard
#

print out entity

#

and print out entity.result

grim ice
tender shard
grim ice
#

does nothing

#

i tried that

tender shard
#

you don't have this maven thing on the right?

delicate lynx
#

what are you trying to get from this JSON?

grim ice
#

Nope

tender shard
# grim ice Nope

something MUST happen when you click on "Add as Maven project"

naive bolt
tender shard
grim ice
#

yes

tender shard
#

well there you go

#

your json thing doesn't return a result

delicate lynx
#

it's returning, he just isn't getting the result array it seems?

mortal hare
tender shard
#

did you actually replace A-KEY with a valid key?

ivory sleet
#

yes

naive bolt
#

obviously

ivory sleet
#

pretty much dovidas

#

afaik

tender shard
naive bolt
#

because i wouldnt get a response

#

and i shared the response im getting

tender shard
#

oh wait - CoordsJSON is your own class?

naive bolt
#

yes

tender shard
#

class CoordsJSON {
ResultJSON[] result;
}

naive bolt
#

yep

tender shard
#

doesn't look like you ever set it to anything

naive bolt
#

how do is set it

tender shard
#

entity.result = whatever??

mortal hare
#

@NotNull vs @NonNull, which do you use?

tender shard
#

NonNull

#

lombok's one

naive bolt
tender shard
undone axleBOT
mortal hare
#

i hate how there's no standard

#

for such simple annotations

tender shard
#

bruh what do I know. I have no idea what you want to set it to or why you even need that class

tender shard
tender shard
#

I use NotNull to simply declare "don't make this null" and NonNull if I want it to actually check if it's null

quiet ice
#

@NonNull/@Nonnull is already javax.annotations and checkerframework (or whatever it is), so I'm using something I won't accidentally import

delicate lynx
#

unless entity.result[0] is being called on the JSON response? wouldn't that not work? don't you need to getJSONArray("results") and then get the JSONObject in there?

mortal hare
#

should i add precondition clauses inside the method body

delicate lynx
#

never used Gson before lol

tender shard
tender shard
mortal hare
#

i like conventions

tender shard
#

if you want it to throw something when null is provided, yes

#

if not, no

quiet ice
#

If you do static analysis and do it in a pedantric fashion there is little reason to check for nullabillity at runtime unless you have an API

tender shard
quiet ice
#

didn't fully catch that

tender shard
#

it wasn't mentioned, I just thought it

mortal hare
#

ok

#

my rule of thumb: if its internal - don't, if its meant to be public - do because there are monkeys that could pass null values into methods

young knoll
#

Think of the CPU cycles

quiet ice
#

Honestly, it isn't really your fault if they do not interact with the API in the right way

sterile token
#

HEY

mortal hare
#

HELLLOOO

sterile token
#

I need help please, im really stressed

mortal hare
#

I see.

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's help

quiet ice
#

?permissions grant @quiet ice owner

undone axleBOT
#
CafeBabe Help Menu
Syntax: ?permissions 
Command permission management tools.

**__Subcommands:__**

canrun Check if a user can run a command.
explain Explain how permissions works.

quiet ice
#

aw

sterile token
#

Im trying to create this class:

HttpRequest request = new HttpRequest.builder().uri("http:google.com").headers(bla bla); // How can i do this?

#

I have been with this for over an Hour

quiet ice
#

class?

tender shard
#

make builder() a static method that returns new HttpRequest()

sterile token
#

Mfnalex

tender shard
#

and then just do HttpRequest.builder()

sterile token
#

I try that thousans of time

#

Give a simple example

tender shard
sterile token
#

I explain

tender shard
#

?paste

undone axleBOT
tender shard
sterile token
tender shard
#

here's my very simple ItemStack builder class

sterile token
#

Ok let me check

#

But before i explain how im doing

tender shard
#

but I am not using a static builder() method

quiet ice
#

Do you want to use this or recreate?

sterile token
tender shard
#

I just do new ItemBuilder(Material.DIRT).setLore(someLore).build()

sterile token
#

Yeah my problem its that i want to skip the new ItemBuilder()

#

Thats its killing me

ivory sleet
#

a JEP similar to the jspecify specs might be proposed once jspecify has been proven in production

tender shard
#

I don't really understand the problem

sterile token
#

Hmn

#

Wait i will check

#

Im really confused

sterile token
tender shard
#

I changed my code

#

now it uses an inner class

quiet ice
#

oh, you probably forgot the static

quiet rune
#

question, what's the best way to learning all the options that spigot has for plugins like all the settings and possibilities

#

do you just like, stay on the api page for years researching?

quiet ice
#

As a rule of thumb, in 80% of cases there is nothing wrong with using static class when declaring inner classes

tender shard
tender shard
quiet ice
#

The javadocs are your friend

sterile token
quiet rune
#

javadocs? what does that refer to

young knoll
#

?jd

sterile token
tender shard
ivory sleet
hybrid spoke
#

yo @opal juniper and i need help. important. please vote <#general message>

quiet rune
#

o ty

sterile token
ivory sleet
#

wat

#

the point of a static factory method for the builder is to decouple builder instantiation from creation (which comes with some benefits, namely easier to support)

sterile token
tender shard
sterile token
#

WAIT

#

I will explain all again

#

IM mixxing everything

tender shard
#

Do you want to use Builder.builder() or HttpRequest.builder()?

quiet ice
#

You do not have a #build() method

tender shard
#

You want to use HttpRequest.builder() so HttpRequest needs a method that returns Builder

quiet ice
#

wtf is that

#

I just realized

#

You have cyclic dependencies, that will not work

tender shard
#

you create a new Main in your COmmand class

#

you must never ever have more than one instance of your class that extends JavaPlugin

young knoll
#

No creating main class

#

Otherwise spigot will make lots and lots of lightning

tender shard
#

do you know basic concepts of OOP?

sterile token
# tender shard that makes no sense

I want to use it like this:

HttpRequest request = HttpRequest.builder().build().paramA().param();

  1. Should create HttpRequest instance
  2. builder() should create inner class instance (Builder)
  3. build() should return me the HttpRequest instance
#

Explain?

tender shard
#

to do this:

sterile token
#

It doesnt work

tender shard
#
public class HttpRequest {

  public static Builder builder() { return new Builder(); }

}
tender shard
sterile token
#

But how i create http isntance?

tender shard
#

what is http instance

ivory sleet
#

like you always invoke build() lastly

young knoll
#

?di

undone axleBOT
young knoll
#

He’s using us for website traffic!

tender shard
young knoll
#

Yes

tender shard
#

99% of my traffic is my api 😦

young knoll
#

IP logging

sterile token
#

Hmn?

fallen thunder
#

No I just want know if I let all servers make connection to database or if I let a server or proxy to make calls at the db ?

tender shard
tender shard
young knoll
#

Exactly

#

Then you’re gonna uhh

#

DDOS us until we send you minecoin

tender shard
#

someone from UK

#

Ireland to be precise

#

huehue now I will sell this information to...

#

erm

young knoll
#

Wait

tender shard
#

Coll do you want to buy this information?

young knoll
#

Northern Ireland?

tender shard
#

let me check

#

weird it says Ireland but the city it mentions is near london

young knoll
#

Because Ireland isn’t part of the UK

#

And they don’t like the English afaik :p

tender shard
sterile token
#

nfalex

tender shard
#

oh I am stupid

#

it says UK of GB and Northern Ireland

sterile token
#

Not working

tender shard
#

I only saw "Ireland" on the last line

tender shard
#

can you be a bit less specific pls

sterile token
#

Really it doesnt work and im stress

tender shard
#

all those details you provided are hurting my brain

young knoll
#

?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.

sterile token
#

I explain all again

tender shard
#

I know what you want to do

sterile token
#

Ok

tender shard
#

but you didnt tell what's not working

#

You know what @sterile token

#

just switch to Lombok

sterile token
tender shard
sterile token
#

I have fixed all

tender shard
#

you still don't have a builder() method

sterile token
#

I have yes

#

All works

tender shard
#

there is no builder() method

sterile token
#

But not the protected constructor

tender shard
#

in what line should it be?

sterile token
#

Look where its writed

#

Or its old link?

#

Let me check

tender shard
#

no idea

#

what you sent has no builder method

sterile token
#

This last link

tender shard
#

there is no builder() method

sterile token
#

Yes i get confused

#

It was called build()

tender shard
#

oh you named it newBuilder

ivory sleet
#

ye

tender shard
#

well okay, a bit weird but sure, it works

ivory sleet
#

looks alright

sterile token
#

not work the this

#

On constructor

grim ice
#

if i add a plugin as an external library, initialize a class from it, then use its methods after checking if the plugin is installed, what are the dangers of this?

tender shard
#

well why do you provide "this" into the builder

ivory sleet
#

tho the "this"

tender shard
#

makes no sense

ivory sleet
#

like

#

thing is, you use a builder to construct an object

tender shard
#

instead of giving an existing HttpRequest(), the BUILDER is supposed to create one

#

that's why it's called BUILDER

#

remove this inside the () and remove the Builder constructor

#

and simply do HttpRequest request = new HttpRequest(); in your builder class

#

also wait whut

#

this whole thing is fucked up

young knoll
tender shard
#

your builder requires a HttpRequest and your HttpRequest requires a builder?

#

that makes no sense at all

grim ice
young knoll
sterile token
#

Look im tryin to do somethis like this:
I take it from OkHttpClient but the thing its that i dont want to use a new HttpRequest i want to be static

young knoll
grim ice
#

I see

#

thanks

tender shard
#

fuck it, I'll rewrite it completely for you

unreal quartz
young knoll
#

I choose to believe that’s intentional

ivory sleet
#

yes

#

due to people like this

young knoll
#

Does not is work

sterile token
ivory sleet
#

myes

sterile token
#

Them im fine

tender shard
#

@sterile token make your life easier

#

use lombok

#
import lombok.Builder;
import lombok.Getter;

@Builder
@Getter
public class HttpRequest {

    private final String server;
    private final Integer conTimeout;
    private final Integer readTimeout;
    private final Boolean redirect;
    private final Boolean cache;

}
#

this does everything you want

ivory sleet
#

Or just generate a builder with intellij lol

young knoll
#

But then the file is bigger

#

Onoes

ivory sleet
#

idm

#

class file will be about same size regardless

tender shard
#

there's no Builder for me in idea

ivory sleet
#

let me open IJ

tender shard
#

I updated to latest ultimate today 😮

#

so it can't be a new feature that I missed

ivory sleet
#

rather sure its been around for quite a while

ivory sleet
#

good

tender shard
sterile token
#

please don't torture me

tender shard
#

yours is totally flawed 😛

sterile token
#

Not matter

ivory sleet
#

Verano I very much share your feelings concerning lombok

hasty prawn
#

As do I

unreal quartz
#

Conclure is a very smart dog so I agree with whatever they said

tender shard
#

to each their own ¯_(ツ)_/¯

quiet ice
#

Just use delombok afterwards

sterile token
#

mfalex but please helpme without using loombok please

tender shard
#

I rather spend my time creating real code

quiet ice
#

Use lombok, then use delombok

#

Easy fast code

tender shard
ivory sleet
unreal quartz
tender shard
#

refactor

ivory sleet
#

ye

tender shard
#

I only looked in Code -> Generate

#

(where tbh it belongs :P)

young knoll
ivory sleet
#

and iirc you can actually change the template it uses to generate the builder 😛

sterile token
#

Allright THANKS

#

Really thanks

#

Over 2 hours alone trying to do this.

tender shard
#

as developer you can get OP on so many servers lol

#

it's almost frightening

young knoll
#

Oh?

unreal quartz
#

Hey I'm from planet minecraft

tender shard
quiet ice
#

Meanwhile I am not even OP on my own server

tender shard
#

weird name tbh

young knoll
#

/op @e

wet breach
tender shard
sterile token
tender shard
young knoll
#

That’s not the vanilla /op output

tender shard
young knoll
#

Really?

sterile token
young knoll
#

Oh

#

What about that top line

tender shard
#

that's leftover from angelchest's config checker

ivory sleet
tender shard
#

can someone explain the hate against lombok?

young knoll
#

Still haven’t fixed the spacing smh

blazing scarab
#

🥄

tender shard
young knoll
#

🍲

blazing scarab
#

.

#

.

#

.

tender shard
#

Well, for one, I don't think you should use setters at all.

#

erm

#

why

blazing scarab
#

immutability

ivory sleet
#

Well thats both yes and no, kinda a double edged sword gepron1x

tender shard
young knoll
#

Some things have to be mutable

tender shard
#

*most

young knoll
#

Unless you want to like

tender shard
#

imagine having mutable events

young knoll
#

Make a new home instance to rename a home

tender shard
#

imagine doing this

public void onSomeEvent(SomeEvent event) {
  event.cancelled = true;
}
blazing scarab
tender shard
blazing scarab
#

I agree, not everything should be immutable

ivory sleet
#

sure you get thread safety, but like, as soon as you your project scales to millions of lines of code, you will end up layering your code, where each layer must use an api to talk with another layer, in which creating contextual objects might be necessary thus setters and getters might be needed.

tender shard
#

I don't think that "lombok is a compiler hack" is any reason to not use it

ivory sleet
#

Well tbf, lombok is just useless

tender shard
#

CraftBukkit also is a "vanilla hack" yet most people here use it

tender shard
#

imagine the builder class from above

#

now you add a new field

ivory sleet
#

it doesnt add any inherent abstraction like most other libraries do in some way

tender shard
#

you now have to create the new builder methods

young knoll
#

Meh

ivory sleet
#

it just makes it a bit more succinct

#

but thats only for the source files

young knoll
#

You can just regenerate the builder

ivory sleet
#

and it damn requires an ide to use

tender shard
ivory sleet
#

which you may not always have

tender shard
ivory sleet
#

intellij allows you to expand if you want to

blazing scarab
tender shard
ivory sleet
#

it merely virtually collapses

tender shard
#

lombok does not require any IDE

ivory sleet
#

you sure?

dusk flicker
#

as far as I am aware it does require an IDE

ivory sleet
#

^same

#

but feel free to prove us wrong

#

im not a native lomboker so Idk tbf

young knoll
#

Lomboker

tender shard
#

works fine without ide

ivory sleet
#

alr cool

dusk flicker
#

Lombok is nice, but like most things some like it, some dont

young knoll
#

Are you telling me

ivory sleet
#

nah

young knoll
#

That a lot of programming is personal preference?

sterile token
#

Loomboks sucks

ivory sleet
#

^

dusk flicker
#

For all the people saying it breaks shit, etc, ive never had that happen to me at all, and I havent heard a single person in this discord say it broke anything for them

sterile token
#

Where would you recommend me executing the get, post, methods? on HttpRequest class right?

tender shard
#

I am still looking for a VALID reason why lombok sucks

ivory sleet
#

hasnt broken for me either

#

but it just does not provide anything

tender shard
blazing scarab
#

"Imma do everything procedurally in static methods cuz u know personal preference"

#

"bro wtf maintainability means"

ivory sleet
sterile token
#

Alex?

tender shard
ivory sleet
#

it just adds some compiler hacky annotations

blazing scarab
dusk flicker
#

how does it affect maintainability?

ivory sleet
#

which to every extent, do not abstract the code I write

wet breach
#

Setters are a necessary thing o.O

tender shard
tender shard
tender shard
wet breach
#

you couldn't be dynamic without setters

tender shard
#

or @ SneakyThrows

ivory sleet
#

no im not talking about abstracting semantics of Java

drifting vault
#

how would i go about spawning an entity in a world with data? say if i were to store the entity in a hashmap and spawn it that way?

ivory sleet
#

im talking about abstracting behavior

#

two entirely different things

tender shard
#

and then spawn it again and apply all the metadata it had

blazing scarab
#

I expose all of my builders and getters through interfaces

tender shard
#

you can't just store an entity blueprint

wet breach
tender shard
wet breach
#

Object storing is a thing 🙂

tender shard
#

yeah and how would you then spawn a copy of that entity?

#

I'm totally fine with people not liking lombok. I however like to just do @ Builder and have a perfectly fine working builder. or adding @ Data and automatically have working getters, setters for non-final fields and constructors, etc etc.

wet breach
young knoll
#

I mean

#

@Data is just a record

tender shard
blazing scarab
tender shard
#

it's true that Data is basically just a record

blazing scarab
#

It is so nice to design api first and then do implementation

tender shard
golden kelp
#

Hello guys, how can I spawn a shulkerbox at X, Y, Z with 5 totems in it?

tender shard
#

for example, everything that does not get implemented more than once, you could also just directly implement it

tender shard
young knoll
#

But then it’s not decoupled

golden kelp
#

oookay

young knoll
#

Or soemthing

wet breach
#

some people like to obsess over non-existent API's XD

ivory sleet
#

Sure, thing is lombok does not provide any behavioral abstractions as opposed to something like Guava, Caffeine or such libraries. IDEs have many keybinds to generate code equally quickly you'd write it with using lombok. In addition, having all the verbose code in source files (as opposed to Lombok) makes it extremely much easier to refactor code later on, which was one of the reasons I stopped using lombok. More over does lombok cause source and class file mismatch (tho that was not a problem but still annoying) (it used to, idk if it still does)

dusk flicker
#

Heretere has a good writeup on why people saying lombok is hacky/bad/etc is wrong, id recommend checking it out if you havent yet #general message

blazing scarab
#

Also, interfaces allows us to do such a great pattern like Decorator

tender shard
young knoll
#

My API is currently a class full of static methods

#

I should probably change it

wet breach
#

I dislike annotations

tender shard
#

although

wet breach
#

probably one of the things I dislike most in regards to some things Java >>

tender shard
#

why would you care about source / class file mismatch

ivory sleet
#

Because I couldn't navigate through files with CTRL + Left Click

blazing scarab
ivory sleet
#

so I had to double shift click and search for the class

tender shard
ivory sleet
#

which was just a tiny bit of extra work

#

idk, what does ctrl b do?

blazing scarab
#

Yes. As i said before, a mental overhead. You don't see the code, you have to imagine its existence

young knoll
#

Idk how to make a good API.
Like, should I have a getAPI method in the plugins main class or something

wet breach
ivory sleet
#

ye alex

blazing scarab
ivory sleet
#

I imagine it was fixed long time ago

#

so thats a non issue

tender shard
ivory sleet
#

ah fair

young knoll
sterile token
#

Which is the code for website that describe an error?

young knoll
#

Brain small

tender shard
#

Internal Server Error is 500

wet breach
#

going to destroy and recreate the instance everytime?

sterile token
wet breach
#

kind of counter productive to a singleton

tender shard
dusk flicker
#

i think they were

golden kelp
blazing scarab
tender shard
#

or wdym?

golden kelp
#

ooo

#

tyy

blazing scarab
young knoll
#

Yeah the entry point is where I struggle

blazing scarab
#

It is doesnt stick to OOP like at all

wet breach
#

It does

#

but ok

ivory sleet
#

Java isn’t purely oop thankfully

dusk flicker
#

what are you on

ivory sleet
#

Well singletons aren’t elegantly object oriented

tender shard
wet breach
#

The only part it doesn't adhere to is so called object reuse, but not all objects are destined to be reused because they don't go away in the first place XD

blazing scarab
#

Singletones are procedural programming. This is what you want and can avoid in object oriented language

blazing scarab
tender shard
wet breach
golden kelp
ivory sleet
#

Gepron1x do you truly believe in pure object orientation?

tender shard
ivory sleet
#

By your own definition on object orientation that is

young knoll
#

Elegant Objects (EO) is an object-oriented programming paradigm that renounces traditional techniques like null, getters-and-setters, code in constructors, mutable objects, static methods, annotations, type casting, implementation inheritance, data objects, etc.

ivory sleet
#

As the definition seems to be somewhat subjective sometimes

golden kelp
#
p.getWorld().getBlockAt(p.getLocation().getBlockX() + 2,
                            p.getLocation().getBlockY() + 32,
                            p.getLocation().getBlockZ()).setType(Material.YELLOW_SHULKER_BOX);
                    Block block = p.getWorld().getBlockAt(p.getLocation().getBlockX() + 2,
                        p.getLocation().getBlockY() + 32,
                        p.getLocation().getBlockZ());
                    BlockState bsm = (BlockState) block.getState();
                    ShulkerBox box = (ShulkerBox) bsm.getBlock();
                    box.getInventory().setItem(14, new ItemStack(Material.TOTEM_OF_UNDYING, 5));
dusk flicker
#

yeah

tender shard
midnight shore
#

Guys what time is it for you?

golden kelp
#

ok

dusk flicker
#

4:37pm

tender shard
dusk flicker
#

oh god my pc time is wayy off

midnight shore
tender shard
#

22:39 people unite

dusk flicker
tender shard
dusk flicker
#

hmm?

tender shard
#

it automatically syncs time and every OS has it builtin

#

even windows XP had it

young knoll
#

Well

dusk flicker
#

honestly never heard of it

young knoll
#

Actually it’s 2 books

tender shard
young knoll
#

Isn’t the default to sync time

wet breach
young knoll
#

At least for windows

dusk flicker
#

generally I have it sync to time.gov every few weeks but apparently it isnt on

tender shard
#

at least it is the default on windows, macOS, ubuntu, debian, and even centos 7

young knoll
#

What about uhh

blazing scarab
# ivory sleet As the definition seems to be somewhat subjective sometimes

No. Honestly, i dont follow elegant objects fully. Some of ideas are too radical and crazy, you werent meant to do such stuff in java. IDE's are not designed to follow Elegant Objects. But still, there's ideas i really respect and found them awesome. They made my code better, even if at the first look it felt weird.

young knoll
#

Slako Puppy

ivory sleet
wet breach
#

makes a lot of sense in why they believe setters shouldn't be a thing

ivory sleet
#

Frostalf define a setter first and foremost

midnight shore
#

Is there any way to get the timezone of a specific player?

young knoll
#

I propose a new idea

#

Ugly Objects (UO)

ivory sleet
#

lol

wet breach
midnight shore
young knoll
#

All code goes in the constructor, all fields must have a setter

wet breach
#

it can be a value of an object or variable

dusk flicker
#

well you could get their ip and do like a geo locate

young knoll
#

Tru

dusk flicker
#

not sure how accurate itd be

ivory sleet
#

So a method which mutates some state?

tender shard
young knoll
#

Probably good enough to get a time zone

#

I kinda want to make that an API now

wet breach
midnight shore
#

I saw it in some servers

ivory sleet
#

Yeah alright, in that matter I also believe totally dissuading yourself from it is a bit too extreme

young knoll
#

Alternatively you could just make a /settimezone command

young knoll
#

Yeah

#

But for getting a timezone

tender shard
#

its builtin

charred echo
#

lmao

young knoll
#

Fair enough

tender shard
#

System.out.println(geolocation.getTimezone().getCurrentTime());

wet breach
midnight shore
#

Ty guys you are always helping me

young knoll
#

I might have to try that

midnight shore
#

Gn for the people in 22:45

young knoll
#

Auto detecting timezone sounds cool

midnight shore
#

Bye

young knoll
#

Can you detect client language?

wet breach
#

I understand where a build factory and all that comes in handy

#

but I mean really do you need a build factory to update just a single value?

ivory sleet
wet breach
#

would seem a bit excessive if you ask me in that scenario

young knoll
#

You can detect client language

charred echo
young knoll
#

Heck yeah

young knoll
left swift
#

How can i check if packet entity was hurted?

charred echo
#

ah

ivory sleet
#

Yuh, I mean sometimes leaning towards principles like KISS can be more insightful than following strict oop

wet breach
young knoll
midnight shore
#

I’m currently checking how Essentials Does the geolocate thing

young knoll
#

Specifically the damage one

tender shard
#

at least it required that 10 years ago

young knoll
#

Isn’t it dead now

dusk flicker
#

I never liked plugins doing geolocate shit

wet breach
tender shard
wet breach
#

you could then further query the IP DB and see if the ISP added any additional regional info on said ip

young knoll
#

Ah

tender shard
young knoll
#

You gotta sign up now

tender shard
#

also people could use VPN, proxies, ...

young knoll
#

And get an API key

#

Yeah idk about giving geo location data to server owners

#

But getting the time zone seems innocent enough

wet breach
#

in which case proxies doesn't matter in the equation

ivory sleet
tender shard
#

what is an "open" slot?

wet breach
young knoll
#

Loop between the two slots

unreal quartz
#

A non closed slot

young knoll
#

And check for air

#

Or null, I don’t remember

unreal quartz
#

Hey sue

wet breach
ivory sleet
#

for instance the, a function must only do one thing is subjective, one thing is extremely subjective in spite of bob’s objectification

young knoll
#

I’ll sue y’all

unreal quartz
#

Now that's rude

young knoll
#

Autocorrect hates me and actively tries to screw me

ivory sleet
#

And generally software is subjective because you cannot prove your software to be correctly written, we can only prove our software to not be incorrectly written gepron1x

wet breach
young knoll
#

True

#

I could also disable it but that would probably be worse

#

Phone keyboards are hard

wet breach
ivory sleet
#

Yes ik it’s double negation

#

But that’s the only way to word it

#

We can surround our software with tests much like proving science

tender shard
#
  1. check if it's not null
  2. it's AIR not Air
ivory sleet
#

If those tests do not fail, then we haven’t written our software wrongly to the extent of the tests

wet breach
ivory sleet
#

Indeed

tender shard
#

we can also know it's wrong when it was written by @unreal quartz

wet breach
#

lol

unreal quartz
#

Ex

#

cuse

#

me

tender shard
#

oh shit he's here

#

a better way of doing what?

#

and you MUST check for null, otherwise getType() can throw an NPE

young knoll
#

You want code written wrong?

ivory sleet
#

It is actually incredibly hard to prove that a specific design is the right correct one Frostalf, I believe merely proving a method engages a rabbit hole of predicates and other mathematical theories

tender shard
#

a method for this already exists

young knoll
#

Look at Chocos code

deep sail
#

[21:57:45 ERROR]: Block at -67,52,-287 is ENDER_CHEST but has net.minecraft.server.v1_8_R3.TileEntityBeacon@67cb2838. Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.

Anyone know how to fix this? I'm setting a block to Ender Chest the moment the falling block lands (beacon spawned with world#spawnFallingBlock) (also before you say use 1.18, i'm using 1.8 for the tnt mechanics)

wet breach
#

you can use the contains method

dusk flicker
#

1.8 alert

tender shard
#

but wait

#

why is there even a beacon

sterile token
#

What its the response code when you are tryin to use an http verb invalid (that its not: GET, POST, PUT, or DElETE) ?

deep sail
tender shard
#

is the beacon your falling thing?

deep sail
#

yes

wet breach
#

and then instead of manually finding a free slot

tender shard
#

did you kill your falling block before setting the block?

wet breach
#

you can use addItem()

#

which does that exact thing for you

deep sail
#

ah no i didnt

#

i'll try killing it first

#

thanks

tender shard
#

np

blazing scarab
#

Why do most programmers I have talked to believe that if an underlying entity is mutable, an object is mutable too? I think the answer is simple—they think that objects are data structures with methods. That’s why, from this point of view, an immutable object is a data structure that never changes.

This is where the fallacy is coming from—an object is not a data structure. It is a living organism representing a real-world entity inside the object’s living environment (a computer program). It does encapsulate some data, which helps to locate the entity in the real world. The encapsulated data is the coordinates of the entity being represented. In the case of String or URL, the coordinates are the same as the entity itself, but this is just an isolated incident, not a generic rule.

#

Btw

ivory sleet
#

Which to some degree was a selling point why people should use oo I believe lol

wet breach
buoyant viper
wet breach
#

interesting that you are not able to use that method

mortal hare
#

why people like to add final inside method arguments

#

its not as if the parameters are passed by address pointers

#

or smth

young knoll
#

final public final void final test(final int final amount)

buoyant viper
#

but typically an invalid request results in a 400 Bad Request @sterile token

wet breach
ivory sleet
wet breach
#

400's are generally user errors and 500's are generally server errors

buoyant viper
#

yeah

mortal hare
ivory sleet
#

Lol technically yes

buoyant viper
#

and its not set in stone what verb is valid, a server software could expand upon its base with more

mortal hare
#

interesting

wet breach
mortal hare
#

i thought it was only a syntactic sugar

#

like in C

ivory sleet
#

Tho must be said it’s in realms of negligence

young knoll
#

Imma gonna final

#

Everything

buoyant viper
#

im gonna brown

wet breach
ivory sleet
#

Undoubtedly 🙂

wet breach
#

especially if approached from, at what point do those micro optimizations become non-negligible

young knoll
#

This is why I skip null checks

#

Those take time

wet breach
#

do you wait till it gives you a whole second more?

ivory sleet
mortal hare
#

but i guess it is not

blazing scarab
#

People from adventure just likes the final keyword you know

wet breach
#

like how do you know when to see if those micro optimizations are worth it XD

young knoll
#

Bukkit.getPlayer

mortal hare
#

UUID.fromString()

#

iirc

ivory sleet
#

Yeah Frostalf, it’s an intriguing debate… Maybe I could see if I can benchmark it tomorrow

young knoll
#

Array is empty

#

You can’t get the first index from an empty array

blazing scarab
#

Reverse-engineer Player.toString and write your own parser

buoyant viper
#

always thought using final for parameters was decompiler garbage lulz

young knoll
#

Netbeans will yell at you to add final

young knoll
#

.size > 0

buoyant viper
sterile token
young knoll
#

Do you want to see if it’s empty?

#

Or not empty

sterile token
#

Why using ChatColor.Color?

grand coral
#

!slots

sterile token
grand coral
#

?slots

sterile token
blazing scarab
#

Lol are you literally bruteforcing bot commands

wet breach
young knoll
#

?gimmestaff

grand coral
young knoll
#

Dangit

blazing scarab
#

?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.

buoyant viper
#

can u at least do it in #text jesus fuck

sterile token
#
public static String style(String text) { return ChatColor.translateAlternateColorCodes('&', text); }

    public static List<String> style(List<String> text) { return text.stream().map(Chat::style).collect(Collectors.toList()); }
delicate lynx
#

I know

grand coral
#

But in a Chest

young knoll
#

I use the static color constants

#

It’s faster

#

(Probably)

sterile token
#

Hmn

sterile token
iron tundra
#

Use: I am trying to make when a player uses a specific item it gets the nearby entities and strikes them with lightning, I got the other functions I want with it to work but this specific line of code doesn't want to work.

    @EventHandler
    public void PlayerEvent(PlayerInteractEvent event) {       event.getPlayer().getWorld().strikeLightning(Arrays.stream(event.getPlayer().getLocation().getChunk().getEntities()).toList().listIterator().next().getLocation());
    }
#

I might be using the wrong method of doing this, as I am barely even scraping by with understanding java so if you know a better method or why this doesn't work I would appreciate it!

young knoll
#

Just use getNearbyEntities

left swift
#

How can i check if player sees entity (from player#hideEntity)

young knoll
#

Yay javadocs

mortal hare
#

is there any reason to use WeakHashmap for storing player objects

#

i mean does spigot clean up references

young knoll
#

Yes

mortal hare
#

what if dumb plugin holds the player reference

young knoll
#

Then it hangs around

mortal hare
#

But having Strong reference would not make any difference right

#

even if dumb plugin holds the reference strongly

young knoll
#

Hmm?

mortal hare
#

I mean lets say i hold the reference strongly

#

it would not get GC'ed

#

right

young knoll
#

Correct

mortal hare
#

wait

#

my question just doesnt make sense

#

lol

#

nvm

#

do you use WeakHashmaps?

#

I'm thinking of using it

#

but i don't know if i really need it

young knoll
#

I’ve never used one

mortal hare
#

since i could just clean up the map via onDisable()

young knoll
#

I just make sure to cleanup on leave

mortal hare
#

and playerquitevent

young knoll
#

Or I just hold the uuid instead

tender shard
#

does anyone know whether HttpURLConnection follows 301/302 redirects?

tall nova
#

How do I use mojang mappings

tender shard
ivory sleet
tall nova
#

Can you send me it

tall nova
#

Alright

#

Thanks

tender shard
#

np

ivory sleet
#

Like do you know the semantics of gc and weakly reachability?

tall nova
#

WAIT THATS YOURS

ivory sleet
#

If you don’t then don’t use the weak hash map tbf

tender shard
young knoll
tall nova
#

Oh I had that page open lol

tender shard
#

XD

ivory sleet
#

Server::getPlayer

young knoll
#

Overhead

ivory sleet
#

And the player is merely acting as a key there isn’t it

young knoll
#

Well, probably not much overhead I guess

ivory sleet
#

Just because a player object is weakly reachable does not mean its gonna be garbage collected whatsoever

tender shard
young knoll
#

I thought the GC ignored weak references

ivory sleet
#

Yes but post weakly reachability is phantom reachability

mortal hare
tall nova
#

for the plugin

#

is there a repository?

mortal hare
#

if plugins don't clean up the references to player objects it would stay in the memory

#

just like Strong references

ivory sleet
mortal hare
#

Strong references aren't guaranteed to be GC'ed even if they're nulled too

tall nova
mortal hare
#

Whole GC cycling is undefined

#

for a programmer

#

only JVM devs know how it works accurately

ivory sleet
#

Mhm, well anyhow in conclusion you should only use a WHM when you are dealing with internal objects that you have full control over

#

So perhaps not the ultimate use case here

mortal hare
#

yea

tender shard
mortal hare
#

that's why i was doubting

tender shard
#

did you try to hit the maven reload button?

#

it should be in maven-central, so no repository needed

mortal hare
#

and i won't be holding UUID's since I don't need them, i need to access player methods frequently

ivory sleet
#

For what purpose?

mortal hare
#

i will cleanup those in events

mortal hare
ivory sleet
#

Alr

young knoll
#

I was going to hold player references

ivory sleet
#

😮

young knoll
#

But I know some plugins need to make economy users that aren’t real players

young knoll
#

Think so

#

Towny towns for example

ivory sleet
#

Ugh yikes my plugins are probably bound to break now

#

Hmm

young knoll
#

I wish vault had some more options

ivory sleet
#

I’m working on an economy plugin

#

But I have some issues surrounding the design

young knoll
#

Econcluremy

ivory sleet
#

Lol almost

young knoll
#

I still need to think about API

#

Mainly on where the entry point should be

tender shard
young knoll
#

And if I should have everything be an interface

ivory sleet
#

Api for?

#

Yeah please do coll

tender shard
ivory sleet
#

It might sound overkill

#

But interfaces are god ascend

young knoll
#

It’s a generic user API

#

And some other stuff like a language API

ivory sleet
#

Ah

young knoll
#

My current entry point is a class with static methods but ehhhh

mortal hare
#

Interfaces are thing i've hated at first

#

but they're really

#

godsend

ivory sleet
#

Yup

ivory sleet
mortal hare
#

spigot/paper

#

as it shows

#

inside embed

ivory sleet
#

like if you’re just doing something generic, technically you could provide the service with ServiceLoader

ivory sleet
#

Or am I blind

mortal hare
#

someone could use service api for once

#

😄

#

its so rare

ivory sleet
#

Yeah well not talking about ServiceManager

#

But ye

#

^

#

?ask

undone axleBOT
#

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

mortal hare
#

Sin(0)=x

#

solve it

tall nova
tall nova
#

sorry

drowsy helm
#

whats a physics tabs?

#

just send it here

hollow bluff
#

dont think they can? He aint verified

dusk flicker
#

then verify.

visual tide
#

then verify

#

?verify

#

smh no ?verify

young knoll
mortal hare
#

Does somebody agree that Collections util class is a godsend too

ivory sleet
mortal hare
#

it allows to wrap Maps,Lists,Collections into immutables

ivory sleet
# young knoll Yes

Ah, maybe just use the service manager or static singleton where you reflectively set the instance

young knoll
#

That’s what I do currently

#

The later one

drowsy helm
#

@quaint mantle you're asking for some pretty complicated maths, may i ask what the usecase is

ivory sleet
#

As well as the singleton proxies and the empty ones

tender shard
#

?paste

undone axleBOT
ivory sleet
drowsy helm
#

its okay

ivory sleet
#

I do it myself also (;

drowsy helm
#

reino's images for anyone interested

tender shard
#

turkish person detected

drowsy helm
tender shard
#

I'm a private detective

#

jk you have turkish stuff in your discord profile, arkadas

tall nova
tender shard
tall nova
#

Now Im just confused on how to send packets and shit lol

tender shard
tall nova
#

All of the names are changed haha

tender shard
drowsy helm
#

sorry not really, i am not good with physics

tender shard
#

what packets are you looking for @tall nova ?

drowsy helm
#

you will probably go have to read some published papers on it

tender shard
tall nova
#

Also EntityPlayer changed

tender shard
tall nova
#

Ohhh

#

Is there an API for this somehwere?

tender shard
tall nova
#

Yikes

tender shard
#

The Metadata thing should be ClientboundSetEntityDataPacket

tall nova
#

Thats true

tender shard
#

@tall nova are you using intellij?

tall nova
tranquil viper
tender shard
#

on the left side, scroll down to "Libraries" or what it's called, then open Mavn: org.spigotmcspigotremapped-mojang -> net.minecraft -> network -> protocol -> game

tender shard
#

there's a list of all packet names

tall nova
#

Thank you

#

ok brb

tender shard
#

ofc you have to search a bit, but most have similar names

tender shard
#

Clientbound = packets from server to client, Serverbound = client to server

mortal hare
#

another question

#

where do you get the reference of empty string from

mortal hare
#

there are multiple references

drowsy helm
#

just skimming over, if the surface is at 0 deg, the bounce is equal to 90-firstangle

mortal hare
#

of static fields

#

like log4j has

ivory sleet
#

I just use ""

mortal hare
#

Strings.EMPTY

ivory sleet
#

Because most likely it gets internalized anyway

young knoll
#

Intern it yourself just to be sure

drowsy helm
young knoll
#

I assume java interns “” itself

mortal hare
#

^ that picture represents my current state of my back

ivory sleet
#

Experienced an empowered top spin and back spin then we presuppose?

ivory sleet
#

Lol

young knoll
#

My back is also a tennis ball reflecting off a wall

terse ore
#

How can I get if a block is inside two locations?

wet breach
drowsy helm
terse ore
#

or two locations or two whatever

young knoll
#

You mean like

drowsy helm
#

wdym?

young knoll
#

Inside an area

terse ore
#

yeah that

young knoll
#

With 2 corners?

terse ore
#

basically that ty

wet breach
#

bounding boxes?

young knoll
#

BoundingBox is your friend

terse ore
#

oh

#

ill check that in the doc