#help-development

1 messages ยท Page 447 of 1

round finch
#

๐Ÿคทโ€โ™‚๏ธ

vast raven
#

INSERT INTO placed_types (id, x, y, z, world) VALUES ('testid', 2, 2, 2, 'test', 'test', 'test', 'test');

Why?

lost matrix
#

Check if they are "whitelisted" and change the location in the PlayerSpawnLocationEvent

narrow lichen
#

ah okay thank you

round finch
#

oh i see what you're trying to
my bad

vast raven
hasty prawn
#

You have more values than columns

vast raven
#

thanks

lost matrix
#

If you insert all values then you dont even need the first part

vast raven
#

seriously?

terse ore
#

yeah

vast raven
#

I mean they are not all the values at all times

real fable
#

Anyone ?

lost matrix
vast raven
#

the last 3 parameters are nullable

#

that's why sometimes they can be not be inserted

lost matrix
vast raven
#

Go ahed

terse ore
#

is this channel spigot development restricted or it can be used for noob java questions?

real fable
#

Is it possible to do ?

vast raven
lost matrix
real fable
#

I can't do it trough PersistentDataContainer ?

terse ore
vast raven
vast raven
terse ore
tawny remnant
hazy parrot
tawny remnant
hazy parrot
#

show your whole class

tawny remnant
terse ore
# tardy delta ask your noob java questions

(I am watching a 127 h tutorial to start to make good plugins)
If "+" operator takes longer than "String#concat" and StringBuilder, why the "+" operator doesn't use StringBuilder?

#

idk if it makes sense

young knoll
#

The compiler will often optimize + to use a StringBuilder

#

If it can

terse ore
#

oh

hazy parrot
#

why are spigot docs so slow wtf

terse ore
#

maybe it is your internet?

hazy parrot
#

other sites seems to be okay ยฏ_(ใƒ„)_/ยฏ

terse ore
#

it works fine for me

tawny remnant
#

goksi

hazy parrot
terse ore
tardy delta
terse ore
hazy parrot
#

docs

terse ore
chrome beacon
tardy delta
#

nothing is what it seems in java

hazy parrot
chrome beacon
terse ore
#

it might be something in your side

tawdry echo
#

How can block tab complete for specifics commands

chrome beacon
tawdry echo
#

If i can

chrome beacon
tawdry echo
#

filter getCommands Collection si?

chrome beacon
#

Yes

tardy delta
#

but at runtime to concat two string, string1.concat(string2) is called

terse ore
#

why isn't StringBuilder always called?

tardy delta
#

for what

terse ore
#

for concatenating

tardy delta
#

in what case

tawdry echo
#

so when i remove command from collection then args of this one isnt suggested?

terse ore
#

"a" + "b"

#

if it's faster

tardy delta
#

thats optimized at compile time into "ab"

#

in the stringpool

terse ore
#

yeah but it uses .concat right

tardy delta
#

no

terse ore
#

not StringBuilder, compiler

tardy delta
#

compiler isnt written in java, remember

terse ore
#

oh

#

makes sense

tardy delta
#

well probably not ๐Ÿฅน

#

i have no idea actually

young knoll
#

It's actually written in HTML

tardy delta
#

C and C++

young knoll
#

And CSS, of course

tardy delta
#

java runtime is C

#

so lets go with the unsafe languages

terse ore
#

almost all languages are made in C right?

tardy delta
#

uhh something like that ig

terse ore
#

can I ask another noob question

tardy delta
#

or assembly ๐Ÿ’ช

twilit roost
#

any ideas why im suddenly getting 403?
In the morning it was working just fine

Im using REST to POST some logs onto pastes.dev, but now I'm getting 403'd

tardy delta
#

yes

terse ore
#

when we set a variable private for using a getter

tardy delta
#

either my keyboard or discord is having a stroke

terse ore
#

why do we use a getter

#

if it returns the same variable

tardy delta
#

instead of a public variable you mean?

twilit roost
#

you sometimes modify the value before returning it
so u can have raw data in class and return modified one

e.g

terse ore
#

yeah
private int foo = 1;
public int getFoo() { return this.foo; }

young knoll
#

Because public values can be changed directly

tardy delta
#

cuz you shouldnt assume that getter always returns the same value, it could do some computation

#

if you set it public and you decided to change the impl, cry

young knoll
#

And yes, getters sometimes change the returned value

tardy delta
#

basically when i refactored mindustry lol

young knoll
#

For example in spigot, a lot of getters clone the object

tardy delta
#

not a single getter

terse ore
#

I still don't understand

lost matrix
#

Dont forget about validation

terse ore
#

for example

#

wait

#

wait

#

so it is basically so you can't give it another value?

tardy delta
#

thats a setter

terse ore
#

so

tardy delta
#

the outside world shouldnt be aware of the objects internals, and thats fields included

terse ore
#
public class Test {
  private String hey = "Hello, World!";

  public String getHey() {
    return this.hey;
  }
}
zinc lintel
#

does anyone know how i create a claim plugin?

terse ore
#

so that would prevent setting hey right?

tardy delta
#

in that case if you dont have a setter yes

#

should make it final then

lost matrix
#

Take this as an example:

public void setProgress(double value) {
  if(value < 0) {
    this.progress = 0.0;
  } else if(value > 1.0) {
    this.progress = 1.0;
  } else {
    this.progress = value;
  }
}

Or in short:

public void setProgress(double value) {
  this.progress = Math.max(0, Math.min(1.0, value));
}
terse ore
#

what would be another case of using gettrs instead of making public

tardy delta
#

validation as 7smile said

lost matrix
terse ore
#

that makes more sense

terse ore
#

but why

tardy delta
#

probably want to throw an exception too

lost matrix
#

Unless they are constants.
Like public static final double PI = 3;

tardy delta
#

3 ๐Ÿ’€

terse ore
#

but what's the reason for it

#

3.14159265358979842 iirc

weak kayak
#

more flexibility

hazy parrot
#

google about encapsulation

terse ore
#

omw

lost matrix
#
  1. Helps enforcing strong encapsulation
  2. Makes it easy to create limited mutability
  3. Validation

Ill give you a very important example about limited mutability in a min

terse ore
#

ty guys

#

I really appreciate it

tawdry echo
#

someone have easy in use lib for configs?

terse ore
lost matrix
#
public class Counter {
  
  public int count;
  
  public void increment() {
    count++;
  }
  
}

If you want a counter to count in increments (And never count in other steps) then this class is unsafe
because someone could just do whatever they want with the field. counter.count -= 4000

Now we encapsulated the count field to protect it from unwanted access:

public class Counter {

  private int count;

  public int getCount() {
    return count;
  }
  
  public void increment() {
    count++;
  }

}
terse ore
#

let me show an idea I just had

#

wait nvm it doesn't make sense

terse ore
#

which are the cases you would make the variable public?

eternal oxide
#

if it were static and never changed

lost matrix
#

Now the important part:
If your field has a mutable value in it (like a List<> or Set<> or Map<>)
then you never, under any circumstances, create a getter or setter for it.

tardy delta
#

tell that my college teacher ๐Ÿฅบ

lost matrix
terse ore
#

something that happened to me today

#

if I have an Inventory

#

I shouldn't use a getter right

#

because the value can change

weak kayak
lost matrix
# terse ore for example

Bad

public class StudentCouncil {

  private final List<String> studentNames = new ArrayList<>();

  public List<String> getStudentNames() {
    return studentNames;
  }

}

Better

public class StudentCouncil {

  private final List<String> studentNames = new ArrayList<>();

