#help-development
1 messages ยท Page 2023 of 1
not a bad idea lol
(Full quote is: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%")
^
nooo
never
don't do that
guys?
That's what I meant
I mean the quote does say that given an opportunity, you should optimize the 3%
But it's not the most important thing
Although actually
optimization can already be the simplest refactoring what has in the most cases nothing to do with the performance
It is kind of a good idea to fix some performance issues when they arise, since they can affect testing
Like
If it takes 5 minutes to test something when it should only take 30 seconds...
Yeah
I suppose that depends on a case by case basis though
you mean the remapped -mojang ?
Yeaa
can someone answer my question now...
sure
he does
Probably the releases page
do you have another one? ๐
i dont
if releasing on spigotmc, use github releases or github download link as resource link?
what are you trying to pull from github? - oh
just upload the jar ๐ค
releases would be the better choice
thank you
do you have github setup for it though?
yes
there you go, then it should handle updates for you - or atleast that is the purpose of github releases
Is there any api where I can check the latest version of spigot and build it when it releases?
GitHub actions ๐๐๐
Oh yeah
Oh yeah that wasnโt to you specifically
lol
But just needed to shout GitHub workflow out
public static
void main(String agrs [])
agrs... How dare you.
also... strange question but can I not use NMS? I'm trying to spawn a village
It's annoying
oh wow
isnt there some structure api thing
oh on that topic
Funnily enough, the stdlib uses This shittyStyle[] pretty commonly.
anyone knows why datapacks suddenly broke from 1.18.1 to 1.18.2?
forward or backwards?
I can't start my perfectly fine 1.18.1 server in 1.18.2 unless i remove the datapacks
one sec imma dig up the logs
I mean were they built against 1.18.2 or an earlier version?
JDK internals are also fans of 3k line class files :)
thats just a warning btw
no it literally doesnt start
thats not the cause
the only thing i changed was removing the datapacks
Maybe one of the tags got changed? Maybe check the 1.18.2 change logs and see if there were any changes
that's literally the last message in the log
java.util.concurrent.ExecutionException: com.google.gson.JsonParseException: Error loading registry data: Not a tag id a missing tag id itself is not enough to stop from loading
this
server crashes after that
no further messages or warns
and,.... that doesnt mean thats where it crashed
You almost crashed my phone god damn ๐
[08:40:24] [ServerMain/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
this and the other
after that
ded server
Pog
AAAAARGH
also is it normal to get 1 download per 3 minutes on your first plugin
1
1 file?
?paste it
Oh
but again
start message
error message
dead server
and removing the datapack 'fixes' it
and the system log says java process is being killed
Well, check the change logs then and see if something was modified.
it says something about changing from datapack v8 to v9
and about allowing the use of tags instead of id
Well that's probably your issue
And you need to update the version
thats not my datapack
You can still change it
Either you have to update it yourself or wait for the developer to do it and release it
if you just uploaded it its still on the front page basically so for an hour or so, yeah
How do I show a subtitle to a player? This doesn't show anything:
player.sendTitle("", "ยง6Subtitle!", 5, 12, 3);
well i did something super simple
i expected exactly one download
from the person that wanted it
it shows something for a second if you actually call it
lots of people collect bugs and exploits
intentionally made bugs?
yup
well then
For me this does not show anything
well the error is not in the code you sent, so you will have to supply more info or code
Everything else around this line works just fine, there is also no console error
where are you sending it?
what did you assign player to yeah
public void onRightClick(PlayerInteractEvent event) { Player player = event.getPlayer(); //.... }
Yes, but every other line of code within the if statement gets executed perfectly
Sends a title and a subtitle message to the player. If either of these values are null, they will not be sent and the display will remain unchanged. If they are empty strings, the display will be updated as such. If the strings contain a new line, only the first line will be sent. All timings values may take a value of -1 to indicate that they will use the last value sent (or the defaults if no title has been displayed).
might want to put a space or non display char for title
I can try that
I thought so too
should, i do not trust java in that respect though
your tick times are also awfully short
I know but thats intentional
okay, 1/2 a second might not show on some clients
its a full second
20 ticks = 1 second
including fade in and out
Thanks @crimson terrace and @viral crag :)
np, couldnt expect an empty string to be equal to null in that method
well ...
In Java programming, null can be assigned to any variable of a reference type (that is, a non-primitive type) to indicate that the variable does not refer to any object or array.
A String in Java is actually a non-primitive data type, because it refers to an object. The String object has methods that are used to perform certain operations on strings.
so based on that you can assign a null to a string
you can assign null to a string
Strings are just โจ special types
but "" is not null
Yeah
"" is an empty String
I do not see any rule that actually says that
Well
Any string literal should never return a null value
unless im returning to monke
That would likely be a fault of the compiler
(I don't even know how the compiler would mix up ldnull and ldc)
So, even if it's not bound by the JLS/JVMS, it is still practical that "" is not null
String string = null; //a null object, string == null returns true
String string = "" // an empty String, string == null returns false
If "Hello, World!" can't return null, neither should "" as "" is no more special than "Hello, World!"
"We consider a string to be empty if it's either null or a string without any length." is from Baeldung
that says that a null String can be considered empty, not that an empty String is null
^
Also a lot of shit would break if "" returned null
It is typical to use an empty string when one wants to avoid nullability issues but also pass an empty value
From Java 7 onward, the recommended approach is to use the String.isEmpty() method to check for an empty string in Java. To avoid NullPointerException
isEmpty() does not avoid NPEs
i am aware
i think that String.isEmpty() method is just there so that its neat XD
Yeah, I'm pretty sure it's the equivalent of s.length() == 0
Later versions of Java have isBlank() as well iirc
s.equals("")
which also applies to situations like " "
it is likely there because I cant find a rule in java that actually states what it is supposed to be
null is my love life
in one sentence you described perfectly what I couldnt in like 5
I feel that, fellow gamer
all I really know is that empty may or may not be null, but it will never be false
in true programmer fashion
i stole it
nah most of that is original at this point
oh scrape
true programmers concurrently develop
im getting creative
no need to get creative, just /gamemode creative
๐
can't tell if you just found that randomly or are a brony
I saved that crap, its pure gold
which answers the question not
saved that gif along with this next one
https://media.discordapp.net/attachments/727946110399938666/932693379475705946/4810138D-EB24-425A-96E3-F01DED1BEF4F.gif
what's the event for when someone right clicks a bock
that was book and not block ?
lmao
doesn't matter if its a book or a block
either way it still uses the interact event
true but i wanted to know
wait is that true?
I think someone is laughing their ass off every day for having done that
damn you slipped over a letter didnt you
the bock broke em
nice
the power of bock compells you
@smoky oak is that your clone in help-server?
im unsure what you mean so probably no
same tag-id error from datapack
how can i take the dropped item in dropevent
event.getItemStack or something like that
this does not work with isSimilar method
you should link us to the 1.7 api so we know what exists
masochists
aha!
is there some class that wraps a number and a timeunit?
?
just make one
couldnt find it on spigotmc.org
can you escape an if?
that ends the function
I think break; might work
alr imma make it on 1.8
if else is something
dont use while ๐ฅด
continue;?
thats loop thing too
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.
๐ฅด
If there is any context to this disregard my statement
i do not even see a drop even in that api
there is
lol while(false) is an unreachable statement but if (false) is not
thanks but no thanks, just never had to use continue, so never knew it only worked on loops
but limited
๐ณ
int?
thats a powerplay
at that case you could just go with a while(true) loop
๐ฅด
"" is a blank string and null is a null object
You cannot invoke any methods on the latter
But I think you know that already
do you recommend 1.8
yes, actual minecraft arenapvp on 1.18.2
cool
well, i belive at least spigot 1.8.8 is patched against log4j
If 1.8 wasn't to crash that often I would recommend it - but right now I cannot
And custom clients make the crashing even worse. Like seriously, how can one fuck up that hard
You have like an entire decade to develop a stable application on a stale codebase and yet they fail doing that
like not crash minecraft but crash ALSA
how can i equal the dropped item and custom item
or do i can?
(I have no idea how mc manages to crash ALSA however)
Should report it to the maintainers but eh, too lazy
no idea. I bet you could if you were to read the documentation
PDC or other metadata (NBT?) comes to mind here
in 1.8.8 you might be able to utilize the CustomName - and then manipulate teh itemstack i guess
Oh Oh I know this one! I usually use the PDC to store any PersistantDataType and then check wether the itemStack.getItemMeta().getPersistentDataContainer().has the NamespaceKey I defined in my Items enum ๐
On spigot that is
lore comes to mind, so does the ScoreboardTags
Some forks probably have backported that api
lore isn't a good idea, even if it can be used for that thanks to legacy strings
Probably not as that looks like a C-style enum constant
writing a discord bot kekw
stopped using the api for months and now i have to relearn everything ๐
just remember to .queue() the messages you send via the bot๐
is there a way to include a folder following
+ libraries // root, i want everything in this folder to be included
+- com
+- example
+- foo
+- foo-6.9.1.jar
as a repository in gradle?
jda yikes
yep
ye that hurt me for a while
you can declare a flat directory repository
wdym?
im glad I had a friend explain that one to me XD
but will i be able to use it like
dependencies {
compileOnly 'com.example.foo:foo:6.9.1'
}
a repo does not require a pom
oh
uh well
Poms are totally optional depending on your resolver
Of course it is better to have them however
my previous bot is from when i was a java noob so lets redo that ๐
ok thanks ill look into it
this.dependencies {
this.flatDir {
this.dirs('com')
}
}
this.dependencies {
this.compileOnly name: 'FileWithoutDotJar'
}```
unsure if it works for nested dirs
why dont you pull the maven into gradle the normal way?
but else just walk the directory down and add each as a flat directory
ok thanks
wait is there a way to create a custom repository
with a custom resolver
why do you think that this isn't done this way?
gl, don't try that
ok i will try
Either you are writing tons of groovy or create a gradle plugin
seems like a lot of extra monkeying to pull/put a project locally and then access it directly
kotlin dsl x)
i want to include the libraries folder from the minecraf tserver directly
i have a 1.18.1 dev server
so i can just get it from there
compileOnly files("build/obftools/intermediary.jar")
^ but calls such as this one allows to include any arbitrary file
ofc it could be good, but intellij made it suck sorta
yes. Though kotlin is also nonsensical to me
oh yea
I dont like kotlin a lot, but when it comes to gradle I have to use it
i can just make a function that maps a string like com.example.foo:foo:6.9.1 to <dir>/com/example/foo/foo-6.9.1.jar
Sadly eclipse does not support kotlin gradle (WHYYYY)
and then use that
yeah orby
ah that also sucks
i forgot but is HashMap#put overriding older pairs with the same key or not?
like kotlin got some god ascend features as well as some questionable things, its like yatopia basically
there is apparently a plugin that adds support for it, but last time I installed it everything has gone south.
Nowadays I am starting to maintain my own build tool anyways so now it's only an issue with 3rd party repos at which point using intelliJ can't be that bad
owh right it is
if you want one that doesn't you are looking for putIfAbsent
how do i read the contents in a txt file and put them in a book?
BufferedReader I believe
Buffered Reader would be a good option for reading from a text file
Eclipse does have a Kotlin plugin which should allow you to write gradle files in Kotlin
Though really if you're writing in Kotlin, you're better off using IJ anyways
and that's coming from an Eclipse user
how do i use it, is it a dependincy?
standard java
Nah it's pure Java
kk
Look it up google is your bestie
StackOverflow is great
kk danke
Hmhm
java.io.BufferReader or something like that
If you want to use nio, there is Files.newBufferedReader(Path)
Hi, my PlayerInteractEvent (when stepping on a pressureplate) is called way too often, I want it to call only once when you step on it. If you leave the pressure plate and step on it again it should be called again. But right now it spam-fires the event when you're standing on it. Is there a simple solution?
player move event perhaps
`
private final HashSet<UUID> activated = new HashSet<>();
@EventHandler
public void OnPressurePlateStep(PlayerInteractEvent event) {
if(event.getAction().equals(Action.PHYSICAL)) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if(event.getClickedBlock().getType() == Material.LIGHT_WEIGHTED_PRESSURE_PLATE) {
if(!activated.contains(uuid)) {
activated.add(uuid);
//code
}
}
}
}`
Thats my code so far
I think that is considered very laggy
Hello, I'm starting with spigot and a little with java and I don't understand where this error comes from, could you help me pls
public CommandMap getCommandMap() {
try {
if (Bukkit.getPluginCommand() instanceof SimplePluginManager) {
Field field = SimplePluginManager.class.getDeclaredField("commandMap");
field.setAccessible(true);
return (CommandMap) field.get(Bukkit.getPluginManager());
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}```
what is the error
if I send a packet of setting an item in an inventory, I assume that none of the events of bukkit would work with it right ?
why would it?
It's only called at most once a tick per player
And the event handling overhead it minimal
what's the error?
As you see, I have a hashset where I add the UUID of a player when he steps on the pressure plate, and if he calls the event again and he is in the activated set, it doesn't execute the rest. now how do I remove him again, when he steps away from the pressure plate?
as soon as you get a couple of lines of code going and have a bunch of players it uses a lot of resources
says that if (Bukkit.getPluginCommand() instanceof SimplePluginManager) { is always false
Even thousands of lines can compute stuff in sub-millisecond ranges
So what i have to do XD
you get 50 milliseconds per tick, thats not a lot when you think about it
and it always depends on how many players it runs for
You are underestimating the speed for a CPU
youre underestimating the amount of plugins people have on their servers
With minimal amounts of allocations and carefully chosen data types everything is really fast
I know it says you should not access Bukkit API when async but... is calling an event from another thread bad?
It depends
Also, in this case checking whether a player moved from a pressure plate is going to be a call that takes a few nanoseconds at most
Ideas on completing this?
Player move event or just a scheduler
it says no candidates found for method call 'minecraftLibraries'
that doesnt look like java
there is probably no FolderArtifacts#find method
okay it just doesnt work lol
okay, thanks
are you not only affecting the objectives you set?
so you would only get the objectives you want on/for each
^
ugh
from what I know you use one scoreboard instance
but you create more than one objective
and then change display slots for each one of them
it worksl

hey guys, i'm using an interpreter called beanshell to debug java code interactively
But why do all the spigot/bukkit/paper methods are inherited from craftbukkit/nms kinda classes?
They do implement the same fields (more or less) in general, but still sometimes it's different
I'm assuming that this is made possible thanks to reflection right
So is there a way to reflect the actual classes (and not the underlying ones)?
maybe setting the classpath for beanshell or sth would do the trick? I really don't know
here is an example https://i.imgur.com/NumPWQL.png
as you can see it returns a CraftPlayer, instead of an org.bukkit.entity.Player
org.bukkit.entity.Player is an interface
CraftPlayer implements Player so no issue there
yeah, this was just an example
You can act as if it is a regular bukkit class
sometime it's annoying though cuz it misses fields
currently i have a problem with dealing customized damage to all entities hit by a fireball.
my code works for the functionality part but i dont know how to cancel/remove the damage taken from the original explosion and then set the damage to my custom amount.
Why would it ever miss any fields?
the event im using is the EntityExplode as i need to get total values for one explosion.
Bukkit is mostly built around interfaces so there are going to be few of them. And the few fields that you do have are private
i tried using entitydamagebyentityevent but i couldntget it to work properly
I don't know, okay here is another example
When i use nms on beanshell, its fields are obfuscated, but as you know with mojang mappings, obfuscation is almost removed, just like when i code the plugin
cancel the event?
that would cancel the fireball explosion not the damage
could i just get the entities last damage cause and remove that from the total damage dealt? idk
You can cancel the damage event
how
anyway guys do u know how to fix this or do you at least know what's causing this
Which kind of fireball are you talking about?
livingEntity.damage(truncatedRandomDamage - livingEntity.getLastDamageCause().getDamage());
prolly wrong but just an idea
custom
Also why not rethrow the explosion event?
i dont get what u mean
?jd-s
rethrow the event? why would i
how does that help
Actually, I thought that there is a entity damage boolean there
Turns out there is only a fire boolean
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
However still https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageEvent.DamageCause.html#ENTITY_EXPLOSION
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent, enum: DamageCause
yeah the isincendiary
okay i'm having the same issue than this guy https://www.spigotmc.org/threads/mojang-mappings-and-reflection.540538/
but no one answered the thread
so what would i do with this?
livingEntity.setLastDamageCause(damageEvent);```
Oh, you are complaining about fields being obfuscated?
im already using something like that for my event but
Do you want to damage entities or not damage entities?
?jd-s
but i want the original damage from the fireball to be cancelled
but when im using the entityexplode event it has nothing to do with damage so im wondering if theres a way to get the damage dealt from the entities idk
declaration: package: org.bukkit.event.entity, class: EntityDamageEvent
how can i install datapacks for spigot to work on aternos?
damageEvent.setDamage(truncatedRandomDamage);
this
how can i install datapacks for spigot to work on aternos??
erm what
TinyRemapper could help there
- aternos brh
- datapacks arent spigot
- plugnis are managed by aternos iirc
i dont think you can add custom ones
what server like not aternos are u recommending>
i might be wrong its been years since ive used aternos idk
your pc
is better than aternos
what?
100%
aternos gives you 2gb bro
#help-development is not the place for server help
But really unless you deobfuscate the jar (TinyRemapper) or obfuscate your reflection calls (probably not tiny remapper, but the same idea still applies) you aren't going to solve your issue @vivid cave
i highly doubt you have less than 2 gb of ran
2 gb is quite a lot actually
not for newer versions
my dev server runs on 2GB
but do u know what's causing that reflection modifies my objects classes in general? It feels like every of my objects is one abstraction level higher or sth
yeah dev but i think they arent making stuff
okkkk i was just asking but anyways how to play with my friends with my pc
๐คจ
What exactly do you mean there?
theres like 600 thousand tutorials on youtube just search it
ok then
used it as an smp with 40 ppl on 1.16 and used it as an smp with 10 ppl on 1.18
I'm just magic
as i told you, using beanshell doesn't output me the same object types that i would code them in; example Player is returning CraftPlayer
And the nms classes i'm using seem to be one abstraction higher in the sense that they are obfuscated, as the nms classes in my code work very fine with their new mapping
pf. Back in my day we still installed borderline virus virtual networks
so i'm wondering whats causig that
will setting the meta of an item in a player's inventory update that item?
true that
Fr
I forgot its name... Something with an H or M at the beginning...
Yes. That piece of invading garbage
The player <-> Craftplayer example is a bad one as you have already told.
And spigot reobfuscates the jar but you should already know about that if you are using beanshell.
So really what is your issue?
it's not a bad example because i don't get why this happens
understanding this may help me understand my nms issue
Player is the interface, CraftPlayer is the implementation
in my code i deal with Player, not CraftPlayer
Basically any CraftPlayer instance is a Player instance. YOu cannot have raw Player instances due to how java behaves
It is safe to either just checkcast all craftplayer instances to player instances or to just not cast them in the first place since the JVM does not really care about such details
Example for this would be
public interface Itf {
}
public class Impl implements Itf {
}
In this case all Impl instances would be an instance of Itf. It is fully valid to do
Impl var10001 = new Impl();
AnotherClass.itfConsumer(var10001);
if AnotherClass.itfConsumer is
public static void itfConsumer(Itf variable) {}
How can I disable the hit-cooldown? I dont want to do it with another plugin i want to implement this in my own plugin.
On a java bytecode layer the same applies:
NEW Impl
DUP
INVOKESPECIAL Impl.<init> ()V
INVOKESTATIC AnotherClass.itfConsumer (LItf;)V
is also valid
i see, thx for the explanaation!
i see:)
Were you the one to use the celeron or am I mixing up people?
me?
yeah
u r mixing up
isnt a celeron some cpu thing
idek exactly what it is
wasnt it some cheap cpu thing or smth
Yes
The Intel Celeron is just old
are there even people coding like this?
I personally avoid such constructs at all times, but there are def. some people out there that do this
๐
nop
I used to run my dev server at 400MB
man, I miss 1.8
Hello, I am trying to use a MySQL database for my spigot plugin, and I am trying to select many things but I would have to use a while loop, which would freeze everything. how could I avoid using a while loop? the guide on spigot (https://www.spigotmc.org/wiki/connecting-to-databases-mysql/) only selects one thing, but I am trying to select multiple things. my current code: ```java
try (Connection conn = FFDatabase.getConnection(); PreparedStatement stmt = conn.prepareStatement(
"SELECT coords FROM ff_claim_blocks"
)) {
ResultSet rs = stmt.executeQuery();
// can't do while loop here
what freezes the server is not exactly the loop, is the actual query. You need to run that on other thread
alr ive just been told to never use while loops
actually I didn't see the Statement, don't you use WHERE statements on your query?
or are you filtering whatever you want to look for on the loop? ๐
learn to use select and join
ive used basic sql for a while
well the efficiency of your query is other topic but if you want to not freeze your server, as I said, do it on another thread
no, make mysql do the work
there is no reason to parse what the database server can do for you
whatever he's doing he needs to learn how to do it on another thread first
if he says it's freezing his server, he needs to do it on another thread
okay il do it on another thread
and learn how to use WHERE statements perhaps?
theres no parsing involved in this, its just a list of coords?
i know how to use where statements, I just dont need to right now
while (true) {
for(;;) {
new Thread() {
@Override
public void run() {
System.gc();
}
}.start();
}
}```
poor programming is not going to be fixed by moving it to another thread
the only while loop that can freeze or server
that just burns your threads, there are lots of other ways to write blocking code
Thread.sleep(Long.MAX_VALUE);
yeah, but Idk if it's poor programming or what, he hasn't told anything about what he's trying to accomplish
he says it here
and he only needs 2 coordinates
And don't create new threads. Use CommonPools like the one provided by bukkit or the commonForkJoin pool of the CompletableFutures which I really recommend getting into it for comprenhensive Async operations
it
was
a
joke
might go with a better approach
if i cant get it working il explain with more detail
but useful
thanks
ik
for new people
all you need are the two diagonal coordinates and you know the rest
if you need multiple connected rectangles you ask for the diagonals of each rectangle
any ideas on this?
i tried to run the code 1 tick after that
i want to get the killer inside the PlayerDeathEvent
I'd recommend just using the EntityDamageEvent
and checking if the entity's health is equal or lower than the final damage
PlayerDeathEvent is usually not as useful as the EntityDamageEvent
depending what are you trying to do
i just need to get the killer
EntityDamageByEntityEvent then?
then try to get the killer a tick after the event is called?
i just need the killer for a special damage
the killer is null
even after 1 tick
I just saw your code and the amount of times I tried to do something similar I just gave up and ended up using the EntityDamageByEntityEvent as I told you
cancelling the damage
and turning the player into spec
other solutions are just hacky workarounds
like the player.spigot().respawn()
which now I think about It might be because of that
try getting the killer before respawn?
unless you are using an old version
bro
it was
because of the respawn
thanks
the .respawn() was setting the killer to null
_ _
i had no words
I'm trying to send to the player a pluginchannel message but I'm not receiving it, but it should be sending it normally because i get also after sending in my logs
https://pastebin.com/EAX3Eus6
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
mine is literally just my name
beuh pastebin
imagine not centering ur name
idk mine breaks on phone
I replaced it with a pastebin
why oh why ..
if you are using 1.18 player.getName() isnt a thing
its getDisplayName() or getListName()
looking and no see
HumanEntity#getName()
yup humanEntity has it
why use player instead of humanEntity? despite most people want the DisplayName anyway
ยง supremacy
put another comemnt in the no match
this was the only thing in the code that i pasted that doesn't work for some reason:
player.sendPluginMessage(CoreProtect.getInstance(), CoreProtect.COREPROTECT_PLUGIN_CHANNEL_REGISTERED, sendRegistered());
or are you still getting it in the log/console?
returns teh default mojang one
supposedly, yup
im gonna leave the server
Lmao better
btw, you could use the prejoin event as well ...
Bukkit.getPlayer(UUID).getDisplayname()
would that be better
what does that do
plus you don't need to update name for every time you changed your name
runs on the initial handshake, would put the message slightly earlier
so you would get the message and spawn in at the same time
looks like they want you to use async for prelogin now https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerPreLoginEvent.html
The event is deprecated for a reason
Lmao
821b7c98-9069-4ef4-b3a4-5665d2d01fda
821b7c9890694ef4b3a45665d2d01fda
why not PlayerJoinEvent
what UUID do i put in code
idfk
it looks like all those offline servers need a UUID from now on: AsyncPlayerPreLoginEvent(String name, InetAddress ipAddress, UUID uniqueId)
e.getPlayer() == bukkit.getPlayer(Your_UUID)
could someone help me in #help-server ?
you can even make a list and loop every UUID
821b7c98-9069-4ef4-b3a4-5665d2d01fda
or
821b7c9890694ef4b3a45665d2d01fda
why would i wanna do that
if you've more one uuid
no
note there exists a offline uuid ๐คทโโ๏ธ
whats the diffrence
both are the same one is with out the -
i dont know what to use
im so lost
its a local server rn
im gonna pubish this so if a server has this pl and i join it says that
sounds good!
sarcasim?
kk thanke
two times the same
huh?
it is
i forgot if the UUID#equals method compares the versions
trimmed and untrimmed
??
what do i use
does it matter
nothing to worry about
kk
uhm
how do u know my name, he is a stalker @everyone he stalks
starting method names with an uppercase character
sus man i k @round finch
unused import, shame on you
?event-api
what
lol
lets go take a nap im litteraly falling asleep here lol
read that and rest assured you'll understand
use prelogin for keeping people off your server ๐
someone told me to use pre login event
if you want to make a simple join message just use PlayerJoinEvent
it was an alternate suggestion
your onjoin was fine
yeah the join event, login or prelogin doesnt matter
I mean only benefit is that the async pre login is alr async in case you do some heavy stuff
dude i process dumped intellij and it created a 3 gigabyte file
lol
i had a 20 min video on my ipad that was 2.25 gigs
<-- Brain 0 bits
do u mean ^
why is intellij not starting bruh
its a background task in task manager
but its not visible
I WoNdEr wHy
because windows task management is stupid
because its using 230 mb of memory?
so it creates a 3 gb file
going back to figure out why my plugin refuses to make folders and makes configs the wrong places
this is only happing on my host not locally ๐คทโโ๏ธ ๐
remember defragmenting? windows only recently learned to count
pterodactyl ?
are you using getDataFolder() to parent all your files to
It took me a bit to figure out that annotations was putting my plugin.yml one directory up in my jail. so I could only access it programmically
public void OnPLayerJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
InetSocketAddress ip = e.getPlayer().getAddress();
if (p.getUniqueId().equals("821b7c9890694ef4b3a45665d2d01fda")){
e.setJoinMessage("ยง6ONWARD TO GLORY. ยงrยง5Welcome Cyber" + ip.getAddress());
}else{
}
}
does nothing, no error
because that uuid aint valid like that
do it need the -
yes
that will never be true
a UUID will never be equal to a string
not the way you're doing it at least
then how do i do it
either convert the uuid to a string first
^
or convert the second one to uuid first
I'd advocate that
idk whats faster tbh
is there a difference/preffered between String.valueOf() and .toString()? i know some things cant be converted but should i try to stick to one
String::valueOf is much more powerful
as it is in fact null safe
altho toString will be slightly slightly faster
tho generally, since Java's null is extremely unoptimized (not in terms of speed) you'd prefer valueOf
actually i have wondered what is better to do, a null check or use an optional
in sense of speed
and here's how I'd use it in my model interface for instance
https://github.com/Conclure/Eventful/tree/master/src/main/java/me/conclure/eventful/model
i see thats interesting. only thing i've never heard of is sealed & non-sealed
compile time enforcement of subclasses
Ah alright. Thanks for showing me. I might implement a similar system. This looks really nice
๐ yeah nw, well Im still just trying it out, like code that uses sth like this/optional gets verbose extremely quick
bootleg optional?
lol
in principle
I did plan to add a lot more higher order functions
but just dont wanna sit there and guess code
Let it implement Stream
Then you can apply mappings and what not
yuh
interesting use of sealed. First time ive seen this used in a justifiable way
I mainly made my own to make it polymorphistic towards differentiability for absence and presence
does the join message goto everyone?
does that work in java 8+ or just j16+
lol, yeah idk how it is even supposed to be used tbf
?jd
I know optionals are in java8
'sealed'
but like, j17 is lts
ah rip ok
so pretty pog
on default yes
i might update to j17 anyway tbh
awwesome!!
mmmk danke
none of my stuff needs j8 so i could probably just change it without too much hassle
because it was originally a latest java project anyway
hopefully this works
for (int i = 0; i>54; i++){
p.getInventory().setItem(i, glass);
}
is this for loop right?
is the alligator going the right way?
glass is a item stack btw
What ide do you use?
Then go into your class and press ctrl + alt + L pls
what does it do
Format your code
oh ok
for (int i = 0; i > 54; i++) {
p.getInventory().setItem(i, glass);
}
what now
no error no glass
Then its probably not being run
how do i fix that
Idk you didnt send any code
https://mystb.in/RevisedEstimationEau.java
this is whole code
package HotBarInventory.me.cyberwolfie.Me;
import HotBarInventory.me.cyberwolfie.Me.Events.JoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public final class CyberWolfie extends JavaPlugin {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new JoinEvent(), this);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}
this is main class
Is the plugin loaded?
yes
Write a debug message
How I can update libraries in spigot use BuildTools?
sysout
That is the appropriate way to use it, yes.
how to i make a player not drop a item when they die?
declaration: package: org.bukkit.event.entity, class: PlayerDeathEvent
Or with a gamerule
get Drops
get Item
Store Item
remove item in drops
replace it back into inventory then respawning
How can I make a gui someones inventory
like I create the inventory with the the type of player
but how can I make the players inventory and items show in the inventory
like /openinv?
you make a gui like this
Inventory inv = Bukkit.createInventory(null <--- Holder fx Player, 9<--- Size, "Example" <---- Name);
player.openInventory(inv);
@pliant oyster
i dont believe you make a PlayerInventoryGui like e
far as i know
but you can get a players inventory and open it as a chest
I just realized I don't need to make it into a gui
quick question, why do you get banned if trying to create a new spigot account
Player p = e.getEntity().getPlayer();
ItemStack glass = new ItemStack(Material.RED_STAINED_GLASS_PANE);
e.getDrops().remove(glass);
it is not removeing the glass apon death
How I can update libraries in spigot use BuildTools?
?bt
show entire code
that is all the code
package HotBarInventory.me.cyberwolfie.Me.Events;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class DeathEvent implements Listener {
@EventHandler
public void death(PlayerDeathEvent e ){
Player p = e.getEntity().getPlayer();
ItemStack glass = new ItemStack(Material.RED_STAINED_GLASS_PANE);
e.getDrops().remove(glass);
}
}
does the item even drop?
oh
You're trying to remove something you just created, so the drops won't contain that item stack.
probably not the same item
You probably want something more like:
for (ItemStack drop : event.getDrops())
if (drop.getMaterial() == Material.RED_STAINED_GLASS_PANE)
event.getDrops().remove(drop);```
haven't used spigot in quite a while so that naming might be wrong
or List#removeIf ๐
?
you can use e.getDrops().removeIf()
so?
๐ฆ
i thought
maybe set Item on Respawn then Die
to test
e.getDrops().removeIf(drop -> drop.getType() == Material.RED_STAINED_GLASS_PANE);
this works
yea i know.
ofc
private static ArrayList<ItemStack> Special_Items = new ArrayList<ItemStack>();
@EventHandler
public void OnPlayerRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
if(Special_Items.isEmpty()) {
ItemStack Special_Item = new ItemStack(Material.DIAMOND,1);
Special_Items.add(Special_Item);
}
for(ItemStack item : Special_Items) {
p.getInventory().addItem(item);
}
}
@EventHandler
public void OnPlayerDeath(PlayerDeathEvent e) {
for(ItemStack item : Special_Items) {
if(e.getDrops().contains(item)) {
Bukkit.broadcastMessage("Dont Drop Your Item" + item);
e.getDrops().remove(item);
}
}
it was just an Exemple

oof
Code blocks are fine (sorta), but the initial way you formatted it was...
It's much better now lol
@simple anvil here if you want it
it works now
thanks
also
List<Integer> slot = new ArrayList<>();
int i;
for (i = 9; i < 36; i++) {
slot.add(i);
}
if (e.getSlot() == slot) {
e.setCancelled(true);
}
i wanna make the slots 9-36 all cancel if you click on them
i cant use int with list
and i dont wann have a or statment for all the numbers
imma go eat dinner
bye
so guys i have a math question.
i have a list of Materials that each have a certain worth. (these materials are spawned into a generating mine)
now im making minions, and they automatically mine those ores (or at least pretent to) now when i a player opens my menu i need to "simulate" how much that minion has made in the time the player was away. and there are a few factors to take into account. such as efficiency, fortune. does anyone know a good way to go about this?.
My first idea was to calculate how many blocks the minion couldve broken, take the total % chance to get a certain ore and that would be the amount of ores from that type. the problem then is fortune as i probably would have to generate a chance for the amount of blocks the minion had broke. this could be a high number like 1.000.000, that probably would not be very performance friendly, sooo anyone any ideas? let me know.
probably best way to do this if had some formula that can give me the amount of times a chance would return true. with a changing amount & chance
its only math with no in game actions. it doesn;t matter how many blocks
InventoryClickEvent
will it be fast enough?
plenty fast enough
like generating a random 1mil times for example
you can do all teh calculation async so it won;t matter at all
dont know about that, when a player opens my menu. it should be updated then and there
amount of fortune drops
speed of efficiency
time
or i could handle that differently?
just calculate at regular intervals, like the minion has to bring the rewards home
that would require me to keep the "Mine" object in memory though
config to get it
which is something im trying to avoid
mine object?
or i would have to read straight from my data file
config should not be used to store player data
it could for numbers
worded it badly
as it is player specific data, and only related to a few numbers put it in their pdc
its not though


