#help-development
1 messages · Page 375 of 1
i've tried it, it just refuses to work
In maven it's easy and a lot of projects recommend it for optional features
Sadly never done it in gradle
Dude just threw an aci construction at me
You should consider to just use maven, there everything just works. Trying to get this to work in gradle will waste many hours of your time
Material.TNT = e.getPlayer().getPlayerItem
You can get the material of the players held item
Send entire code snippet
thats basically all for now
Material mat= e.getPlayer().getInevntory().getItemInMainHand().getType();
its a listener
oh
.-.
No that's not real code
im udm
then check if material == Material.TNT
that’s his issue lol
.getType()
I have my doubts it even exists
^^^
ohh
my typo my bad
what is = and == difference?
...
its basic java
= sets something
== Compares values
?basics
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.
it's important to know the basics before trying to make a java plugin
"==" is only realiable though for Enums and primitives, for anything else, like Strings use #equals
Yeah it checks if it's the same exact thing right
For primitives and for anything else it checks the address pointer, I think?
Yeah I think so
smt like that
Yes
Still does sometimes with Strings
Equals is also null safe iirc
Object.RequireNotNull() is needed
well you can't call #equals on something that is null, but you can use it as a parameter
Yes
ok can someone explain what happens if i use provided inside maven
how tf does the java knows
what .class file to use
if its not inside the jar file
when compiled
Because that artifact/groupid is already provided at runtime
yea ik that, but how does the code run
And with import, you declare what exact class will be used
when none of the libs are inside the jars classloader
Well, class is loaded somehow inside of runtime env
For example log4j in spigot, you can put provided in your plugin
Because spigot shades it
Exactly
that's whati thought
because everyone class has a name?
it doesnt, unless you have that class "provided" by sth else
hi, you should take a shower
i fixed my issue
it turns out the real shadowJar task file outputs at *-all.jar
package
so it wasnt a real issue after all lol
now it lacks snakeyaml in bukkit implementation
while in core classes it includes it
yeah that is normal in gradle
i thought you knew that lol
i that's that what you wanted to do?
remember that bukkit relocates snakeyaml
so you'd need a relocate thing in your shadow thing too
one line in maven but probably quite complicated in gradle lol
nah it easy on gradle
// Relocating a Package
shadowJar {
relocate 'junit.framework', 'shadow.junit'
}
@tender shard it seems it doesnt relocate anymore
all those dependencies are loaded at runtime
or this might be only paper thing
is it better to create multiple @EventHandlers for a event (i.e AsyncPlayerChatEvent) or just create one and run functions for better performance?
depends what you are doing
it usually does not matter at all "performance-wise"
unless you wanna register 500 listeners for PlayerMoveEvent
and in that case, your logic is flawed anyway
sooo don't worry
thanks
I'm creating a single plugin instead of creating multiple plugins and using each other as API's.
whether you have 5 or 20 listeners, doesn't matter
got it thanks
ok now this is very scuffed. I am using Player#sendBlockChanges with supressLightUpdates on true. It seems to ignore this flag completely when above about y=-33 which makes my sending extremely laggy. When settings the flag to false, it appears to ALWAYS lag
I can see some laggy shadows getting removed and added in the lag, too. Does not matter if its on superflat or normal
can someone tell me why the opItem dont drop?
have you tried to debug it?
maybe opItemsDropCounter is not less than 3
maybe the player's name is not equal to GoldGamerPT
it is
add a System.out.println(...) everywhere, then see where it "stops working"
add a few System.out statements to check out what could be wrong, its the best solution to most problems, or at least to diagnose the problems
oh btw I don't see you doing any item drops at all
world.dropItemNaturally() in line 47
java debug agent
btw you are usually not allowed to "extend" ItemStack
i made another plugin and it works
Isn't ItemStack final?
not that I recall, I also extended it years ago
100% sure I saw that once somewhere
Suppose I'm just having the mandela effect then
a better idea would be to make your custom item stack class not extend itemstack directly, but just be some wrapper that has a "getItemStack()" method or similar
I also recall something like that remotely, but it either was 1.8 and earlier, or we are both confusing sth haha
in 1.13 and 1.19, ItemStack definitely is not final
Mandela effect is a bitch sometimes
I just confirmed that the flag is always getting sent
ah that might be it
the bukkit one definitely isn't
what about CraftItemStack?
oh wait that doesnt exist
or does it
I am confused lmao
it's early (15 pm)
my brain doesnt work yet
CraftItemStack is also final
its 3pm in english time-format lmao
Mine never worked
oh right
my brain is too german to use english format
it's fucking 15 o clock
No, 14:50
I kind of adjusted myself to that whenever writing with English people
Yes
Anyways, let's not get off-topic
only 1 minute to go, then it's only 8 minutes
yaaay
so cringe that I am always sick whenever holidays start
I had already planned to go out today ;-; Its a special event right here
Whats cringe Is, me getting sick Yesterday but having to write a class Test today 😂
Sadge
No
I Had to write IT anyways
39°C fever, can't talk, can't breath right
But still having to take a damn geography test 😂
I've already raided the medicine cabinet
Am trying my best here 😂
are you me? lmao
and dizyness
Only when getting up tho
and the good old throat
tasty tasty benzodiazepines lol
And whilst standing
bro today I stood up because the postman stood at my door, I literally instantly almost fell over
Insert windows xp shutdown sound
uhh is this the wrong way to use an atomiclong? ```java
private final AtomicLong generatedYet = new AtomicLong(0);
@Override
public void generate(@NotNull GenerationUnit unit) {
Point start = unit.absoluteStart();
UnitModifier modifier = unit.modifier();
Audiences.server().sendMessage(Component.text(
"Generating chunk at %s %s (%s yet generated)"
.formatted(start.blockX(), start.blockZ(), generatedYet.getAndIncrement()
), TextColor.color(131, 201, 22)));
for (int x = 0; x < Chunk.CHUNK_SIZE_X; x++) {
for (int z = 0; z < Chunk.CHUNK_SIZE_Z; z++) {
// generation
}
}
}```numbers dont seem very correct
that generate method is called by multiple threads
or maybe its just the sendmessage method that doesnt respect the order or smth
I went to the school nurse to get something against my pain. She just literally said: You ain't leavin 😂 Had me sit there for 30 min till my gf took me home 😂
but.. cmon... its holidays... why bully me???
I got a streak of being sick the last 3 holidays
spigot stash comments are even better
is there an event for whenever a player's advancement progress changes?
Collest thing is having Corona in the holidays 😂
Totally didn't happen to me twice 😂
My lungs are fucking dead
haven't eaten anything big for 2 days now lol
I have eaten two and a half toast crackers
sounds accurate
Do you have many instances of the class?
no, multiple threads just call that generate method
So just a single instance then?
Anyways, trying to sleep now
yeah good night
Cause otherwise, AtomicLongFieldUpdater (fourteen)
I have slept for the last 22 hours
can someone help me with this?
https://paste.md-5.net/yejedazoyi.java
it isnt giving me the enchanted item
Most of the times when I wake up I don't know which day or time of day it is
ye just a single instance
accurate, too
dunno if getAndIncrement even assures its only updated by one thread at the time
It increments atomically
its just not very good at counting then
Idk, maybe generate isn’t called in a chronological manner?
Or like, yk sequential manner we
no clue, its just for debugging so shouldnt matter too much
But ye, could be sendMessage also
@tardy delta actually
Maybe you want to incrementAndGet
still weird, im looking at the impl and it uses the forkjoin commonpool
Ye
I am currently trying to use AdvancementDisplayType. However when using it in the IDE it works perfectly fine. But the second I try to compile it using maven it tells me: cannot access org.bukkit.advancement.AdvancementDisplayType
Anyone happen to know why?
makes sense
not if it has a deque
with forkjoincommonpool it doesn't necessarily create a thread for every subtask, and instead there is a deque where all the other worker threads are trying to steal work from busy threads
There’s a lot of other factors other than deque which can lead to that also but yes
true, but one of the bigger ones though lol
Ye
wheres the difference between @NonNull and Optional<T> in this case? For the return value
Btw iirc fjp doesnt have a particular shared data structure where it puts the tasks, isn’t it just that every worker has its own queue of tasks, or am I getting ahead of myself now, haven’t touched that for quite a while so icl forgot implementation sorta
every thread has a deque. The thread will pull from the top of that deque until its finished, free threads look at other threads deque and pull from the bottom until its done or gone
Yes, but doesnt fjp abstract away the notion of task per thread, instead you have workers
so it uses a normal queue just its an open ended queue that can be pulled from both ends
correct, only the workers have threads not the tasks themselves
uh i only see notnull, no nonnull
Yea, so then the workers have the deques where tasks are stored
typo
correct
you know me by now
but there is no telling which thread gets your task and just because a particular thread is holding your task doesn't necessarily mean that thread will be the one to execute said task lol
Optional lacks flexibility
Yea indeed
so the annotation does... what exactly?
The annotation is just an annotation at the end of the day
afaik optional forces you to handle null returns so it doesnt throw an exception later
Yes but it sucks
Optional has no subtype that expresses absence and presence
@notNull basically means you have ensured that the object or value is not null and that if it is null at this point something terrible happened and we should stop 🙂
Like there’s no
NoneOptional extends Optional
SomeOptional extends Optional
why would it be needed?
Optional doesn't necessarily mean it can be null, it means the object may not be provided or the value
which includes obviously nullness
And for generics, Optional is clumsy due to restricting method overloading
im still waiting for java enum Optional<T> { SOME(T t), NONE() }
😌
that looks wrong somehow
but ye thats rust
sealed Optional permits Some, None {}
rust is like rs if let Some(value) = some_optional { value.do_something(); }
reminds me of if (a instanceof b B)
Moterious, but yea there’s benefits with optional also
the gripe i have with instanceof is that you cant do a negated if check
like
Like, it becomes a bit harder to miss accidental poor null pointer handling
if(a instanceof B b){}
cant be negated
IT can
if (a !instanceof B b){} when 
Bang a !(expression)
i mean that you cant really remove the block
Around that
but yeah the biggest use of @notNull is testing and if you are making an API and where ever that method is implemented you insured to the best of your ability that it can't be null because it will throw all kinds of errors if you use that annotation and that object or value is null. But the downside is if you use it somewhere where something could be null and it does end up being null, it kind of hides or makes it harder to tell what the actual real problem is or where the problem is at
what when a is a boolean
Hush
Two funny bits
!instanceof hmmm
boolean is 8 bits minimum
is not
unless you store it as an array ie a char
😢
in java vm it is
Dont think that was to u x)
Boolean is 1bit
I'm replying to fourteenbrush xd
but it depends at what area we are specifically talking about
VM does
boolean, as boolean, is stored as the same bit 8 times
Well since most everything is backed by an integer in Java, the least it can be memory wise is 8bits or 1 byte. But because this Memory is located inside the Java heap, java can make use of those other bits for other things.
there are no instructions for booleans afaik, so a boolean is handled as an int
bruh
A Boolean has 8 bytes of header, plus 1 byte of payload, for a total of 9 bytes of information. The JVM then rounds it up to the next multiple of 8. so the one instance of java.lang.Boolean takes up 16 bytes of memory.
lol
so address + byte for storage ig
that’s java.lang.Boolean?
we re talking about a Boolean now
Not to be confused with boolean (primitive)
arent they auto cast
no
Yep
doesnt the jvm inline Boolean.valueOf by the respective Boolean.X?
Inline like as in jit compilation? Or do u mean aot?
compiles beforehand
probably that
Ahead of time
java bytecode doesnt actually get converted into machine code unless the jvm deems it important
uhu
but the primitive boolean only takes up 1 bit in the JVM heap space or the memory the JVM requested from the OS. If the JVM had to request more memory from the OS for this primitive it would need minimum just 1byte or 8bits but it wouldn't use the other 7bits instead it would probably stuff some other things that would fit there since the entire memory is for the JVM anyhow and it can use it as it sees fit or as long as the OS is happy anyways
i dont think the jvm can address those other 7 bits
as said afaik the jvm just fills it up with the same bit
it can because the entire memory glob is assigned to the JVM
so if the JVM requests 1GB of ram to be assigned to it, the JVM gets 1GB assigned to it. The JVM then uses its pointers it has use of to do whatever
It depends on the jvm, but a boolean is usually a byte
those pointers are not specifically allocated for any one thing
urgh dont come at me with this 'version dependent' nonsense
i had enough of that with SD 1.4 vs 2.1
is it really?
why the fuck does using a 2d matrix make it necessary to use full precision
doesnt the primitive boolean take up one byte
It does usually.
its backed by an integer so the minimum it could ever take up is 1byte, but that doesn't mean the entire 1 byte is dedicated to the boolean
if anything, it will probably stuff other booleans in there if it can
since 1 boolean uses a bit, you could fit 8 booleans in a byte
well i know that integers should be in the heap
ik you can store up to 8 boolean values in one byte by using bit toggling
It’s very much jvm dependent
isnt stack reserved for pointers
with bitwise operations you can store up to 8 boolean values inside one byte
but that would require more computational power
due to bitshifting operations
bitset my beloved
in this modern age, its not really worth it
old news
This is true but since most of us here are not making use of some weird JVM implementations, the oracle and openjdk does this
Where is this information from?
most people only google 'java' and click the oracle link,
its called herd mentality
i dont think that jvm reuse leftover bits from the primitive values
it would cost cpu power
no it wouldn't
Even oracle says that it’s undefined
address alignment padding exists
what have i done
i paid for the whole cpu, im gonna use the whole cpu 💪
memory is cheaper than cpu
i hate how server hosts are like 'oh here 40 core cpu'
like
minecraft is predominantly single threaded
Lol
🤓
40 core cpu like lmao
im gonna call this: the attack of the boats
have anyone used paperweight here before
Yes
why my dev version of jar plugin is smaller in size
like for my book?
than normal one
have one on my desk
paperweight-userdev
this
not a real paperweight lol 😄
U’re using the test server thingy?
no
you do know that youre asking in a channel filled with people 95% can be sorted into god-complex, troll, or lurker, correct?
how do u force ij to recheck for modules without restarting ide
@onyx fjord Gradle or maven?
but for some reason dev version is more optimised in terms of size 😄
What’s the top one? @onyx fjord
Isnt one reobfuscated
gradle
Where one isnt assuming u do use nms
Open gradle window and look for the refresh button @onyx fjord
only objects are 8bytes aligned in Java, not primitives, however a primitive in a class could cause the class to allocate an additional few bits to be a multiple of 8
yea that only refreshes for gradle modules
Oh then that’s weird
i tried
also you can change the memory alignment of objects as well in the JVM but if you do it has to be a multiple of 2
oh wait nvm i had to add it to project modules
guys what is the name of potion effect for haste?
speed?
hi , i want to create a better chance system for itemstacks ..
this is how i have it rn , and its not 100% accurate
weighted random
it should show possibilities
ctrl + space
I told them what it is
thx
its called speed
could probably use reduce on your stream
and people call me micro-optimising for using different type of hashmap
can you explain a bit what do you mean?
i hate streams
Try
don't blame you
this is how its stored :
so dev version of paperweight outputted jar reobfuscates or its reverse of that?
each item have its own chance
the other thing you should do, is reduce the amount of objects in a class too. While it may seem obvious that you should have less this isn't quite the case I am referring to, there is a pool for objects in classes that is a certain size and if you go over it, then instead of your objects for that class sitting in heap space it ends up in a different type of space that is slower and harder for the JVM to locate
also is true for the size of objects as well
the size of an object being too large can make this happen as well
something to think about later on 😉
had to look how reduce worked again lol, but dont stream twice
streams make devs lazy
thats lambda's for you
More productive tho
not always but sometimes true
but it is ironic though that lambda is actually one of the few things that came into existence purely because of someone being lazy XD
nothing wrong with it, just ironic
is that minestom
is it possible to set properties in gradle that are visibile within the whole project scope? im currently using gradle.properties, but i think that's an abuse
Gradle props are nice
you can do
ext {
}
``` in your root build.gradle and reference the settings with `rootProject.property`
eh, i havent touched kotlin ever
Well im just a strong proponent of the kotlin dsl
Kotlinscript isn’t harder by any means
may not be harder, but it is different and people don't like learning many different things for just a very specific thing
Mye i suppose
im storing these values in gradle.properties:
PROJECT_NAME=TestPlugin
MC_VERSION_MAJOR=1.19
MC_VERSION_MINOR=3
MC_VERSION_BUILD=R0.1-SNAPSHOT
but i think that's not where i should store them, since I use them to sync my gradle plugins with other parts of subprojects
extra properties is what i seek to use
That’s fine tho
but last time i tried it didnt work
global properties is acceptable if sub projects rely on it, I mean where else would you put them
cant you make extra properties global?
probably, but not entirely sure what extra properties means
ext {}
block
but by using those i have another problem lmao
i want to make settings.gradle see those properties
to make a lowercase version of my rootproject.name from plugins name
to prevent duplicates
i think i'd just stick to gradle.properties
How do I make unit tests for my plugin?
Look at JUnit5,
Hey I'm using sqlite database with jdbc and I get an error no such column 'pvp' but in a database viewer, the column is in, and when I try to access the name of all columns with ResultSetMetaData I get the column named 'pvp', why?
This is my code:
String uuid = p.getUniqueId().toString();
ResultSet rs = Database.onQuery("SELECT * FROM PLAYERDATA WHERE uuid = \"" + uuid + "\"");
boolean is = false;
if (rs != null){
while(true) {
try {
if (rs.next()){
is = true;
PlayerData playerData = new PlayerData(uuid, compressors(p), rs.getDouble("pvp"), is1(rs.getInt("pvp")), rs.getInt("kills"), rs.getInt("deaths"));
SennyMine.playerDataHashMap.put(p, playerData);
break;
}else{
break;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}```
Unit tests are gonna be difficult with a java plug-in, but you can test logic that isn’t related to spigot
uhh
ok
Use preparedstatments
So you have column 'pvp' ?
yes
ty, now it works
Ok
it s still a little bit sus
I am editing a custom music disc plugin, and I wanted to add something that multiplies my items. For example, if i type /musicdisc.d it duplicates what item i have in my hand.
what’s the issue then?
give the player there current item in their main hand
yeah
but
can i just add anotherfile in the jar file and be goodorwaht
good or what
you should probably recompile it..
you probably could just use a single class and maybe like 10 or so lines
just a for loop
where should i add the class or whatever
yes but how?
or use an AABB
aabb is a colliding box why i need use this?
no its a bounding box
basically you want the border
oh nooo
ye
yes i k now about the .clone nvm this
Location loc = player.getLocation();
for (int x = loc.getBlockX() - radius; x < loc.getBlockX() + radius; x++) {
for (int z = loc.getBlockZ() - radius; z < loc.getBlockZ() + radius; z++) {
Location newLoc = new Location(loc.getWorld(), x, loc.getBlockY() - 1, z);
// do something with the newLoc
}
}
do you want only the border of everything inside the border
in this case I would need to get only the edges so I can do a logic, in this case I would need to get the last block of height y
wait
if you know the size of the box in 2d, then you have the border
you also need to only know half the size as well
a quarter if it's a perfect square
#getHightBlock
an eighth it it’s a perfect trapezoid
but this ill return air
all you need is the corners and some math
in this case ill already have the corners
if you know Pythagoras's theorem you know the lengths of all 4 sides if you just have 2
😉
i mean
this is 8th grade math
example this
too advanced for our developer monkey brains
you also know that one side of the square is equal to half the distance of the length
so even if you just had the opposing corners you could still determine the width and length with just that
i need just get the hight block at of that corners locations
for loop
oh well you said nothing about 3d
through each block
getHighestBlockAt
I'd make an example if I didn't have to catch a train in an hour
not always
that's what they want
thats return air
while true, what I said wouldn't work out quite well in 3d for border only
I mean it still does, just needs to be applied differently
or if you put a block on 255
so, to get the border blocks to include height, you need to use 2 triangles. 1 for the size of the box, and the second from the height to the bottom and from that you know the exact dimensions and can get all of the blocks just only on the border only 🙂
actually might be able to use 1 triangle if you know how to combine it
but probably easier if you just use 2
how do i give myself the item imholding
like for example if i hold a stack of cooked meat, it doubles
time for them to learn then
in java plugin of course
ItemStack item = new ItemStack(itemFromMainHand);
PlayerInventory inventory = player.getInventory();
inventory.addItem(item);
something to this effect
there is other ways
so i should be able to put this in a command
Well your command works however you specify
if you want the register a command that is named duplicate
you could just have that command run that code and it duplicate items
and how do i make it so you need a specific permission to execute the command
you would check for said permission
if they don't have it don't run it
if player.hasPermission("Permmisssion here")
can i sepcify so that only my username works?
sure
add the permission to the command in plugin.yml and you need no checks
what is uuid
seems like you have a lot of learning to do
well can the operator of the server run every command
yeah
technically yes, but also no
it depends on the plugin 🙂
yeah i think i understand
unless it's specifically excluded, yes
because if i say that in theplugin only my username can run it. Then the operator cant run it because their name issomethingelse
not to mention that I would need to pick it up by the center
basically what I am asking is. Do you know the size of the box ahead of time, is this user provided or is this some dynamic thing based on a arbitrary value
even if the box has nothing and is only imaginary, you still must know the size because it has a purpose
i just need a loop provide me all those red carpets location
where is the main file of the plugin located
ok, but you already know the box size correct?
on this case i have a middle location with a float paramenter called radius
yeah when i edit it, oredit someone elses, i need to find where like to main fileis
Sorry, I don't understand you
modify that method to only select ones with red carpet
in this case (2 + 1) = 3 * 2 = 6
red carpet is just for visual aide
yeah i know but the carpet is just a example
i need get only the ''borders'' location
well i might make a mistake. But i cant figure out where i can edit commands
they want to get all the locations along the border including the height
the easiest way I can tell you to do it without making it too complex for you to understand
all you have to do is traverse in 2 directions in regards to your radius
so one direction is on the 2d plane, and you will go out in a direction however far, and then up or down to get a corner. The second direction, is going to go up in the amount of the radius, and then go in the opposite direction you went for the 2d plane
this gives you the opposing corners
now you can just use 3 for loops to iterate just on the x, z axis only and inverse at the same time, and then move your y afterwards one at a time. This will give you all the locations around the border
so the first loop, is the y, the second and third is x or z which ever you want
the y is considering the height?
Well yes because these are xyz coords