  public void addStudent(String name) {
    studentNames.add(name);
  }

  public void removeStudent(String name) {
    studentNames.remove(name);
  }

}
river oracle
terse ore
#

wait what

terse ore
#

oh wait, I understood now

lost matrix
#

Those are accessors

terse ore
#

if you needed access to the list

lost matrix
#

You never expose the list

zinc lintel
river oracle
terse ore
#

you would clone it or should you make whatever you need to do in a method inside the class

#

and return the desired output

lost matrix
# terse ore you would clone it or should you make whatever you need to do in a method inside...

Right, if you want to show the content then you create an immutable copy of your encapsulated collection

public class StudentCouncil {

  private final List<String> studentNames = new ArrayList<>();

  public void addStudent(String name) {
    studentNames.add(name);
  }

  public void removeStudent(String name) {
    studentNames.remove(name);
  }

  public List<String> getStudentNames() {
    return List.copyOf(studentNames);
  }
  
}
terse ore
#

by inmutable you mean that the original value doesn't change right

lost matrix
#

Its a different object. So even if you would change it, the original list would be the same.
But this has another step of protection that makes it clear that you should not modify it:
List.copyOf() returns an immutable list which throws an exception if your try to edit it.

#

Using an immutableList is for fail-fast purposes

terse ore
#

okok

river oracle
# lost matrix Right, if you want to show the content then you create an immutable copy of your...

All you are achieving by doing what 7smile7 is doing above is simply abstracting away the list making sure you know everything that can be done with it. As well as making it a little more clear for people using / writing with your api or codebase know whats going on.
And you always copy your list before returning it as he does above to ensure this can't be done
studentCouncil.getStudentNames().add("Lol") etc

The clarity and explicitness of what can be done is worth the extra code written

lost matrix
terse ore
#

one last question

#

are there any official rules on how you should write code, like Python that has PEP 8

river oracle
#

java has guidelines on how you should format and name tihngs

river oracle
# terse ore hmm

I wouldn't worry too much about like tab size etc any competent ide will auto format that for you correctly

terse ore
river oracle
#

but method conventions etc are a big deal

terse ore
#

to use encapsulations

#

that type of code style

river oracle
#

I'd say you should strike a balence between OOP and Functional programming

terse ore
#

how much years have you guys been coding in Java?

river oracle
#

7smile7 has been coding for a long time

#

me

#

I started 2 years ago yesterday

#

With my python atleast

#

I've been coding java for slightly less than 2 years

terse ore
#

you also code in py?

river oracle
#

I'm competent in python and Java

#

I could probably get a job for either language given I'm not expected to write bytecode

terse ore
#

Im only with python

river oracle
#

I'm learning haxe atm too

terse ore
#

let me search that

hazy parrot
tardy delta
#

atleast something that gives me hope on the island of x86

fleet sundial
#

whats the place holder for exentalx

#

need one for cash

regal scaffold
flint coyote
#

Is there something like a category with blocks that have functionality on right click (Chests, crafting table, furnace, anvil etc.)? I want to cancel the right click interact event on those but don't wanna deny building by cancelling entirely.

torn shuttle
#

so if I'm not wrong for development purposes it doesn't really make sense to test API by committing to remote and then reading back from remote unless you are specifically testing remote right

hazy parrot
#

What

young knoll
flint coyote
#

Does that count in crafting tables and anvils?

#

Since it's not a persistent inventory

young knoll
#

Probably not

flint coyote
#

yeah, no :/ But it's a good start^^

lost matrix
#

Use mayfly in your if stetements

rigid drum
#

Anyone know if build tools would fiddle with git settings or something on linux? My WSL2 was working totally fine, jetbrains ides could push and pull using the git installed in WSL2
I think running build tools broke that, now they get permission denied instead ๐Ÿค”

ivory sleet
flint coyote
#

You would most likely keep all regions in memory anyway. Saving 2 coordinates per region won't take up too much ram (even with 10k region).
The problem is rather determining in which region someone is. Simply looping over 10k regions on each event would definitly hurt your tps pretty hard.
Worldguard obviously had the same problems and they optimized it by using a Quadtree afaik

ivory sleet
#

time, or space?

#

(or both?)

young knoll
#

Quadtrees are fun

flint coyote
#

Well you don't have to design the Quadtree. You just have to utilize it :)

ivory sleet
#

i mean obviously one way (to avoid having everything in memory at all time) is to bind the data to chunks

flint coyote
#

Wouldn't that lead to huge chunk lists in case you have large regions?
Lets say your region is from 0 to 1.000.000 in x and z directions - that would be plenty of chunks

#

I guess you'll have to learn how to use a Quadtree ๐Ÿ˜›

ivory sleet
flint coyote
#

Well ya. I expected it to only be squares. But obviously he could also have spheres, cuboids, circles

hasty prawn
#

Beating WorldGuard is going to be pretty difficult lol

flint coyote
#

A quadtree could still be a start for other shapes. If you plan to not always go for full height you even need an R-Tree to support the three-dimensional space tho

#

What if you utilize worldguards api to make what you need?

hasty prawn
#

Oh you're making a claim plugin? Yeah why not just use WorldGuard then

#

It can do all the heavy lifting region nonsense

flint coyote
#

So regions would still be in worldguards control but you could add your inventories etc. based on worldguard regions and their owners/members

lost matrix
#

If you want to ensure compatability with other plugins then using WorldGuard as a backbone for your claim plugin
is a decent idea

hasty prawn
#

WorldEdit and WorldGuard I assume are going to be installed on most servers tbh

lost matrix
#

Would never have WE on prod

flint coyote
#

I'd start with a region interface and have one Implementation that is called "WorldGuardRegion". Then you can support those regions (if the plugin is installed) and you can still implement your own regions

flint coyote
hasty prawn
hasty prawn
lost matrix
#

WE is a building tool. There is no reason to have it on production servers

hasty prawn
flint coyote
#

No, each region would have something like "isInRegion(Location loc)" or "isInRegion(Player player)" and maybe "getPlayersInRegion()".

I'd extract the claim part since it will be the same for all regions. However if it's not too much you could also make an abstract class and give those methods an implementation by default

#

I'd rather put the claim and inventory management in a seperate class "RegionController" or "RegionManager" of some sort tho.

lost matrix
flint coyote
#

That's why I said "of some sort"

flint coyote
lost matrix
#

What would you call a class which manages regions?

flint coyote
#

Oh you mean get all regions a player is in, right?

lost matrix
#

Just use WorldEdit as a backbone without an abstraction layer in between

#

Thats less confusing

flint coyote
#

He was talking about worldguard ig

lost matrix
#

*WorldGuard i mean

#

Start with your claim.
Creat a class Claim and then start adding what you think a claim needs.
A name for example.

#

Then maybe a manager class which keeps track of youir claims in a Map<String, Claim> and so on

flint coyote
#

Do you wanna take the WG approach or not? Or do you take the interface way and create an abstract class "Claim" and extend it to "WGClaim"?

#

Because WGClaim would already have an ID and coordinates

#

and ownerid(s)

lost matrix
#

Something that is extremely efficient is chunk-based claims

#

You can claim only whole chunks

flint coyote
#

Therefore you have to do all the optimization (with an R-Tree) yourself.

sullen marlin
#

For years and years worldguard just iterated every claim

lost matrix
#

That was also the reason why i initially wrote my own region system that doesnt scale O(n)

#

The fastest approach would be a Long2ObjectMap<Claim>
where long is the key of your chunk. Basically the x and z coordinate (both 32bit)
packed into one 64bit long.

