#help-development
1 messages ยท Page 277 of 1
pong
Did i ping at this reply?
cheerio
Why does it not work?
"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.
does a java.util.ArrayList remember the order its in?
splendid
is Annihilation you main class?
?di please
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
that
gamerule immediateRespawn ?
shit right
ye
if thats the case something is going wrong here
u cant make another instance of ur class that extends JavaPlugin
Right
Use di
no
Will do
using 1.8? :d
1.19.2
doImmediateRespawn prob
ah really. ur making an annihilation plugin for 1.19 ?
Mhm
current ones are either outdated or are just shit
thats interesting im working on an annihilation plugin as well haha
Oh damn
it's theoretically not that hard
Since I'm still a beginner, it's a bit lengthy for me
it can be
mine for example has to be fully modular to support adding multiple different game types easily
as the server im making it for has a few different versions of the game.
Ah right
My progress so far
just working on the teamRespawn event
when player dies
get their team
get their team spawn
spawn them there
u have ur naming conventions the wrong way arround ๐
class names start with an uppercase character
Right, so I had it right the first time round
packages are all lower case
ohh
shi right
xD
thanks ๐
I mean
what's the point in doing it?
It still works for me
its just minimal naming conventions set by oracle.
Right
it makes your code more readable as well.
aight
go to c++ and suffer
Holder doesn't get set. Can you help me, please?
this.holder = new FurnaceHolder("smartFurnace");
Inventory inventory = Bukkit.createInventory(holder, InventoryType.FURNACE, Legacy.translate(title));
CustomHolderClass:
@AllArgsConstructor
public class FurnaceHolder implements InventoryHolder {
String inventory;
@Override
public Inventory getInventory() {
return null;
}
}
How do i filter out specific console logs?
I tried adding a filter but that doesnt work for some reason
show errors? or explain the problem you are experiencing and when in the code
also dont you need to make the String inventory field a Inventory field and return this.inventory; in the getInventory implementation?
-
No errors, but obviously I can't use the IF Condition to check if the Clicked/Closed/Opened inventory is that furnace.
-
https://www.spigotmc.org/threads/custom-inventoryholders.253149/
Never had this problem before (using that class), switched from Paper to Spigot and here we are.
The problem happens only with this furnace inventory.
guys am trying to develop a custom plugin for my server, I want to use the essentialsx's player head thing
can you get the holder from the inventory view?
do they have a public api or something using which i can code it??
public FurnaceGui build() {
this.holder = new FurnaceHolder("smartFurnace");
Inventory inventory = Bukkit.createInventory(holder, InventoryType.FURNACE, Legacy.translate(title));
for(int i = 0; i < elements.size(); i++) {
inventory.setItem(i, edit(elements.get(i).getStack(), elements.get(i).getCustomModelData(), elements.get(i).getDisplayname(), elements.get(i).getLore()));
}
System.out.println(inventory.getHolder() == null); // ! THIS RETURNS TRUE
this.inventory = inventory;
return this;
}
Holder doesn't get set (Look at the comment inside the code)
Okay, It's correct
bukkit might do some checks, maybe try setting that inventory in the holder and have it returned by getInventory()
My code with PlaceholderAPI:
String withoutPlaceholdersSet = "%player_name% &ajoined the server! He/she is rank &f%vault_rank%";
String withPlaceholdersSet = PlaceholderAPI.setPlaceholders(event.getPlayer(), withoutPlaceholdersSet);
event.setJoinMessage(withPlaceholdersSet);```
But the join message in the game is "%player_name% joined the server! He/she is rank %vault_rank%"
There are no errors in the console. Player is registered expansion.
How to fix it?
pretty sure createInventory(..., InventoryType.FURNACE, ...) just ignored the holder lol
this is the source code behind it
NICE
rip
you could make like a custom furnace gui with a chest gui
or something
or just check the getInventory instance, might work but i dont know if it would be identical
... That's why, sometimes, I prefer using Paper
all the types that are set to DEFAULT_CONVERTER can be used with a holder
others will just ignore lol
that's no-sense
it creates a tile entity to display the furnace gui
i think
but it doesnt store the holder anywhere
it's called "doImmediateRespawn"
also why is spigot making shit a pain in the ass
the package is just org.bukkit.craftbukkit in the source
What could I do to identify that inventory...
but when you try to use it in code its org.bukkit.craftbukkit.stupidfuckingversionstring
use a Map or sth to store the inventories you created
yeah that's annoying. they relocate that package using the maven-shade-plugin
idk if identity is consistent tho
So... the check would be
event.getClickedInventory() != inventory return;
right?
yeah
thank y'all
but dont register a new listener for each gui
this will only work if you only ever have one inventory
usually you will want to create a map
getting these errors, A little confused
uhm, it's a setup gui... That's the easiest way to avoid using maps and some crappy things to manage more player at once
then check if the map contains your inventory
giveConfig() ?!?!?!!
https://www.spigotmc.org/wiki/using-dependency-injection/ <- I'm so confused with DI
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
wait a second
do something like
Map<Inventory, FurnaceGui> customInventoryMap = new HashMap<>();
@EventHandler
void clickEvent(InventoryClickEvent event) {
FurnaceGui gui = customInventoryMap.get(event.getClickedInventory());
if (gui == null) return;
gui.onClick(event);
}
read this ^
aight
here I explained both concepts (static getter & DI)
sweet
wdym a setup gui
will you only allow one player at once?
damn this sentence is fucked UUUUP
I'm actually doing a Identity-Setup gui...
I prefer to maintain a listener for each player who see the gui
NO
but thats slow
yes
using a map is not that hard bruh
here
then just do your code in FurnaceGui.onClick(...)
if you don't understand how maps work, tell us, and we'll explain it to you
Oh... hmh
and otherwise youll have to make sure the listeners are unregistered and shit
when youre done
this is much easier
i use one listener for every single gui of any type
one to rule them all
nobody ever thanks me ๐ฅฒ
trying to write archetypes lmao
what the fuck is an archetype
don't you use maven?
- use grdaldle
gradle doesn't even have archetypes
an archetype is like a "template" for a whole project
wow, one file
with one line of code
paperweight userdev + javadocs + publishing set up in one line
basically this is an archetype in maven
ah
and then it generates plugin.yml, main class, pom.xml, and other stuff
waht is curently supported java ida?
intelliJ, eclipse, netbeans, ...
choose whatever you like
most people will tell you to use IntelliJ
including me
Waht is the best software for java?
imho IntelliJ
i am using visual studio
Explained it perfectly
perfect!
thanks
no problem, glad I could help
VSCode?
Yes
grdaldle archetype, in this case for one module
but you could just put one of these in your like app data or something and use it anywhere
you are better off switching to IntelliJ
i make my all stuff on code
but i`am Backend dev. im learn curently java ida
intellij has faster intellisense as well
How can I check if the listener is already registered?
why would you need to check this? just don't register it twice
just register it once in onEnable
I mean you should know when you register your listeners
and then make sure its never registered again
oh wow inteliji have loot of features o,O
ofc it does
Guys... FurnaceGUI is like Bukkit.createInventory()...
It's called more than once
There's a reason why everyone considers IJ to be the best java IDE ๐
?
that doesnt register a listener
// Nothing to see here
nooo?!
have a FurnaceGuiManager
wtf are you doing
yeah
bruh
bruh
Wtf
null ๐ญ
they probably just used "null" as example, chill out lol
is community edition Inteliji ok ?
OnEnable, this is how you register your events
ok 
CE = Community Edition
Then in your class:
inteliji req Java or installed automatic?
you get all the jetbrains products for free if you are a student
(don't worry about the setCancelled() thing)
You need java
https://adoptium.net/ get it from here
it gives you the option to install when you first launch
or from oracle website
Oh? my bad
java com unsupported?
or that
that works too
Wait
No
You need development kit
Java.com provides SE
not JDK
no image perms ๐
?img
Not verified? Upload screenshots here: https://prnt.sc/
@daring elm
Just make sure to get JDK
bruh what
even I don't
xD
you didn't copy the full url
??
yes
ok i can Intelliji install with step java installation?
mhm
You can also have multiple versions of java
for me is 17 but 1.13 Server
For plugins, I suggest using this
It's a simple GUI that lets you set-up specific types of plugins
Like Spigot, Paper etc
Set your depends
etc, etc
and for theme, I personally use this
Yeah, thats Java 17
ok i install Adoptium & Java SE
so sexy
Adoptium is just a website that provides JDKs
Java SE is for Minecraft clients
lol
make Spotify theme likes good ๐
administrator
is spigot automatic as lib in intelliji Plugins?
That's why I suggest adding this plugin
Automatically sets up a basic spigot plugin for you
ah lol i dont have see it
any guide to learn 1.19.3 api? ๐ฅฒ
i see items give cmd minecraft:
Intellij can install jdk automatically
told him that ig
go on Preferences
plugins
It should be similar for Windows
if not, the same
File -> Settings when not on macos btw
^
oh thats os
^^
better design as windows ๐ฆ
woah i like english dev community in german all toxic ๐
i am learn new stuff and another peoples say to me "Skid you cant development" sorry i am beginner .-. xD
whomst mentioned germany
This is dangerous
Hi, how can i hide player to another player without removing it from playerlist? I'm currently using hideEntity method
Player#setVisible?
without removing it from playerlist
or
xD
np
Player#hidePlayer
without removing it from playerlist
only by sending a packet
doesnt setInvisible makes them invisible to other players but doesnt hide them for tablist?
heard somebody say that
sorta like invis pot
let me check for you
Straight from the mc sourcecode
Entity.class
from nms?
nah I have a fabric project open
I am looking at the genSources code
this isn't NMS
not bukkit
not spigot
just mc generated sources using fabric mappings
the logic is the same though
๐ค
npe incoming
NPE incoming
get ninjad
fuc
brug
ohh, so you mean it's client, right?
hmm whats CraftEntity#getHandle returning
oh right; error
nms entity
what class
playerTeams.get(player) can return null
you should check for that
oh probably cant look into that sourcecode
there's the stash
I did, I think
need the class name then
okay, where did you get this sources?
it was outside screenshot
Open a fabric project -> gradle -> gensources
dont check Map#get twice
thx
cuz its not needed
check if get returns null when you run the get op
aight
also, why is the hashmap public but there is a method to get from it??
if youre going to make a program that must be fast it wont if you do that kind of stuff
I can't compile until this is fixed
Idk
hashmap is too slow for my parser \๐ข
made my own data structure to store functions
try fastutil
they have like Int2ObjectHashMap and shit
for every primitive
it's a great lib
Changed to private
hashmap wise i would need a Map<String, T>
*Biased: It was made in italy
iirc there is one for that
wait
well actually i cant have the string
?
im looking thro a char array dynamically
i dont know where my string ends
so ig my current approach is fine
and String#indexOf is slow
hmm yes
As far i know it is dangerous to use
how so
theres like nothing inside of those damn packages
:/
huh never had a problem with that
but I'm also using the ultimate version, but I doubt that there's any difference in regards to this
It's not lmao, basically doing same thing you would do manually
yeah
fixed it
i used to play minecraft with 15 fps so dont complain
i used to play roblox with 20 fps
Small question
When you setBedSpawnLocation
does it reset after the world is regenerated?
by regenerated I mean unloaded and a blank clone of the world is unloaded
Iyea
Hunger games with 15 fps
But coding is even harder
any ideas how can i get full spigot jar with nms with yarn/fabric mappings?
Probably better to learn and use mojmaps
You can use screamingsandals to compare mappings
Olivo is our god
still wondering how sandals can scream \๐ค
yes, i know
but why is it better to use mojang mappings?
They're complete (exept params), easy to use and the same on each platform
?nms
?switchmappings
read both
TL;DR: you won't get any yarn mapped spigot .jar unless you create it yourself
why not just use mojang mappings?
as i see yarn mappings are more comfortable to use for me
are you using maven?
gradle
you will have a very bad time if you don't use mojang mappings
idk if there's any gradle plugin to switch yarn<>obf mappings
all I know is that it easily works with mojang<>obfmappings
because there's no gradle plugin that does this
how can i create it myself?
okay, so i can try with maven
@tender shard since ur the pdc champ. would u have any idea why this doesnt work?, its sets the pdc fine. but when i click the block the pdc is empty.. https://paste.md-5.net/osupuqiruw.cs
you need to state.update() as you are working oni a snapshot
i see, thanks 
looking at stash is fun
Hi guys. I came across very weird thing. Every time I spawn an endermite with plugin it dies immediately. It does get spawned but straight up dies. I could not even debug damage cause with EntityDamageEvent. Any ideas how to fix this?
Huh, maybe OldCombatMechanics could be causing this?
@EventHandler
public void anvilDmg(EntityDamageByBlockEvent e) {
Block block = e.getDamager();
if(block != null && block.getType() == Material.ANVIL) {
e.setDamage(1000000);
}
}
why does this not kill a player when the anvil hits them
if (false && bruh
they could just comment it out
yeah
no, thats a smaller diff
when you are working with patches, it is soooo much better
\๐ค
cause if more stuff is added inside the if statement, you dont have to then go and comment that as well you can just leave it on the if
/**/
go look at some paper patches
dunno what that stuff is even supposed to do
how do i set world's time to night?
this one isnt working
world.setTime(12 * 1000);
how is what rendered?
i mean patch files arent supposed to be edited by hand so it doesnt need to be easy
ugh
help
that's everywhere lol
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
yea
I need help
in what
help
np
anyway I just wanted to say:
don't just say "help" but rather ask your original question again
i just replied on it
aint that spam?
just do it, I am too lazy to scroll up
how do i set world's time to night?
this one isnt working
world.setTime(12 * 1000);
hmmm try using 18000 or sth
k
0 is probably "morning" then
aaa
0 is 6am or 8am or sth
intresting
As I remember to get nested class you need to do something like Class.find("ExapleClass$NestedClass")
yes
but you can call your classes whateer you like
this e.g. would still compile just fine
wdym
I'm on the phone so would be hard to explain whole process I can later send you full example
how do i reset playertime?(set it to current world's time)
ye i was trying to say that $ is used to distinct from inner classes
Not in newer JDKs as I have heard
Although I don't know whether that is correct as I rarely use those signs
just tried on java 17, works fine
yep it does
Yeah, then it is an issue caused by incompatible encoding standards
only a bunch of warnings
Since newer JDKs use UTF-8 and many editors still use whatever the device standard is
my plugins always look like this lmao
and no, that's not inner classes
they are indeed called like that
As in those are obfuscated
I believe recaf might be choosing the system default by default
im thinking about putting my whole os in english
it didnt make it use german on purpose
worst mistake i made
uhu
uwu*
does not compute.
uwu does not compute?
uwu does compute
would there be a way of doing this?
public static Class<?> parseClass(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}
public static void test() {
Class<Location> locationClass = (Class<Location>) parseClass("org.bukkit.Location");
PlayerVariable<locationClass> thing = new PlayerVariable<>(Bukkit.getPlayer("OutSpending"), "test", null);
}``` i'm just wondering

and why is because i want to use json for storage so i would also store the class then parse it back to it
It is possible.
.
yes but im storing it into a json aka object so i was wondering if i could store the class name and then parse it back to the class after
so i can store whatever i want
?paste
https://paste.md-5.net/hiyubukovu.java Here is simple example how It could be done
whats that supposed to do
get certain enum value with reflections
๐คจ
what about valueof
dont need to recompute name method for each constant too
clazz.getMethod("name")
I was thinking about it
but
Method valueOf= clazz.getDeclaredMethod("valueOf");
this code throws exception
what exception
shouldnt Method nameMethod = Enum.class.getDeclaredMethod("name") work?
fake metadata
Is it possible to make a fireball invisible?
And is there a way to give it a time until it disappears automaticly
?
With the API, I don't think so
With nms/packets, just send an entity destroy packet to the player
how can I do that?
Are you any familiar with packets?
no
I never used nms before
Read the packets section
alright, thank you!
You might need the mappings part too
also one of the images ain't rendering grr
Updated the post to include image urls
I now wrote my own binary- and json (de-)serializer, whether it'll be any good remains to be properly tested, xD. If anybody's interested: https://github.com/BlvckBytes/ItemSerializer
whoa
looks like the code for my reflective pojo mapper
It's all based on predicates and "fuzzy searching". Works pretty well, I'm happy with the little lib! :p
Paper has a method to serialize itemstacks that passes through that one thing known to be a performance killer
I don't know why item serialization is still such a pain...
https://jd.papermc.io/paper/1.19/org/bukkit/inventory/ItemStack.html#serializeAsBytes() well it is quite easy if you use paper
just get the master compound and serialize it :)
Guess what my lib does, xD.
reflection
But the custom binary format really manages to squeeze it together
?whereiam
How else would you confidently serialize it?
?whereami
You are disconnected from the world
Ah, yes
Next to no people use plain spigot. This server is only alive for historical reasons and due to paper being paper
Really lovevl being on spigot and recommending ppl to use a software were they comm is really toxic and their people are ussesless because they shity you for not knowing
Me, having only used spigot until now: :-:
But well, I'm also not running any servers, just developing, xD.
does not compute.
paper is nice as a software, the community is not that great however
just like all things honestly
Exactly.
yeah its exactly the same what i said
most games are like that
Parser error? Or interpreter? xD
Verifier error
Sorry man i worked all night from 9pm to 6:30 am as djs, im really tired and with like 90% of alchool in blood
aren't you like 15?
16y and i work tho
close enough
Yeah haha
lmao
Its really accurate
I've been working since I was 11-12, doesn't really matter
I just don't see the appeal of alcohol
Alchool make you say 100x stupid things and all the time than normally
I have never worked myself (If you ignore all the FOSS stuff I am doing, which should be considered working in itself) - and the only alcohol I consume is the occasional cider from Aldi (which has next to no alcohol)
alcohol doesn't make you say stupid things. it rather makes you do stupid things. for example, yesterday, I was sad about my dead cat. then I joined this "yo my pet died" discord. and now I'm not only sad about my own cat, but also about everone else's
bruh
cider is nice
there's this fancy custom burger place
I go there, get a cider
get a nice borger
That's the only alcohol I ever drink
that seems like an odd combination
I can guess that
Oh @dry yacht by the way: The reason BukkitObjectOutputStream performs so badly is because java serialization sucks. It's not as bad as YAML serialisation, but it has similar overhead as the full class name is written for each object alongside the name and descriptors of fields and more. It's disturbing really
trust alex, this man has experience.
Yes, it is disturbing. I'm not really willing to use such an API in any of my projects. Since I got into C, all this overhead is really hurting my feelings, as I've grown more conscious of it. Sometimes you really cannot do better in Java - cause it's Java, but with this topic you just can, as I proved with my stupid simple serializer. There surely is a reason why "they" didn't do it that way, which I yet have to trip up on.
Generally with java you can do better. My RegionatedIntIntToObjectMap is a perfect example of it. I highly doubt that it is a C-specific thing (outside of C not providing the sluggish niceties)
You can (almost) always do "better", but sometimes just not as good as in a language which offers you full control. What implementation are you talking about there, is it public?
whut
the ObjectOutputSteam is way better than the yaml struff
Hey all, someone asked me to make my plugin compatible with the isAFK() method of the purper software. My question is, what is the easiest way to achieve this?
Oh wow, that looks very interesting! I'm already pretty tired and feel like I need a break, but I'll definitely get back to that, thank you. I love how you documented everything with proper explanations.
Looks like it's used in a region claiming plugin, which is something I was daydreaming about just recently. I asked myself how I would ever manage to look up regions by an (x|y) point inside of it's area definition efficiently. Don't yet know if you solved that with this map, but it still looks like a nice general solution.
This one is a chunk-aligned plugin, but you can definetly use that for faster lookups
It feels to me like going on a more granular level than chunks is insanity anyways, but I'd still love to try it, haha
how i can get current tick number or execute some code every so i can count ticks myself?
which tick number are you looking for
what do you mean by which tick number?
Average or absolute, probably. Which of the two?
ticks per secon, randomtickspeed, ticks elapsed since start etc?
ticks elapsed since start
have a task that runs every tick which increments an AtomicLong
Is there an event that gets triggered when a crossbow is getting charged?
If u go on the default world and use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/World.html#getFullTime()
declaration: package: org.bukkit, interface: World
thanks
Although now that I have had a few minutes to think about it, I am sure that if you were to use Panama or the Unsafe you can get speed that would be adequate for per-block lookups (the issue really being writing large amounts of blocks - i.e. if you were to claim 100 x 100 x 100 blocks you'd be at 1 000 000 writes) while using the same principle
Although I'd just store the bounding boxes of your regions on a per-chunk basis instead of a per-block basis
how can i get the players client version
Use the api of the plugin allowing multiple versions
Otherwise it will be the same as the server
okay but what do you mean by this?
For example if you're using via version use the via version api
do you have viaversion?
If so it'll be through there, if not it'll be = to the same major update as the server.
No, because i dont wanna use viaversion
I just wanna grab what version the user is on, example if the server is 1.19.3 then if the user tries joining just on 1.18.2 then it kicks them saying they cant use 1.18.2
It already does that.
Yeah but i dont wanna use viaversion
Go use protocollib though.
as i said
yes and i am already using it, but idk how to get the users client version through protocol lib
Vanilla will already block versions that don't match the server version
And it will tell the user what version they should be on
Yes but i wanna use a custom message
not none of that boring white msg saying outdated version use 1.19 for ex,
is there any way of knowing where in the tick you are
idk something like this https://www.spigotmc.org/threads/tutorial-getting-the-players-client-version.134397/
Take a look at wiki vg it has the packet information
what exactlyy are you trying to do
usually nms stuff runs first
then bukkit schedulers
i am aware of the tick loop. im spreading work over ticks though and wondered if you can tell where in the tick you are
I mean, why
you always have time
and dont want the tps to ๐
if you're using paper, you have a TickStartEvent that you can use to limit stuff towards the end of the tick
so like
start = System.currentTimeMillis
yeah I am aware of their event
then you do stuff
but this is spigot sir
yeh
in that case you can't know how much time you have until the next tick
well
you can probably use a different thread and do some syncing somehow and then keep that running. Though any amount of lag will through it off and u need to resync.
what type of field?
I guess there is no way of knowing if there are scheduler things after you
but you could account for that
so farmland?
hee hee
can't find anything, so most likely just playerinteractevent
Well
IF it's dirt it's not grass is it
If it's grass it's not dirt is it?
Change the or to an &&
Then what will happen
Change the or to and
in your if statement
It can not be an or
It's quite literally what i said.
IF not grass return. (returns on dirt)
If not dirt return. (returns on grass)
if not grass and dirt return.
Use or
It does
It will literally return if it's anything else but those two
if you do &&
yes
No
You are not thinking in the correct terms.
You are returning
Not continueing
no
if (event.getClickedBlock().getType() != Material.DIRT || event.getClickedBlock().getType() != Material.GRASS_BLOCK) return; -> if (event.getClickedBlock().getType() != Material.DIRT && event.getClickedBlock().getType() != Material.GRASS_BLOCK) return;
Let's try again.
We pass a grass block to the event:
IF block is not dirt or grass, return and do not cancel. It is not dirt, since it's grass so we return and do not cancel.
We pass a dirt block to the event:
IF block is not dirt or grass, return and do not cancel. It is not grass, since it's dirt so we return and do not cancel.
You want to check if it's not both, and then return. Else cancel the event.
I might be too tired let me think about it for a sec.
did you try my weird brain thing.
how can I check if a player keeps holding left click after clicking?
you canรธt.,
IJ even warns you. https://puu.sh/Jv7Fb/0c7cf3dd85.png
oh yes sounds very easy
Current type: GRASS_BLOCK
Testing 'type != Material.GRASS_BLOCK && type != Material.DIRT'
false
Testing 'type != Material.GRASS_BLOCK || type != Material.DIRT'
true
Current type: DIRT
Testing 'type != Material.GRASS_BLOCK && type != Material.DIRT'
false
Testing 'type != Material.GRASS_BLOCK || type != Material.DIRT'
true
Current type: STONE
Testing 'type != Material.GRASS_BLOCK && type != Material.DIRT'
true
Testing 'type != Material.GRASS_BLOCK || type != Material.DIRT'
true
So
As i said && is and
Whats the name of the firework rocket entity?
well when I spawn it it doesn't appear as a rocket
its invisible or something
How are you spawning it
Hello ping for help
yeah
coolio
use join instead of get to avoid trycatching
@EventHandler
public void onPlayerPreLogin(AsyncPlayerPreLoginEvent event) {
ViaAPI api = Via.getAPI();
int version = api.getPlayerVersion(Bukkit.getServer().getPlayer(event.getUniqueId()));
if (version >= 758) {
event.allow();
} else {
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "This server only allows Minecraft versions 1.18.2 to 1.19.3. Please update your game to join.");
}
}
Why does this not work..... like there is no errors, but it just wont let me login with version 1.18.2, on a 1.19.3 server, i get no errors, i registered all events in the onEnable part, i implemented Listener, idk what im doing wrong,
meh it doesnt like the cast
clouds like.... in the sky?... or data
cant you just toggle which versions you want to join with Via
also make sure ur also using like ViaBackwards i think
in the sky ahaha
OwO? what does this look like
Idk???
They do have a config option for that
i would show you, but my server isn't currently loading cause my data loading is fucked. its still very beta stage though
@echo basalt forgot that it needed to be on-main because I was using the World#getChunkAt#getPDC
cache the chunk pdcs or something
like
gather all the pdcs and then do the future stuff?
i think i have made something
I want to make a for loop for all ender crystals, how can I do that?
I got for(EnderCrystal e : but don't know what to put here)
hmm I defo did something wrong, still takes like 15 seconds
public static void saveAllClouds(Set<Cloud> clouds) {
Map<UUID, Set<Cloud>> cloudMap = new HashMap<>();
Map<ChunkCoord, PersistentDataContainer> persistentDataContainerMap =
clouds.stream().collect(Collectors.toMap(Cloud::getChunkCoordPair, cloud ->
Bukkit.getWorld(cloud.getWorld())
.getChunkAt(cloud.getChunkCoordPair().getX(), cloud.getChunkCoordPair().getZ())
.getPersistentDataContainer()));
List<CompletableFuture<Void>> completableFutures = clouds.stream().map(cloud ->
CompletableFuture.runAsync(() -> putAndSave(cloud, cloudMap, persistentDataContainerMap))).toList();
CompletableFuture[] futures = completableFutures.toArray(CompletableFuture[]::new);
CompletableFuture.allOf(futures).join();
waht is the KEY to adding java for my project building (Intelliji free version)
public CompletableFuture<Void> saveCloud(Cloud cloud) {
ChunkCoord chunkCoords = cloud.getChunkCoordPair();
World world = Bukkit.getWorld(cloud.getWorld());
PersistentDataContainer pdc = world.getChunkAt(chunkCoords.getX(), chunkCoords.getY());
return CompletableFuture.runAsync(() -> {
...
}
}
Want to cache it? it's gonna be a bit weirder
Why sending my Console this?
Can't keep up! Is the server overloaded? Running 6853ms or 137 ticks behind
Your Server Being Lagged a lot
just make a new project? lolwtf
No? No Players on my server
Lags?, i have lot of resource
Dude...
private static final Map<Long, PersistentDataContainer> chunkCache = new ConcurrentHashMap<>();
private static final Map<Long, CompletableFuture<PersistentDataContainer>> chunkFutures = new ConcurrentHashMap<>();
private static PersistentDataContainer getContainerFast(Chunk bukkitChunk) { // run this async :)
long key = bukkitChunk.getChunkKey();
if (chunkCache.containsKey(key)) {
return chunkCache.get(key);
}
if (chunkFutures.containsKey(key)) {
return chunkFutures.get(key).join();
}
if (Bukkit.isPrimaryThread()) {
PersistentDataContainer container = bukkitChunk.getPersistentDataContainer();
chunkCache.put(key, container);
return container;
}
CompletableFuture<PersistentDataContainer> future = CompletableFuture.supplyAsync(
() -> getContainerFast(location), MainThreadExecutor.MAIN_THREAD_EXECUTOR);
future.exceptionally(throwable -> {
throwable.printStackTrace();
return null;
});
chunkFutures.put(key, future);
return future.join();
}
@opal juniper
nvm, i'm not Gonna say it, it's Serious Help
make sure to evict entries after like 30 seconds
Use timings
/timing on
Let the server run a bit
Then /timings paste
Ok
What Processor are you using?
Is there an easy way to require stacked items in a ShapedRecipe?
Second
You mean wait a Second?
Hey, I have this code which permits to place sugar cane without water nearby. It works perfectly excepts that it doesn't play sound associated with block placed. Any idea how to solve this?
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
if (event.getBlockPlaced().getType() != Material.SUGAR_CANE) {
return;
}
if (event.getBlockAgainst().getType() != Material.AIR) {
return;
}
List<Material> authorizedMaterials = Arrays.asList(Material.DIRT, Material.GRASS_BLOCK, Material.SAND, Material.RED_SAND);
if (!authorizedMaterials.contains(event.getBlockAgainst().getRelative(BlockFace.DOWN).getType())) {
return;
}
event.setBuild(true);
}
and do a future to get the container
it caches n such
I use that code in a similar way to flood-fill chunk snapshots and detect stuff
went from ~1k bps to ~30k
,g$$$$$$$$$$$$$$$P. ----------
,g$$P" """Y$$.". OS: Debian GNU/Linux 11 (bullseye) x86_64
,$$P' `$$$. Host: KVM/QEMU (Standard PC (i440FX + PIIX, 1996) pc-i440fx-7.1)
',$$P ,ggs. `$$b: Kernel: 5.10.0-20-amd64
`d$$' ,$P"' . $$$ Uptime: 8 hours, 30 mins
$$P d$' , $$P Packages: 936 (dpkg)
$$: $$. - ,d$$' Shell: zsh 5.8
$$; Y$b._ _,d$P' Resolution: 1280x800
Y$$. `.`"Y$$$$P"' Terminal: /dev/pts/0
`$$b "-.__ CPU: AMD EPYC-Rome (4) @ 2.794GHz
`Y$$ GPU: 00:02.0 Vendor 1234 Device 1111
`Y$$. Memory: 3439MiB / 18000MiB
frequency doesn't matter THAT much compared to other aspects
an epyc cpu isn't that strong with single-core workloads
๐คจ ๐ธ
this can probably wreck the pentium with certain tasks
and Minecraft uses 3 Cores at Max
You can have a cpu that does a lot more per clock cycle
i think it does
I write a lot of my plugins to benefit from multithreading
I got for(EnderCrystal e : but don't know what to put here)
and absolutely wreck 16-core cpus :)
sure the core itself doesn't use that much
MainThreadExecutor.MAIN_THREAD_EXECUTOR
but with 2.794GHz it lags so Hard
I named it with the intention of static imports
fuck off
xD
Something tells me you don't know what you're talking about
should definitly increase my os gui scale
i Actually do
you're rating cpus purely based on clock speed
actually doesnt look bad on the screen but stuff is damn small
Yes, welcome to Minecraft
That's... not how it works
single-core performance is the main deal
Multi-core is secondary
single core performance go brrrrrrrrrr
clock speed is just a multiplier for such performance
if the Aplication is Made to use it
so if we have half as many clocks per second, on the same cpu, we can expect around half the performance
Minecraft uses:
- 1 thread for the main server stuff
- a thread for each player online (network, IO)
- some versions may benefit from multi-threaded world loading etc
Minecraft java edition is made to multithread
@buoyant viper
the main tick
woo
Yeah, Basically almost Everything
loop through entities, do random ticks, fire events, handle movement
Stuff like world loading or player IO is done separately
time to make it multithreaded
there is that one mod trying to multithread world ticking
and Chunk Generation thanks to Paper
Minestom go brr
havent used it
Multithread != "1 more thread"
Completely
it means it will take as many as it can (some algorithms prefer to take more threads than others) and spread the workload
hey, I've got a question regarding multiple versions support for nms. I understand the concept with the interface and the copies of the different versions, except the problem for me which I don't understand is: I don't use nms version specific... I use it to get to Mojang:
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
So this is not version specific. which means making copies of the class with the interface doesn't help me right?
What method do I use to make my plugin multi-version compatible?
Now, since it is mostly single-cored
But i mean, a Process can't Divide itself
we should look for a strong single-core performance cpu
intel gamer cpus are usually chosen because they're more focused on that
paper...
lol
like the i9-9900k, 12900k etc
gotta spawn 1 more thread to do the multi thread 
and this Dude is Running a 2.794GHz Amd Epyc Processor (Probably Hosting)
That's not for Minecraft
let me guess, paper lets you do async pdc?
is Runs so Bad
well yeah, but you are using paper
Yes, but that's a feature of this specific cpu
getChunkKey
Paper Loads the Spawn Chunks Asyncronously
ah
i will just find the src
change my mind
/**
* @return The Chunks X and Z coordinates packed into a long
*/
default long getChunkKey() {
return getChunkKey(getX(), getZ());
}
/**
* @param loc Location to get chunk key
* @return Location's chunk coordinates packed into a long
*/
static long getChunkKey(@NotNull Location loc) {
return getChunkKey((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4);
}
/**
* @param x X Coordinate
* @param z Z Coordinate
* @return Chunk coordinates packed into a long
*/
static long getChunkKey(int x, int z) {
return (long) x & 0xffffffffL | ((long) z & 0xffffffffL) << 32;
}
here
what the fuck is this char?
xD
that is not the answer to the problem my guy
thats a thiniking emoji
fuck im so bad at typing on this keyboard
LIGHT MODE AAAAAAAAA
i was not Responding to the Problem
LOL
xD
LOL
Some cpus can have the same clock speed and thread through single-core workload
AAAAAAAยชยชยชยชยชยช
im doing a one week challenge all apps on light mode
Blaming the clock speed entirely isn't gonna be that helpful
example: threadripper
or an underclocked intel cpu
๐ค
Some operations are simply more optimized at a hardware level
You usually Prefer Older CPUs with Higher Clock Speed for Minecraft
<?><?>
Change my Mind
I don't
Just Test it
I actually handle a fleet of multiple machines, and have each machine's hardware picked out for whatever task I'll run
I'm currently writing a system that is extremely multi-core heavy
unicode
That's not an Answer for the Problem
As in: tons of database operations, lots of async
\๐
So I'll probably go for a threadripper or xeon system
fuck atleast this one is normal
Because only nms is running in the main thread at this stage
go for the amd epyc
nah
128 cores i believe
amd epyc is way too extreme on multi-threading
