#help-development
1 messages Β· Page 504 of 1
There are only 2^32 possible identity hashcodes and over the full lifetime of an application there can be much more than 2^32 objects. So some are bound to have duplicated hashcodes
object references are 32 bit though
so no 2^32 objects at once
System::identityHashCode is fine as default impl for Object because whenever Object::equals is true, Object::hashCode should be the same for the 2 objects
And that obeys contract
isnt Object#hashcode native?
Wut? I thought they allow more than that
Let me say this, I had a hashmap check function where the block.getDrops(item) is if( Arrays.asList(BlockFace.UP,BlockFace.DOWN).contains(face) ) { for(int x = -size; x <= size; x++){ for(int z = -size; z <= size; z++){ if( !(x != 0 || z != 0) ) { continue; } if( !block.getRelative(x, 0, z).getDrops(item).isEmpty() ) { block.getRelative(x, 0, z).breakNaturally(item); } }} }But if you had the hashmap with 25-100 objects, what is there to improve?
hmm
if your jvm doesnt have more than 32 gb of memory the implementation spec says its a type 1 computational type
so 32 bits
but 4 billion objects is a lot
more than enough
That max address size for 32 bit applications if 2-4Gb fyi
yeah but an object reference isnt an address
2GB if PAE is not used, otherwise 4GB
actually more then 4billion objects can be addressed in 32bit
Hence 2-4
this is because that each object doesn't take up a full 32bits to address and also how Java addresses objects as well
if u had 4 billion Objects im pretty sure the headers would already be over 32 gb of memory
tf
how
at once
According to https://wiki.openjdk.org/display/lilliput objects have to be quite large in JVM world
The identity hashcode field is already 64 bits long
However since the object is not aware of it's own address I can fairly state that no, there can be more than 2^32 objects at the same time
16 byte object headers sometimes π
But the identity hashcode part is 64 bit long
where is that stored
Ah no. I read it wrong
in 32bit java, its 8bytes instead of 16
theres physically no way to reference more than 2^32 objects with 32 bits
that means in a single 32bit address size, you could store 4 objects
Yes, but modern hotspot uses 64 bits
The identity hashcode is - contrary to popular belief - not the memory address, so the fact that it is 31 bit long is irrelevant
no shit its an int
Ugh. Let me just do a test then
you do know that Java can compress references right? If an object doesn't use up the entire width of an address space, Java will place another object in there
CPU instructions
wtf now we talking abt cpu instructions??
bytecode ig
you mean addresses
no i didnt know that
what if another object gets that reference normally
without compressing
you still only have 2^32 possibilities
right
if java didn't compress yes
that doesnt give u more possibilities in a 32 bit number
im 100% sure im not understanding
if you have 32 slots, but 64 things. Nothing said you could double up the things in a single slot. So therefore, you could place 2 things in each slot
the amount of things exceeded the number of slots
but it still stored them
If I had more than 32 Gb of memory I might be able to test it for use but as it seems I am unable to obtain enough space vm-wise
are we talking about storing partial objects in an address space π
so java stores multiple objects under the same reference?
But it still seems to be able to use up 20 Gb no problemo
im talking about object references here not addresses
that has nothing to do with the object references
it wouldn't be the same reference per-say, that is why offsets exist you know
Aren't they the same thing fundementally so?
nah a reference is not an address into memory im pretty sure
object reference
a reference does require a pointer, however duplicate copies of the reference don't require their own pointers
that 32 bit number
isnt that an address offset?
but there does have to be at least 1 pointer
that is the i-hashcode
yeah?
I already said it before lol
all i know is that i read in the jvm spec that object references are 32 bit unless youre on a 64 bit system and have more than 32 gb of memory allocated to the jvm
There is bound to be duplication in the i-hashcode
.
references or pointer addresses are indeed 32bits, however nothing said that only 1 object must occupy the entire width of that address space either. You can split that address space and put 2 objects as long as they fit. If java determines that it can't make use of the entire width for any other objects it just pads out the rest of the width
Even at once there could be more than 2^32 but you need a very beefy PC for that
i dont see a single use case where youd have more than 4 billion objects at once
and if there is one
dont use java
every object is a minimum of 16 bytes
In the future you might see such usage
16bytes for 64bit, 8bytes for 32bit
because you have an offset
to memory?
does java multiply the object reference by 32 bytes and use that or smth?
yes, and as well as if memory didn't have one you could just have your program remember the offset of a given address
im so confused
so one object reference can point to two objects?
im not talking about pointers into memory im talking about jvm object reference
the values passed around on the stack and shit during execution of a java program to reference objects on the heap
jvm object references requires at least 1 pointer
so the object reference points to a table which has a pointer to the object in memory
how would you exhaust the amount of addresses on the stack π
i believe im mixing up between the word address and reference lol
typically they contain the pointer into memory, otherwise some equality checks wouldn't really be possible
if we assume each object takes up an entire memory address width
wtf is a memory address width
you mean like a byte for normal pointers
how big one block is?
it can vary, however it should be noted that I refer to modern stuff therefore PAE is most likely going to be enabled/available on a given system. PAE makes use of virtual addressing that is then mapped to physical addresses. Thus allowing you to use less of the physical addresses at once
isnt that on every single OS ever
virtual memory
it is similar how you can have 300 threads, but your processor only have 2 logical threads
no
you are thinking of paging
is that the thing that the cpu caches when it requires smth within that page?
like block of memory
if i write
*((void*)0)
in c++ that doesnt try to access address 0 of my physical memory right
the process has its own memory space
it depends really on the system. You could store in physical memory outside of the process
that will give you a straight up access violation LOL
me trying to free nullpointers 
well yeah ofc it depends on the system its something the OS has to do but every modern OS does that
average programmer
why would you even need that, too lazy to register classes yourself?
just wondering
its good to be lazy
its the only way to do it
for unloaded classes
ye <insert for loop and try with resources here>
isnt there a reflections dependency thing
org.reflections
yeah
i believe
idk if that works for unloaded classes though
and if it does it has to do it a similar way
better hope so
i would just implement it myself
how many items?
i smell hardcoded things
i was thinking about loading items from json files but loading behaviour doesnt really work π
load from lua
ew
straight up assembly ofc
π
Hello, how can I kill a player with a custom cause ?
then show this custom cause in the chat
isnt there a SomeEvent#setDeathMessage
PlayerDeathEvent
you just kill her and keep track that you were the one that killed her and keep track of the cause
When you kill the player add some PDC you can read and remove in the death event?
^^
tell that in court
what date
bruh this somehow explains my current situation
who ever said relational databases were fun
even json files feel more appropriate for this
i dont really get the relational part
No duplicate data. Change the address of a customer once and it's changed for all the data.
- it's easy to implement a changelog
anyone have intellij say it cant access a class but said class is in the same package
intellij is having strokes recently
ive got an abstract class and a normal class in my lib, same package but the class is unable to access it, still builds fine just visual error
sounds like you wanna clear caches
when is it not
about three months ago
Increase ram usage to 10GB
Bukkit recommends Netbeans anyway
thats because md uses it
Use whatever you prefer, but support is most likely on InteliJ and Eclipse
Most support is for intellij
netbeans is a shit IDE
I gave it a try many times
it cannot even auto-complete pom.xml files
I understand that md uses it, because that's probably how he learnt java, but honestly speaking, it's a shitty IDE that has next-to-none maven support
I hate IntelliJ every day, but it's still the best thing out there as of today
free tops my requirements π
community edition
eclipse is "okay" too but unfortunately the auto-complete is utter garbage
is there any advantage of eclipse over IJ?
"oh, you wanna get the display name of an itemstack? why don't you cast it to player?" ~eclipse be like
none that I could think of
imho IntelliJ is shit but still better than anything else
why is it shit?
it's not shit, but there's many issues with it. For example, please Ctrl+B into some random class, then try to "find references". it won't find any, even though there's refenceres in the same class
with "random class", I mean "decompiled classes"
what
Yeah, if it has the sources available it can find references
enter "CraftPlayer", then Ctrl+B into it
you'll quickly see what I mean
Eclipse has huge issues when sources are not attached
please tell me more about how it cannot find references about a class I already got open
You need to attach sources for it to find the references
Even in same class
gimme a minute
ECD is total garbage
intellij can download sources automatically
you dont need to attach anything by hand
CB does not have sources
you guys don't understand the issue I'm describing
maybe I explained it badly
I will attach a screenshot in a few minutes
Well it's not that suprising that it is garbage given that ECD is based on literal malware
skill issue then
people saying "skill issue" are usually 14 year old jerks
how did you guess my age?
I know what you mean. But it is a rather sporadic issue as I recall not having the issue recently and being a bit suprised by it
no usages found for "entityId"? I found at least 3 usages just by looking at it
yeah, as said, IJ is shit
oh no. eclipse is shit for other reasons
thats maybe because it cant find usages in decompiled class files?
Because Eclipse has a similar issue there
yes? that is what I said
yeah
Well it's more that fernflower does not support tokenization yet
idk i thought you were talking about bugs
Hi guys im intrested in creating a plugin anyone can help me setup the first file?
it IS a bug
just ctrl+f entityId
it says there's no "usages" while they are clearly there, in the same file
I know how to workaround it
another issue is jetbrains "support" which is basically non-existent
(for the paid version, that is)
oh no i meant that its maybe unable by design to find usages in decompiled class files
so it's shitty by design?
i dont need much help just to open the file cause like the guide i found in google doesnt help very much
Well I mean it would be possible
yes, sure. are you using intelliJ?
im sure that, if its by design, there is a reason why it doesn't work.
Quiltflower (Fork of FF) supports Tokenization and is used in Enigma for example. However IJ uses stock FF which does not support that feature
idk customer support of jetbrains told me "it's a bug, we're working on it"
that was like a year ago
ok then it's really shitty
I still agree that IJ is the best IDE out there
but it doesn't make intellij shitty just because of this
intellij has thousands of useful features. i forgive it for some minor things.
true. but I pay for it, and I demand bugs to be fixed within like, at least a year
then go to jetbrains
no, i mean work at jetbrains
how slow are their devs working
I cannot work there, I'm a lawyer, not a coder
I never studied any IT stuff
The main problem with IJ I have is that it only supports one project per window. That is why I still stick to Eclipse and won't ever dare to think about switching to IJ for the foreseeable future
I also demand that a company is supposed to fix bugs themselves, even without me applying for a job there
is that too much to ask?
it does support "any amount of projects" on macOS. but yeah on windows it doesn't
idk about linux
And the main problem with Eclipse I have is that their debugger is a bit iffy if you don't have a setup that can be described as orthodox
On linux I haven't been able to replicate Eclipse's workspace feature to any degree
tbh I switched to IJ 5 years ago because I hated this whole "workspace" idea lol
I want to have one project per window
it has been reported 8 years ago
I truely love it if I am working with 2 - 5 projects at a time
yeah thats funny haha
Ah, you probably are talking about m2e automatically resolving dependencies between projects
Really nice feature I must say
let id = event.target.id;
if (id.contains(button)) return;
Doesn't work on html/javascript someone knows an alternative to this?
Sadly it's not a thing in gradle world unless you use subprojects
why are you asking for js support in a Minecraft server api discord?
JS uses includes
the bultin feature of maven?
No. it eclipse's maven integration that does it
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
because i needed fast help
It basically sees "hey, project X is depending on Y. However project Z is actually Y, so we can make project X depend on project Z"
then explain the issue please
It's probably because the method they're looking for isn't contains but includes
hm idk anything about gradle. in maven + IJ, that'd work fine
but I guess everyone here knows that "gradle = maven - features"
Well the issue with maven is that it is far too locked down
You can't add dependencies through plugins
You cannot. At least not conventionally
Ah yeah they can, but the IDEs will fail to find them
The IDEs only evaluate the POM but never execute them
that's eclipse's fault then
maybe, idk. I just declare dependencies when I need them
wym by executing the pom?
he means "eveluating"
No
then idk
I mean executing a noop task (such as :nothing in gradle)
why dont you just add the dependency
Because it is computed at compile-time
wtf
but really,,,,, if you need such features switch to gradle....
gradle users be like "i want my build to reproducable" and then they they are like "oh I want this dependency to be computed at run-time" erm whjut
Basically it deobfuscates a jar and sets the access of classes and their members based on an accesswidener file that is dependent on a per-project basis
it "deobfuscates" it? how? for what? to compile?
why don't you simply have the deobfuscated version in your local maven repo
As if it were to apply mojmap on craftbukkit for example
just use the mojang mapped artifact?
However I cannot do that the way you are familiar with since I am using the accesswidener system
So I'd need a jar for every project and that'd get messy real quick
how so? just run buildtools with the -remapped flag
then you got the "unobfuscated" version in your maven repo
it's not minecraft-related. I'm just using minecraft-related comparisions since you have no clue what I am doing
you only mentioned minecraft, so that's the only thing I can talk about
lol
Technically it is 95% minecraft-based technologies being applied on a non-minecraft setting
again, why are you use maven where it seems to be much more complicated than just using gradle and write your own task to do things?
gradle is much more complicated imho
but you can use it, if you want to, ofc
gradle has the issue of being a bit hard to debug
@tender shard followed the tutorial and got to here:
package me.Sylent1305.skyblockplugin;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class SkyBlockPlugin extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("Yo bro, my awesome plugin is indeed working!");
}
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!player.hasPlayedBefore()) {
player.sendMessage("Welcome to the server, " + player.getName() + "!");
}
}
}
but its not working can you help me understand why?
you are fine to use gradle if you want to
correct. But if you need to do complicated stuff you should be able to do it with complicated tools
you need to register the listener
exactly. most people don't need that, hence we use maven
Though I have figured out that you can append --debug to the gradlew command to debug gradle from your IDE
a maven plugin can modify the pom
im trying to optimize my plugin (minigame)
which makes new void world for instance
I tried unloading all worlds and loading them only on demand, but this resulted in Loading terrain when player tries to access them, even tho I loaded that world before hand.
any ideas why it occurs?
my load world:
https://paste.md-5.net/bopotahuce.java
"how to shade a library in gradle and relocate it?"
OH I forgot, it's not possible in gradle π₯²
package me.Sylent1305.skyblockplugin;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class SkyBlockPlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getLogger().info("Yo bro, my awesome plugin is indeed working!");
}
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (!player.hasPlayedBefore()) {
player.sendMessage("Welcome to the server, " + player.getName() + "!");
}
}
}
like that @remote swallow ?
would be really great if you use gradle for spigot with a task to start the server with the changed code and a plugin to test the code. Like paper does it.
dont you need an @EventHandler
what? you can shade and relocate just fine
you can easily do that?
just use the maven-exec plugin?
there is a plugin that does that, it just isn't free
I guess that'd be a way to do it - cursed but ultimately possible I guess
and how do i do that?
getServer().getPluginManager().registerEvents(this, this) on onEnable + annotate the onJoin method with @EventHandler
okay first of all, you should NOT use your build tool to start a server.
BUt if you wanna do it, just add the maven-exec plugin to your pom, then tell it the args "java", "-jar", "server.jar", and that's it?
I don't understand how that'd be an issue
run-task be like https://github.com/jpenilla/run-task
wtf is that
a gradle plugin
gradle task to run a server
yeah but thats just overcomplicating things. It already required me a day to figure out how to change something on the 3 different repositories spigot has.
run paper also downloads the jar
maybe you are just not understanding how maven works
what has that to do with the incomplete explanation on what is responsible for what. we have bukkit and its implementation craftBukkit and we have spigot. When do i make changes to (craft)bukkit directly and when do i make changes on spigot?
craftbukkit has changes for the bukkit api
gradle is great for people who just wanna do things without understanding. they just copy/paste stuff and then "keep it like that" because "it works in gradle 7.3"
it's also great for people who spent 2 years into understanding how exacrtly it works
it's bad however for everyone inbetween
idk. Somehow you all have different opinions than everyone else i have talked about this topics.
probably because we understand the two different build systems
that's normal, different people have different opinions
i would not encourage any new plugin developers to use gradle. However if you need to do complicated things gradle is good.
you can do the same with maven, though
oh believe me, the people i talk to do know the difference between those 2 systems
90% of what you can do with gradle can be done with maven, same vice-versa suprisingly enough
gradle is nice if you want a more procedural build system, utilizing scripts and the sorts
where as maven is all about making use of plugins
yeah
as far as performance goes, both are the same unless you got a super massive project but even then it still depends in what it needs
otherwise small projects you will never notice a difference between the two
yeah
for small projects maven works fine
i also rather use maven over gradle for plugins
maven works fine for large projects too. Just most people don't know you need to tell maven to use more resources before it actually will. Maven is conservative where as gradle is the opposite in this regard
just dont understand why spigot doesn't m or at least provide a way to test the changes without me having to definite 17 run configurations
gradle usually takes like 30 minutes longer
it needs to downloads itself
then it sets up its own repo in the project folder
you can just downloaded gradle from its website and tell IntelliJ to use that one?
over the wrapper
it depends on the project
you can, but how's that going to work if this specific build file only works with "gradle 6.3.1"
Well at least you have the wrapper
then you shouldn't use them.
and this
funny
It's worse when the dunce that uploaded the project doesn't include the wrapper
"I just cloned this repo that only works on gradle 6.3.1. But I use gradle 8.0. Guess I'll just not use it" lmao
funny idea
you do you
fork it and make it work for new versions
it has been 2 major versions in-between? time to update.
tell this people who still use gradle 6. erm... eg... sponge?
To be fair there is no 3.7
this is like ah "uh oh why does this not work on my 1.8 Minecraft server" buddy you expect a 2014 released Minecraft server to have the up to date features?
maven works so well, that a lot of the times, I forget to update maven plugins XD
no, the opposite is true. it's like asking "why does my 1.19 server not support 1.8 plugins"
same difference
Nor is there no 3.8.0 iirc - but 3.8.1 does exist
outdated shit, shouldn't be used
that is weird
tell that to my car
They had a last minute bug and decided to bin the version number
outdated is a bit more of a personal thing at times. You could argue everything is outdated
no, because you probably maintain it. A 1.8 plugin, if it would be maintained, will work for new versions.
but that doesn't make sense to do that though
yeah whatever, you're a bit weird, I don't feel like talking to you anymore. Everyone knows that gradle breaks build files on every update, while maven does not. Everyone also knows that maven build files are detailled and just work fine on the next update, while gradle cannot even decide on which language to use (kotlin, groovy, and the other thing they used earlier). There's also no archetypes in gradle, btw. But granted, gradle fanboys like to just copy/paste other people's stuff, so that's fine, I guess
im sorry but we have over 10 major versions between 1.8 and 1.19 there is no "personal thing" 1.8 is outdated. Should not be used.
let's all agree, 1.8 is dead and shit
maven, gradle, whatever ... 1.8 is shit
and dead
and should be dead
we are all weird.
frostalf is making a good point in that it is really a personal matter. At long as someone uses it it isn't truely dead
I'm cute
yes, he's right
yeah but they shouldn't expect support and rely on their own.
even hypixel is doing the switch
I seen servers supporting 1.8 to latest before
I understand the view point you are coming from with the whole outdated thing, however since there isn't like any formal or standard thing in what constitutes as being outdated its really of your opinion most times. Second, just because you consider something outdated doesn't mean it suddenly doesn't work or it is suddenly bad as well.
But know this is the dev channel we talking on
yeah it's called viabackwards
I agree 1.8 is old and people shouldn't use it, however my reasoning for people not using it is mostly because they are going to encounter issues they don't know how to fix on their own even though they were warned
Or viaVersion for 1.8 but yes, its backwards
unpatched security leaks, known for multiple years, sounds bad to me
yeah anyway, whatever. gradle is an awesome piece of software. it just doesn't come close to maven, which actually is able to do reproducable builds
thats what viarewind does, viaback only does to 1.9
not everything outdated has security problems
Is there a way I can check if a player's hitbox will collide with a nearby non-passable block (like a door or solid block, but not grass) upon teleporting them to a location? If they do collide, I want to be able to shift their hitbox out of the way of the collided block.
I've tried checking for collisions using Player#collidesAt and World#hasCollisionsIn but they only return a boolean and not the points the box collided with, so I can't shift the location back out of the obstacle's way
Example of what I mean:
exactly. my old opel (vauxhall in USA) has no security issues
do a raycast
raycast? is that not the same as raytrace
it is
yeah i've tried raytracing but that does a single line and i need to account for the player's hitbox. and ray sizes are only taken into account for entity collision checks
whatever
Running a outdated version of MineCraft is not a bad thing, When I was searching stuff I don't remember on Bukkit on how to use a API. All I seen is threads on 1.16 and in 2016. I knew that code was not going to work on the latest version of MineCraft or 1.19.3 in my case. I think I was trying to add a custom enchantment and I seen a function is deprecated. I did not know what was happening
Its like trying to run newer programs on Windows 98 for a example, there is a cause of something not working
So don't be scared to run any of these versions, just create a new profile and set a directory for that profile so it does not interfere with the .minecraft folder. I done talking about this
idk if its only on paper but their javadocs mostly provide a reason why it is deprecated and, if there is one, a replacement
I know
the paper javadocs basically deprecate everything
no paper depreciates everything
Adventure
and in most cases the deprecation has a valid reason
for example
as weird as it is, that 2016 code will most likely still work as long as it isnt nms
Adventure is great,,,, once you get used to it
Or any event constructors
Paperβs deprecated. The spigot works just fine
I don't think it was nms but I don't remember what the code was
is that paper
it was
yes
i still wonder why they called themselves "paper", which obviously gets destroyed by a spigot. why did they not call themselves "hydrant", which is basically a "super-spigot"
but yeah we all know, paper staff is a bit slow
but i can understand why you are so pissed about paper. They take your work and make it better.
make it better? my work?
I have never contributed anything relevant to spigot
you = plural in this case
ah ok
better? Nah, I doubt that
they have accomplished to turn a nice fork into sth that's incompatible with upstream
but this is not the correct place to discuss this
paper was nice a few years ago
at this time its probably just a matter of fact until paper drops spigot support and goes for the hardfork
...```irectory of D:\Home\Servers\MineCraft.Launcher - PAUSED\Versions\Paper
[.] [..] 1.10.2.jar 1.11.2.jar 1.12.2.jar 1.13.2.jar 1.14.4.jar 1.15.2.jar 1.16.1.jar
1.16.2.jar 1.16.3.jar 1.16.4.jar 1.16.5.jar 1.17.1.jar 1.17.jar 1.18.1.jar 1.18.jar 1.19.1.jar
1.19.2.jar 1.19.3.jar 1.19.4.jar 1.19.jar 1.8.8.jar 1.9.4.jar
22 File(s) 878,368,543 bytes
2 Dir(s) 665,099,268,096 bytes free```
exactly, and that's when they'll die
haha no
I hope they won;t. I've no interest in plugin deving for Paper. Not going to do it.
if they actually wanna "do their own thing", they gotta listen to what others said, and claim "spigot's api is copyrighted" and stpo using it
yk
can't claim "craftbukkit is copyrighted", then keep on using it
PaperMC improves Minecraftβs ecosystem with fast, secure software and an expanding plugin API, providing quick releases and helpful support as the most widely used, performant, and stable software available.
"helpful" Is that marketing speak for toxic?
that's just ChatGPT
Similarly, if gnomes snuck into your house at night and replaced the internals of your TV remote with a different (but compatible) technology, you probably wouldnβt even notice! lol
guys this type of debate doesn't suit in this channel
i have experienced more toxicity in this discord in 3 days than in the paper discord for over a year
Redirect to #general
he's looking at me
he definitely has eyes for me
This channel is #help-development
ask a question then π
I'll help your mom to develop, but she didnt ask any question
programmatic differentiation without using first principles?
can i have en example of the state pattern please?
Back to my plugins I guess
I'd push my glasses up the bridge of my nose and compile an answer... but I know you were not serious π
i saw it in an AI video recently but it made me cringe seeing them pluging in 0.00000000000000000001 as h
π
?paste
they don't provide security
i still keep calling it async spigot
Is there any reason why a spigot commandexecutor only spits this out in chat if there's an error in any code that affects the command, but nothing in the console? I'd expect a stacktrace, but it's almost as if the commandexecutor eats the error up in a try catch somewhere?
library provider source: https://paste.md-5.net/uqoxalarev.java
error: https://paste.md-5.net/xulosicuvi.cs
anyone know why eclipse aether is failing to resolve the artifacts?
it depends on the problem. Not all problems raise an exception
only exceptions cause there to be stacktraces
so, that means there could be something like not registering the command
being the problem
TCPShield
are you not using maven?
or gradle
hardly consider that security
what did they say about "security" lol. I can't check, I blocked them
that paper provides a secure software
haha erm ok
I just said they don't provide security
yeah this is one of those 50/50 chances where I agree with you
Gotcha, ty
im making a standalone application but i dont want to shadow in all dependencies
so im trying to download and load them at runtime
with eclipse aether
Hello, how can I get the players in a chunk ?
oh i didnt know it was that simple
no, but a getEntities
stream and filter it
I've got this but I can't convert :java List<Player> player = (List<Player>) Arrays.stream(event.getChunk().getEntities()).filter(e -> e instanceof Player).toList();
chances are this will works for other repos too
yes, if you change the address
convert what
List<Entity> to List<Player>
Inconvertible types; cannot cast 'java.util.List<org.bukkit.entity.Entity>' to 'java.util.List<org.bukkit.entity.Player>'
You need to add a cast in your stream
how ?
Arrays.stream(event.getChunk().getEntities()).filter(entity -> entity instanceof Player).map(entity -> (Player) entity).collect(Collectors.toList());
thanks !
I replaced .collect(Collectors.toList()); with .toList to get a List π
teh Collectors.toList() is just backwards compatible
Player.class::cast
and Player.class::isInstance
okay
does ItemDisplay#isDead() always return true
'collect(toList())' can be replaced with 'toList()'
My plugin is only compatible with 1.19+ so I think I can use this
ye
bump
Do you mean the "loading terrain" loading screen
yes that screen
That's client side loading. The client needs to get the chunks from the server also Mojang hardcoded a 2 second minimum loading time (This has been fixed in a snapshot I believe)
just why would they hard code it :D
also that loading screen goes forever
or atleast 1 minute
You can install that to help
looks good
but how can I actually make it load, since it just won't ever load those chunks
or so I think
I can't see whats in that world
The 2 second hardcode is gone in latest
great
yes Teams
my problem isn't waiting for it to load
idc 'bout that
i only have problem with it loading the world or chunks
since I can't seem to ever load into that world (no matter that 2 sec)
then packets
How do I access a plugin from one plugin?
I trying to make a shop plugin and have my farm rod plugin add its custom items to the shop
Anyone want me to make them a free custom plugin? DM me
?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/
Do I need to do what vault did? private boolean setupEconomy() { if(getServer().getPluginManager().getPlugin("Vault") == null) { return false; } RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class); if(rsp == null) { return false; } economy = rsp.getProvider(); return economy != null; }
You can
if you dont have a service provider, no
If you want to
Anyone want me to make them a free custom plugin? DM me
that being said using services is rather rare
I just trying to access my plugins from one. Like a core plugin if you call it
The only plugin making active use of the service interface that I know of is vault. But that is about it
and permission plugins
I don't want to combine all my plugins to one huge plugin just to add a server shop with my Timber Axes, Hammers, Shovels, Portable Chests and Gps Compasses
And Farm Rods
6 different plugin files (.jar)
Then like I said
Just use getPlugin
Or provide some kind of api to obtain an instance
Or design your plugin(s) in a way that the plugin instance is not needed
Like turning all 6 plugins to one plugin?
no. I'm talking about the forbidden keyword
Forbidden?
your plugins sound like they dont need to know about the core plugin at all
||static||
Anyone want me to make them a free custom plugin? DM me
I'll report you to Choco if you continue like that
?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/
How can I tell if a player hit another player from behind? I'm trying to implement a feature where if you hit a player from behind you do bonus damage
It's just a lot of math with vectors which idk how to do
/**
* Is the Player behind the Entity?
*
* @param player
* @param ent
*/
public boolean isBehind(Entity player, Entity ent) {
Vector playerDir = player.getLocation().getDirection();
Vector entityDir = ent.getLocation().getDirection();
double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(), playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;
return (relativeAngle <= 60 && relativeAngle >= -32);
}```
thanks I'll try this
You should not be doing that as some people think you trying to affect them like if I wanted you to make a plugin for me, I would ask for the source code so I can check before I run the plugin. Just stop, anyone can report you
wait where do you define angleInDegrees
sorry that shoudl be relativeAngle
wasn;t my code but I pinched it
that one is a bit tough to be honest
Now how do I detect what body part got hit :p
Ask him where the bad man touched him
Please don't, you remind me of my past. Can you keep this in #general . I give you a task, find how I can access my plugin from my other plugin
That is what this channel is for
No, when you've been here longer than me I'll allow you to dictate how I behave.
^ you have already been given your answer, more than once
Is there a way to make custom advancements in Spigot?
Three ways, Create your own RegisteredServicePrivider, Use Bukkit.getPlugin(... or create an API in your plugin you can access via an instance.
Several
There is an experimental method to load a advancement from a json string
Or you can just have your plugin deploy a datapack
I'm trying to make a simplified connection string for my config, but I'm kinda stuck when its coming to the regex to match the parts
nitrite:user@password:/home/user/path/to/database
(\S*?):
Currently I've come up with this regex but it only matches if there is a : character after the portion I'd like to match the end portion as well
Current:
Group 1:
- Match 1: nitrite
- Match 2: username@password
What I want:
Group 1:
- Match 1: nitrite
- Match 2: username@password
- Match 3: /home/user/path/to/database
why regex and not String.split?
different params in the future rn I'm hoping to start semi simple though I suppose String.split works for now
string.split does regex internally anyways
oh'
Does anyone know if itβs possible to get the skin of a player and change the colors code wise? So I can for example make stone statues of players that way
If not it doesnβt really matter, just a fun idea I was forming in my head
No skins come from Mojang and are signed
Can I not make items take longer to eat using NBTAPI
nbtItem.setInteger("UseDuration", ticks);
I did it and now it seems like I can never actually eat the item, it's eating forever
How can I alter the speed of a particle effect
I donβt want to change the players skin, I just want to take it and modify it (and then apply it to an npc)
modifying it IS changing
yes I know, the answer is still the same
Okay sadge
Skins are downloaded by the client from Mojang not the server
Yeah they do it
Skins have 2 values
A texture and signature or smth
And thereβs tools, for example mineskin.org , to convert an image of a skin into those values
yes that website
Sounds like you have 2 classes with the same package and name?
Yes, same name. Is that my issue?
Yes
How can I set a custom head skin (i'm using the last api verion 1.19.4-R0.1-SNAPSHOT)... i don't don't understand how to create a PlayerTexture object (and if i want to use a base64 code for the skin for example). It's even possible in this version?
Yes
Ok, that a great starting point, how can i do this?
β€οΈ Tanks
Still the same error, I renamed com.mrnategeek.serverShop.Main to com.mrnategeek.serverShop.ServerShop_Main
You need to be using the same import
You canβt just magically cast it to a completely different class
if(getServer().getPluginManager().getPlugin("MGN_ServerShop") == null) { return false; }
this.shop = (ServerShop_Main) getServer().getPluginManager().getPlugin("MGN_ServerShop");
return true;
/*
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if(rsp == null) { return false; }
economy = rsp.getProvider(); return economy != null;
*/
}```
getServer().getConsoleSender().sendMessage(ChatColor.YELLOW + "+ " + getName() + " Disabled (Server Shop not found)");
getServer().getPluginManager().disablePlugin(this); return;
}
getServer().getConsoleSender().sendMessage("Creator: " + shop.creator);```
I tried everything
How can I get every mob within view of a player
Are you still getting a class cast exception?
Did you make the same class in both plugins
What you mean? com.mrnategeek.<pluginname>.<rootclass>, the pluginname and rootclass is the only thing different
Oh you are trying to cast the main of one plugin to the main of the other
Yeah you canβt do that
You have to cast it to the main of the plugin it belongs to
Can you show a example? I seeing examples of this being done by static and all that. I don't want to use that unless I have to
Well
If I had a plugin called MyPlugin with a main class of me MyPluginClass
I would do
MyPluginClass <name> = (MyPluginClass) Bukkit.getPluginManager().getPlugin(βMyPluginβ);
That is what I did. https://paste.md-5.net/osafolasic.http
that doesnt really show anything, do you have the other plugin as depend in plugin.yml
Maven
EntityDeathEvent, Entity#getKiller
Are you accidentally shading the one plugin into the other
(Killer is always a player)
what does the dependency look like
True
Thanks
Thanks, I was including it from the class folder. Did not think that was the issue but its working now. I can add my custom items to this shop
Any suggestions on how to get every mob within a player's views?
Depends on what you define as the players view
Any mob within 90 degrees of where a player is looking, up to 20 blocks away i guess
get all mobs within a 20 block range, then use the code I gave you (rewrite) to check if they are in the 90 degree arc of the getEyeLocation().getDirection()
i dont understand how to do the second part
just reverse teh last line so it checks the correct angle, and change teh first to use the eye location not the players facing
I have a feeling those angles shoudl be 45 and -45 currently, so invert that for in front 135 and -135
I believe they are 60 and -35 currently as the player doesn't face directly forwards.
or somethign close
The players body faces different from their head
Idk why they didnβt use that vector
no clue
I'll see what I can do but im prob gonna come back for questions lol
and sry i dont understand what u mean by this
if you look at teh code you can see it currently uses the players Location
instead use the players getEyeLocation
then the last line use 135 and -135
I've not tried it, doing it from memory as no code in front of me
why 135 and -135
MC uses 0 to 180 and 0 to -180 for direction
ah
and 180-45=135
also how do I access getEyeLocation
it's not a method of Player
Inb4 1.8
1.8 has getEyeLocation lmao
I've altered the method to look like this
/**
* Is the Player behind the Entity?
*
* @param player
* @param entity
* @param angle
*/
public boolean isBehind(Player player, Entity entity, int angle) {
Vector playerDir = player.getEyeLocation().getDirection();
Vector entityDir = entity.getLocation().getDirection();
double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(),
playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;
return (relativeAngle <= 180 - (angle / 2) && relativeAngle >= -135 + (angle / 2));
}
oh wait
180?
i just realized why am i modifying this
why are you adding in (angle / 2) ?
Idk man itβs 1.8, you could tell me it didnβt have items and Iβd believe you
:D
yeah nvm ima revert it
Idk why my brain decided to modify the old function
yeah ik
i just did a stupid
public boolean isFacing(Player player, Entity entity) {
Vector playerDir = player.getEyeLocation().getDirection();
Vector entityDir = entity.getLocation().getDirection();
double relativeAngle = (Math.atan2(playerDir.getX() * entityDir.getZ() - playerDir.getZ() * entityDir.getX(),
playerDir.getX() * entityDir.getX() + playerDir.getZ() * entityDir.getZ()) * 180) / Math.PI;
return (relativeAngle <= 135 && relativeAngle >= -135);
}
looks fine
so i'll just loop through player.getNearbyEntities(20, 20, 20)
then loop over whatever mobs are within 20 blocks
and run that check
so .forEach over it and add any that fit to a Set
i feel like i should also check to make sure theres no blocks in the way between the player and the entity
i could use a raycast for that right
if you want line of site too, raytrace after checking isFacing
yeah ima do that then
this is my current code without raytracing
player.getNearbyEntities(20, 5, 20).stream().forEach(nearbyEntity -> {
if (!(nearbyEntity instanceof Mob)) {
return;
}
Mob mob = (Mob) nearbyEntity;
if (!mob.equals(event.getEntity()) && isFacing(player, nearbyEntity)) {
mob.damage(event.getDamage(), player);
}
});
this is within an EntityDamagebyEntity event btw
if u couldnt tell goal is to make the attack damage all mobs in view
Is there a way to get the non-passable blocks a player would collide with if he was at a certain location? I know there's Player#collidesAt but that checks they're current location and that also doesn't give me the blocks that he would collide with
its quicker
oh
no point in doign a heavy raytrace if it's not inFront
use the player's bounding box
put that bounding box at the target location, and see what blocks are in the bounding box
im talking to someone else
take off the !
why are you comparign it to the entity from the event?
Because i don't want to damage the entity that got hit twice
you are going to have to explain what you are doign better
Let's say I punch a chicken
It should also punch 20 other chickens that are in my view
ah ok
but I don't want to do double damage to the chicken that i punched
thanks
so you want to check it IS the same type but not the same entity
doesn't need to be the same type
and is inFront
Just not the same entity
you just said 20 other chicken
i want to be able to punch a cow and hurt a player and a ghast too
ima do some debugging and figure out whats up
ok what
It just worked somehow idk
Maybe i forgot to reload
I always full stop/start for every test
it just takes too long tho
not that long
like 20 seconds
unless potato
patience then grasshopper
ive rarely encountered an issue where a reload caused issues compared to a restart tho
you haven't done enough coding then
^
Meh, you eventually get used to what does and doesnβt work through a reload
I also usually specifically design my plugins so that they would function on a reload
replacing teh jar is unreliable at best
there is some things no matter how you code it, will never be reload safe
yes ik
but i'd much rather make it as safe as possible and save time
also how do i get the vector of the player towards an entity
if that makes sense
targetlocation.toVector().subtract(playerlocation.toVector())
imagine a x/y graph
x = 1 and y = 1 would draw a line from 0,0 straight up at 45 degrees
so thats an arrow pointing in that direction
mhm
ohhh wait a min
thats a 3d vector
yes
and a unit vecotr teh sum of x,y and z totals 1
yeah im starting to remember
so from 0,0,0 its just an arrow pointing in whatever direction that values of x,y,z plotted on a graph point
a vector has no location as it's just a direction
what you are doing with the subtracting is reducing them to the smallest value (the difference between locations), so the target or player is at 0,0,0
the remainder of x,y,z is teh vector pointing to the target
mhm
you shoudl .normalize() to ensure it is a unit vector
while true, it can have an origin
if you don;t normalize you can vector.length to get the targets distance from the player
an actual 3f can;t have an origin
it has no world space
so with this information
does this look fine to you
Vector vectorTowardEntity = entity.getLocation().toVector().subtract(player.getLocation().toVector());
RayTraceResult rayTraceResult = player.getWorld().rayTraceBlocks(player.getLocation(), vectorTowardEntity, vectorTowardEntity.length());
yes
great
well it can, that is what position vectors are. they describe a point in space
not a 3f vector though
yes
a position in of itself is just another vector, but to get it, you need at minimum 2 vectors
a single vector isn't enough to know where in space it is at
so as I said not a 3f
no you are using a second 3f to represent teh origin
vector3fA - vector3fB = vector3fC C would be the position vector
but its still a vector
what you mean to say, is that 3f vectors don't store anything about their positions in themselves
in every mention I referenced a single 3f vector
A 3f vector has no origin.
factual
frostalf, elgar, you are both betrayers
definitely
you should watch macgyver instead of being here
possibly
(the old version, not the shitty new one)
its doing something pretty strange now
after I added the check it seems to be only hitting random mobs in view
I've watched them all when they were originally aired π
not all of them
this is generally called progress π
dude how old are you?
lol
you must be like 45+
great! anyway, what's the issue with okay1204's code?
no clue
yeah me neither
they are about the same age as @knotty shell
nvm it is working correctly, I just can't hit mobs who are standing behind like grass
no code = no help
oooh
Gotta code that swing through grass plugin
support folia when??
RayTrace with an ignore set of all the blocks you want to go through
could just ignore transparent blocks
but then it would also ignore like glass
Nope
Glass isnβt that kind of transparent
However it does ignore cobwebs
Found that out the hard way -_-
i thought by transparent it meant like
we don't care about the webs
Someone on my server got killed through cobwebs and then there was a big accusation of hacking and blah blah
actually funny you found out about the webs this way
And then I had to fix it
Stupid cobwebs
just a tiny commit
you probably spawned a small cult of conspiracy theorists that are now trying to prove how the staff are covering up for the dude hacking
isPassable is what I used
try using Material#isSolid
Covers any blocks that you can walk through