flint coyote
#

Ouch. But what did they do to get all regions of a player?
Did they really call something like

for (Region region : regions) {
    // compare x,y,z?
}
lost matrix
sullen marlin
#

Yep

echo basalt
#

octtree maybe

lost matrix
#

Long2ObjectMap is from fastutils. You can also just use a HashMap

echo basalt
#

cpu improvements would come at the cost of memory

lost matrix
#

One moment

echo basalt
#

maybe an octtree of chunk sections

#

but them again this isn't an arbitrary shape

flint coyote
lost matrix
echo basalt
#

indeed

flint coyote
#

How much overhead is it to have 10 listeners instead of one listener that loops 10 times?

#

(this can scale up freely)

lost matrix
#
  public static int[] getChunkCoords(final long chunkKey) {
    final int x = ((int) chunkKey);
    final int z = (int) (chunkKey >> 32);
    return new int[]{x, z};
  }

  public static long getChunkKey(final int x, final int z) {
    return (long) x & 0xFFFFFFFFL | ((long) z & 0xFFFFFFFFL) << 32;
  }

  public static long getChunkKey(final Chunk chunk) {
    return getChunkKey(chunk.getX(), chunk.getZ());
  }

  public static Chunk keyToChunk(final World world, final long chunkID) {
    Preconditions.checkArgument(world != null, "World cannot be null");
    return world.getChunkAt((int) chunkID, (int) (chunkID >> 32));
  }

  public static long getChunkKey(final Location loc) {
    return getChunkKey(loc.getBlockX() >> 4, loc.getBlockZ() >> 4);
  }
#

Bit shifting

#

x >> 4 is pretty much the same as x / 16

#

other way around. x / (2^y)

flint coyote
#

I would have expected the Compiler to optimize such things anyway, I was never sure whether it does tho.

Does x/2 get compiled to x >> 1 ?

lost matrix
#

Not right away. Division and bit shifting still have some subtle differences.
But the JIT will eventually find the most efficient way.

flint coyote
#

I see, thx

flint coyote
lost matrix
#

You need to be aware of your claims ofc.
The Long2ObjectMap<Claim> map is a pure runtime structure and doesnt get persisted.
For that you either let the claim have a Set<Long> of claimed chunks or you create
a second mapping in your tracker Map<Claim, LongSet>.
Either way: adding or removing claims should never be done through the Claim object and
only the claim manager because it is vital to have both data structures updated.

lost matrix
flint coyote
#

Is it still negligible on 3000 Listeners?
Currently each of my regions has its own 5 listeners - I could make five listeners and just call it for each region instead. Would not look as clean tho ๐Ÿ˜…

lost matrix
#

You should never have that many listeners. Registering and unregistering them is also expensive.
So if you are doing that anywhere else than in your onEnable then you should absolutely change it

lost matrix
flint coyote
#

Yeah I might go with that approach aswell then

lost matrix
#

Delegate your events to your regions. Dont let every region listen for events

flint coyote
#

I'll still have some listeners that have to be registered at runtime but it won't be that many

lost matrix
#

Every time you have to loop through something and compare properties you can
make it more efficient using a HashMap<Property, YourObject>

#

*Given the property is unique

#

First question: Is a player allowed to have more than one claim

wet breach
flint coyote
lost matrix
#

Then you need a way to identify claims by something human readable.

private final Long2ObjectMap<Claim> liveChunkTrackMap;
private final Map<Claim, LongSet> claimChunkMap;
private final Map<String, Claim> claimNameMap;
private final Map<UUID, Set<String>> claimOwnerMap;

This is a primitive way of mapping your data and i would probably split this into
two different managers and write two new data classes but this is the one-class solution.

wet breach
flint coyote
#

AI compilers when?

wet breach
#

in the long run, the CPU and the extensions in the CPU microcode IE SSE3/4 type stuff

#

do this

#

basically by you doing the bitshifting in your code though, you are essentially skipping the line

#

in the CPU figuring out what the bitshifts should be

lost matrix
#

To have O(1) access when a block gets broken/placed/interactd. Or anything else happens on a location.
You simply compute the chunk key of that block and then check the claim for it.

flint coyote
wet breach
# flint coyote AI compilers when?

Its not an issue that the compiler can't do it, I think you mis-understand in just how does a CPU actually do math, how does 1+1 in code make it to the CPU for the CPU then to send back it is 2

#

it isn't even optimal when the CPU microcode is more effecient then most if not all compilers in knowing the bitshifts

#

for the compiler to figure out the bitshifts

#

your cpu already takes shortcuts that is why CPU extensions exist

#

and is their purpose, allows compilers to invoke those extensions which Java does use some of them including for math

#

and then there is just some things the CPU knows to do in regards to math to take shortcuts

lost matrix
#

Meh. Every claim should have a name.

flint coyote
#

While the microcode might be more efficient in resolving the bitshift than the compiler, this is still done at runtime and not at compiletime

wet breach
#

but, bitshifting is basically you overriding the entire middles process, and you say alright I want you to move these bits around just like this and tell me the result lol

flint coyote
#

So it might be that the compiler actually replaces divisions by bitshifts by using the CPU extensions?
Or is that done during runtime by the JIT (only)?

lost matrix
#

If a player wants to change something in a claim he needs a way to select it
/claim addfriend SummerHouse Olaf
For example

wet breach
#

anything too complex, the compiler will leave for the CPU to handle

#

or runtime as we say

lost matrix
#

For me the ideas come flowing in while i write.
The core is always just CRUD really.

flint coyote
wet breach
#

well for the compiler to figure out the bitshifts it will need the cpu to compute that

#

which would be counterintuitive

flint coyote
#

Obviously, yes. But I'd rather have my compiler take 0.2 seconds longer than my runtime to be slowed down

#
  • bit shifts are not as intuitive to calculate in your head when watching the code. Although that's probably a "get used to it" thing.
lost matrix
#

Whats so bad about letting the player chose a name?
/claim create SummerHouse <- creates a claim with the name
/claim addchunk SummerHouse <- adds the chunk the player is currently standing in to "SummerHouse"

wet breach
#

as this is how binary math actually works

flint coyote
#

If you work with that you are used to it - I'm not ^^. Workaround would probably be an IDE-Plugin that shows what 10 >> 16 translates to as a small indicator on the line.

wet breach
#

binary math is nothing more then shifting left or right however many bits, an example, if you shift the bit over to the left by 1, it is the equivalent of multiplying by 10 on that number

wet breach
#

you mean power of 2?

flint coyote
#

isn't 10 << 1 = 20?

#

To me it sounded like 10 << 1 = 10*10 = 100

native nexus
wet breach
#

I sometimes get mixed up lol

native nexus
#

its correct if its Decimal at least

#

If it was binary it would be 4

wet breach
#

its not like I keep all these things I know written down somewhere ๐Ÿ™‚

flint coyote
#

All good haha, it's already pretty late aswell

wet breach
#

just as long as I am able to convey what I am talking about and still be understood then that is all that matters ๐Ÿ˜›

flint coyote
#

But now I know a lot of what's going on behind the scenes. And that I should use bitshifts if applicable ๐Ÿ™‚

#

Although I'm aware that this is a micro micro optimization and there's usually better things to optimize ๐Ÿ˜ƒ

#

Thanks!

quaint mantle
#

I will venmo someone $20 RIGHT NOW to help me getting started into building my server

undone axleBOT
flint coyote
#

You technically helped him. I'd ask for 20$ lol

wet breach
wet breach
#

