#help-development
1 messages Ā· Page 654 of 1
does that not take the axis into account?
I mean that'd also break blocks behind you
proabably every line of code u wrote was already written at least once before
so aren't we all stealing
it's always just +-1
it just makes a 3x3 doesnt care where you are pretty much
yeah
if you want to break ur self, in front or behind or wherever
I mean everyone should be able to figure this one out themselves within 3 seconds
like
no, I once wrote a java class that used so many generics, I believe if the founders of java generics saw my code they'd revert the changes
probably been written before
maybe not same usecase
how many generics can one use in a class im curious now
what could u possibly have in a class that would need it to have more than like 5
there were like 9 generics and some of the types after initialization also used generics
I don't even remember why because that code is long gone thankfully
at most 2.1 billion
max_integer
well Class#getGenericTypes() or whatever returns an array
getTypeParameters() *
also there was once upon a time this code in my codebase
returns a TypeVariable<Class<T>>[]
WHAT IS THAT
please do not ask.
please answer
I refuse
Ok
looks like an example for MorePersistentDataTypes
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
lmao
well it doesn't have pairs
I really do not remember why this abomination used to exist
you'd have to create your own datatype for pairs
but this function also had like 300 lines iirc
If It Wasnt Because Of This, My Server Wouldnt Be Alive RN
šµāš«
how can I get block data for like an iron golem spawner?
what are u tring to do
I am sending a packet and it requires BlockData but I can't figure out how to set the mob type of a spawner
nvm
sendBlockUpdate(Location, TileState)
on Player
CreatureSpawner spawner = (CreatureSpawner) Bukkit.createBlockData(Material.SPAWNER).createBlockState();
spawner.setSpawnedType(EntityType.ALLAY);
Player player = ...;
player.sendBlockUpdate(block.getLocation(), spawner);
sth like this
You may need to send blockdata first
someone know why ide wont start?
oh hi bogdan
noob
if something's not working in intellij, the problem is usually the MCDev plugin
I updated and work now
š
Does it even still get updates aside from compatibility shit?
I remember like half a year ago I added an issue about a feature that was accidentally removed
He was like "yes I forgot to readd it after the UI rewrite" and now nobody knows if it comes back lol
writed this function:
public static List<Block> getNearbyBlocks(Location loc, int r){
List<Block> nearbyBlocks = new ArrayList<>();
int minX = loc.getBlockX() - r;
int minY = loc.getBlockY() - r;
int minZ = loc.getBlockZ() - r;
int maxX = loc.getBlockX() + r;
int maxY = loc.getBlockY() + r;
int maxZ = loc.getBlockZ() + r;
for(int x = minX; x <= maxX;x++){
for(int y = minY; y <= maxY;y++){
for(int z = minZ; z <= maxZ;z++){
nearbyBlocks.add(loc.getWorld().getBlockAt(x,y,z));
}
}
}
return nearbyBlocks;
}```
But with this for i **cant** go (means it or output one block in console or output nothing) through all blocks from list (list is not null)
```java
@EventHandler
public void onFurnaceExplosionEvent(ExplosionPrimeEvent e){
for(Block b: Utils.getNearbyBlocks(e.getEntity().getLocation(), Math.round(e.getRadius()))){
logger.warning("ExplosionPrimeEvent-"+b.getType());
if(!furnaceMaterials.contains(b.getType())) return;
removeFurnace(b.getLocation());
}
}```
debug the radius
Anyone been able to make a good decoy entity?
Like an invisible, uninteractable Cat/Ocelot to scare creepers away or a Wolf to scare Skeletons.
I need it to be attached (or follow) to the player in some way.
I have code that gets very close, but the entity will still be in the way and block hits and block interactions.
Is there a way for me to like, spawn an Item entity, attach it as a passenger, then trick the server into thinking it's a cat with packets or something?
Does a cat actually block interaction when itās on your head?
Yes.
When attached as a passenger, it gets in the way from you doing anything.
Can't interact or mine or punch
You can offset it by stacking it on something else and then stacking that on the player
I could make a tower of Item entities all with nested passangers, but if the player needs to mine a block above their head it still will be in the way
Or you can just constantly tp it to the players location + x
Or you could get messy with NMS and mess with creeper ai so they fear players
I'm very happy having somehow not needed nms in my plugin yet.
I'll see what I can do with the bukkit api, then if the nms way is straightforward I'll dive in š„²
I'll take a look
i love frankensteining mobs by adding pathfinders from other mobs
Giving me Blightfall flashbacks of the Thaumcraft tainted pigs xD
Wait until I teach them to shoot arrows
Very talented piggies for sure
You can also use the parrots goal to make them fly while they attack you. That's what I did when playing around with pathfindergoals
Lul
They also fly over lava and fire to then kill you. It's fun
I'm trying to make a command that would set a sort of timed event, as in one minute to react to the event. How do I set up a synchronous timer
?scheduling
How I detect uhm slim mc skins
technoblade's son
check the texture out for blank texture
skins are downloadable
what does that mean
well skins are pictures
you only need to check within a certain size the squares missing color
so a blank texture where the arm area is
or i check if there is the black hex
mc gives
no wait that would cause problems
you won't use the api here except for obtaining the link to the skin to download
once you have the skin picture, you will use the specs required for skins
then its checking the appropriate areas for missing color
or it has transparency
since it will be a png
from the byte information of the png
png has a spec itself
that tells you how each pixel is stored and its information
so what spec would i need to check
png and mc skins
You can also just use the PlayerProfile api
you cant just check if its transparent
cant
i am checking geysermc skins
too
you gotta go through the pixels
and geysermcs skins arent in their api
player profile api will only let them get the link to download the skin
oh guess it has the slim thing
not sure if that solves their problem or not
but I suppose that works
cant use a spigtmc apii ether since what im doing is the backend of the plugin
you probably have to download the skin as an image and go through that pixels then
so how would going through the pixels work then
not download since i already have that part covred
what do you mean?
it sounds like you are asking in a way you want us to do the work for you
no
i was just asking if i need to search the main area of the skin
i have a idea how
I already told you png has a file specification in regards to how information with pixels are stored
you need to use MC skin specification so you know the size and areas you need to constrain your search
i think i did it
My freind bought this plugin and because we are both new to this stuff, can anyone help me decipher what the develope was trying to say by this?
Just like before, make sure you have a development environment set up with the Spigot API and the necessary dependencies. Create a new Maven or Gradle project, create a new Java class named KillRewardPlugin in your chosen package, and replace the package name accordingly.
Ping or DM me if you can help
"decipher" - that are straight up simple instructions
You bought a plugin
no
Why do you need to modify the code?
that deveoper just sent it as text, and I don't know how to get it to work
tell him that
ā¦
communication is the key
I don't have direct communication with the developer
I didn't it was my freind who asked me to get it to work
š
Imagine you buy a burger from McDonaldās and they give you a small garden and a live cow
All Iām saying is if Iām paying for it I expect a compiled jar
(Or burger)
wait the dev just sent the text of one class
and then told you to add it to a class and compile it yourself?
that aint a dev thats someone using chatgpt
i bet theres no actual dev in this situation
i dont think theres a single actual human dev who would code it, probably with an ide, test it, then instead of sending a compiled plugin or even the source at least they just send unhelpful instructions of how to setup the project to build it yourself
Why the fuck is luckperms' bukkit plugin just a jar in a jar and a fancy classloader
bro?
because it needs to add the dependencies to the classpath
it just bootstraps everything
Elaborate
the plugin classloader does not allow you to add elements to the classpath (the downloaded dependencies)
so it uses its own classloader to do it
Yeah but the dependency manager system also has a separate classloader to load dependencies
Maybe I should learn about classloaders
I really want to do something similar but this is breaking my brain
those are a bit special, it's for isolated dependencies that don't use the plugin/server classloader as parent
you'll see a ClasspathAppender or something, that's an interface implemented by the bootstrap classloader to add jars to the classpath, and that's where the bulk of the dependencies end up in
isnt there a thing built into spigot for downloading maven repo dependencies at runtime
or do i misremember
There is but I'm not limited to spigot
yeah i was just generally curious
Have you specified where to output the jar file?
No worries, weāve all been there! When creating a plugin, you need to specify where the plugin is sent
What does it tell you?
The plugin file
I think they're running BuildTools
java -jar BuildTools.jar --rev 1.20.1
OR
java -jar BuildTools.jar --rev <VERSION YOU WANT> --output-dir /path/you/want/to/use
You could also try the GUI that's being worked on if you wanted to. #1117702470139904020 message
I don't do DMs from random people.
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
Usage: !verify <forums username>
Rate limited. Please try again later.
Oof. That's a first for me.
Unrelated, but what seems like a good way to detect a player opening a survival inventory?
BuildTools is not the spigot server jar.
It is the tool used to create the spigot jar.
Spigot has to be compiled manually because of legal reasons.
you should send them the GUI
I did.
If you use Windows, you download it and double click the jar file.
What is āa survival inventoryā
Like, the players inventory?
Because thatās client side
in XML what's the difference between something like this
<item>
<name>""</name>
</item>
and something like this
<item name=""></item>
One's inline and one is treated as a subsection.
does whether its inline or subsection matter once its parsed or are they both treated similarly?
I don't think it matters as long as it's parsed correctly. I think that's just a preference.
Follow the instructions. :3
Java 17?
Latest from where? Java 8 is the most common download.
get java from one of the links in the GUI that popped up
Use the download links provided in that error modal.
I'd reccomend adoptium personally
?java17
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
Yeah kinda bad phrasing. Iām trying to detect when a player accesses their own inventory. I know you can do the crappy way and repeatedly get the playerās inventory and type using a runnable, but isnāt there a more efficient way?
Looks like the instructions need to be rewriten to be clearer. š
Thank god I made it in HTML.
FInna add an inline youtube video, I stg.
haha lol
this is a good test run for the GUI to see how intuitive it is for newer users though
All those years of training at the academy. WASTED.
Now let's watch how many will skip reading and just ask here
Not that I know of
probably a lot, but now we can be lazy and say read what the GUI says
Whatās a read
dies
go through all the links in the GUI and specify to download the .msi or .exe or whatever it is
Can you not link directly to the msi
You can't really do that either
https://paste.md-5.net/qagiyuwene.xml thoughts on this format anyone? typo with hgroup its supposed to be vgroup
A private message has been sent to your SpigotMC.org account for verification!
Think that one line of text should solve the issue?
What about mac and linux users
if a linux user can't figure out how to install a java jdk they have bigger issues than BuildTools
but I suppose for mac
I'm pretty confident linux users would be able to figure out that these instructions are primarily for windows users.
Considering the line above says that downloads are available for all operating systems.
maybe for sake of it include the mac one though
What's their file format?
dmg I belive
whatever it is, it's something stupid.
Looks like they also have .pkg
Oh well. At least it all fits on one line.
you could do something like this in the Gui
Windows (.exe / .msi)
Mac (.dmg / .pkg)
Linux (.deb / .rpm)```
this would cover a vast majority of people
Specify which file for which platform
Hmm, lets see if I can shrink some this.
Time to find out if swing supports flexbox/gap.
https://paste.md-5.net/qagiyuwene.xml first review this xml layout for my inventories xD
You making this for readability/ease of use? Or are you making this for custom data parsing?
developer use
internally
material > item-type
item-type is coming soon
probably within the next update
What's it supposed to represent?
ItemType is the new Material for Items then there is BlockType for blocks
spigot experimental branch go brrrr
Oh
Man, that transition is gonna be wild isn't it.
I haven't even looked at it yet.
its so much better and makes so much more sense
Right I forgot about that
Is your vgroup tag supposed to be like a submenu of sorts?
it represents a virtical group
e.g.
1
2
3
vgroup's would cover the entire column of the inventory they are assigned too
Those would translate to slots:
0
9
18
right?
depends on the inventory but yeah
for example in droppers it would be different
What happens if you have an item listed later down in your xml that conflicts with the slot?
Does it just get overriden?
how do I save an arraylist of textdisplays
haven't thuoght about what i want to take priority vgroup or explicitly defined items or error
Windows vps??
I'm thinking about that right now. I feel like it'd be appropriate to error why would you explcitally define 2 items that override eachother
DDos Incoming.
I was joking :d
idk what do you think. about erroring vs overriding or something
It's 4am
I kinda want feedback I want to design this well
Try using localhost
@torn badge This is a good tutorial series for plugin development https://youtube.com/playlist?list=PLDhiRTZ_vnoUvdrkTnaWP_hPmbj2JfPAF
No need
OVH handles that
Need to let Java access internet through Windows firewall though
Erroring would keep your files clean, but be annoying to fix when you go to load it up and only find out at runtime.
Overriding solves that issue, but can lead to file clutter and confusion if you aren't on top of writing.
I mean, overall the format is fine. That one line item creation seems really nice.
What does a one line item creation look like with a custom name?
What seems like a good way to access the inventory of a shulker box itemstack?
idk if you can oneliner with a name yet I have to figure out how the XML parser works
I haven't even started coding yet
Would be crazy if your parser could recognize which slots are being used more than once and warn you.
I mean with a name right now you'd have to do
<item item-type="DIRT" row="1" column="2">
<name>The Name</name>
</item>```
but that's subject to change if you can just shove it up in the properties and it be fine
that's what i plan to do
Oh, how do you plan on doing names with colors?
Ahh, I for some reason thought that was a link because I'm used to the markdown format.
You'd use the BlockStateMeta
I want to make a once and for all inventory framework for myself I keep making them they're getting better, but I wanna sit down and spend a couple months making a good one
Not MiniMessage :sadge:
MiniMessage is rammed into adventure
Why use adventure when spigot will soon be natively supporting BungeeChat on everything
I also already have the NMS code to add bungeechat to ItemStack's and Inventories
Ffs, it doesn't support it properly.
I mean maybe I could justify adventure pre mappings, but now I can just copy paste my NMS between versions and change 1 number in the cratbukkit package name
If I have to use floats, I'm just end it all right here right now.
also not to mention BungeeChat is getting rid of that annoying ass array
which is my only gripe about it since day 1 of using it
āOn everythingā doesnāt include everything.
Nothing on any event
true forgot about events
but The BukkitAdapter for Adventure can't do that anyways
Well thatās why you use a platform that works with adventure natively š
I'd prefer not to use paper api
I like my buggy crashy minecraft :P paper doesn't let that happen
Paper module
Gradle isnt loading my dependencies for spigot, it works fine for gson but spigot wont load. (It worked before, but when i switched to linux it broke)
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT"
implementation 'com.google.code.gson:gson:2.10.1'
}```
It just doesnt load the External library for spigot
more work than its worth in a lot of cases
if your on intellij try invalidating caches or just reloading your project
how do i invalidate the said caches? Ive reloaded the project many times
File > Invalidate Caches
intelliJ is the only IDE that I know of, that has these unique problems with it XD
I know
Its a great IDE, but there's so many weird quirks
like when I used vsc didn't have any of these weird issues, but now I finding myself invalidating caches atleast once or twice a day
seems to me they should remove this so called cache thing
It worked! š
as it doesn't appear to work for its intended purpose
I haven't invalidated caches in over a year now
#help-development message
Anyone
Don't think that is allowed.
Don't think so
It can't break if you don't use it
also my whole thing with paper is if I want something that's not there I'll PR it and wait. I have a lot of patience because I don't run servers I have nothing banking on these features being released other than the enjoyment of working on a project. I'm kinda in a situation with a lot of my projects where I just don't care and I'm not in a rush for specific things
If you're running a server I can see just wanting that stuff if there's someone who provides it
its economically smart because it allows you to proceed with your server
I just like fucking around with server code and finding out how internals work and such its long fascinated me
except some people who run servers tend to go to the extremes of expectations
until you learn its just one over glorified while loop that runs everything
I've made game loops before I know that much
everything is a while loop. I find more interesting the packets and such
networking etc
Omfg. Swing only supports HTML4 and CSS1.
I don't want to live anymore.
well I guess we are going to lose shadow
he was a good part of the GUI team guess I'll have to PR it now
lol
I just wanted to put two divs next to each other. Guess that's too much to ask of CSS1
didn't realize when I made a stash account you could use a username xD I woulda done that
mr nothixal
I should get a prize for this
PR #1234
okay this one is funny out of bounds horses crashing the server xD
Yooo, I forgot about that method of making holograms.
this is how HoloAPI worked
Is it smart (in terms of efficiency) to create a method, for a quite simple math equasion, that is being used often, or should i just leave it in the method that it is used in?
sigh Guess it's just gonna have to scroll to the top instead.
If I save an entities uniqueId will it also save their properties?
No, you have to save those manually.
Fffffffuuuuuuuccccckkkkkkkkk
Use paper!
what does java reflection mean and does it have something to do with creating instances of classes? (should I avoid it? I heard that reflection is bad for perfomance)
Java's reflections system is a native api for playing with classes and their fields and methods natively
Let's say you have something like
public class MyClass {
private int number = 5;
public int getNumber() {
return number;
}
}
You can access the number field and make it accessible
MyClass instance = ...;
Field field = MyClass.class.getDeclaredField("number");
field.setAccessible(true);
field.set(instance, 10);
You can also get constructors and invoke them in code
It's mostly used when dealing with hacky stuff
Like accessing private fields or injecting data
Or annotations
I heard that reflection is bad for perfomance
depends. It can be just as fast as normal code if you use the correct APIs and set it up correctly
Yeah so fields can be cached
Getting a field can be expensive but once you have it, it's quite fast
well anything, calling methods, getting fields, setting fields, anything can be jsut as fast
If you use the java.lang.invoke api with MethodHandles and those method handles are created and stored in static final fields, the is pretty much no difference between that and just calling the method, getting the field, etc. normally.
Reflections are also used when dealing with nms because you aren't doing imports directly
Okay, so that does mean my code isnt doomed perfomance-wise for using normal instances of classes to acces their methods?
if you can use objects normally, just do that.
So accesing methods from another class isnt slower than implemneting it directly into the method?
Thank you, for you brief explanation of Java reflection :)
Thank you too
Nothing beats an object getter in terms of performance
Avoid reflections and use it if you get desperate :p
no
in fact, an overly large class can be slower then if it were split up
MethodHandle doesn't beat it, but its just as fast if you store the MethodHandle in a static final field
gotta be a static final field tho, can't create them dynamically
There's still the overhead of having to fetch the method
I dont really understand what you guys are talking about
well you asked
there's just different reflection APIs in java, the classic reflection and MethodHandle
I only understood this part
now you are getting answers that are way above your level of understanding š
Yeah maybe you should understand the questions you're asking about
MethodHandle?
I use this to get methods Main.getinstance.getclass. getmethod?
Is this bad?
What's the point if you can make a getter instead?
you shouldn't be using any reflection to get something in your own class like that
just add a method to get what you want
Reflections are made to access classes you don't have control over
(or to parse annotations)
or in the rare circumstance, the micro optimization to bypass some thing
so this = bad
Pretty much
In terms of clean Code or Performance?
bypass that defensive copy
both
So i shiuld be using getters?
Yeah
It's basic java
Don't try to be smarter than you are, just stick to the traditional methods and you'll go far
There's a reason you don't see reflections for every getter in enterprise code
Im not doing anything, this is the only method i knew to get methods from other classes
You still need an instance to invoke it
And if you have an instance and control over the class why not make a getter in the firs tplace
I dont really ever used getters because i got this
Yeah pretty much
If I use getters why is my getter Bad š
Because what you think is a getter is in reality an overcomplicated Field#get(instance) method
But yeah sticking with basics though is generally sufficient for most things and is adequate enough
without resorting to some weird method of doing things
you should only change how you are doing something if only its a problem identified from testing and profiling
I mean its not a problem i was just worried that it is ineffiecnt
well it is or can be because it isn't providing you with any advantage doing it that way then from the normal way
premature optimization moment
We should just switch to c++, java's too unoptimal
Still waiting for the day we have dedicated minecraft server hardware
lol, I wish it would be so easy to have some people switch to C++ just to show them the beauty of java in how it optimizes your stuff quite well
because in C++ its left to you to optimize but it also won't tell you where its not optimal either
if it works, C++ is happy with it as much as you are
TBH profiling in java can get pretty cumbersome
I paid 100$ for a PERSONAL 1 year license for yourkit
all the enterprise stuff is in the thousands
yeah but like its so much better then trying to profile a native application though
Guys is there a Guide on how i can use getters properly?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Pls no
private final int whatever = 123;
public int getWhatever() {
return whatever;
}
bam
But, for collections, make sure to return an immutable version or a defensive copy
This is what im doing, but just in the main class??
In every class
Main or not
It's part of the Encapsulation principle
Where you never expose internal values directly
literally it is impossible to not use a getter in Java
But instead make the values private and expose get/set methods as you wish
You end up having better control, such as returning a copy or only allowing non-null values to be set
And also get to follow basic code principles (yipee!)
so at the most basic level, a getter is just a method that gets something, whether it be a value or an object or instance etc.
In the most basic terms, in java everything is a method, unless it's a field or a constructor
The reason you see guides explain this a bit differently is because typically people have an issue in regards to using getters for collections or similar where you are not using such methods in a way that is pointless
I dont think my getter is that bad its just that i can acces it from every class and dont need to get it everytime i want to use it
This is a method:
public/private/protected <Insert Return Type Here> methodName(Param1Type param1Name ...) {
// implementation
return /*<Return type, or nothing if it's void>*/;
}
What is commonly referred to as a "getter" is just a method that returns a field directly
the purpose of your getter isn't what was the issue it seems, it was how you were implementing it
public int doWhatever(String input) {
return input.length();
}
Is a method, of public accessibility, with the return type int, named doWhatever, where the first parameter is of String type and called input
So we must return an integer
Ik what methods are
So you understand that a basic getter is just a method that returns a field's value
well just know what you are asking or having some confusion over is basic java stuff
Yes
I have a getter in a class
Alright
Can we also agree that it's the most basic form of method, as it holds no logic other than just returning a value
Yes i have somthing like this
I understand the concept but i dont know what wrong about Main.getinstance.getclass.getmethodfromotherclass
Main.getinstance.getclass.getmethodfromotherclass if the method that you really wanted is in a different class, then why are you not calling the method from that class directly? Why go through the main class?
You are correct, but i got tired after doing this over and over again from class to class, so that i just get it from mainclass
This breaks OOP fundamentals which is what Java is primarily for. This is more inline with how functional programming is.
OOP?
Object Oriented Programming
It breaks the OOP, but my code doesnt break, whats the problem with it?
Stick to standards
I mean yeah the code works, just it isn't appropriate or correct is all lol. Java excels at doing Object oriented stuff, its what it is primarily designed to do. This isn't the say that using functional programming is inherently slower, unoptimal or whatever else but it could be depending on what you are doing and more easily. Java does a lot better if you stick with object oriented programming, even more so when it comes to stack traces or errors. If you call a method like you are and it returns an NPE, the stack trace is going to contain unnecessary entry/exit points of the overall execution that resulted in the NPE. There is many other reasons such as standards as well in why the way you are doing it isn't correct.
why is it incorrect, if it isnt slower or unoptimal? And it works
Welcome to code architecture
I know the standards
No you don't
No I know (bacause of) the standards
The standards aren't made as a "because I said so"
What?
They serve a purpose
Their goal is to make you write code that's more reusable, easier to test and enforces ownership
When writing a class think "Is this function supposed to be the duty of this class?", will help you avoid writing crazy functions for data objects that should belong elsewhere etc
Im not importing all of the classes into one, only the ones i need
because it uses reflection and yes it can end up being more slower or unoptimal. By how much? Well it really depends on the code being called in that way. Granted for the most part you probably wouldn't notice the difference, but do note the JVM has a more difficult time optimizing reflection, then if you were to just stick with the standard way of doing things.
If you were to port your entire project to bungeecord, how big of a percentage would need to be re-done? That's a basic example on code re-usability
I never used bungeecord
however it seems pointless though that you keep asking why it is wrong when it is clear your reasoning is because you want to be lazy and ignoring anything else in regards to what is being explained. That is fine, however that isn't justification in whether it is the correct or wrong way of doing things, just you don't want to go through the appropriate coding etiquettes.
I would change it, but only if there is evidence that this is perfomance wise worse
Maybe you're too caught up in performance to actually care about code quality
why is there two exclamation point before the UUID I saved in the config file
it's like !!(entity's UUID)
so you mean before?
can you show the config and everything?
wait do I have to convert the UUID into a string before saving them?
cuz it shows "java.util.UUID (entity's UUID)"
yes
what it is doing is saving it as a Java object
but before I assumed that I wanted to see what it looked like first š
Yeah I usually just write a basic codec type thing
I'm not a huge fan of bukkitserializable's yml format
just like what was stated, there is more to programming then just performance. It has already been explained to you how it could be less performant as well and that you may not really notice the difference. How you choose to program is up to you, but when you ask however in why it is wrong and others here explain to you why it is. You shouldn't dismiss the explainations all because you don't notice a performance difference. I am not going to go out of my way to create a test application to show you the difference because you want evidence. In large part, the majority here who help are not going to lead you astray or purposely tell you false information and quite a lot of us are very experienced in the programming field.
I should write a config codec system
You are probably right, i will change it.
easy
whats goin on
nuke?
Is there anyway to detect if the player closes the inventory by pressing E?
Guys. I need an encoder for payment. For a permanent job
InventoryCloseEvent gets triggered by the closeinventory method
You want to find out if it was closed using "e" and not in general?
Cause I don't think there is
yeah
that sucks
You could create a situation where the player could only close the inventory by themselve and not from outside sources.
But they could always just close/crasg the game to close it
but I'm the one forcefully closing the inventory
Isn't that what you want to check for? That the player closes it?
oh wait lemme rephrase that
So basically when they press confirm, the inventory closes so that they can type the hologram's text in chat
wait nvm
i'm just gonna think of another solution
There is a packet server bound u could check for
?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/
Altho things like world change, logout etc do close inventories as well right?
Yeah but fixed radius sucks
No clue, i never use it
What is an āencoder for paymentā?
im gonna guess a paid coder
this is the first time I'm using &= I think
wtf for
i mean i kinda need to, cuz i aint going to search for all the mixin-bytecode manually
and mcdev provides me with all the autocompletion
to return false if any of those commands returns false
so it should stuff run them, regardless if any fail?
yeah I've heard people say it's useful for mods. I only do plugins for that, this plugin is completely pointless and useless and only causes trouble
i dont really do plugins anymore lol, so idk
it parses a configurable list of commands, like this. And then it executes all of them. And then it returns true if ALL of those commands returned true, otherwise false
but this is kinda self-explaining lol
When I use this, whenever I get the output item, the lore I created doesn't show up on the outputted item:
for(Material acceptedItem:acceptedItems) {
ItemStack newTool = new ItemStack(acceptedItem, 1);
ItemMeta newToolMeta = newTool.getItemMeta();
newToolMeta.setLore(List.of(ChatColor.GOLD + "Test"));
newTool.setItemMeta(newToolMeta);
NamespacedKey recipeKey = new NamespacedKey(this, "test" + acceptedItem.toString());
RecipeChoice trimChoice = new RecipeChoice.MaterialChoice(Material.AIR);
RecipeChoice baseChoice = new RecipeChoice.MaterialChoice(acceptedItem);
RecipeChoice additionChoice = new RecipeChoice.ExactChoice(createTestItem());
SmithingTransformRecipe smithingRecipe = new SmithingTransformRecipe(recipeKey, newTool, trimChoice, baseChoice, additionChoice);
Bukkit.getServer().addRecipe(smithingRecipe);
}
Does anyone know why this is happening? Like does the lore get removed because of the way the smithing table works?
easy as heck
Hello https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockExplodeEvent.html
this event is called when a block such as the tnt explodes? and the list contains all the blocks that the tnt exploded?
nice
and it works for all explosions? (creeper, tnt etc...)?
is a creeper a block? ._.
NO
so will it work? :=
entity explosion?
there's probably an EntityExplosionEvent too
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
and that's why blockexplode can be activated (tnt is an entity)
? what is your problem exactly
I need to know when a certain block disappears whatever the event (explosion, blockbreak event) etc...
yes, let's say that if the block is a gold block, I need to know it in order to act accordingly (I record it in a recovery inventory).
then you listen to BlockBreakEvent, EntityExplodeEvent, BlockExplodeEvent, BlockPlaceEvent, BlockBurnEvent, BlockPistonExtendEvent, BlockPistonRetractEvent, BlockFadeEvent, StructureGrowEvent, BlockFertilizeEvent, and probably some others too
LETS GOO I FINALLY FINISHED MY FIRST PLUGIN
oh well for gold blocks you won't need some of those
problem there is i doubt that all of them contain the "destroyed" blocks
these are all the events I listen to to check basically all block changes https://github.com/JEFF-Media-GbR/CustomBlockData/blob/master/src/main/java/com/jeff_media/customblockdata/BlockDataListener.java
okay
well if not then this is a high risk
Yeah they should review every uplugin
My friend's server got backdoored
Paid ones guaranteed. Some suspicious free ones (or reports obviously), too
Wouldn't say every single one. At least not by a human
Yes, don't make a bot review a resource
I check every resource I download for the first time
As y'all saw tomorrow
Yesterday
Curseforge removed and "detected" a virus on my plugin, which is on BBB, PolyMart and of course, spigotmc
It's better to leave virus checking yo an human
I don't think the same šæ
A lot of websites put ads too
That's not curseforge problem, the problem is that, it allows you to pay to stop viewing ads
Bro thinks he's an android game
š
? isn't that what goes into the rewards program which you get money from
It's not much inside bukkit world
Thanks to Fracturiser and MMPA (Minecraft malware prevention alliance) we will get a lot of such bullshit for months to come.
It is possible to use villager trade gui on spigot plugin ?
Yep
hey geol is there a way to flag my shit for automatic review? There's a few ways i think i might be able to get perms or backdoors
Ok
I don't quite understand you
Why would they be disabled in the first place?
wasnt it mentioned above it's not automatically done for free resources?
also I'd like to see the results, to see if and what it found
Also, spigot does its own kind of malware analysis that to my knowledge has little chances of false positives
Or rather said the resource is reviewed manually sometime after an upload
The automatic malware scanning process is intrinsic to CF/Devbukkit
ah makes sense
though wouldnt that mean if someone hides something in a super large project it might be undetected for months?
that
wouldnt work
Alr
depends what you mean
like the event should fire
but it's not like display entities have their default behaviour
thats optional
Aight ty
isnt it?
I need to remove furnace from some list which contains locations of different furnances.
here is func:java public static List<Block> getNearbyBlocks(Location loc, int r){ List<Block> nearbyBlocks = new ArrayList<>(); int minX = loc.getBlockX() - r; int minY = loc.getBlockY() - r; int minZ = loc.getBlockZ() - r; int maxX = loc.getBlockX() + r; int maxY = loc.getBlockY() + r; int maxZ = loc.getBlockZ() + r; for(int x = minX; x <= maxX;x++){ for(int y = minY; y <= maxY;y++){ for(int z = minZ; z <= maxZ;z++){ nearbyBlocks.add(loc.getWorld().getBlockAt(x,y,z)); } } } return nearbyBlocks; }
here is my event:java @EventHandler public void onFurnaceExplosionEvent(ExplosionPrimeEvent e){ logger.log(Level.INFO, () -> "ExplosionPrimeEvent-"+e.getRadius()); for(Block b: Utils.getNearbyBlocks(e.getEntity().getLocation(), Math.round(e.getRadius()))){ logger.warning("ExplosionPrimeEvent-"+b.getType()); if(!furnaceMaterials.contains(b.getType())) return; removeFurnace(b.getLocation()); } }
what i get in console:
[SmeltingParticles] ExplosionPrimeEvent-4.0
[SmeltingParticles] ExplosionPrimeEvent-STONE```
I dont know why, i can't get through the entire list which return `.getNearbyblocks`. List in not null and contains many different `CraftBlock`'s
thats simple
oh shit
i need to create variable?
no
no
ohhh
either replace return with continue
if(!furnaceMaterials.contains(b.getType())) continue;
Help the depressed loop :(
or do if(material == Material.FURNACE) b.remove
do freejavalessons for him
I remember when I did return my IDE yelled at me
my ide only yells at me for
- typos
- unused
- this aint compiling mate
Lol
how do I know if there is a certain plugin on the server?
no, I mean in code
I don't care what are installed when I'm playing
Bukkit.getPluginManager().getPlugins
Oh certain plugin, I read get all plugins
There is PluginManager#isPluginEnabled
It have overload for string (name) and plugin instance
what if my loads before the other plugin?
Hello, kinda super general Java question and also kinda embaressing tbh:
This is in Bukkit.class of the Spigot/Bukkit Library:
public static void reload() {
server.reload();
CustomTimingsHandler.reload();
}
You want to check if plugin is present in your onEnable?
How do I find out what server.reload() does while server is just an Interface? Am I stupid?
yeah, and if so, disable my plugin.
?stash and look for CraftServer, that is implementation of Server interface
import spigot from build tools and look into CraftServer
or atleast log a thing
what the heck is that, codeblock where
Then you would have to add plugin.yml entry, it's either depends or loadAfter I can't remember. To ensure your plugins enables after
``` still exists
It's in CraftBukkit somewhere, I suppose?
if there is craftbukkit, is there craftspigot?
lol didnt work for me but i found it
If ur not sure about impl name, if I want to search for Server interface I usually just search for "implements Server"
If I basically want to change the messages the server sends for reloading, Do I just override the command "reload" and put Bukkit.reload() in there?
Hey I have a rather complicated request, do you know how to make a java code or when the player connects to the server. The plugin connects to this link: https://www.xdorgluckuniverse.net/musername/xdorgluck (if the player who just connected is called xdorgluck), and checks if the username appears on the page ?
The plugin will then send information to the Minecraft server that the user is premium
on my website?
Yeah
How can I do ?
Scraping the page is a pain
Asking how to make rest api is kinda vague question
Yeah + you have a million frameworks for that
Spring etc etc
@stuck imp or you can at least make a blank .txt file
That will be easier to work with
I'm on wix
And I use Velo developer Mod
// backend function in Velo
import wixData from 'wix-data';
export function getUserData(username) {
return wixData.query("MUsername") // Use your collection ID here
.eq("musernameclass", username) // Use your field key here
.find()
.then( (results) => {
if(results.items.length > 0) {
return results.items[0];
}
return null;
} )
.catch( (err) => {
console.log(err);
} );
}
I use this to retrieve the username:
š
?
Wix
hey
i need help installing my servers
server*
i can that
i ran that*
it asks me the versoin
then java
and i enter then it says done the next seconda and a folder is created with buildtools.jar but not spigot 1.18.1 ;-;
can I somehow prevent the death message from saying what weapon a person was killed with? I don't want people to know shit about the cool sword from my plugin
You can customize the Deathmessage to your liking by adding an EventListener for PlayerDeathEvent.
@EventHandler
public void onDeath(PlayerDeathEvent event) {
Player player = event.getEntity().getPlayer();
event.setDeathMessage(player + " died.");
}
Something along those lines
That would be absolutely no information at all
Weird question but what happens if you create a new Player() does a model appear somewhere or something? Just something I was wondering about
I saw that some servers have this font is it some spigot feature? Are ordinary characters converted to unicode and where could I find such a font
texture pack
or unicode
i think theres like a link somewhere in this chat
to the font
com.devotedmc.ExilePearl.core.ExilePearlCore is not abstract and does not override abstract method getDefaultBiomeProvider(java.lang.String,java.lang.String) in org.bukkit.plugin.Plugin```
any reason this keeps happening
ExilePearlCore does not override method getDefaultBiomeProvider
is this your plugin
also why are you overriding plugin
shouldnt it be javaplugin
wasn't that like called mini text or something
hi, i am trying to teleport player into the boat, but it doesn't work
Boat b1 = (Boat) world.spawnEntity(l1, EntityType.BOAT);
b1.setBoatType(Boat.Type.OAK);
b1.addPassenger(p1);
i'm getting no error
what am i doing wrong
have you added a check if your code actually runs?
happens to me way more often than it should
how do i get an inventory that i saved in a yml file beforehand?
it's something along the lines of config.get...(path) or sum, but idk exactly how
idk how you saved it
I used a Hashmap
of what
public void saveVault(int number, Inventory inventory) {
LinkedHashMap<String, Inventory> inventoryHashMap = new LinkedHashMap<>();
if (!cfg.contains("Vault " + number)) {
inventoryHashMap.put("inventory", inventory);
cfg.set("Vault " + number, inventoryHashMap);
try {
cfg.save(file);
} catch (Exception ex) {
ex.printStackTrace();
Bukkit.broadcastMessage("Saved.");
}
}
}
what does the file look like
true
nothing
maybe wait a tick or something
i tried it
same output
even teleporting close to the boat
I don't have the file rn bc i'm not at my usual pc and i only have the project due to github.
The file looks something like this:
Vault 0:
- inventory:
- item
- item
...
iirc
oh actually @opal saffron it might be that players are special in some way, lmc
huh nope
yea im out of ideas
me too, thats why i'm writng here
yeah
the true return means spigot thinks it put teh player in the boat
idk why it didnt
probably get it using like get("Vault 0")
yeahhh idk why i was a dumdum and forgot about just get
lol
i mean i obv have to test that at some point but for now i'll hope this works lol
fck
i was in worldguard region lol
now it works :)
Someone help me please
how ?
thats from buildtools page ;-;
Download the jar, open command line and run java -jar BuildTools.jar --rev 1.20.1
command line ?
type cmd in the search bar
then you navigate to the folder where the BuildTools.jar is using cd <path>
then you execute the command above
in order for the cli to find the jarfile you need to be in the folder or add the absolute path
alr
np :))
see plugins interact weid if not designed together. If my plugins break cuz of some worldguard itd be like tough luck lol
does it make sense to have saveDefaultConfig() in both onEnable and onDisable?
not really, it writes the included config if it doesnt exist
if its not there on disable you have other problems lol
oh okay lmao
Is there anything (except for some message) that makes sense to put into onDisable?
tons
mostly all the data you need to still have next time
but cant save immediately after you access it
for example?
for example if you do something that constantly changes. If you make custom behaviour for stuff
hmmmmmm
guys why does an event on if(ageable.getAge() == ageable.getMaximumAge()) is being called even though the nether wart is only at stage 2? (it works at stage 3 too, but below 2 it isnt called as intended)
couldnt that lead to data loss tho?
well, true
would it make sense to have some async timer running that saves everything after some time?
or could that be l a g?
eeeh async data is difficult to design properly
it may lead to corruption if you dont lock it, at which point you might as well spare yourself the headache
tbh best for me to stay away from that anyway, never worked with async
If I have something like a /back-command what is the best way of storing, using and then deleting the locations for that?
I have it working right now but only using a file where the locations are constantly saved everytime a player dies and is then deleted once the player uses the command.
There won't be concurrency if it won't be accessed at same time from multiple thread, hence no needs for lock
And I feel like with a lot of players that would be slow asf
?pdc
uh you could just keep it in a player list too
i dont think this needs to persist over restarts
oh ty
also: i have a command that uses nametags as a key. this key can sadly be renamed or used on entities though and therefore destroyed, which will effectively lead to staff having to restore keys constantly which would be stupid.
how to i prevent players from changing the displayname, crafting with it and using it except for on doors?
Why does renaming it mater
use the item uuid
^
changing the name technically doesnt matter
As for crafting you can use the PrepareItemCraftEvent
For using in mobs there is PlayerInteractEntityEvent
Thereās also InventoryClickEvent to handle villager trades
it's just it's a special name which you can't get again and you get more than one key to give to trusted people.
what's not working is the EventListener for the key being used.
The rest is stuff that came to my mind while writing the question lol
?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.
sorry lol
hold on
What's the difference between PlayerInteractEvent PlayerInteractAtEntityEvent and PlayerInteractEntityEvent??
First one is for interacting with not entities
Second one is special and is only really useful for armorstands
Third one is for interacting with entities
oh-
note
right clicks on air with no items dont trigger the interact event
^
guys since when is sugar cane ageable?
Since always afaik
It always was
Yeah, when it reaches max age it grows a new cane on top
Once the state reaches the max value then it tries to spawn a new block
?gui
not the right command ig lol
thought it was
found it
What is the proper way of getting an OfflinePlayer, since Bukkit.getOfflinePlayer(String name) is depracated?
I mean it totally makes sense that it's depracated since you can change your name and if you're not on the server a different player could have taken that name.
But how do I get the UUID if I want to e.g. add a whitelist override? (so i only have the name from args)
You can use it
Just not recommended in most cases
Hey i need some developers for a project
https://www.spigotmc.org/resources/village-defense-1-8-8-1-17.41869/
And all of the other plugins the creator has created
Hey I updated the server to 1.20 and now I always get an error when waterfall is executing the proxyplayer.chat() function: java.lang.UnsupportedOperationException: Cannot spoof chat on this client version!
So far only one has mentioned this issue a year ago but so far I can't see a fix or workaround for that.
https://github.com/SpigotMC/BungeeCord/issues/3327
Do you guys have more info on that topic?
Not the place
Oh-
?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/
Oh- thanks
Would be stupid though for the reason i wrote as well
It's not possible did you read what md5 said
Chat signing stops chat spoofing from being realistically possible
If you store the name sure just use the uuid once you get the offline player
yeah but why is the function still present in the latest version if its not possible to use it since a year? Shouldn't it be deprecated or removed entirely?
Make an issue or post on that issue about it
So I store every player onJoin? Sounds like a waste of resources
Don't store the entire offline player object sounds like a waste why are we not comparing uuids in your system all it takes is comparing uiids once you get the offline player var
Found out why it's not deprecated
Wait, I think I donāt get how the OfflinePlayer works
Bungee supports 1.8-latests natively thus the api works for those versions natively depreciating it for
It'll query mojangs servers if the players never logged on iirc
I'd have to recheck stash but I believe that's what's done
Okay so i can loop through that checking for the uuid but how do i get the uuid from my system?
Why would you loop and not use a hash set
Uhmmmm tbh maybe iām dumb lmao guess i donāt have as much java knowledge as i thought
Hash set contains look up time is o(1)
i mean at least the function description should contain a warning or something because its hella confusing to get that error and find no info about it anywhere except this one comment by md-5 in that one issue
I think iāll need to come back to that later when iām home
You'll need some form of data storage whether it's a database json file etc to verify bypasses
Then use a hash set instead of an array list
In your java code to store those players uuids
yes but for only like 100 players it generally doesnt matter
but using a set in this case is also just cleaner
^
like the performance difference can be ignored
It does matter using proper data structures for a job should be something you just do
are you setting the meta back onto the item?
It should be a new item (same material as passed in), but with a new meta
yes
otherwise the meta will not be updated regardless
hmm, maybe the meta doesnt work for recipe outputs?
idk I never made recipes
Yeah json is also a thing i would love to understand in java but it just never works lol
json is super easy, yml even easier and both are pretty much baked into spigot or java
you can use the gson library for json stuff
anyway I could know for sure? I wanna know if I should continue this plugin or not
Yeah rn i use yml but i hate it so much
and spigot configuration file stuff for yml
I would not know sorry
Yeah thatās what makes yaml so easy lmao
Iām not sure if i mentioned this already but i have no idea about hashsets
Structure and how the files look. Itās so ugly
Json is so much better