#help-development
1 messages ยท Page 447 of 1
INSERT INTO placed_types (id, x, y, z, world) VALUES ('testid', 2, 2, 2, 'test', 'test', 'test', 'test');
Why?
Check if they are "whitelisted" and change the location in the PlayerSpawnLocationEvent
ah okay thank you
oh i see what you're trying to
my bad
The error is on the slots parameters
You have more values than columns
If you insert all values then you dont even need the first part
seriously?
yeah
I mean they are not all the values at all times
Anyone ?
Yeah if you insert all columns then you can just do
INSERT INTO name VALUES (?, ?, ?)
Why are you adding tags to itemstacks like that in the first place?
Go ahed
is this channel spigot development restricted or it can be used for noob java questions?
It's a friend that is doing that, so I have no hands on that
Is it possible to do ?
I was not even paying attention to the first part of the query
You can get the NBT tags by using nms
I can't do it trough PersistentDataContainer ?
it was for asking myself a question lol
NBTAPI > *
I felt being considered on that, sorry
dw
why ios the @Override red? What am i doing wrong? im on 1.19.3
https://paste.md-5.net/udixidaref.java
ask your noob java questions
because there is no pathfinder() method in class that is extending yours
so how do i override the pathfinder of the entity
show your whole class
(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
oh
why are spigot docs so slow wtf
maybe it is your internet?
other sites seems to be okay ยฏ_(ใ)_/ยฏ
it works fine for me
goksi
well
server location could me also a factor
- operator calls String::concat
docs
wait what
๐คทโโ๏ธ Works for me
nothing is what it seems in java
i saw your message, i just can't open docs
Those aren't mojmapped names
it might be something in your side
How can block tab complete for specifics commands
Do you want to hide commands?
If i can
declaration: package: org.bukkit.event.player, class: PlayerCommandSendEvent
filter getCommands Collection si?
Yes
well two literal strings gets optimized by the compiler into one
but at runtime to concat two string, string1.concat(string2) is called
why isn't StringBuilder always called?
for what
for concatenating
in what case
so when i remove command from collection then args of this one isnt suggested?
yeah but it uses .concat right
no
not StringBuilder, compiler
compiler isnt written in java, remember
It's actually written in HTML
C and C++
And CSS, of course
almost all languages are made in C right?
uhh something like that ig
can I ask another noob question
or assembly ๐ช
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
yes
when we set a variable private for using a getter
either my keyboard or discord is having a stroke
instead of a public variable you mean?
you sometimes modify the value before returning it
so u can have raw data in class and return modified one
e.g
yeah
private int foo = 1;
public int getFoo() { return this.foo; }
Because public values can be changed directly
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
And yes, getters sometimes change the returned value
basically when i refactored mindustry lol
For example in spigot, a lot of getters clone the object
not a single getter
I still don't understand
Dont forget about validation
thats a setter
so
the outside world shouldnt be aware of the objects internals, and thats fields included
public class Test {
private String hey = "Hello, World!";
public String getHey() {
return this.hey;
}
}
does anyone know how i create a claim plugin?
so that would prevent setting hey right?
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));
}
what would be another case of using gettrs instead of making public
oh
validation as 7smile said
You never make fields public
that makes more sense
probably want to throw an exception too
Unless they are constants.
Like public static final double PI = 3;
3 ๐
more flexibility
google about encapsulation
omw
- Helps enforcing strong encapsulation
- Makes it easy to create limited mutability
- Validation
Ill give you a very important example about limited mutability in a min
someone have easy in use lib for configs?
isn't FileConfiguration for that?
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++;
}
}
I understand it better
which are the cases you would make the variable public?
if it were static and never changed
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.
tell that my college teacher ๐ฅบ
There are none.
Only for constants.
for example
something that happened to me today
if I have an Inventory
I shouldn't use a getter right
because the value can change
me omw to refactor all my code to do that just so people who look at it die of cringe
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);
}
}
yeah, code it
wait what
you just told not to use a getter or setter
oh wait, I understood now
Those are accessors
if you needed access to the list
You never expose the list
yeah that i know but idk how to start
extend JavaPlugin
you would clone it or should you make whatever you need to do in a method inside the class
and return the desired output
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);
}
}
by inmutable you mean that the original value doesn't change right
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
okok
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
https://www.spigotmc.org/wiki/spigot-plugin-development/
Scroll down to guides. It covers how to create your first plugin.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thx
one last question
are there any official rules on how you should write code, like Python that has PEP 8
I wouldn't worry too much about like tab size etc any competent ide will auto format that for you correctly
yeah ik, but like you guys told me
but method conventions etc are a big deal
I'd say you should strike a balence between OOP and Functional programming
how much years have you guys been coding in Java?
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
you also code in py?
I'm competent in python and Java
I could probably get a job for either language given I'm not expected to write bytecode
Im only with python
I'm learning haxe atm too
let me search that
that is not just java, but object oriented programming
atleast something that gives me hope on the island of x86
@fleet sundial
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.
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
What
Block#getState instanceOf BlockInventoryHolder
Does that count in crafting tables and anvils?
Since it's not a persistent inventory
Probably not
yeah, no :/ But it's a good start^^
Use mayfly in your if stetements
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 ๐ค
ik it does fiddle with git settings, or well ive experienced that, altho on windows
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
Quadtrees are fun
Well you don't have to design the Quadtree. You just have to utilize it :)
i mean obviously one way (to avoid having everything in memory at all time) is to bind the data to chunks
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 ๐
depends on how complicated the shapes of ur regions are
Well ya. I expected it to only be squares. But obviously he could also have spheres, cuboids, circles
Beating WorldGuard is going to be pretty difficult lol
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?
Oh you're making a claim plugin? Yeah why not just use WorldGuard then
It can do all the heavy lifting region nonsense
So regions would still be in worldguards control but you could add your inventories etc. based on worldguard regions and their owners/members
If you want to ensure compatability with other plugins then using WorldGuard as a backbone for your claim plugin
is a decent idea
WorldEdit and WorldGuard I assume are going to be installed on most servers tbh
Would never have WE on prod
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
why? Does it do that much behind the scenes?
Well now how else are you gonna troll your players then?
It's for security reasons probably, not performance. If someone malicious manages to get ahold of WorldEdit permissions your entire server could be destroyed almost instantly.
WE is a building tool. There is no reason to have it on production servers
I continue to argue this reason actually 
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.
You need to get a region at a certain location. So this will not be enough.
That's why I said "of some sort"
Isn't that what "isInRegion(Location loc)" would return?
What would you call a class which manages regions?
Oh you mean get all regions a player is in, right?
Just use WorldEdit as a backbone without an abstraction layer in between
Thats less confusing
He was talking about worldguard ig
*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
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)
Something that is extremely efficient is chunk-based claims
You can claim only whole chunks
Therefore you have to do all the optimization (with an R-Tree) yourself.
For years and years worldguard just iterated every claim
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.
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?
}
Yes. But to be fair: making this more efficient is also not easy.
Yep
octtree maybe
Long2ObjectMap is from fastutils. You can also just use a HashMap
cpu improvements would come at the cost of memory
One moment
That's a fact - I'm on the same boat rn since my current plugin also relies heavily on regions.
But I expected them to have at least some optimization
There is an O(1) solution for locations where regions dont overlap.
indeed
How much overhead is it to have 10 listeners instead of one listener that loops 10 times?
(this can scale up freely)
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)
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 ?
Not right away. Division and bit shifting still have some subtle differences.
But the JIT will eventually find the most efficient way.
I see, thx
Someone has an answer to this? Besides registering the listener, is there a huge performance diff between having x listeners vs looping x times in one listener?
I'd expect it to be pretty much the same since it's just a function call. But the call might be done by reflection that's why I'm asking :)
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.
Listeners get invoked through reflection and Spigot doesnt use MethodHandles iirc.
There is an overhead but its negligible.
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 ๐
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
Also: Having one listener for all of your objects is as clean as it gets
Yeah I might go with that approach aswell then
Delegate your events to your regions. Dont let every region listen for events
I'll still have some listeners that have to be registered at runtime but it won't be that many
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
bit shifting is a way to bypass the use of cpu cycles to compute something, basically instead of the CPU figuring out what it needs to do in regards to math, bitshifting is where you tell the cpu basically how it needs to be done. There is some other uses with bitshifting as well, like bitmasking. Where you use a byte for example and every bit of that bit means something different.
That's why I expected the compiler to replace divisions by x^y through bitshifts (to some extent, obviously you could to that for infinitly high numbers) but I guess I'll have to keep it in mind if the compiler does not do it
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.
compiler isn't smart enough to do this
AI compilers when?
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
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.
Yeah I understand. Would only be reasonable to replace it during compile time.
I'll keep it in mind and will try to avoid dividing by x^y from now on
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
Meh. Every claim should have a name.
While the microcode might be more efficient in resolving the bitshift than the compiler, this is still done at runtime and not at compiletime
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
both, but it depends
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)?
If a player wants to change something in a claim he needs a way to select it
/claim addfriend SummerHouse Olaf
For example
some math things when you look at the bytecode already contain some shortcuts but generally for the easier to compute stuff
anything too complex, the compiler will leave for the CPU to handle
or runtime as we say
For me the ideas come flowing in while i write.
The core is always just CRUD really.
Yeah that's only reasonable which is why I thought they would introduce bitshifts up to 16 (or some other small number) during compile time but after that those numbers are used so rarely that it's fine to not optimize it and let it be handled by the CPU.
well for the compiler to figure out the bitshifts it will need the cpu to compute that
which would be counterintuitive
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.
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"
actually they are if you work with binary
as this is how binary math actually works
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.
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
By 10? Wouldn't it be by 2?
you mean power of 2?
Yes that is correct
I sometimes get mixed up lol
its not like I keep all these things I know written down somewhere ๐
All good haha, it's already pretty late aswell
just as long as I am able to convey what I am talking about and still be understood then that is all that matters ๐
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!
I will venmo someone $20 RIGHT NOW to help me getting started into building my server
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
You technically helped him. I'd ask for 20$ lol
it can also make your code harder to read or understand too
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
not looking for a funny guy.....
Well an IDE-plugin could technically do something like that in order to solve that
ive been there
it could but I don't know of any that exist lol
I could bet money that there is one but yeah I never checked either lol
I don't know you really want that
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
only some bitwise is in place of math
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
nibbling for example isn't really something I would say has a direct mathematical equivalent that's "easier to understand"
this compresses from 16bit to 8bit space
I mean kind of
If you have to shift twice to get the same result it's already dubious
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
I agree with Fabsi, and that's a far more common case
your cpu does bitshifting already, please don't comment on a topic if you are not very familiar with it ๐
uh no, the bitshifting for division isn't quite straight forward lmao
My bad master
It sure isn't but seeing
rgb / 100000 instead of rgb >> 16 won't help the understanding of the code (in my opinion)
would that not be rgb / 65536 (or the hex equivalent)
that does make it pretty confusing-looking
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
oh true, I did bitshifting here because it is really the efficient way to do it but I wasn't going to go as far to avoid using arithmetic symbols
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 /
Yes you are right. I used a bitshift calculator and it rounded it lol
that was another reason for the use of bitshifting
was for the rounding in regards to 8bit colors that are commonly implemented in terminals
oh lol makes sense
but is that still faster than just doing long / long? I mean it has an additional function call, multiple ifs to calculate etc?
no
it can be, it just depends
for simple stuff no it isn't
but if it was combined to do some long running calculations then yes it would be
Example?
For long running calculations I would expect the JIT to be just fine
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
while true, that doesn't mean the CPU does what the JIT does
I'll believe that if I see an example, I doubt you could get any improvements of that nature in java
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
Is the JIT time based? Or cache/ram size based?
I am not going out of my way to prove anything to you so you are just going to have to investigate it yourself. You are fine to disagree and that isn't the point of my conversation here.
JIT is cached based, but point is while the JIT can cache stuff or optimize things, it doesn't mean it is cutting out the CPU or that it always can
however if we are going to look at the difference between bitshifting and just using /
and nothing more
just those two things in java
Ok what if I ask you kindly to educate me?
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
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.
But for how long is that stored? Lets say I run a loop that has to calculate x / 256 100 times every 20 ticks. Will this stay optimized or will it re-optimize it once every 20 ticks? Probably depends on how many other things are loaded into the JIT cache, right?
I agree with this
how long it takes to optimize varies but once it has been optimized I don't think the JIT goes back and does it again
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?
it will remove it from cache
But then it has to optimize it again, no?
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
yes if it happens to run again at some unknown point in time
Lots of "magic" going on behind the scenes lol
oh you will be surprised
I do recommend people diving into the JVM code
not everything works as you think it might either ๐
The .class compiled code?
no the source code
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
how did they test the java part without having the java part? xD
But it's kinda the same for github. Github is used to develop github
Anyways time for me to go to work 
exactly this
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! :)
@lost matrix managed to get mineskin working?
I do wish more people would learn about the jvm
There is plenty that can be useful just by knowing how the jvm does things
Just give it some velocity at a slight angle
This is a scenario where trial and error tod figure out values would be easier
Probably around a 2:1 ratio of y velocity to x/z velocity
I would probably go more like 3:1
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
You are trying to compare ItemMeta to a string
ItemMeta is not a string
ItemMeta#getLore#contains(string)
What about display name?
Sure
didn't work
For downloads, yes
Didnt try uploads yet
call dropItem(...) and then apply a velocity on the Item
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.
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
I remember that my plugin Advanced Drop Manager had this option in the past.
Dont remember if the re-write has it now...
- Yes this is possible
- Here is a resource on how to create a plugin:
https://www.spigotmc.org/wiki/spigot-plugin-development/
Thanks for the reply. I've been doing plugin development for a couple weeks and have a really good start for a custom server gamemode. I've just been stuck trying to figure out this chunk generation stuff.
This doesn't seem too difficult to make
Let me look into that. You might need to write a custom chunk generator for that
Som1 know why i get this error ?
The whole code :
https://paste.md-5.net/qafesazojo.java
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
FileConfiguration#getInt() is not an existing method
Thats what you want
Comparator.comparingInt(id -> lb.getInt(id.toString())).reversed()
Also this will lag your server extremely fast if the placeholder is requested often
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
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.
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.
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
Like a bukkit runnable?
Im going to do this later thanks for the idea
Yes the BukkitScheduler has methods for that for example.
But a normal Executor will do as well.
https://paste.md-5.net/fasupetelo.java
Do you know why the placeholder isnt working ig ? Its registred by papi but when i parse it, it return nothings
Do it as soon as possible. You will fk up your server with just those few lines of code.
It will ruin what ? Tps?
I thinks im going to forget this idea ๐
No thats a good first step into multithreading.
Learning how to not block with IO is important.
First make the placeholder work
I have no idea why its not working im getting 0 return
Then its probably not registered properly or your are having an exception in your console
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
Add a debug message in your placeholder and see if its fired
Also: Never reload the server. Always restart.
yep ik but why ? what its the difference between reload and restart
I look at this tomorrow i go to bed thx for help ๐
Read the message that comes up when you do /reload
Its not supported and fks up half of the plugins.
Bad news, it looks like you wont have much luck with events alone.
To stop generating chunks at a certain point you might need a custom ChunkGenerator.
What about something like taking a void world, and generating chunks in it with normal world data with a chunk generator?
One at a time
Hmm. Merging those will be a hustle.
If it's all taken from the same seed, won't it just generate normally?
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.
How would I do that?
Which part exactly?
One moment
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);
}
}
Damn, this looks good
How would I implement the two methods?
What do I do with the world after I put it thru generateChunkSquare so that it uses the void generator?
Generate the default chunks for it, then unload it again.
Afterwards you need a new WorldCreator where you pass
an instance of your VoidGenerator
Could you kindly show me what that looks like?
I'm probably such a pain in the ass for my incompetence
Sorry โค๏ธ
I can explain if you dont understand a part of what i suggested. But no more code