the method I am explaining you is the easiest to do, not the most performant but still accomplishes what you are wanting while at the same time of you capable of understanding it
maybe I am just not explaining good enough which I wouldn't be surprised and I imagine imllusion has something to add
public List<Location> getLocationsAroundPlayer(Player player, int diameter) {
Location location = player.getLocation();
int radius = diameter >> 1; // this is the same as dividing by two, but more cryptic
List<Location> corners = new HashSet<>();
corners.add(location.clone().add(radius, 0, radius));
corners.add(location.clone().add(-radius, 0, radius));
corners.add(location.clone().add(-radius, 0, -radius)); // the order of these matters, otherwise edges might cross diagonally
corners.add(location.clone().add(radius, 0, -radius));
corners = addBorders(corners);
for(Location borderLocation : corners) {
int highestY = location.getWorld().getHighestYAt(bornerLocation);
if(highestY <= borderLocation.getY()) { // use heightmaps to our advantage
borderLocation.setY(higestY);
continue;
}
while(borderLocation.getY() <= location.getY() + radius && !borderLocation.getBlock().getType().isAir()) {
borderLocation.add(0, 1, 0);
}
}
return corners;
}
public List<Location> addBorders(List<Location> corners) {
List<Location> locations = new ArrayList<>(); // 0->1, 1->2, 2->3, 3->0
for(int index = 0; index < corners.size(); index++) {
Location start = corners.get(index);
Location finish = corners.get((index + 1) & corners.size()); // this is the same as a %, but more cryptic
Vector difference = finish.toVector().subtract(start.toVector()).normalize();
double distance = start.distance(finish);
Location current = start.clone();
for(double irrelevant = 0; irrelevant <= distance; irrelevant++) {
locations.add(current);
current.add(difference);
}
}
return locations;
}
something like this
`@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
String uuid = player.getUniqueId().toString();
if (uuid == "bce295f0-0575-4c83-ac7a-8b6f285881a5") {
ItemStack item = new ItemStack(itemFromMainHand);
PlayerInventory inventory = player.getInventory();
inventory.addItem(item);
}else{
// I dont know what to put here
}
}
}`
i tried codingsomething