here is an applicable way of using bitshifting

#

one thing I like about bitshifting with using it with the above is the fact that I don't have to do any rounding manually

quaint mantle
#

not looking for a funny guy.....

flint coyote
quaint mantle
#

ive been there

wet breach
flint coyote
#

I could bet money that there is one but yeah I never checked either lol

rigid drum
#

I don't know you really want that

flint coyote
# wet breach here is an applicable way of using bitshifting

While something like that

int red = (rgb >> 16) & 0x0ff;
        int green = (rgb >> 8) & 0x0ff;
        int blue = (rgb) & 0x0ff;
        int red2 = (red * 8) / 256;
        int green2 = (green * 8) / 256;
        int blue2 = (blue * 8) / 256;

Isn't easy to understand it definitly won't get easier when seeing a normal division

rigid drum
#

only some bitwise is in place of math

wet breach
#

but yes you are correct though that if you could make your program nothing but bitshifts it would indeed be more optimal in terms of how quick it would run

rigid drum
#

nibbling for example isn't really something I would say has a direct mathematical equivalent that's "easier to understand"

wet breach
rigid drum
#

If you have to shift twice to get the same result it's already dubious

flint coyote
#

I was just giving an example based on your code. Having normal divisions here won't help with understanding what it does. For something like that bitshifts are probably even easier to understand

rigid drum
#

I agree with Fabsi, and that's a far more common case

wet breach
wet breach
rigid drum
#

My bad master

flint coyote
weak kayak
#

would that not be rgb / 65536 (or the hex equivalent)
that does make it pretty confusing-looking

flint coyote
#

I mean sure I would instantly know that it is 100.000 instead of seeing >> 16. That would not help me to figure out what (rgb / 100000) & 0x0ff; is supposed to do tho. I feel like it kinda adds complexity

wet breach
#

for example this is bitshifting to divide

#
public static long divide(long dividend,
                        long divisor)
{
 
// Calculate sign of divisor
// i.e., sign will be negative
// only if either one of them
// is negative otherwise it
// will be positive
long sign = ((dividend < 0) ^
            (divisor < 0)) ? -1 : 1;
 
// remove sign of operands
dividend = Math.abs(dividend);
divisor = Math.abs(divisor);
 
// Initialize the quotient
long quotient = 0, temp = 0;
 
// test down from the highest
// bit and accumulate the
// tentative value for
// valid bit
// 1<<31 behaves incorrectly and gives Integer
// Min Value which should not be the case, instead
  // 1L<<31 works correctly.
for (int i = 31; i >= 0; --i)
{
 
    if (temp + (divisor << i) <= dividend)
    {
        temp += divisor << i;
        quotient |= 1L << i;
    }
}
 
//if the sign value computed earlier is -1 then negate the value of quotient
if(sign==-1)
  quotient=-quotient;
return quotient;
}
#

all that is required if you don't want to use /

flint coyote
wet breach
#

that was another reason for the use of bitshifting

#

was for the rounding in regards to 8bit colors that are commonly implemented in terminals

flint coyote
rigid drum
#

no

wet breach
#

for simple stuff no it isn't

#

but if it was combined to do some long running calculations then yes it would be

rigid drum
#

Example?

flint coyote
#

For long running calculations I would expect the JIT to be just fine

wet breach
# rigid drum Example?

bitshifting bypasses the cpu in figuring out some things it needs to do in regards to arithmetic. Therefore, if you can provide a shortcut to the shortcut it tends to be a lot better

wet breach
rigid drum
#

I'll believe that if I see an example, I doubt you could get any improvements of that nature in java

wet breach
#

two different things here, if I tell the cpu to calculate 1+1 it will tell me its 2, and if I do that again a minute from now it will do it again, unaware it had already done this

flint coyote
wet breach
wet breach
#

however if we are going to look at the difference between bitshifting and just using /

#

and nothing more

#

just those two things in java

rigid drum
wet breach
#

then you will probably be surprised that java goes to native methods and in the native code it turns into bitshifting if it can figure it out, otherwise the native method invoke any CPU extensions that are relevant

#

but the key part is the if though

rigid drum
#

But I actually do agree that in the case of division and PERHAPS multiplication if you were doing something that could broken down further you probably should.

flint coyote
wet breach
flint coyote
#

But how does the JIT know that it ever needs it again? What if I do that for 3 seconds and then never again. Will it keep that optimization in memory (or even in the cpu cache) for the rest of the runtime?

flint coyote
#

But then it has to optimize it again, no?

wet breach
#

how long this takes I actually never measured or had a need to look in code

#

various things have differing time spans in the jvm memory stuff lol

wet breach
flint coyote
#

Lots of "magic" going on behind the scenes lol

wet breach
#

oh you will be surprised

#

I do recommend people diving into the JVM code

#

not everything works as you think it might either ๐Ÿ˜‰

flint coyote
#

The .class compiled code?

wet breach
#

no the source code

flint coyote
#

oh

#

Where do I even find that? And what language is it written in? C?

wet breach
#

some of the JVM is in java

#

then you have the native code

#

which is sometimes C++ or C

#

native code is needed to invoke cpu extensions

#

and do some other things like invoking OS stuff

flint coyote
wet breach
#

idk

#

I never really thought about that if at all lmao

flint coyote
#

But it's kinda the same for github. Github is used to develop github

wet breach
#

Anyways time for me to go to work uwu

flint coyote
#

But github is not a language so it's easier to understand how they got started without it

#

Alright, have fun at work and enjoy your day! :)

echo basalt
#

@lost matrix managed to get mineskin working?

wet breach
#

There is plenty that can be useful just by knowing how the jvm does things

sage patio
#

can somebody help how to drop a item like this?

wet breach
#

Just give it some velocity at a slight angle

#

This is a scenario where trial and error tod figure out values would be easier

young knoll
#

Probably around a 2:1 ratio of y velocity to x/z velocity

wet breach
hexed falcon
#

is this right?

#

i'm trying to make the player get levitation if they right click and the crown is in the helmet slot

#

but it's not working

young knoll
#

You are trying to compare ItemMeta to a string

#

ItemMeta is not a string

#

ItemMeta#getLore#contains(string)

hexed falcon
young knoll
#

Sure

hexed falcon
#

didn't work

young knoll
#

Add debug print outs

#

Figure out where itโ€™s failing

lost matrix
lost matrix
# sage patio

call dropItem(...) and then apply a velocity on the Item

wary mauve
#

I want to create or find a plugin that allows me to do the following.

Each player has their own mini world. Maybe 16 chunks by 16 chunks. These are normal chunks that I can generate with the default generator or a custom generator, and the chunks are surrounded by void.

Each player's mini-world is potentially in its own Multiverse world, or I can find another way to separate them.

Additionally, I'd like to regenerate the player's mini-world every day that they log in.

Is this possible? Could anyone point me in the right direction to learn how to do this? I've been trying to find stuff for hours.

real marsh
#

Hello, who knows a plugin where you can have a chest that is updated from time to time fill the chest again. a plugin similar to PhatLoots or lootin

lost matrix
lost matrix
wary mauve
wary mauve
lost matrix
#

Let me look into that. You might need to write a custom chunk generator for that

bold vessel
#

I want to make a placeholder that return the top voter by using the leaderboard.yml file (already created by the plugin)

#

It looks like this

lost matrix
lost matrix
lost matrix
bold vessel
#

I want to display it in a hologram in my spawn

#

How can i made it without lag ?