You should have all you need
How do I use a WorldCreator to load the previously created world?
Just let the creator have the same world name
because you always return null for all placehodlers shown in your screenshot
Wow, so it worked... kinda. It won't generate new chunks. But, it generated a complete spawn and not the couple of chunks I tried to have it do.
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();
how do i remove my resource from the website?
report it and ask for it to be deleted
oh ty
Custom chunk generation
Why do the players need their own world?
why does IJ get worse and worse every day
lol
My man still on the old style
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
It tooke me a bit to get the into the flow but i love it so far
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
that ik you can toggle
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
i havent updated intellij since like 2021 lol
im still on IntelliJ 2021.something
why
how would i get a specific players uuid?
getUniqueId
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
- you cannot cast a UUID to player
- you cannot loop over sth that's not iterable
what are you trying to do?
add passive effects to a player when they hold an item
oh and 3. you don't have any player object in the first place
then loop over all online players
loop over Bukkit.getOnlinePlayers()
but the issue right now is it's adding them to all the players online
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);
}
How can I manage to cancel damage cause by crystal by some specific players?
Listen for the damage event
check the cause
cancel it
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
as for by some specific players you will need to also listen for the reverse - player hitting crystal
:l It does has properti (cause by crystal ? )
damager and damagee are both Entity
check if isinstance EnderCrystal
and isinstance Player
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.
show the context too please
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()
Hey
milliseconds
Milliseconds
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
how should the velocity be? i have never worked with them, any tutorial link or description?
Its a float or double cant remember. Anyways just set velocity to something like 0.5.
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
yea sounds cool, i did its ok but it is a little fast, anyway to adjust the speed?
on ```java
Entity droppedItem = location.getWorld().dropItem(location, item);
To decrease the speed you are going to have to modify its gravity and lower the velocity
maybe disabling that for just smth like 5 ticks?
You could try that
ooo looks way more nice now, lemme record
sets back the gravity to true after 3 ticks
There you go
thanks
Looks really good now that it isnt flying away
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
In that case you need to add a randomizer
yea for the loots, its already done
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
the warzone just drops the loots to in front of the loot box
i'm sure they do, lemme double check
I play on ps4
whats up with the graphics
i just copied an image from internet
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
hmm yea right
Anyways time to drive home
live footage of frostalf
rocket league looks a bit different
How do i remove this
maybe add HIDE_ATTRIBUTES?
Nope
idk then ๐ฆ
I was about to post it ๐
makes total sense
arguing is fruitless. I am the winner.
Source Code/Support: https://patreon.com/mixmorris
My Links:
Twitter - https://twitter.com/mixedmorris
Instagram - https://instagram.com/mixedmorris
Twitch - https://twitch.tv/mixmorris
Music Used:
Swing de Chocobo - Final Fantasy Distant Worlds
Fighting The Enemy - Sailor Moon
Yorokobi to Shiawase to - ...
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?
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
nice thanks
Material.BRICKS is a brick block, right?
ty
this is my code rn
still gives a null error even when i'm checking its null or not
whats Lootbox.java 56
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
uh yes you are right, thanks
also you can just return the lootBoxes variable instead of constructing a new list
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
Gays help me PLS. I wanted to install the Simple Voice Chat plugin in my server, but I can't.
ops sorry
np
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 ?
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...
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
E toi
what?
What you want to do
do you have enum methods?
let not implemnted override the enums methods to throw an ex
It's french and means "you too"
assuming your enum has a state
Where get either returns the enum value or throws
hmm, isn't a little weird a random French man replies on my messages and says you too?
Et tu, Brute?
mange baguette
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?
Don't ask me. I don't speak french
Still open question
I don't think you really understood my question here
Idk what I did but I removed a nametag (above a players head) by accident with just spigot ๐
PluginManager getPlugin no? (Null check)
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
Can't really cast as the plugin in question doesn't provide the main plugin class through their API...
Ah I see
Tho, I assume it will be relatively save to assume that when the plugin is present, it works
Yea, would suppose that also
How can I get the ChunkData of a chunk? Or how can I manually call the generateNoise method to regenerate a chunk?
I assume you want to do this exclusively with a bungee plugin and not a combo of bungee+spigot bridge
declaration: package: org.bukkit, interface: World
Yeah I have the generator I want to use
How do I use these methods manually?
Just call them on a separate thread
Everything you need should be in that class
I dont understand how to get the chunkData to modify
Those methods are not designed to be called by plugins. They should only be overriden by a plugin, nothing more.
How could I regenerate a chunk with my plugin?
Damn maybe there's a reason I havent seen a plugin do what I'm trying to do.
how do i fix this?
oh wait IPUSH maybe
?
answer to my own question
There's world.regenerateChunk
It's deprecated. The chunk won't have the same terrain decoration
oh man this code goes brr
I'd just try it out
Otherwise you could create a new world with the same seed and generator and copy the chunk over
As the javadocs say decoration may be spread across chunks so it's not easy to get the correct decoration
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?
It's unsupported. just doesn't work in the current version of minecraft, and throws error
Well, if you need it perfect then I'd just have a second world with the original chunks and possibly use FAWE's API to copy the chunks over. There might be better solutions, but Spigot's API is unfortunately kinda limited when it comes to chunk manipulation, possibly also due to Mojang's implementation
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
I think I found a solution. What I wanted to do was create 'mini-worlds' of a small chunk radius and the rest doesn't need to be generated because it would be out of limits anyway. I think I found a solution. Instead of different worlds, I just have one world with a bunch of mini-world sections that I can isolate in a different way.
You could just use md5's maven plugin that does that for you, with which you are able ot use the mojang mappings
link?
uh
any simple way to get an offline player's world (location)? trying to reset an offline player's spawn location to default
Yes, that's a way better solution. I'd always avoid to create unnecessary worlds, as they are just cpu and memory monsters. You could potentially even split each section into a 16x16 chunk radius, which would be the size of a region file format. And when you want to reset that area, you could simply just delete the corresponding file
md5 actually mentions them witch each update https://www.spigotmc.org/threads/spigot-bungeecord-1-19-4.596508/ Just search for "NMS" or "mojang mappings"
@tender shard maybe you have something in jefflib for that? closest i could find is offlineplayerpdc
I mean your only options afaik are storing it yourself and using that or reading it from their player file directly.
hm
thanks
i'd be down to read it from the file if i knew how to lmao
Does anyone know of a plugin that allows you to "design" an inventory in the game and then "convert" the inventory to Java code?
i'll take a peek at nbtexplorer or whatever is opensource
Yeah NBTExplorer
maybe i won't
i don't wanna read csharp at this time of the day
or any other frankly
heh?
You just have to read the .dat file, NBTExplorer is just going to help you find where the information you want is
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
how to use tabCompleter for several arguments?
The tab completer gives you the existing args. So you check that and then provide the args you want
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
Lol. Not possible
Instead, learn a gui implementation
@lost matrix
You have to implement that on your own, but I suggest you to use a dependency
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
i didnt understand what you said but i thought that i can check args.length and if its 1 use first list of args if its 2 use the second one with other arguments, is that how you do that?
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
declaration: package: org.bukkit.entity, interface: Player
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
why do kotlin stacktraces always point to lines that don't even exist
gotta debug it eh
Probably skill issue
๐
what is return in onCommand method for?
return false prints the command usage to the sender
if someone would've told me kotlin was a transpiler for java, i wouldve believed them
oh, but i do it myself anyway
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
have you considered not using kotlin
i looked at scala but it surprised me that the syntax is a piece of shit
lmao
Epic
What's an alternative to using gameprofiles to get a custom player head
Something that's actually reliable
why do yall hate syntax sugar so much ๐ it's fun
Cause getting it using gameprofile is so inconsistent
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
Also extension functions can be neat
meh intellij handles that for me anyway
jesus christ how are brains supposed to work in minecraft
I can't get this garbage to behave
I still prefer seeing
x.map { it.toString() }
over
x.stream().map(obj -> obj.toString()).toList()
Well it may be case for java too, as its compiled to anonymous class (unless you use inline keyword in kotlin)
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
I don't understand how brains are meant to work
Sometimes the whole immutable by default thing gets a little annoying tho. Since I always feel bad when I'm using "var"
haha 100% yeah
var makes me feel like i'm doing something wrong
I think I used var In kotlin probably less then 20 times lol
xD
Yeah and function parameters are immutable, too. So if you get a string you first have to make a var string before modifying it.
go to rust where iterators (java streams) compile to the same code as normal loops
or "modyfing" - since they are immutable anyway
yep, but as to not shadow args i normally do this:
fun foo(bar0: Bar) {
var bar = bar0
..
}
kotlin is however a very funny language
oh yeah it's all fun
I'll stay as far from rust as humanly possible
xD
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
I get the idea behind rust and personally I haven't used it but it sounds so painful to code
but when someone says "kot..." there are stones and tomatoes flying around the air instantly
๐
as it should
And it's most likely guys that never tried kotlin, or wrote 100 lines at most
whats the difference between between getPlayer and getPlayerExact
ive tried kotlin with gradle and it looks terrifying
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
getPlayer returns everything that starts with that string afaik
Tbh I will never go back to java if I don't have to use it
correct me if i'm wrong
getPlayer(fourteen) will also return fourteenbrush
As I said.
Less then 100 lines
kinda same, i'll keep java in my mind because a lot of industrial code bases are on it
You can use kotlin with maven ๐
and a shit ton of experience
yeah, you're encouraged to use uuids if possible
480 lines of horror
i know but its not
player gives me a name of player
Ya that's probably the biggest reason for java at this point. Unless you really care about compile time. Since the kotlin compiler is slow af

I mean only coroutines is reason for me to not go back to java if I don't have to lol
A lot of people have grown up using Java. Not everyone is comfortable or has the time to try new things
i was looking for a different bird meme template but this one also fits
^
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
Sadly java is kinda like muscle memory for me at this point - kotlin is not :(
you'll get there ๐ i'm doing my third full size kotlin project and i'm getting there
haha, i try to refrain from it but i can't help myself sometimes
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
I dropped kotlin because of the poor standardisation.
Because of java enterprise, java has a well defined and
refined standardisation when it comes to everything from
caches and DB accesses down to style. Kotlin is still a
wasteland in that regard. 100 competing standards + the
language allows some things that just blows up every
standardisation.
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 ๐
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
some upsides & downsides everywhere
Sadly the age of java + the goal to keep backwards compatibility is also its biggest pain point
Spigot has an api for profiles now. PlayerProfile.
Just call Bukkit.createPlayerProfile(...), set the textures and
apply it to a head.
btw why do you wrap your messages this way instead of allowing for auto wrapping
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.
Not sure...
Sure, let me take a look
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
Hi, how can i spawn a zombie that doesnโt attack specific players
You have to cancel the EntityTargetEvent
wait you could do that
i was writing an entire essay on how to make a custom pathfinder goal
xD
well that works too
Well the pathfinder runs beforehand. If the pathfinder finds a target, the EntityTargetEvent can be cancelled to "ignore" that result
But thats for all the mob not for only the zombies the plugin spawn as โressurectedโ
just check if your zombie is resurrected
Obviously you would have to keep track of your zombie(s) and only cancel the event if your entity is one of those zombies
and the same applies to cancelling it only if the target is a certain player
I once made a pig that was pathfinding like a parrot and would attack you. Getting attacked by flying pigs is kinda funny
lmao
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)
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)
update the plugin
wym it's a library
What you mean with library? you are shading into your plugin?
or using as plugin at the /plugins folder?
Shading
I literally see the compatibility folder for my version
open a issue ig
I have problems using the "creative" library: https://github.com/unnamed/creative
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
you arent shading it
How do I do that and why is it necessary
you need to add <scope>compile</scope> to the dep, without shading the class doesnt exist anywhere so your plugin cant access it
Did that, still same error
?paste the error
?paste your pom
that looks correct, run mvn clean build and try that jar
also i dont think you should be shading the server
that was a default
I get an error back: [ERROR] 'repositories.repository.id' must be unique: unnamed-public -> https://repo.unnamed.team/repository/unnamed-public/ vs https://repo.unnamed.team/repository/unnamed-public/ @ line 69, column 17
oh I had that twice
some confision with the docs