will this give myself the item im currently holding?
and will it check if the uuid is correctbefore executing thecommand?
but is it correct
I'm going out in 10 minutes
and can't bother watching 2 people argue over trivially simple code
most likely correct or very close to it
hard enough forme
yeah i researched everything you toldme
we need to use more bitshifting
sure
what can i put after the else
or how could i like not execute the command
yea
@wet breach added comments for clarity
Hey. Is there a way to register a custom flag using WG API, which value is not a boolean? I need a list of values to be stored there
where is most likely the OnEnable function
Yes. There are a few flag types: https://github.com/EngineHub/WorldGuard/tree/master/worldguard-core/src/main/java/com/sk89q/worldguard/protection/flags
thanks
main class of your plugin
otherwise its in the JavaPlugin class
Hi everyone
Can someone help me?
This is the link of the post I made on the forum
https://www.spigotmc.org/threads/how-can-i-change-the-color-of-unknown-commands.592584/
Can someone please help me with how to enable the scripting engine with spigot I’ve looked for hours at this point and can’t find a direct modern answer for newer Minecraft versions. I know spigot has its own loader and stuff and that’s why it doesn’t work but is there any way I can enable it or something
Ask skript mostly everyone here uses java
Skript has their own discord
does EntityDeath event get triggered when players break armorstands?
I dont think he is speaking about skript...
ArmorStand is a LivingEntity so it better does
thanks
Also
WHen doing rayTrace entities
is there anyway to get the hitVector
Yes
like the onPlayerInteractAtEntity event
cause then you can do event.getClicked position
declaration: package: org.bukkit.util, class: RayTraceResult
I know you can get the actual location hit
but not in the same format as this one
Because the getClickedPosition is kinda relative if you get what I mean
for example if you click the top of an armor stand
you get something like 1.9 for the y
and not the actual location in the world
Well then just calculate the relative vector.
Vector fromPlayerHeadToHitPosVect = rayVec.subtract(playerEyeLoc.toVector());
so can I then compare the difference between the location of the hit armor stand and the hit location?
Wait so its a vector within the BoundingBox of the clicked Entity?
I think so, but I am not completely sure
All I know is that on the PlayerInteractAtEntity event the top of the armor stand is represented as 1.975 y
So its probably relative to the AS's location.
Find that out and then calculate the vect:
AB = B - A
Vector from A->B is B minus A
Thank you
but what is a and b here
is a the armor stands actual location
and b the raytrace hit loaction?
Hello^^ Now this is very scuffed. I am using Player#sendBlockChanges with supressLightUpdates on true. It seems to ignore this flag completely when above about y=-33 which makes my sending extremely laggy. When settings the flag to false, it appears to ALWAYS lag
I can see some laggy shadows getting removed and added in the lag, too. Tested it both on superflat, normal and paper, spigot
Fun times
Hey guys, how can i obtain single line of lore?
I am using player.getInventory().getItemInMainHand().getItemMeta().lore().get(3) for now, and it returns whole Componen thing, I just want to have one word as a String, any solutions ?
is there a list of translateble components somewhere?
like the commands.gamemode.success.self stuff
if i am looking at the right thing, then no
java has mem leaks?
if you mess up badly enough
yes
it can have yes
so for example infinite recursion?
i am trying to debug one rn actually xD
well infinite recursion will stall your server
so no
more like making stuff without resetting other stuff
or whatever
yes
is there a limit to how manny recursive calls you can have?
yes
ofc
but thats probably not your issue
stack overflow is 9/10 times a programming error on the devs part
Dont check custom items by comparing their name.
Add a PDC tag to the ItemStack. Then it will stay your
custom item no matter what name or enchantment it
might get.
@small hawk i think it was
yes its on me
like you arent breaking out
yes I learned this too, super useful 👍
well you are exceeding the limit not because you need more , but probably because you made another mistake
I have recursion using events hehe. Is there any way I can pass a value to my event that tracks the calls so I dont overstep?
Nope
what kind of events
Use a field for that
i don't want to check if my item is like CUSTOM, i just need the last line from lore to get TargetedPlayer
a field?
oh
like just a private int of the class?
The lore returns a List<String>
Just get the nth element.
If you are using paper (in which case)
?whereami
You need to deserialize the line first:
Component line = ...;
String text = PlainTextComponentSerializer.plainText().deserialize(line):
that explains why my if statement is always true
Anyone know how I can check if an item has a specific name?
Ex. I have a book (Material.BOOK), how I can check if the name of it is equal to "Hi"?
get the item meta and getDisplayName()
i believe its this https://gist.github.com/LoneDev6/1df03fd853b2b244a7348216c8fa909d
I swear using player#sendMessage is the best debugger
unless you actually get memory leaks xD
okay, it didn't work BUT, I did
Component lastLore = player.getInventory().getItemInMainHand().getItemMeta().lore().get(3);
String text = PlainTextComponentSerializer.plainText().serialize(lastLore);
And that worked for me, returns one word as string, that i needed. tysm for help
mojang translations go brr
Yeah, I do this:
ItemMeta b = book.getItemMeta();
if(b.getDisplayName().equals("Hi")) {
...
} else {
...
}
But it is always false
wait lol
no namespace?
hi everyone, i have a error on this : itemMeta.getPersistentDataContainer().set(new NamespacedKey(this, "creatureType"), PersistentDataType.STRING, creatureType.name());
its said : Multiple markers at this line
- The method getPersistentDataContainer() is undefined for the type
ItemMeta
and how did you create the item?
what version are you programming for?
With a command, in the command I had set the DisplayName to "Hi"
spigot 1.16.3
did you set the item meta on the item again after you changed the name?
Yes, when I get item I get the book called "Hi"
hmm
can you show the code you wrote?
yes
I don't know why I get this problem
can you show your code when you created the item?
Yeah
?paste
and the exact error?
Multiple markers at this line
- The method getPersistentDataContainer() is undefined for the type
ItemMeta
- Line breakpoint:Main [line: 70] - onBlockBreak(BlockBreakEvent)
is trie tree data structure good for searching autocomplete words?
is what structure?
@pseudo hazel
Yeah
bruh ur creating a new itemstack when checking
without the name
of course its false
any idea for me ? 😦
idk
check if your version of ItemMeta implements PersistentDataHolde
the only thing i can think of is that your source is outdated
ok thx
Wdym?
I check if the itemMeta (DisplayName) in the hand of player is equal to the displayName of book
exactly what i am saying. in that code snippet ur creating a new ItemStack upon which you do the check
u dont use the item in the players hand
^
Ahh, ok. Thanks
someone know this error pls ? https://paste.md-5.net/cuxuyixeve.rb
yes but i don't know what i have to do
it tells you in the error
did you even read it?
I need help to change plugin from 1.16.5 to 1.17.1
ofc but i don't understand thats why i ask for help
you read the part about plugin.yml?
yes
it said : Did you forget to define a modern (1.13+) api-version in your plugin.yml?
Just change the maven dependency. If your not the dev you won't receive much help in this though I'd reccomend
?services
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/
join #690688600895127683 please and help me
No I'm at school
Do it yourself or commission
Plus there's no need to do any upgrading unless youre dealing with nms
but I dont know what is NMS
the forums post had an update example
Is it your plugin?
No
just read the update post ?
my plugin is multi character
because I tought that I can change the plugin version but I didnt understand
It very clearly says what it supports
Well, ehm, updating a whole plugin to 1.17 that uses NMS is work
work that I guess is now on you
I need spigot buildtool?
wtf is that
seems somehow you have implied you are available for private help 😉
unless you really are lol
LMAO
naturally frost, I shall updated random plugins to 1.17
well, random doesn't necessarily mean to include the large or popular plugins
just random unheard of maybe mostly useless ones 😄
buying a plugin that does not support your server version is genius tho
especially if it is open source
Well I can't say it is smart, but I can see the point if you still wanted to support the dev
even if its not an item that currently works for you lol
ah so they are in the wrong place then
SO HELP ME I NEED YOUR HELP
NO AND USING CAPS DOESNT HELP
there is also this blog if you wanna read something else
I don't know what else I can do