#
@Override
                public String onPlaceholderRequest(Player player, String params) {
                    if (params.startsWith("wovote_")) {
                        // get the leaderboard file
                        FileConfiguration lb = YamlConfiguration.loadConfiguration(leaderboardFile);

                        // extract the number from the placeholder name
                        int place = Integer.parseInt(params.substring(7));

                        // get the list of player UUIDs who have voted, sorted by number of votes
                        List<UUID> voted = lb.getKeys(false).stream()
                                .map(UUID::fromString)
                                .sorted(Comparator.comparingInt(id -> lb.getInt(id.toString())).reversed())
                                .collect(Collectors.toList());

                        // check if the requested place exists
                        if (place > voted.size()) {
                            return "inconnu";
                        }

                        // get the UUID of the player at the requested place
                        UUID playerUUID = voted.get(place - 1);

                        // try to find the name of the player with this UUID
                        String playerName = playerUUID.toString();
                        if (Bukkit.getOfflinePlayer(playerUUID).getName() != null) {
                            playerName = Bukkit.getOfflinePlayer(playerUUID).getName();
                        }

                        return playerName;
                    }

                    return null;
                }
            });
        }
    }```
I start the server with this im going to try
lost matrix
#

Dont do IO on the main thread.
Persistent storage (Hard drives, SSDs etc) are way way slower than
your ram. Reading/Writing files is very slow. Doing that on the main
thread takes away a lot of CPU time from the actual game.
(Minecraft and other plugins need the thread as well and you are blocking it with IO)
So simply dont do IO on the main thread.

bold vessel
#

So what should i do instead of IO ?

#

Make a request to the vote website ?

lost matrix
#

Thats also IO

#

That is extremely slow IO even

#

Accessing Databases, using Files and web requests are all IO operations
and should never be done on the main thread.

bold vessel
#

So what should i do ?

#

What is not going to slow the main thread

lost matrix
#

Create a structure in memory which stores the top N players and schedule
an async task which updates the structure every few minutes.

#

*And make sure the structure is thread safe

wary mauve
#

Like a bukkit runnable?

bold vessel
#

Im going to do this later thanks for the idea

lost matrix
#

Yes the BukkitScheduler has methods for that for example.
But a normal Executor will do as well.

bold vessel
lost matrix
bold vessel
#

It will ruin what ? Tps?

lost matrix
#

Yes

#

Sometimes IO can even crash the server all together

bold vessel
#

I thinks im going to forget this idea ๐Ÿ’€

lost matrix
#

No thats a good first step into multithreading.
Learning how to not block with IO is important.

#

First make the placeholder work

bold vessel
#

I have no idea why its not working im getting 0 return

lost matrix
#

Then its probably not registered properly or your are having an exception in your console

bold vessel
#

Its registered, the %wovote% i in the /papi list and in the logs its writted its registered

#

And i got 0 error in console

#

Thats weird

lost matrix
#

Add a debug message in your placeholder and see if its fired

#

Also: Never reload the server. Always restart.

bold vessel
bold vessel
lost matrix
lost matrix
wary mauve
#

One at a time

lost matrix
#

Hmm. Merging those will be a hustle.

wary mauve
#

If it's all taken from the same seed, won't it just generate normally?

lost matrix
#

But what you can do is create a world using the normal generator, generate NxN chunks, save it
and load it again with a simple empty world generator. Then there wont be any new chunks being
generated.

wary mauve
#

How would I do that?

lost matrix
#

Which part exactly?

wary mauve
#

That sounds like a good solution. Uhh

#

like all of it

lost matrix
#

One moment

wary mauve
#

Youre good, thank you so much

lost matrix
# wary mauve Youre good, thank you so much

Creating a new world by using the default ChunkGenerator

    WorldCreator creator = new WorldCreator("YourWorldName");
    
    creator.environment(World.Environment.NORMAL);
    creator.generateStructures(false);
    creator.type(WorldType.NORMAL);
    
    World world = creator.createWorld();

Generating a square of chunks in a world (should be done async probably)

  public void generateChunkSquare(World world, int centerX, int centerZ, int width, int height) {
    for(int x = centerX - width; x <= centerX + width; x++) {
      for(int z = centerZ - height; z <= centerZ + height; z++) {
        world.getChunkAt(x, z);
      }
    }
  }

A simple void generator looks like this. I believe that no implementation results in nothing being generated

public class VoidGenerator extends ChunkGenerator {

  @Override
  public Location getFixedSpawnLocation(World world, Random random) {
    return new Location(world, 0, 100, 0);
  }

}
wary mauve
#

How would I implement the two methods?

wary mauve
lost matrix
wary mauve
#

I'm probably such a pain in the ass for my incompetence

#

Sorry โค๏ธ

lost matrix
#

You should have all you need

wary mauve
lost matrix
tender shard
# bold vessel

because you always return null for all placehodlers shown in your screenshot

wary mauve
wary mauve
# lost matrix Creating a new world by using the default ChunkGenerator ```java WorldCreato...

Any idea what went wrong?

WorldCreator creator = new WorldCreator("mini-world-1");

creator.environment(World.Environment.NORMAL);
creator.generateStructures(false);
creator.type(WorldType.NORMAL);

World world = creator.createWorld();

generateChunkSquare(world, 0, 0, 8, 8);

assert world != null;
getServer().unloadWorld(world, true);

WorldCreator voidCreator = new WorldCreator("mini-world-1");
voidCreator.generator(new VoidGenerator());
voidCreator.createWorld();

hot bridge
#

how do i remove my resource from the website?

remote swallow
#

report it and ask for it to be deleted

hot bridge
#

oh ty

wary mauve
#

Custom chunk generation

wet breach
tender shard
#

why does IJ get worse and worse every day

rough ibex
#

lol

lost matrix
tender shard
#

old style?

#

you mean UI? Yeah the new one is ridiculously bad

#

it just takes up more space for everything lol

#

also wtf is this? why did they replace the names with those shitty icons? what for example is this "information" tab?

#

I mean sure, the middle one is probably terminal/"Run all", and the lower one is git history or whatever. b ut wtf is the "i" thing?

#

erm I meant exclamation mark

lost matrix
#

It tooke me a bit to get the into the flow but i love it so far

tender shard
#

I really dislike it

#

I'll keep it disabled as long as it's possible

#

wtf is this e.g.

#

nobody ever was like "oh, I wish I would need an extra step to access the menu" lol

remote swallow
#

that ik you can toggle

tender shard
#

yeah but this alone is an example about what's wrong with the "new ui". Why would they hide something so important on purpose, and then make me go through the settings to enable it again

#

