#help-development
1 messages · Page 1854 of 1
So the shade plugin is a spigot plugin, yes?
like, do i add it to my plugin, or my mc sevrer
why do you need the shade plugin anyway?
just put the <scope>compile</compile> is okay isnt it?
Don't think so
tho it is default so idk why it is making error
ok, i have the plugin in my pom.xml, how do i "shade" a jar
See the page I sent
Yuh compile is basically the gradle equivalent of implementation
So should be shading if you add the plugin
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
sorry i was so rushed
it is confuzzling
Apparently all you need to do is add the plugin
So it should work if you have stuff set to compile
kk thx
gradle: use shadowjar, change compileOnly to implementation
Shade plugin: what is the goal "shade". Maven doesnt know what it means and neither do i. Its in plugins>exicutions>goals
components with a click action doesn't work in 1.18 for me, any ideas why?
textComponent.setColor(ChatColor.YELLOW);
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://myurl.com"));
player.spigot().sendMessage(textComponent);```
Did you disable them in your client settings
Eww Swedish
lmao
multiple users, so don't think so
Jeg snakker norsk hehehe
Nei, det er så bra
🤬
kan du sende ut komponent json
Firing up google translate
Players are still dying for the first time they enter this plot world, I've tried teleporting them above the block but they just die instantly. I only have eventhandlers causing them to be teleported, and eventhandlers catching the world change event
just make them invulnerable until they move?
I will, it's an odd bug to have though idk why it doesn't happen anywhere else on the server... Or maybe it does.
ferdighetsproblem
Yes
There is no code other than player.teleport() and it's just instantly killing them, but only the first time they enter the plotworld. I wonder if PlotSquared kills players that don't have a plot lol
i had a bug once where setting their max health to less than 3 hearts then teleporting them would kill them, strange stuff happens sometimes but if nobody knows a solution sometimes you just need to turn to janky work arounds
My plugin basically uses P2 to like create plots, worldguard to paste schematics down, and my plugin teleports ppl to their "hideout" (plot)
TextComponent{text=> Tryck här för att öppna kartan.,BaseComponent(color=, font=null, bold=null, italio=null,underlined=null, strikethrough=null,obfuscated=null,insertion=null, extra=null,clickEvent=ClickEvent(action=OPEN_URL,value=https://myurl/#), hoverEvent=null)};
Ah yeah
Click event is not on the text it’s after
Try using component builder API perhaps? Is that possible here
No idea why it’s parsing like that but it shouldn’t do unless I’m misreading
Maybe someone will come and correct me but looks wrong to me
Jeg skal prøve det
Okay does anyone want to join and click a button and see if they die on my server I hope the bug is fixed
nope, using component builder doesn't work either.
Weird
And I can't do it myself because this bug appears when a players purchases a plot for the first time
Jeg er prøve nå
.color(ChatColor.YELLOW)
.append("» Tryck här för att öppna kartan.")
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://randomurl.se/"))
.create();
player.spigot().sendMessage(componentBuilder);```
That looks correct code wise, you are adding it to the component that has the text in it
can't buy plots yourself?
do you not have access to console or something? if you do just set yourself as normal perms
I really gotta code a system to reset plots, it's all custom code
Does the p2 method not work
Once I bought the plot I have it so I can't experience the bug anymore
Delete your data
its always been lower case 😛
Not when I spoke here, I swear!
It's custom code that works with a database, p2, and some other stuff. Not so simple
Not in IRC either if memory serves, but I have no idea at that point
that is because I set the nickname, my account its lowercase and will forever be that way since discord is case sensitive that way
I will just wait til the next person joins to see if they die lol
sounds like a design flaw on your end if that is the case
bet you found the log4j thing interesting
m8 why are you talking I just wanted someone to debug
At least I am coding
didn't know about it, but also not super serious if you know proper admin stuff
Like updating spigot
never thought it was either - I imagine the most anyone could work out to do in the time it was known is crash a server and/or their own client
i reckon governments knew it way before disclosure but maybe that's just the pessimist in me :p
they could extract data, but it wouldn't be possible to do that if all the ports were closed down anyways
why am I vulnerable when I'm running my chmod 777 server as root!
as I said, if you knew proper sysadmin stuff not overly serious 😛
fuck you spigot
@drowsy harness jeg velger for [whatever the word for download is]
(jeg forgor)
maybe? assuming some of them using it? In the military our hardware doesn't use java so just depends which department I suppose
what
because that is my opinion on something that shouldn't be difficult. What you decide to do is on you overall and ultimately in the end I could care less.
The exploit for wannacry was known about by the NSA for a while, so I could see it
Governments sus
They probably have tons of exploits, but ones for log4j would get them into most Java software
but what do you mean wait for download, what do you want a download for?
ah
wannabe sysadmins already provide this functionality
the bug was just a plus
😛
hahahaha
👀
bruh
TextComponent textComponent = new TextComponent("» Tryck här för att öppna kartan.");
textComponent.setColor(ChatColor.YELLOW);
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://myurl.com"));
player.spigot().sendMessage(textComponent);
This on 1.18.1
is it something server side then?
Are you using a fork
I had fresh 1.18 + tw // ||paper|| 1.18 server
ye i am
as for the government knowing about exploits they definitely do, just its not the governments job to do a private corporations job
No
What fork
But if they don’t report it to said corporation, how can they fix it
It might not be that difficult. It's why I'm bringing it up here. You don't need to just tell me to f off by saying it's a basic flaw. This could've been a bug on Spigot's end.. Was looking for feedback, I already have it patched.
purpur
why report when you can have the POWER
maybe ask in purpur discord? might be a known issue or something
i'll check
Because then it gets leaked :p
Don't see it on their GH issues
I am not saying creating something isn't difficult. You said it isn't easy to remove someones data. I said that might just be a design flaw since you said everything was custom. As far as removing data about a player on a spigot server, yes you absolutely can do it and is relatively easy. As far as whatever data is stored on whatever it is you are keeping track that is on you. Don't get upset over a tiny comment
I am not saying F off, just if you want to get upset about it, just know in the end I really don't care either way
It's just not even that simple, idk what you call data
It's like they get an upgradeable mansion
Sounds like data to me
sounds nice to get an upgradeable mansion
data? I hardly know her
Can I get one in real life
no, you suck.
I already have the system online on a production server with a tiny bug
I don't need useless java code that removes their hideouts
:c
death does not sound like a tiny bug
I’m telling Santa
and it sounds like you do
death usually only happens once
except when you need to be in compliance with EU and US laws in regards to data collection and privacy 😄
You are just trolls, this is for development chat
I am trying to seriously figure out what is happening in the spigot code
A simple teleport did not ever do this pre 1.18
your* code
Oh god, GDPR on spigot server
I patched it with player.setInvulnerable but it's just not a good idea
Well this is fruitful thanks
so players die when they teleport?
if that is the case, might want to look at anything that modifies their health or regen stuff
Making them invuln for a tick is fine
Not ideal, but it’s a perfectly fine work around
i'd suggest trying to find a minimal way to reproduce the bug, and if you can, then report it as a bug
but if it isn't a bug then the setInvulnerable idea i provided is the only jank patch i can think of
do u guys think that the log4j exploit effects spigot?
Which one
any
?log4j
Find information about the log4j2 security patches here: https://www.spigotmc.org/threads/spigot-security-releases-—-1-8-8–1-18.537204/
Yes, that is why there was a patch
ok thx
it's this friction that just is unbelievable unhelpful
I don't understand this
Code is already hard enough, socializing is too
they are making it a point that it isn't spigot's code that is causing your players to die
at least not directly anyways
I believe he was referring to me just wanting help and not having the strength to do it myself
As it seems most of the chats are in this place, very watered down
o.o
I consider myself quite the social butterfly
well I don't, you suck
Teach me
Ouch
are you in uni now bishop? been a while
just do keep in mind that support/help here is voluntary
i've been operating under the assumption that spoon feeding info to people is a bad idea
Yes
Friction is unnecessary is my point. gnite
don't think i'm getting in. lool
terrible idea, but sometimes u gotta
At least you had the balls to apply
it is personal preference. In general yes, but everyone is free to do what they want 😛
And I know a person who kept telling me she bombed her Oxford interview for Maths and lo and behold she got in
cya later @stone apex some rest sometimes is beneficial to figuring out the problem
yeah but I got uhh
very low entry exam scores
4.5 was my score average between the two papers, 6.5 is average offer :p
I really have no clue about your problem specifically or where to look in regards to it, but that is how custom code stuff goes though
Rip
- average interview so unlikely unfortunately
You’ve just gotta believe
to get back at them is when you decide to create your own Uni and give yourself a degree 🙂
i don't think beliving at this point helps much hehehe
they've likely already decided who is getting in
The University of Minecraft
and are just torturing us for a month to tell us
Well applications for Oxbridge only closed like recently
there is legit some businesses created just to get back at others XD
Actually no
Nah, early entry deadline was oct15
It's october
To be fair believing hasn’t gotten me anywhere, but it hasn’t hurt
All interviews have been had by now
The delay is likely just for the pooling stuff
that you know of
Okay that’s a lie
im trying to make a bossbar that displays the time and the previous time like
1am - 1:30am - 2am - 2:30am - 3am
but whenever the time is 6:30am it displays two 6am's
6am - 6am - 6:30am - 7am - 7:30am
Apparently java is cpp now
o.O
well depends which end you looking at
the front or the back? lmao
Those paste sites never get the Lang right
always has been 🔫
Oh no water gun
which time are you trying to display?
when the issue happens 6:30am
that isn't what I am asking. What I am asking more specifically is are you trying to display in game time or real world time?
looks like in-game?
in game time
from the world ticks
using getTime
assign both those to be the same
0 to 23999
or do that
that is how real world time works
oh wait i figured out something which might be it
in ```java
if (i < 0) {
timeBarString.append(prefix).append(TimeBossUtil.getTimeFromTicks(Math.floor((time + (i) * tickInterval) / tickInterval) * tickInterval));
} else if (i > 0) {
timeBarString.append(prefix).append(TimeBossUtil.getTimeFromTicks(Math.floor((time + Math.abs(i) * tickInterval) / tickInterval) * tickInterval));
} else {
timeBarString.append(prefix).append(TimeBossUtil.getCurrentTimeFromTicks(time / tickInterval * tickInterval));
}
?
2400 in the real world really doesn't exist. Some people use it, but in reality 2400 is actually 0000
Yeah
in the first if statement when "i" is -1 and -2 they both equal 0.0
better example
(800 + -2 * 500) / 500
(800 + -1 * 500) / 500
they both equal 0
simplified maths from my thing
Probably because it’s marginally easier for the majority of checks in the game
or just stick with real world time 🙂
Like when trying to convert to real world hours
converting to real world hours really isn't that hard o.O
Synchronise minecraft time with time servers
How do you convert from a DataWatcher to SynchedEntityData?
SynchedEntityData sed = npc.getEntityData();
It keeps giving me errors saying its a DataWatcher object, but there is none for the new Mojang Mapping itself
I keep getting NullPointerExceptions too because of it
Where can I download javadocs 1.18.1?
why would this happen tho, its so annoying
either use buildtools to produce the javadocs or just use spigots url for the api
That wiki page sucks
Can anyone generate one for me? Im on my phone and I don't have access to my laptop rn. And when I get access to my laptop, my internet is probably down at that time.
depends on what kind of number object backs the math in the end. If it is int's then you only have whole numbers since that is all int's handle. If you go with double you get more digits to work with, and float even more then that XD
the time is a long and everything else should be an int
Welp
longs are not doubles or floats
Rip whoever made that page
How do I generate them in intellij?
Then they get promoted to long
And fourthly you can just add the source to your ide, since buildtools already downloads it
And fifthly your ide should also just give you the option to download if using maven or gradle
Certainly netbeans does
first equation = -0.4 and the second equation =0.6 just fyi
I think there are wiki pages for that too
I just download download javadoc.jar then open it?
Depends what you want to do with it
im pretty sure java makes them both 0
Most ides should just let you attach a jar
if you use the incorrect data types absolutely
Casting to int truncates
Is there any way i can convert it to like a pdf file
You could save the raw HTML as a pdf
How can I open a jar file in chrome?
Do what now
Ah so its extractable
all jars are 🙂
Ok thanks👍
just fyi int double and floats etc
generally have a method to convert already
just depends if you need them decimals or not 😛
k
How to input something in BukkitRunable?
Huh
damn always my bad english want to kick me
lol
idk about BukkitRunnable, but Runnables can access stuff that's final or effectively final if you make an anonymous
(stuff in parent scopes)
with an anonymous inner class like that you can just have a final local variable outside it for whatever you're trying to pass in
^^ya what they said
depends on what exactly you are making final
generally anything can access final, it is more of a question are you going to be able to change it?
i wasn't the one with the question
k
I don't know much about Java,
if I have multiple targets running BukkitRunnable at the same time, can the values get mixed up?
If yes, can I solve this if I don't make variable as static?
If you're accessing a field in the enclosing class then you will probably mess it up
yes and no on the values getting mixed up, really just depends how it is coded. You are allowed to extend runnable and then put all your run code in that class, and then just create a new object for that. This isn't the only way to over come such an issue, just one of a few different ways. I applaud you for having the sense to think about this though because many don't 🙂
I thought it was a simple loop, but Scheduler Programming is quite difficult. Thanks
I'm working with maven multi modules and can't seem to get my jar to compile properly. My final jar is only ~150KB when it should be around ~350KB. It's like it's missing the main part of the plugin. Still trying to figure out how to use maven correctly, but the project is on gitlab. Would appreciate some help.
https://gitlab.com/Nothixal/hugs-multi-module
are you shading the modules into the final jar?
if not, that would be why
I thought I was. Should the shading have to happen in the core module?
it should happen in which ever has all the modules as a dependency
and for in the dependency tags, make sure they have the tag to compile
if they are set as provided, then shading plugin won't shade them in
I want to use the mojang mappings for NMS, but running Build Tools again with the --remapped flag changes nothing in my local maven repository. It gives me this warning while running the jar:
[WARNING] The requested profile "remapped" could not be activated because it does not exist.
I understand most of what you said, but I still don't know how.
If LivingEntity A executes BukkitRunnable() and stores the value of A as a variable in run(),
can LivingEntity B, C execute BukkitRunnable() without being affected by each other’s values?
Post the full log
INFO] Installing /root/projects/minecraft/BuildTools/Spigot/Spigot-Server/target/spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang.jar to /root/.m2/repository/org/spigotmc/spigot/1.18.1-R0.1-SNAPSHOT/spigot-1.18.1-R0.1-SNAPSHOT-remapped-mojang.jar
if the objects are local then they basically act like they are being captured by the runnable, if they are members then you will probably get mixups
When I try to import spigot using maven, it uses the spigot mappings
the names are like EntityPlayer
Did you import the remapped-mojang classifier
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
yeah
Post your entire pom
idk then
checking /work/decompile-latest/net/minecraft in the buildtools directory, the stuff there also uses the spigot mappings
Thanks
np
(meaning members of the outer class in which you are making the inner anonymous class, i didn't mean members of the onoymous class, sorry if that was confusing, im not the best at explaining things)
Is there a way to use custommodeldata for a totem of undying effect?
yea, all itemmeta has setCustomModelData and getCustomModelData
yes but I want to just play the effect not give the item
oh srry, didn't understand your question
player.playEffect(EntityEffect.TOTEM_RESURRECT);
this plays the totem effect
(i for some reason didn't see the word effect at the end of the sentance)
im unsure about how the actual effect works
this animation
it works with custom model data but im wondering how I can implement it as just playing the animation with the custom model
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_STATUS);
packet.getIntegers().write(0, player.getEntityId());
packet.getBytes().write(0, (byte) 35);
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
I used protocollib to play the animation also but im not sure how to add custommodeldata
i avoid protocol lib, so can't help you out with that part, but looking at this link (and your code) it looks like it only sends a byte instead of an itemstack, so i would imagine that the custom model data is probably lost
Yea thats why I was wondering if there was another option than protocol lib because the animations are stored as bytes
35 is totem
but player.playEffect(EntityEffect.TOTEM_RESURRECT); also doesnt allow for itemstack
if the resurrect totem acts like how the guardian effect works then there is probably a particle effect for it also, and that particle effect might take an itemstack, but idk, imma look cuz im curious now
Perhaps this is the last question. Can I pass additional variables in runTaskTimer()?
there is Particle.TOTEM but that is just the yellow and green dots that fly out
ah i see, then ya, im stumped, i don't think you can do custom model data with it, but this is not a definitive answer
that sucks, its alright I didnt need it but I think it looks cool and unique
if you want you can implement Runnable in an actual class and create your own constructor for it, passing in whatever you want
no need to always only use anonymous runnables
Thanks bro
np
Why doesn't spigot use gradle by the way? Maven is extremely outdated and should be left behind but a lot of new devs think it's the best thing ever and it's a pain to work with.
Maven takes up like 5 or 6 lines to get the spigot api gradle is 1
Just becomes a long messy file once you add more and more things in.
I'm sure if you did a vote upon moving spigot to gradle more would be in favor of moving than sticking with maven ngl.
would probably just 50/50 idk
I'm not getting into this argument
and literally no one touches the pom.xml except me
Because its hard to get near it?
which is only 500 lines of a project that is more than 100k lines
Is the spigot project not allowed on github by the way?
That exists
can i access persistent data of offline players?
I think they technically could, but they’d rather not take that risk
No
I just find it messy, it's like a whole code block for each dependency where as gradle has it as a one liner.
whether it says compile org.ow2.asm:asm:9.2 or <dependency> <groupId>org.ow2.asm</groupId> <artifactId>asm</artifactId> <version>9.2</version> <scope>compile</scope> </dependency> is hardly earth shattering
not good ):
I’ve thought about expanding the offline player functionality
But that’s a task for another time
Yes but when you got 3 or more of the bottom one then it's gonna get a bit messy where as a single like for each is easier to manage
make it a task for Maows Piping org @young knoll ezpz
I’m in that discord
<dependency><groupId>org.ow2.asm</groupId><artifactId>asm</artifactId><version>9.2</version><scope>compile</scope></dependency>
It’s uhh... going well
one line, problem solved 🙂
lmao
then we make a new library, piping-pdc
What risk is there now? I thought there's no more risk and that they got over the dmca shit?
I mean, couldn't spigot do what paper is doing and upload patches? That's allowed.
That’s what they do
isnt the stash for the cla or something
Hmm?
to avoid what happened to bukkit in the first place
That’s what the CLA is for
or is that solely BuildTools purpose
That as well
I thought they got over all that tho
Over what
The dmca shit
Yes, and
That was 2014 iirc?
The CLA I believe is in place to protect against it happening again
And buildtools is there because you still can’t legally host Mojang code online
yeah
Which is why it’s hosted in patches and buildtools sews them together
its probably just not worth moving the codebase back over to github at this point
I wish md 5 would work with paper to just release one version with all of their changes built in instead of having to wait
I’d assume so
are you trying to make custom items with the same animation like the totem?
It wouldn't take that long would it?
Philosophies when it comes to spigot
well i remember it was hardcoded only for the totem. maybe try make another texture for the totem lul
I guess is the word
philosophies and priorities probably
im not no, the other person was trying to make the totem animation use a custom model data texture afaik
oh sorry i replied to wrong msg :<
Md 5 likes to do it all himself... Paper understand they need to work as a team to get it done. If md 5 let others work on the updates we could likely get the updates faster
many people contribute to spigot?
you have no idea what you're going on about
mdaddy finally here
The paper team said that you prefer to do it all yourself.
why should the paper team speak for md
That's what they said in a livestream, I'm only saying what I heard from them.
and if you want to have a say in how the project is developed, then become a contributor
It actually is all md. Choco, Doc, Me, everyone else that has contributed
We are all actually md
I mean, there's a lot of nms stuff you also need to learn to maintain it right?
He’s a hive mind
Tbh, I should be careful at what I say because md could just ban me from the spigot site at any time
just dont talk abt paper ;^)
Well
I don't think i have broken a rule
Don’t go recommending paper to everyone
Why not
Mentioning it won’t immediately get you executed
i do think it does break some back compat?
Because this isn’t the paper discord?
*backward compatibility
It does
paper
like what? just ask, if you know
I mean, there's no point trying to recommend it a lot of people already use it so...
i thought it only deprecated methods for now
Paper just fixes the bugs in spigot
okay then it kinda same spigot
If it does it’s not intentional
Well, no
nothing bad other than deprecate methods and stuff?
I just wish spigot would fix the load times ngl
That doesn't mean that paper doesn't have its fair share of bugs. cough nocom exploit cough
the few times i used paper it subtly changes behavior in ways i can't fully explain
Did you configure your files?
I believe paper load times are due to async chunk loading
But in the end, when running a production server it doesn’t really matter
Would it ever be possible to get the speed of 1.12 again in new updates?
used the default configs, but i dont think the subtle oddities are due to that
im gonna run craftbukkit then 😎
I’m gonna smack ya
It's just getting slower and slower each update. Something needs to be fixed in either the spigot api or Minecraft end.
youch
It’s minecraft
oh the speed issues are definitely mojangs fault
Every update is adding 5 seconds on the load time lol
I’m not going to sit here and say Mojang is perfect
But they do at least try to optimize things over time
Mojang isn't perfect ofc not
I think they need to focus on server side now don't they?
Like how fast things work backend etc
Sorry
They've been slowly improving it over the last 3 updates.
384 blocks tall
They being mojang
It's sad that the community have to try and fix their messups
Name a game where the community doesn’t
Hm... True
Do you think if all of the devs worked together we could rewrite spigot from the ground up?
did ya know why the update is so long?
this video should probably answer that
https://www.youtube.com/watch?v=dJVBNAqieDM
Mojang also keeps their dev team small on purpose. If it gets too large, it could impact their agile workflow.
Fair enough
because they are too busy with adding vanilla-like features, maybe they dont have time to optimize?
They do
They optimize every update
But they also add more content every update
It’s a constant game of cat and mouse
With a code base that’s 12 years old and was made by someone else
I mean, they've been rewriting most of it for a while now.
Yep
Ever since 1.14 really.
how long people gonna hold onto the notchcode thing
< 1% would be my bet
Was notch well versed in java
Well enough to make the game.
plus the game performs far worse now than it ever did
It's no secret that he's not the best java developer
so if anything notch code was an improvement 😉
Idk about that
I mean, the game is also a lot bigger now. Feature wise
If you reverted all the code back to what notch had
I don’t think the game would run better
boot up beta 1.7 and see 🙂
Beta 1.7 had far less features
There was one really cool feature notch made back in the day. The super resolution screenshot tool. Wish that was in the game today.
Ah yes the mega screenshot
The isometric world screenshots were also really cool.
how to make a cool name
I’m sure mods can do it
I wasn’t talking to you
ye i know
What do you want a cool name for
Sir Bartholomew Gregorius III
okay thanks.
Write a cool name generator lol
microsoft doesnt know how to code in Java confirmed
I do find it odd that Mojang turned down Jellysquid for a job
Bruh, Mojang are the ones who develop Java edition. Not Microsoft.
Well duh, they use C#
i just like bullying microsoft
Fair enough
actually, i just like cyberbullying in general
Bullying big companies is fun
you say mojang and microsoft like they are different things
true
They are
lol
lets go steal some code from 1.8 and put in 1.18, you will see the performance is unbelievable
I mean yes, Microsoft owns Mojang, but they have let Mojang develop instead of taking over like they normally do.
I mean
I’m sure they have influence on them
But Mojang wasn’t just completely absorbed, it’s still a distinct team of people
Hey quick question: I am currently programming that players can claim chunks through my plugin by placing a specific item in the chunk. This will then store the id of the chunk (chunkX + "." + chunkY) under the person's name in a MySQL data table. Now, however, for certain scenarios, e.g. if the chunk has been claimed by another player or you have claimed it yourself before, I wanted to have the player always send a message regarding this and wrote the following lines of code for this:
if(MySQLMethods.getPlayernameByChunkid(chunkID) == null) {
MySQLMethoden.addChunkId(player, chunkID);
player.sendMessage("You have claimed this area with the id " + chunkID);
} else if(MySQLMethods.getPlayernameByChunkid(chunkID).equals(player.getName())) {
player.sendMessage("You have already claimed this area");
return;
} else {
player.sendMessage("This area was already claimed by another player");
return;
}
The getPlayernameByChunkid method searches the database for which player this chunkid was stored under, based on the given chunkid.
My problem now is that the code right after the first if query is never executed. Even if no player was saved under this chunk. So the plugin doesn't seem to identify an empty table row as null. Does anyone maybe know how I can do this correctly?
Maybe cache the result of the method then use it for your comparisons.
That way you don't have to query twice and still have accurate information.
can you show us what your getPlayername method does?
public static String getPlayernameByChunkid(String chunkID) {
try (Connection conn = main.getDataSource().getConnection();PreparedStatement stmt = conn.prepareStatement(
"SELECT playername FROM playerdata INNER JOIN chunks ON playerdata.id = playerid WHERE chunkid = ?;"
)) {
stmt.setString(1, chunkID);
ResultSet rs = stmt.executeQuery();
if(rs.next()) {
return rs.getString("playername");
} else
return "";
}catch (SQLException e) {
e.printStackTrace();
return "";
}
}
^^
Yes I also just noticed that
Okay it works. Thank you so much for your help
i wonder if using ChatColor.RESET is easier for client to compute clientside than ChatColor.WHITE
which one do you guys prefer use to reset color to white
i would use reset if im reseting underlines, italics, etc
but is it any different in clientside for color rendering
just out of curiosity
i imagine any difference is negligible
MySQLMethods.getPlayernameByChunkid(chunkID) store this value instead of running it 2 times ^^
isnt reset basically change the word to normal font and set the color white?
let me check
yes it does
but client should have some kind of buffer
to hold formatting information
i guess none :?
hypothetically this could mean that ChatColor.RESET just flushes that buffer, thus saving negligible performance
or it could be in reverse
anyways
im gonna use RESET only for resetting for all of the formatting
WHITE for changing the color
but this still makes no sense in legacy formatting since, &c&lHello &dworld! would not render the world! text fragment in bold
anyways, bullshitting here, because i haven't opened MC client code myself
this is just a theory
a PREMATURE OPTIMIZATION THEORY
it always is
like from 1.8, maybe pre 1.8 too idk
from the future to the past ?
how ot hide the enchants name from an item
itemmeta -> itemflags
ok
how do I know if World is Night or Day?
litterly 5s google search:
is there a way to create a entity without spawning it?
what do you think of?
not with the api
hmm ok thanks
this could be a oneliner
not my result tho^^
but you posted it^^
just showed that its 1000 times faster to google first ^^
no you showed the solution in bad
if you write it in one line he wouldnt understand it ^^
then let him understand it
i am not here to show the smallest complicated fastest method for something ^^ if he understands this simple small snippet he can modify it to smth smaller
you want to copy a world async ?
A question I'd have:
I'd like to add a delay to a certain part of my plugin which is contained in a for loop.
I'd like to delay the second for loop though, problem is that I want that for loop to finish before continuing with the rest of the code, cause atm it just kinda skips that for loop since the outer for loop continues.
you want to delay the inner loop but want to run the next loop after the first one finished ?
i dont understand the problem correctly
you want to delay inner loop
but what then
sounds like you need BukkitRunnables
and only copy laggs ?
do you create the World or only copy it ?
hmmm just cloning files async should not lagg that much .... only if you create the the world2 then
File copy is resource heavy. Your server will lag even if you do it async, unless you rate limit the copying
so you create the new World too ?
ok your description of the problem is just terrible and you did answer wrong before
this is not teh overworld you are trying to unload I hope
even then.... where is the problem :p i unload the overworld and create a new overworld because the current WorldCreator sucks
You can;t unload any of the main worlds. Its blocked in code
it's in progress but I'm alone 🤣
oh yes by using the API its blocked xD
but its not the copy that laggs ... its the WorldCreation that laggs
you cant do smth against that.
try setting to not keep spawn in memory, then unload, copy, load
you can listen for WorldInitEvent and setKeepSpawnInMemory to false
this would stop loading the world spawn region while creating the world
it will load if you join the world
whoops sry I was gone for a sec, so the issue is, I want the inner loop to run where every time the loop runs a delay occurs, but the outer loop should only increment by one when the inner loop is done, which it doesnt do, it more or less skipps the inner loop completely when I try to use a bukkit runnable
having smth that is that laggy will freeze your server too ?
getWorld().setKeepSpawnInMemory
you can try to use paper ^^ but there is nothing else you can do there
yes but im confused which of the three to use
there is something magical in every coding language called "try and error"
well you can modify the server-jar and create a better system ^^
where do i post bungeecoord help
in here
hey so earlier i was putting protocollib as a repo in my plugin, and i thought i was doing something wrong so i stopped the pom.xml reload midwsay, and this has been stuck like this since. does anyone know what i should do about it?
restart ?
just do it like you stopped a pom-reload that will never be that dangerous
i hope you closed and then opened
oh wait
lmao
closed and opened*
anyways another question: when should i be using packets and when should i be using events?
events whenever possible
packets never
packets only if api does not contain that function you want to do
doese.getCurrentItem() return the clicked item?
custom blocks and cosmetics with a resource pack
blocks - uses noteblock blockstates, so i need to cancel noteblock blockstate updates
cosmetics - uses armorstands, so i need to teleport the armorstand to the player as fast as possible
on inventory click event
this is correct, right?
it will return the clicked item, right?
It is the item that the play is currently dragging
I think
So yes probably
or item in hand ...
alr ty
how can i do that dupers working
What
what's the packet for when a blockstate updates?
yeah i thought so too
so if i cancel that for noteblocks, they wont change from when they are placed to when they are broken, right?
i was told to use packets
does anyone know how to spawn mobspawner particles like spigot used to
back in the olkder versions
the block particle effect
What if I want to continuously input Entity to runTaskTimer when using runTaskTimer() in BukkitRunnable?
Then do that (:
what's the difference between mutli block change packet and block change packet?
I think one is bundled and as such saves on bandwidth, but I do not know for sure
how do i get the block from the block change packet tho
depends on what you have already ... if you already got the packet you just need to run a method
if you have nothing switch to google and search for catching packets for players first
manager.addPacketListener(new PacketAdapter(this, PacketType.Play.Server.BLOCK_CHANGE) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
}
});```
this is what i got
oh... protocollib
ye
probably packet.getData or smth and then read the block
its probably an integer saved to the packet for the type and the position should be with a method
try and error ^^
idk how
i tried broadcasting the getBlockData
with the .toString
it just sent the same thing
what does getblockData return ?
would be easier if i had protocollib - idk
what?
They are methods
im very new to packets, could you elaborate?
getBlockData#read?
its not packets which is your problem... you dont even use packets... you use an API for packets
and for that API there are docs you can read ....
im supposed to put something inside read()
What does it tell you to put?
put in true
All of this has Javadocs, you can check them for yourself
int fieldindex
?paste
then its 0 or 1 or 2 or 3.... try and error
Or be smart
And check the Javadocs for what it wants
yeah i know it must be 0
Rather than just guessing
best way to learn is making mistakes
get block or death location is prob null
If you are talking about like 6, that is
the one after line 6. But I logged the variable deathchest
and that returned a block
and the type was CHEST
which is good
Can you show the npe?
Someone else will have to help you, I got to get back to work sorry
to cancel a onPacketSending thing i do event.setCancelled(true); like any normal event, right?
probably wrong Chest import ... which import do you have ? @fervent gate
why you dont try to test if your method exist ?
why u mad
the bukkit one
this is the code with the npe
right
how do i check the event type of the block change? like i want it to only cancel the event if it's a blockstate update, not a place event or a break event or whatever'
exact name ?
import org.bukkit.block.Chest;
because there are 2
I need the second one?
no
the second one would be
block.data.type.Chest chest = (block.data.type.Chest)block.getBlockData()
which line is NPE ?
It prints up to line 6
there cant be a NPE if deathLocation is not null
What line is the NPE
It tells you
can you send full class ?
and which line there is now NPE ?
35
That shouldn’t compile
Ide should warn that
It logs in chat and it spawns a chest on deathlocation
it is a eventexception: null for me, but the error is in a link
Huh, so I'm working on a Villager Reputation API for a PR and I just realised that Villager trade reputation is per trade, so you actually get more rep if you trade for an item 1 by 1 rather than an entire stack... seems strange
Don’t read that part
Read the caused by part
well just do
Chest deathChest = (Chest) deathLocation.getBlock().getState();
apparently block change packet does not include blockstate updates, does anyone know which packet does?
Line 36
No
I typed that by accident, that wasn't in the code
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock cannot be cast to class org.bukkit.block.Chest (org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock and org.bukkit.block.Chest are in unnamed module of loader java.net.URLClassLoader @46ee7fe8)
try this
There you go
the error is already in this chat
You can’t cast block to chest
Oh ok, then how do I get that chest?
Chest deathChest = (Chest) deathLocation.getBlock().getState();
Chest deathChest = (Chest) deathLocation.getBlock().getState();
Chest deathChest = (Chest) deathLocation.getBlock().getState();
.
This way?
yea ok
trying that now, thx
how can i remove all recipes
just making sure you can see it now 😄
vanilla*
kill all players that want to craft items
Use the recipe iterator and just call remove on all of them
nol ike vanilla recipes
hm?
how do i do tbat
Bukkit#recipeIterator
check the iterator for recipes with namespacedkey where namespace=minecraft
Just calling .remove on the iterator should work, if not use removeRecipe
Bukkit.recipeIterator().remove();?
it creates a now one ... so maybe not
no
Can you find what is static?
String password = plugin.getConfig().getString("Account" + player.getName());
Config.yml:
Frolic_gamers: "test"```
your method is not static
I'm trying to save player's data
will this work
dont save with playernames use UUID
No
Also that doesn't match config
how to match it
...
This
Type the same word
it litterly tells you where the problem ist
you run detectTarget.Function()
but detectTarget is the class itself so it can only use public static methods
but you want a public <not static> void method
public static void start... would be right there
DeTeCtTaRgEt
Iterator recipeIterator = Bukkit.recipeIterator();
while (recipeIterator.hasNext()) {
Bukkit.removeRecipe((NamespacedKey) recipeIterator.next());
}```
Isnt it way better?
No
Recipe is not a namespaced key
You can’t just cast it to one
kay so make it a namespaced key?
No
Check if the recipe is keyed
And then cast to keyed
And then read the javadocs for the method to get the key from a Keyed object
if the recipe is keyed?
if(recipe instanceof Keyed)
?learnjava when
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.
kay not helpful
^
?????
I’d you don’t know java, don’t go making plugins
Trust me
You already have the recipe
Um I want to create a field in config.yml from command. For eg if player is new and joined the server, a field should be created by his name, for example Frolic : password
Don’t
i dont tho
yeye UUID
I have a recipeiterator
Bukkit#crashServer
Yes
but how do I make custom fields
And Iterator.next() is a recipe
and im not sure what im suppose to do rn
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
UUID : Password
it isnt the key?
ik it
like this
oh
just need to know how to create from command
if you know how to create a cmd ?
okay sorry again but why do you check if the nanespace is minecraft?
is it because of the uh minecraft:recipe