I need to change only the numbers from 1.16.5 to 1.17.1 and to install buildtool 1.17.1 snapshot on my computer?
is there a raytrace that gets more multiple entities
presumably not as NMS changed between 1.16 and 1.17
you can try it tho
you also have to follow the more complex setup linked in both posts to get NMS
I am sure if it was just as easy as just changing the numbers around, many plugins wouldn't have such a problem in updating
if only they were geniuses too
yeaaa
ok thank you
probably a stupid question but what does the "target" folder do in intellij projects
target is a folder used by maven to compile your project in
is there any way to reset backup codes for spigotmc
i have verifed my account on discord
and i cant access my spigotmc account due to how i changed my phone
if you fucked up your 2fa probably mail to support
would it be safe to remove some stuff from there because i've noticed it still contains some older files i dont keep in src any more
2FA resets are a rather long thing to go through
you can remove the entire target folder yea
next build, maven just re-creates everything it needs in there
i think i'd rather create a new account with my proper username instead
its my old username
if you don't have anything valuable linked probably easier/faster
yea that is why you don't keep your backup codes on the same device as your normal 2FA
i think i should buy usb cryptographic key instead
way easier to manage
and allows for complete safety
Where can I recruit a developer?
?services
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/
I have insufficient permissions to post there because of one small mistake 💀
I guess I'll have to create a new account then
^
.
LMAO
Lol
Well i emailed them and explained to them I made a mistake but got no reply
you probably shouldn't store important stuff on a fragile device that can die at a moment of dropping it
second, the odds of getting help in resetting 2FA is like 0
Where can I learn spigot plugin development?
ok its not 0 in getting help, its 0 in for someone to reset the 2FA for you so you can get back into the account
third, just make another account, since you can't prove the account is yours it also works in reverse 🙂
Hello! How can I disable player collision?
because 2FA is how you verify your identity
without the 2FA there is no verifying who you are
i have 2FA on discord 😄
I mean usually you can 2FA reset
thank god i had a session on a pc
Where can I learn plugin development since I can't recruit on the forum?
you would need to still log in somehow
Well you need like in person authentication
yeah I doubt Md is going to do that lmao
yeaaa
¯_(ツ)_/¯
issue is like, who guarantees that even if you have access to the old discord, you aren't just a hacker that has the discord etc
but in order for in person to work they would have to have someway to still verify that person belongs to that account
which is pretty much the whole purpose of 2FA
see that is why my backup codes are duplicated in 4 different locations 
Well 2FA isn't super secure anyways
But yeah best to store backup codes in more then one place 🙂
2fa is just another vector for attack. just a password is safest
the assumption many have about 2FA is the delivery method is assumed safe
Can someone tell me how to disable player collision, I couldn't find any information
teams
I tried it but it didnt work
Maybe I have done it wrong, I will try again later
But arent there any other ways?
What roes raytraceresult.getHitEntity return if there were multiple?
How do i recompile Jar file? I would like to turn it from .src to .Jar
its not coming
in general
Well how do i recompile Jar file
Hacks
The matrix rows come back as 3 and this.rows comes back as 4
can I raytrace more then one entity?
These are my kernels that are used to do the image ```java
private NamedMatrix[] kernels = {
new NamedMatrix("identity", new double[][]{
{0, 0, 0},
{0, 1, 0},
{0, 0, 0}
}),
new NamedMatrix("ridge", new double[][]{
{-1, -1, -1},
{-1, 8, -1},
{-1, -1, -1}
}),
new NamedMatrix("sharpen", new double[][]{
{0, -1, 0},
{-1, 5, -1},
{0, -1, 0}
}),
new NamedMatrix("unsharpen masking 5x5", new double[][]{
{-1.0 / 256, -1.0 / 64, -3.0 / 128, -1.0 / 64, -1.0 / 256},
{-1.0 / 64, -16.0 / 256, -3.0 / 64, -16.0 / 256, -1.0 / 64},
{-3.0 / 128, -3.0 / 64, 119.0 / 64, -3.0 / 64, -6.0 / 256},
{-1.0 / 64, -16.0 / 256, -3.0 / 64, -16.0 / 256, -1.0 / 64},
{-1.0 / 256, -1.0 / 64, -3.0 / 128, -1.0 / 64, -1.0 / 256}
}),
new NamedMatrix("laplace", new double[][]{ // ridge + identity
{-1, -1, -1},
{-1, 9, -1},
{-1, -1, -1}
})
};```
linux kernel