same for the "compact mode" (which is still less compact than the original UI"

#

nobody ever said "oh, I think I can see too many files in my IDE. I wish they would just make the entries in the project explorer larger, so that I have to scroll more"

#

and as said, even in "compact mode", it fits less files than the original design

#

on my macbook, it's a difference of almost 20 files between normal mode and "new ui"

#

now it feels like a weird tablet app where you have to do 3 extra steps for things that previously had their own button

glossy venture
#

i havent updated intellij since like 2021 lol

#

im still on IntelliJ 2021.something

remote swallow
#

why

hexed falcon
#

how would i get a specific players uuid?

tender shard
#

getUniqueId

hexed falcon
tender shard
#

?learnjava

undone axleBOT
tender shard
#
  1. you cannot cast a UUID to player
  2. you cannot loop over sth that's not iterable
#

what are you trying to do?

hexed falcon
#

add passive effects to a player when they hold an item

tender shard
#

oh and 3. you don't have any player object in the first place

#

then loop over all online players

#

loop over Bukkit.getOnlinePlayers()

hexed falcon
#

but the issue right now is it's adding them to all the players online

tender shard
#

loop over all online players, then check if they have that item in the hand, then add the effect

#

and don't compare your items by lore, rather compare them using PDC tags

#

e.g. like this

    // Key to identify your custom item
    private final NamespacedKey isMyCustomItemKey = new NamespacedKey(myPlugin, "is-my-custom-item");

    // The custom item
    private final ItemStack customItem = new ItemStack(Material.DIAMOND_PICKAXE);

    {
        // Set up your item
        ItemMeta meta = customItem.getItemMeta();
        meta.getPersistentDataContainer().set(isMyCustomItemKey, PersistentDataType.BYTE, (byte) 1);
        customItem.setItemMeta(meta);
    }
    
    // Returns a new clone of your item, so you can give it to players etc
    @Contract("-> new")
    public ItemStack getMyCustomItem() {
        return customItem.clone();
    }
    
    // Checks if a given item is your custom item
    public boolean isMyCustomItem(@NotNull ItemStack itemStack) {
        return itemStack.hasItemMeta() && itemStack.getItemMeta().getPersistentDataContainer().has(isMyCustomItemKey, PersistentDataType.BYTE);
    }
vital sandal
#

How can I manage to cancel damage cause by crystal by some specific players?

rough ibex
#

Listen for the damage event

#

check the cause

#

cancel it

#

as for by some specific players you will need to also listen for the reverse - player hitting crystal

vital sandal
#

:l It does has properti (cause by crystal ? )

rough ibex
#

damager and damagee are both Entity

#

check if isinstance EnderCrystal

#

and isinstance Player

ashen agate
#

Pretty sure only the first header comments are included when you load a configuration file using SnakeYAML (library that spigot and bungeecord use). The comments will be preserved as long as you do not modify the configuration file and save it again since the library does not take into consideration any comments you added. You can add a header comment, though, which will always be preserved.

#

There are methods out there that allow you to keep these comments. But the best way to do this is to upload it once, and then only load the contents in, without making any changes to the file programmatically. That way the yaml library won't get rid of your comments.

tardy delta
ashen agate
tardy delta
#

ij is indeed getting worse and worse every day

#

cooldown?

#

just store the last time the player executed the command and check if theres 60 seconds in between

#

System.currentTimeMillis()

terse ore
#

Hey

proper notch
#

milliseconds

terse ore
#

Milliseconds

tardy delta
#

thats the amount of milliseconds since 1970 or smth like that

#

January 1, 1970

#

could also work with Instant if you want

#

not that big

#

oh wait that seconds

#

just add a few zeros

#

cmon intellij

sage patio
wet breach
#

And set its direction at like 45 degrees. Just play with the veleocity amount at that angle and it should get you what you are looking for

sage patio
wet breach
#

To decrease the speed you are going to have to modify its gravity and lower the velocity

sage patio
#

๐Ÿ˜‚

wet breach
#

Think you set the gravity too low

sage patio
#

its a boolean

wet breach
#

Hmmm

#

Wonder if its an attribute you can modify

sage patio
#

maybe disabling that for just smth like 5 ticks?

wet breach
#

You could try that

sage patio
#

ooo looks way more nice now, lemme record

#

sets back the gravity to true after 3 ticks

wet breach
#

There you go

sage patio
#

thanks

wet breach
#

Looks really good now that it isnt flying away

sage patio
#

yea lol

#

the only thing remaining is to drop it to the players direction
or just on front of the chest, this one is better

tardy delta
#

imagine trying to pickup an item and it just flies away ๐Ÿค”

sage patio
#

๐Ÿ˜‚

#

i'm trying to create something like Warzone lootboxes

#

Call of Duty Warzone

wet breach
#

In that case you need to add a randomizer

sage patio
#

yea for the loots, its already done

wet breach
#

That throws the items in a circle

#

If you want it similar to warzone

#

Because in warzone the items dont all land in the same spot

sage patio
#

the warzone just drops the loots to in front of the loot box

sage patio
wet breach
#

I play on ps4

sage patio
#

yea it drops it to in front of the chest

tardy delta
#

whats up with the graphics

sage patio
#

i just copied an image from internet

wet breach
#

But they are spread out is my point

#

Occasionally items will stack on top of each other if there isnt much room or just quite a bit of items

sage patio
#

hmm yea right

wet breach
#

Anyways time to drive home

tardy delta
#

live footage of frostalf

remote swallow
#

rocket league looks a bit different

fluid river
#

musty flick

paper viper
#

How do i remove this

icy beacon
#

maybe add HIDE_ATTRIBUTES?

paper viper
icy beacon
#

idk then ๐Ÿ˜ฆ

young knoll
#

Itโ€™s HIDE_POTION_EFFECTS

#

Why? Because bad naming

paper viper
#

I was about to post it ๐Ÿ˜€

icy beacon
#

makes total sense

terse ore
sage patio
#

how i can loop in a section like this?

Locations:
  1:
    world: world
    x: 0
    y: 0
    z: 0
  2:
    world: world
    x: 0
    y: 0
    z: 0
  ...
  69:
    world: world
    x: 0
    y: 0
    z: 0
#

just getting the String list and getting all the values using getString(path) again?

remote swallow
#

thats a config section

#

one sec

#
for (String key : config.getConfigurationSection(path).getKeys(false)) {
    ConfigurationSection section = config.getConfigurationSection(path + "." + key);
    // do stuff
}
#

you can also add an if to check if it is a config section before grabbing it as one

sage patio
#

nice thanks

icy beacon
#

Material.BRICKS is a brick block, right?

pseudo hazel
#

yes

#

a single brick is the item

icy beacon
#

ty

sage patio
#

this is my code rn

#

still gives a null error even when i'm checking its null or not

remote swallow
#

whats Lootbox.java 56

sage patio
#

sorry the lines are missing, wait

desert loom
#

your null check is always false or it will throw an npe

#

getKeys will never return null and getConfigurationSection can return null

#

I think you meant to check if the result of getConfigurationSection is null and not the keys returned from it

sage patio
sage patio
desert loom
#

also you can just return the lootBoxes variable instead of constructing a new list

sage patio
#

its location of blocks, wdym by whole location?

#

what else can be in a location, just yaw and pitch which its not important for blocks

#

getLocation? how

#

from a config file?

#

nope, maybe its because of i'm on 1.12.2

#

just saving it like this and get it back into a location with that code you sent?

#

ow, thanks a lot

wise mesa
#

So weird that set takes a class

#

Should just be a generic

hazy parrot
#

What

#

It takes Object

cunning kettle
#

Gays help me PLS. I wanted to install the Simple Voice Chat plugin in my server, but I can't.

icy beacon
cunning kettle
icy beacon
#

np

cunning kettle
#

Can we go to the Bos I will explain in more detail ?

#

did you set it up through a spigot ?

#

Have you installed only one jar or another ProstoLib ?

quartz sorrel
#

Does someone know here how I could reliably check on BungeeCord, if a plugin is present AND enabled?
Spigot has a PluginManager#isPluginEnabled but BungeeCord doesn't seem to have a method of similar kind here...

alpine swan
#

does Bukkit.getServer().shutdown() shutdown the server the same way as sending stop as consolecommandsender would? like does it first save everything like the command

elder quail
sage patio
tardy delta
#

no

#

its a public constant remember

hazy parrot
#

What you want to do

tardy delta
#

do you have enum methods?

young knoll
#

I guess you could do something like

#

MyEnum.VALUE.get

tardy delta
#

let not implemnted override the enums methods to throw an ex

quartz sorrel
tardy delta
#

assuming your enum has a state

young knoll
#

Where get either returns the enum value or throws

sage patio
young knoll
#

Et tu, Brute?

tardy delta
#

mange baguette

wary mauve
#

How can I generate a world with only a couple chunks? Can I specify which chunks are generated?

I then switch the world generator to a void generator so no more chunks are generated after that. Is this possible?

quartz sorrel
quartz sorrel
#

I don't think you really understood my question here

tardy delta
#

simply dont have an nOT_IMPLEMENTED constant

#

how is it getting used?

heavy mural
#

Idk what I did but I removed a nametag (above a players head) by accident with just spigot ๐Ÿ˜…

ivory sleet
#

and then for safety measures u could go so far as in looking for a NCDFE when casting the instance

#

(And a class cast exception i guess)

#

Remember bungee doesnโ€™t have the same notion of disabled/enabled state, either a plugin enables during startup, or it fails, no dynamic changes during runtime after that

quartz sorrel
ivory sleet
#

Ah I see

quartz sorrel
#

Tho, I assume it will be relatively save to assume that when the plugin is present, it works

ivory sleet
#

Yea, would suppose that also

wary mauve
#

How can I get the ChunkData of a chunk? Or how can I manually call the generateNoise method to regenerate a chunk?

regal scaffold
wary mauve
#

How do I use these methods manually?

warm mica
#

Everything you need should be in that class

wary mauve
wary mauve
lone jacinth
wary mauve
#

Damn maybe there's a reason I havent seen a plugin do what I'm trying to do.

glossy venture
#

how do i push a constant

#

what opcode

charred blaze
#

how do i fix this?

glossy venture
#

oh wait IPUSH maybe

charred blaze
#

?

glossy venture
#

answer to my own question

warm mica
wary mauve
tardy delta
#

oh man this code goes brr

warm mica
#

Otherwise you could create a new world with the same seed and generator and copy the chunk over

chrome beacon
#

As the javadocs say decoration may be spread across chunks so it's not easy to get the correct decoration

vast raven
#

INSERT INTO placed_types (id, x, y, z, world, slot-1, slot-2) VALUES ('test', -381.0, 76.0, -279.0, 'e4026fdd-ed00-44e6-8ac2-73f3e05eab29', 'test', 'test');

#

Where am I failing?

wary mauve
warm mica
pulsar veldt
#

what's the standard way of creating my own deobfuscations for nms code? I'm trying to understand Structures and I'd like to be able to rename stuff

wary mauve
warm mica
vast raven
#

uh

icy beacon
#

any simple way to get an offline player's world (location)? trying to reset an offline player's spawn location to default

vast raven
#

understood

#

thanks

warm mica
warm mica
icy beacon
hasty prawn
#

I mean your only options afaik are storing it yourself and using that or reading it from their player file directly.

icy beacon
#

hm

icy beacon
#

i'd be down to read it from the file if i knew how to lmao

crimson vault
#

Does anyone know of a plugin that allows you to "design" an inventory in the game and then "convert" the inventory to Java code?

icy beacon
#

i'll take a peek at nbtexplorer or whatever is opensource

hasty prawn
#

Yeah NBTExplorer

icy beacon
#

maybe i won't

#

i don't wanna read csharp at this time of the day

#

or any other frankly

hasty prawn
#

heh?

icy beacon
#

i'll find another solution then

#

xD

hasty prawn
#

You just have to read the .dat file, NBTExplorer is just going to help you find where the information you want is

icy beacon
#

i figured that for my purpose i have enough data - i already save the world uuid that could be associated to this player

#

so i'll just use that

#

thanks nevertheless

pure dagger
#

how to use tabCompleter for several arguments?

chrome beacon
flint coyote
#

Is there a better/cleaner way of letting a player mine a block in a way that everything from the BlockBreakEvent (whether it drops a block/xp) is taken into account?

                            ItemStack minedWith = player.getInventory().getItemInMainHand();
                            BlockBreakEvent event = new BlockBreakEvent(block, player);
                            pluginManager.callEvent(event);
                            if (!event.isCancelled()) {
                                if (event.isDropItems()) {
                                    block.breakNaturally(minedWith);
                                } else {
                                    block.setType(Material.AIR);
                                }
                                Location blockLoc = block.getLocation();
                                ((ExperienceOrb) blockLoc.getWorld().spawnEntity(blockLoc, EntityType.EXPERIENCE_ORB)).setExperience(e.getExpToDrop());
                            }
#

While it would work like this it would break with an update that introduces something new.
e.g. Blocks regenerate hunger when mined or whatever

regal scaffold
#

Instead, learn a gui implementation

#

@lost matrix

vast raven
regal scaffold
#

How would you implement a dynamic page setup into your gui implementation.

As in for example, display multiple pages of online player heads if there are more than the allowed slots per page

flint coyote
#

Dang how did I not see that lol

#

thx

pure dagger
torn shuttle
#

so this is an interesting one, contrary to what I thought it seems like the checkExtraStartConditions just freezes an entire activity if set to false

#

the brain implementation is weird

regal scaffold
#

I have a question about ConfigSerialization

#

It only force you to override the serialize() method, but not the deserialize

#

I've been manually adding

public static UltraChest deserialize(Map<String, Object> map) {}
#

If there is no method like the one above present, does it try to find a constructor that matches?

#

Cause intelliJ says no usages obviously

icy beacon
#

why do kotlin stacktraces always point to lines that don't even exist

#

gotta debug it eh

regal scaffold
#

nvm

tardy flame
#

๐Ÿ’€

pure dagger
#

what is return in onCommand method for?

tardy delta
#

return false prints the command usage to the sender

tardy delta
pure dagger
#

oh, but i do it myself anyway

icy beacon
#

it does this shit when it's inside of a lambda

#

so i just gotta look around for something relevant to the error

#

in this case it was quite quick

remote swallow
#

have you considered not using kotlin

icy beacon
#

no

#

i enjoy it

#

thx

tardy delta
#

i looked at scala but it surprised me that the syntax is a piece of shit

icy beacon
#

lmao

regal scaffold
#

Epic

#

What's an alternative to using gameprofiles to get a custom player head

#

Something that's actually reliable

icy beacon
#

why do yall hate syntax sugar so much ๐Ÿ˜„ it's fun

regal scaffold
#

Cause getting it using gameprofile is so inconsistent

flint coyote
#

Kotlin streams are lovely since you automatically have "it" to access objects. + you can directly use function blocks and you can do
x.map
instead of x.stream().map

icy beacon
#

yeah

#

i love the it

#

a small thing but so convenient

flint coyote
#

Also extension functions can be neat

torn shuttle
#

meh intellij handles that for me anyway

icy beacon
#

๐Ÿ˜›

#

also true

torn shuttle
#

jesus christ how are brains supposed to work in minecraft

#

I can't get this garbage to behave

flint coyote
#

I still prefer seeing
x.map { it.toString() }
over
x.stream().map(obj -> obj.toString()).toList()

hazy parrot
icy beacon
#

i'll give credit where it's due, i've never seen a weird stacktrace in java (in terms of mismatching line numbers)

#

but in kotlin lambdas are used fairly frequently and as such it tends to pop up quite sometimes

#

but the lack of NPEs...

#

oh my god it's lovely

torn shuttle
#

I don't understand how brains are meant to work

flint coyote
#

Sometimes the whole immutable by default thing gets a little annoying tho. Since I always feel bad when I'm using "var"

icy beacon
#

var makes me feel like i'm doing something wrong

hazy parrot
#

I think I used var In kotlin probably less then 20 times lol

icy beacon
#

xD

flint coyote
#

Yeah and function parameters are immutable, too. So if you get a string you first have to make a var string before modifying it.

tardy delta
flint coyote
#

or "modyfing" - since they are immutable anyway

icy beacon
tardy delta
#

kotlin is however a very funny language

icy beacon
#

oh yeah it's all fun

flint coyote
tardy delta
#

why

#

what do you have against rust?

icy beacon
#

somehow the hate against languages on this server is somehow larger than any form of hate speech lmao

#

i haven't seen a single sexist/racist/etc sentence in a VERY long while here

flint coyote
#

I get the idea behind rust and personally I haven't used it but it sounds so painful to code

icy beacon
#

but when someone says "kot..." there are stones and tomatoes flying around the air instantly

#

๐Ÿ˜„

tardy delta
#

as it should

icy beacon
#

eh

#

no hate to languages is viable

hazy parrot
icy beacon
#

i mean having an opinion is of course encouraged

#

but not so extremely

pure dagger
#

whats the difference between between getPlayer and getPlayerExact

tardy delta
#

ive tried kotlin with gradle and it looks terrifying

flint coyote
# tardy delta as it should

Honestly? no.
I use kotlin at work and I use java for my personal projects.
I can see why people ditched java for kotlin. I would too, if I wouldn't have like 8 years of experience in java vs 1 in kotlin. + Kotlin is not as popular for businesses

icy beacon
#

getPlayer returns everything that starts with that string afaik

hazy parrot
#

Tbh I will never go back to java if I don't have to use it

icy beacon
#

correct me if i'm wrong

tardy delta
#

getPlayer(fourteen) will also return fourteenbrush

hazy parrot
#

Less then 100 lines

icy beacon
flint coyote
tardy delta
#

lemme count

pure dagger
#

getPlayer doesnt need entire name? what/

#

ur fast

icy beacon
tardy delta
#

480 lines of horror

pure dagger
#

player gives me a name of player

flint coyote
icy beacon
#

true too lmao

#

talking about kotlin on this server be like

remote swallow
hazy parrot
#

I mean only coroutines is reason for me to not go back to java if I don't have to lol

flint coyote
#

A lot of people have grown up using Java. Not everyone is comfortable or has the time to try new things

icy beacon
#

i was looking for a different bird meme template but this one also fits

icy beacon
#

this was the one i was looking for

#

kinda me after trying kotlin for my main project

#

but ofc it's normal if someone doesn't like a language

#

just don't code in it

#

no need to pour shit over it

flint coyote
#

Sadly java is kinda like muscle memory for me at this point - kotlin is not :(

hazy parrot
#

Yeah but there are some languages you have to pour shit over

#

Js for example

#

:kek:

icy beacon
icy beacon
flint coyote
#

I can't start a project with kotlin that I want to be as perfect as it gets since I know I will do "beginner" mistakes xD

icy beacon
#

oh just start

#

if you don't make mistakes you won't learn

lost matrix
icy beacon
#

you do make a good point, the sole age of java allows it to have a lot of standards and etc

#

guess it's something that kotlin developers will have to build from the ground up or somehow manage it otherwise ๐Ÿ˜„

regal scaffold
#

What's an alternative to using gameprofiles to get a custom player head
Something that's actually reliable
Cause getting it using gameprofile is so inconsistent

icy beacon
#

some upsides & downsides everywhere

flint coyote
#

Sadly the age of java + the goal to keep backwards compatibility is also its biggest pain point

lost matrix
regal scaffold
#

Oh

#

Sick

#

Thanks

icy beacon
flint coyote
#

That's also why kotlin has a lot more features than java - they thought it through based on the issues with the language it's based on (java) - and learned from those mistakes.

lost matrix
#

Sure, let me take a look

remote swallow
#

anyone here able to test somethng rq for me, for some reason gradle isnt pulling my dependecy classes and idk why and was just wonder if its my pc or somehow i fucked up publishing. just need someone to like add the repo + dep and check if they can access the classes

cobalt thorn
#

Hi, how can i spawn a zombie that doesnโ€™t attack specific players

flint coyote
#

You have to cancel the EntityTargetEvent

icy beacon
#

wait you could do that

#

i was writing an entire essay on how to make a custom pathfinder goal

flint coyote
#

xD

icy beacon
#

well that works too

flint coyote
#

Well the pathfinder runs beforehand. If the pathfinder finds a target, the EntityTargetEvent can be cancelled to "ignore" that result

cobalt thorn
icy beacon
#

just check if your zombie is resurrected

flint coyote
#

Obviously you would have to keep track of your zombie(s) and only cancel the event if your entity is one of those zombies

icy beacon
#

and the same applies to cancelling it only if the target is a certain player

flint coyote
#

I once made a pig that was pathfinding like a parrot and would attack you. Getting attacked by flying pigs is kinda funny

icy beacon
#

lmao

regal scaffold
#

I'm trying to use anvilGUI by wesJD

#

But it says it doesn't suport 1.17.1

final monolith
#

Some method to convert the Bukkit slots to NMS slots?
(Bukkit's slot zero of player's inventory is the first item of the hotbar, and the slot zero of player's inventory on NMS represents the first left up element of the inventory)

regal scaffold
#
Caused by: java.lang.IllegalStateException: AnvilGUI does not support server version "1_17_R1"
[13:44:53 ERROR]: [RPPhones] [ACF]      at rpphones-1.0-SNAPSHOT.jar//me.tomisanhues2.rpphones.shaded.anvilgui.version.VersionMatcher.match(VersionMatcher.java:34)
[13:44:53 ERROR]: [RPPhones] [ACF]      at rpphones-1.0-SNAPSHOT.jar//me.tomisanhues2.rpphones.shaded.anvilgui.AnvilGUI.<clinit>(AnvilGUI.java:39)
[13:44:53 ERROR]: [RPPhones] [ACF]      ... 32 more
[13:44:53 ERROR]: [RPPhones] [ACF] Caused by: java.lang.ClassNotFoundException: me.tomisanhues2.rpphones.shaded.anvilgui.version.Wrapper1_17_R1
[13:44:53 ERROR]: [RPPhones] [ACF]      at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151)
[13:44:53 ERROR]: [RPPhones] [ACF]      at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103)
regal scaffold
#

wym it's a library

final monolith
#

What you mean with library? you are shading into your plugin?

#

or using as plugin at the /plugins folder?

regal scaffold
#

Shading

#

I literally see the compatibility folder for my version

final monolith
#

Its an error on the library, apparently

#

not seems to be an error at your plugin

regal scaffold
#

That sucks

#

Means I gotta implement it myself...

#

Well, here we go ig

icy beacon
#

open a issue ig

celest hinge
#

It's my first time using maven but what was my mistake? I just followed the docs and still get the error ClassNotFoundException: team.unnamed.creative.file.FileResource

remote swallow
#

you arent shading it

celest hinge
#

How do I do that and why is it necessary

remote swallow
#

you need to add <scope>compile</scope> to the dep, without shading the class doesnt exist anywhere so your plugin cant access it

remote swallow
#

?paste the error

undone axleBOT
celest hinge
remote swallow
#

?paste your pom

undone axleBOT
celest hinge
#

sorry thats an old one

remote swallow
#

that looks correct, run mvn clean build and try that jar

#

also i dont think you should be shading the server

celest hinge
#

that was a default

celest hinge
#

oh I had that twice

#

some confision with the docs