#help-development
1 messages · Page 397 of 1
wym
I need to make it so others cant see durability of armor (using CIT resource packs)
I think I missexplained
In the serialized class. There's a field called public int secondsLeft for example
No, i understand you but the other guy Is mixing ecerything up and make confusions
That gets changed every 20 ticks
Loading data from persistent into volatile storage is not caching.
Its simply changing the state of your data from "In rest" to "In use"
I can't save the data back into the PDC every time I interact with it. I need somewhere to keep it and be able to use it
I knew i had written something for this XD
lol
Lol
can someone help with this?
I think it's what I need just reading the first 2 lines
Patient bruh
If no one answer just wait and Wait
ok
This Is a community so no one get paíd for instant help
😂😂😂
I love those of type of people who expect instant help asking it un communities where none get paíd. Hahaha
Shity word translatof
Cellphone sucks
Before I read the entire thing @lost matrix . I have a question, Is keeping the data "in memory" once per server restart a bad idea? Can the amount of memory usage be negligible? Should you update every X time?
I know these are probably answered but still
Making it short: What you need is a manager class which holds your live data and changes
its state when the session of your data ends.
A session of a chunk looks like this:
Chunk loads -> session starts
Chunk unloads -> session ends
He nerds More thank that
Because he Will be updating constantly
It's perfect
🤔
Let me implement that brb
Isn't catching used when you need to constantly update a resource?
Opposite
^
I thought that too. I thought it was to keep stuff before having to send it over to a longer term storage
Guess not
Yeah today we learnt something new
Also smth related: PDC what persistent storage type is it?
Shity cellphone 😡
File. Its stored inside NBT compounds of players, entities, chunks etc
Ummm, I can't remove an object from a list using the actual object
I need a different datatype
Cant u save a Map?
Wait, what you need to save? And how you need to retrive them?
:v
You musnt do that, you can be punished. If you dont want to your message get lost you must open a thread on this channel and wait patientlly until someone answer
3rd guy doing the same thing 😡 It doesnt join to my head why they doing that knowing they are in a community meaning that no one will instant help them
Would a Set be good?
Does someone here got time right now and has already contributed to spigot at least once?
I've got a couple questions about my NMS patch, it has some weird formatting artifacts because of how the code was written and I was told to do it like that by another contributor but it kind of looks unwanted.
Would be great if this would be possible to do in a vc (solved)
Depends what you need to and how to retrive
Because in a Map you retrive each object via a key
1m i will provide you something
right
I mean
You can just use a List or Set
I guess I can do Map<MyChest,MyChest>
Set is an un ordered list while List is ordered
No, because I can't remove the item by Object, only by index
Seems like a waste tbh
No?
Just use a List if you want to store a bunch of values. If you need the values to be unique, use a Set.
I can't get the values from either of those using the Object itself
List allow to remove entry by the object
What value do you expect to get if you already have object
List#contains()??
Yeah im really confused
You are probably talking about map
I got confused
??? relax man I was complementing
sorry
i thoug tu were swearing us
u confused to much that my brains get brokened
haha
But i recommend reading about the different collections and what re they diff - They are really important when coding. Obf not being rude
Ik i saved that but didnt know where
I am trying to change other items lore when I click an item but its not working
ItemMeta mobItemMeta = mobItem.getItemMeta();
List<String> lore = mobItemMeta.getLore();
if (lore.get(0).equalsIgnoreCase(ChatColor.YELLOW + "Click to Select")) {
lore.set(0, ChatColor.GREEN + "Selected!");
for (int i = 0; i < mobs.size(); i++) {
if (e.getCurrentItem().getType() != Material.LEGACY_MONSTER_EGG) {
continue;
}
if (i != e.getSlot()) {
ItemStack itemStack = inventory.getStorageContents()[i];
ItemMeta itemMeta = itemStack.getItemMeta();
List<String> lore1 = itemMeta.getLore();
lore1.set(0, ChatColor.YELLOW + "Click to Select");
itemStack.setItemMeta(itemMeta);
}
}
}
mobItemMeta.setLore(lore);
mobItem.setItemMeta(mobItemMeta);```
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
well if there was errors I will say I got errors
oh ok
its not replacing the itemmeta
Is this for a GUI?
yes
ok
okay i understand what you doing
You want to make an updateable button, so when you cliked it out, its lore get updated
no
- You should not change your GUI icons like that
- You should never identify items by their name or lore
how can I do it then
This gives you a good base line for GUIs
In case of gui i would use an api
In case you dont want to code a lot and not wondering to mess a lot
I made a great system I just want to fix this
Alright. Then print out some debug messages. Does your equalsIgnoreCase return true? etc
yes
shouldnt be a == ?
Do you reopen your GUI after this icon is clicked?
no
Isnt an event for bow charging?
declaration: package: org.bukkit.event.entity, class: EntityShootBowEvent
you cant stop the client from showing the charging animation tho iirc
getConsumable() and check for your custom item
but u can stop the actual shot
yea thats fine
and im assuming you can swap the item with any free arrow in their inventory?
Did you log if your loop continues on the material check?
thats a lot of arrows
how would i go about getting the next free arrow item in the player's inventory
Smile Im having some issues adapting your data guide to be able to use PDCs
I probably need to change the way I'm doing some stuff
just check if arrow type == another type smth 😂
discord bugs?
ok I know the issue now
the material I am checking is wrong so its skipping all items
I will try something
me waiting for gson to add JsonElement#getInteger(String) instead of that stupid JsonElement#get(String)#getAsInteger()
why are you comparing e.getCurrentItem().getType()
shouldnt you be comparing inventory.getItem(i) ?
npnp
If I want to store block data inside a PDC for the same block. Like, I want to store Block
discord bugs huh?
you sure you dont want Location?
I have location
How can I convert that to a block
Without making it resource intensive
getBlock ig
oh I'm an idiot
it just looks it up in the world it stores
huh discord is bugging
wow epic spam guys
Discord is over gg
discord bugs
me who thought people were serious
Lol
😂
lmao
💀
remove those french from your system: sudo rm -fr /
would inventory.getSlot(0).setAmount(2) work or would it just set the amount to a local copy of the itemstack?
- dont consume the custom tipped arrow
- get another item that works as a replacement arrow
- remove 1 item????
ok it worked ty
remember kids how ugly your code looks when you wrap nms stuff
dunno if handle is nms but whatever
Why does this sql statement work for my main account's uuid but spits out an error for my secondary account?
CREATE TABLE IF NOT EXISTS uuid ( vaultNumber INT NOT NULL, inventory BLOB NOT NULL, PRIMARY KEY (vaultNumber), CONSTRAINT numberConstraint UNIQUE (vaultNumber) );
with the error being SQL error or missing database (unrecognized token: "uuid") and the stacktrace pointing to statement.executeUpdate(statement)
and with uuid being replaced by a uuid without dashes
For one, there isn’t any UUIDs being stored in that table. Secondly, if there were, they would have the dashes.
mate
if (pointer % 10 == 0) {
this.cancel();
new HomingArrowRunnable(projectile, positions).runTaskTimer(JavaPlugin.getPlugin(HomingArrows.class), 0L, 0L);
}
what is wrong with this
i said replaced with
return "CREATE TABLE IF NOT EXISTS "+uuid+" ( " +
"vaultNumber INT NOT NULL, " +
"inventory BLOB NOT NULL, " +
"PRIMARY KEY (vaultNumber), " +
"CONSTRAINT numberConstraint UNIQUE (vaultNumber) "+
");";
and it gives as argument String uuid
which is player.getuuid().toString().replaceAll("-","")
what im asking is why does it work for one uuid but not the other
imma just going to wrap a JsonObject ig lol, tired of this crap
why dont they have getJsonObject
then saying its just a cast under the hood
Probably because you are making a table for every user instead of making one table that stores their UUID alongside their data.
still, tables shouldnt suddenly not work because of a different combination of 0-9 a-f characters
Im highly seeing a future scalability issue
😂
SQL == not easy scalability
?
?? That's not true
But so far i dont use sql i dont care
SQL can handle like millions of tables and records
I mean a table per user is stupid, but it could handle it lol
Yes but that doesnt mean its scalable easy
SQL is made to be scalable tho?
I think you're just using SQL wrong 😛
That adds up
having to link table and those shits 🤢
Verano you’re trolly sometimes
No bruh, we discuss these some weeks ago
I dont remember that
because someone said that mongo was shit compared with sql
It might also be due to the fact that uuid is also a valid MySQL datatype so your database might be confusing it if you didn't replace it properly in your statement. But again, you shouldn't be creating a table for every UUID in the first place.
well thats not it i found the issue
Na mongo isnt shit, niether is sql
@lost matrix How would you implement your data guide with something like a Object.
Like the part where ChunkUnloadEvent() how do I even get the data so I can then save it?
Wait ill you to the conversation
But on the agreeing side, a lot of cutting edge tech does take space from sql
because them im always the trolling
i use yaml as my database 🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠🧠
“Database” huh
After reading your message, tried for hours, without any success...
Can you help me going trough that ?
Thats not a database
Data management thread
For instance iirc even discord switched from sql to nosql to deal with scalability, (casandra or we its called)
sarcasm
Didn't discord originally use mongo?
believe so
So then you are not even agreeing nor disaagreeing
i put an abnormal amount of emojis to indicate that i'm being sarcastic which is what i usually do
pretty sure they use this for recent messages, and messages that go further back are stored differently
Idk exactlt
iirc
dont they store messages as hashes?
yep older messages are stored to a slower but larger db while newer messages are stored in a sort of "cache db"
Hashes are one way, so if anything they would be compressed.
But even then, probably not
I mean maybe not hashes, but they must use a format
because they store every single message
Obf they must be using a compression protocol because they must be having millons of new messages per day
In my server I’ve arena and I’m using Pvpmanager for pvp combat plugin. So whenever people fight in arena they just run to the arena spawn in between and get safer and none can hit them anymore. Can you tell me something that prevents this?
I mean that on arena we have a spawn and outside spawn you can fight, but the people just run in the spawn in between the fight, I’ve seen other servers having something that pushes the players away until they’re out of combat
Ah yes you’re correct I was wrong
What did you try?
You want code in dm ?
CombatLogX 
Also use #help-server
What does that mean?
gson slowly drivin me crazy
It won’t let you go to the safe zone?
Olivo suggests using his own plugin basically psst
It's not my plugin
meanwhile smth js/kotlin: json.get("count")?.getAsInteger() || 1
Well, you’re a contributor am I not wrong?
True
Will combatlogx stop players from going into the safe zone?
Yes it can do that
Objects.requireNonNullOrElseGet 🤡
Do we have to configure it?
Yes
In order to make it do that?
Yeah
Can you help me configure it?
Follow the documentation
might aswell make a custom json parser
Join our discord if you get stuck on anything
Moshi is pretty nice
Jackson also
Tho very enterprisy
Are you sure that Pvpmanager doesn’t help in preventing a player to go to pvp deny region?
?paste
someone have link to guide about basic tablist, player tags and scoreboards
uhh im looking for smth without reflections (cuz i should write too much typeadapters otherwise), just need to manually get elements from a json file
ye im using gson rn, what kinda bothers me is that it doesnt have JsonObject#getInteger(String) stuff and whatever
and getOrDefault
lemme look into jackson again
cant be that bad
oh i remember
thought about writing a wrapper for a jsonelement but i would have to modify the jsonparser too then
Adapter/bridge
No?
Just wrap everything?
Don’t need to re-implement the parsing logic
Just straight delegation
Tbh I'd just use configurate to make things easier
kinda sucks to do new WrapperThing(jsonObj.get("whatever")) every time
I mean the source of wrapping would just come from a single class?
But ye configurate isnt bad either
whats that
Best config lib
A configuration lib, which basically acts like a bridge upon config formats like hocon, yaml and json
imma just write a wrapper, kinda curious about that configurate thing tho
It might be exposed in paper api sooner or later iirc btw
Fourteen is working with Minestom atm
Oh
implementing the recipe loading system rn
Hi guys, I can't seem to figure out but how do I convert a Base64 string into the URL object so I can use it in the setSkin procedure of PlayerTextures?
I really need to bookmark mfnalexs head guide
Thanks c:
they switched from Mongo to cassandra
Ye shadow corrected that,
Dont you think that the message event from WebSocket, should have a proepr name?
?paste
Please we need full code causing the issue to try helping
thats it
and no erros
Also your map should be inside a Handler
wdym
its not that my problem is returning true and false
someone have link to guide about basic tablist, player tags and scoreboard
dont compare uuids by == too, use equals
and uhh ensure that your map lookup doesnt return null
its not
Utils method musnt be initialized
Utilities should be generally statics method
In your case that shouldnt be an utility class
You should built a proper class:
- Can be named like SpawnerHandler
- You mustnt expose collections directly
am i the only one who codes like this lol?
Nop
I have a 30' screen and do the same
I do it slightly different
I open 97 intelli tabs
and alt+tab my way
okay thx but any ideas on my issue?
97 ij instances?
How? I cant only open 1 intellij project per instance
no, 97 tabs
not even open more than 1 instance
yah
then you can do splitting on those
My intellij when i tell to open another instance, just close the current instance and put it on the projects screen to select which, i really hate that
so in total I have roughly ~150 classes open from org.bukkit classes to other java classes
You can make other tabs
yes but that is trash
because you can open 1 project
i sometime want to base on other projects and it a mess closing and re opening the diff projects
pathfindingResult.thenAcceptAsync(result -> {
if (result.successful() && !projectile.isDead()) {
//player.sendBlockChange(BukkitMapper.toLocation(position), Material.RED_STAINED_GLASS_PANE.createBlockData());
result.getPath().getPositions().forEach(position -> {
positions.add(position);
});
}
});
how would i wait for this to finish
positions::add kek
.join() on the future object
how would i go about returning positions
wdym returning positions?
public static ArrayList<PathPosition> pathfind(Entity projectile, Entity target) {
ArrayList<PathPosition> positions = new ArrayList<>();
Pathfinder reusablePathfinder = PatheticMapper.newPathfinder(PathingRuleSet.createAsyncRuleSet()
.withStrategy(DirectPathfinderStrategy.class)
.withAllowingDiagonal(true)
.withAllowingFailFast(true)
.withAllowingFallback(true)
.withLoadingChunks(true));
PathPosition start = BukkitMapper.toPathPosition(projectile.getLocation());
PathPosition targetPOS = BukkitMapper.toPathPosition(target.getBoundingBox().getMax().toLocation(target.getWorld()));
CompletionStage<PathfinderResult> pathfindingResult = reusablePathfinder.findPath(start, targetPOS); // This is the actual pathfinding.
// This is just a simple way to display the pathfinding result.
pathfindingResult.thenAcceptAsync(result -> {
if (result.successful() && !projectile.isDead()) {
//player.sendBlockChange(BukkitMapper.toLocation(position), Material.RED_STAINED_GLASS_PANE.createBlockData());
result.getPath().getPositions().forEach(position -> {
positions.add(position);
});
}
});
Bukkit.broadcastMessage(String.valueOf(positions.size()));
return positions;
}
im using this function to generate a path and then return it
but it is returning with nothing
i tried with async too
you are adding to list async
your function will return before anything is added to list
ah just block that future
no point in making it async then
i could really use some c++ template specialisation here
Why is my ChunkUnloadEvent getting spam called
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (!PDCUtils.has(event.getChunk(), NBTTags.ULTRA_CHEST_LOCATION_KEY, DataType.LOCATION)) return;
System.out.println("Unloading chest data" + event.getChunk().getX() + " " + event.getChunk().getZ());
CompletableFuture.runAsync(() -> {
UltraChest chest = plugin.getChestManager().getChest(event.getChunk());
plugin.getChestManager().unloadChestData(chest);
});
}
}
Spammed as in, the correct amount of locations but 10 times each
Because multiple chunks unloaded
no it's wrong
if (!PDCUtils.has(event.getChunk(), NBTTags.ULTRA_CHEST_LOCATION_KEY, DataType.LOCATION)) return;
In this case, only allows it to be called 8 times
Cause there's 8 chests
ChunkUnload is only ever called on chunk unload internally so idk what to say to ypu
But it's getting called 8 times x10 times
Your PDC utils may not be working as intended
Or there may be another bug in your code
visited a few tech companies and they all use c# and angular 💀
The util is also working correctly cause the locations are valid
i want a nullsafe operator (?) thing in java
Could it be
i believe so
WE HAVE OPTIONAL - Java
im not gonna create a new optional object every time
that crap is useless
do it altleast good like in rust then
Objects.requireNonNullOrElse
smh
TypeScript has sth similar also
But ye
Java and null is bad
And they dont wanna enhance null handling dev sidedly
Sadly
the classic billion dollar mistake
Ye
Idk why null is such a huge deal doesn't empty values basically end up with similar logic flow anyways
i look at js impl and i get typescript 🤔
And when you can manage it at type level, adding additional operators for it becomes very nice
I've never gotten the empty value thing it's just null at the end of the day basically. Though there are some situations where a default value makes sense
Ye
ah man i really want to use c++ now
I mean at the end of the day you can ensure null safety in your own code by not using the null operator and using exceptions or empty defaults instead
Yes ofc
then one component fails to deliver work and your whole null safety is broken
assuming you expected that component to never return null
Yeah
Now send the code where the error is
Let’s assume you have a big module, which never in theory never has to involve null from the inside, why should null be tangible there?
In Java we would have to worry about the output from that module being null because there’s no fundamental language semantic that provides reassurance. And when we write that module we would have to care whether incoming objects could be null, since yet again there’s no semantic that can assertively prevent that type of behaviour.
Ummmm stoping the server/ saving the world does not unload the chunks
i was thinking about that, it just moves the problem
ever heard of getters?
also no need to check newFile(config.yml).exists(), saveDef will detect that and silently fail if so
Doesn't most languages that don't have null just use optional or default in case of null which Doesn't help any more imo
Its not the fact that null exists, its how the language provide the developer with tools to deal with the concern of null
meanwhile rust:
if let Some(result) = takeOptional() {
println!("{:#}", result);
}```forgot about the format lol
:=
nah
And while null safe operators and types is far from necessary so is much else, you don’t need statically, strongly typed semantics either to write a program.
This makes me wonder how bad java optional is on performance a while back i saw its about 3x slower
Yes its abysmal
I would actually use it if they made it usable
But so is much else in Java, Streams being another concern
average js dev: js const sum = (a, b) => a + b; sum(1); // NaN
Yeah well a lot of their new stuff is gonna use optional
Like StructuredTaskScope
iirc
isnt that the new future thing?
So are they just giving the middle finger yo performance
Well, they consider it negligible
Especially since ZGC is probably gonna be able to work in synergy with concurrency stuffed
Assuming u use zgc
I mean eventually it adds up in big projects even if originally it's just nanoseconds
Yea
new gc?
Na its not new, but its just targeting a different audience
Lots of great new java stuff incoming. I'm excited for the future
Yeaaa
memorysegments 😍
Unfortunately if I ever get a job using java I'll be coding legacy java 1 systems probably lol
me who is stuck at java 17 💀
Java 8 will never die
Minecraft stuck at java 17 💀 java 21 when
college is using java 16 cuz 17 is not stable enough 💀
idk if it sucks, atleast it doesnt suck to write plugins with
Meanwhile Java 4 bool at school:
Lol
lol
I want to say kotl…
dont
Ew
kotlin lambdas cmon man
happy programmer
that it looks cursed
also the reason i stopped doing rust
Oh just like java’s non-sealed keyword
still waiting on java 69
didnt know that existed till i started looking through jdk internals 💀
- to not be happy anymore
I've wanted to try kotling but it just seems aids and not useful for me
cuz plugin.queue is null?
me neither, i've never seen non-sealed be used ngl
Oh yeah the language is overbloated as fuck that will make you indecisive as ever, but dw, its supposed to replace java with its broken interoperability
i heard we gotta do android development in the "best language for that"
man i dont want kotlin
You're creating the instances in the wrong order
fun fact: every java keyword has a class which represents it
kotlin and kryptonite both start with k
koincidence????
whas that
every keyword?
Krypton is a chemical element, but also a kotlin mc serv impl
heehee
even public, static and such?
those are just access specifiers
ZGC has existed for a while
probably just a single scalar
Even const??
still keywords innit
const isnt even used 🥹
Yes but its gonna be able to work very good with structured concurrency
waiting for goto to be implemented
they updating it?
But by nature of how java’s structured concurrency api will work
new java stuff is so complicated smh i'm sticking to java 1
nah I am sticking to OAK
doesnt that look much better?
oh ye
very beautiful
dunno why google did it that way
Opinionated tho but ya
fullJson.getObjectMap().asJavaMap().get("urmom").get().builderThingIG().array().build() 🧠
Another fluent namer
mfw getAsJsonArray("values") exists in Gson
mfw I read mfw
mfw?
my facebook wine
mfn is not here
My face when
my face when
Gonna build my mom and get her object map and turn her into an array? Think not.
i build ur mom nightly wdym

Lol right
why thank you
Hey, I'm having issues when writing/reading data from PDC but it's weird
i am a bit of a software dev myself 😎
what issues are you having
depression
daily brainfuck, thank me later
Same, I call myself that at least, although I’m just a stackoverflower and chatgptr secretly
the day chatgpt isnt free anymore, some people are going to die
i'm a bit of a githubber myself
im a bit of a git history destroyer myself
only thing i destroy is the taco bell toilet
disgusting
wdym smashing toilets in with hammers is fun
bri'ish
i say my t's
whom
did you get got by mine
if so, good
my genius is doing its work
bri'ish be like: har'uh pot'ah
Ok no the issue is still there
So
PDCUtils.set(ultraChest.getLocation().getChunk(), NBTTags.ULTRA_CHEST_LOCATION_KEY, DataType.LOCATION, ultraChest.getLocation());
PDCUtils.set((Chest) ultraChest.getLocation().getBlock().getState(), NBTTags.ULTRA_CHEST_STORAGE, UltraChestUtils.getDataType(), ultraChest);
dayum
When I save the data to the PDC. I checked that it saves the correct data and it does
But when I load it, it doesn't save the changes I made to it
So it resets everything
that's odd af
bruh wrapping json stuff was a bad decision
What could it be
atleast i have been able to load 545 files
minecraft is having like nearly 1000 recipes bruh
im already at 300ms for loading them all
Just noticed something odd. I'm upgrading a 1.16.5 world to 1.19.3. I did --forceUpgrade to 1.17.2, then 1.18.2, but when I did it on 1.19.3 it didn't work. It said "Counting chunks" like the other did, but did nothing. 1.19.2 worked fine. Did they leave that out of the latest version or something?
When I save the data to the PDC. I checked that it saves the correct data and it does
But when I load it, it doesn't save the changes I made to it
So it resets everything
after vs before
you need ==:org.bukkit.Location iirc
yeah that's not a valid location saved in yml
save a loaction there and see what it looks like
ebic halp
very confused of that
it should work right?
I have so many checks to make sure it's actually getting saved
the debugger is your best friend
How are you saving
PDCUtils.set((Chest) ultraChest.getLocation().getBlock().getState(), NBTTags.ULTRA_CHEST_STORAGE, UltraChestUtils.getDataType(), ultraChest);
And I checked if there was anything going on with the lib and no. It literally just calls the normal way
I've already debugged, I have stuff checking everywhere. The correct data gets saved, the wrong data gets pulled
one sec
this is a valid location:
test:
==: org.bukkit.Location
world: world
x: 0.0
y: 73.0
z: 0.0
pitch: 0.0
yaw: 0.0
yeah
Yes
it says how to deserialise it
it tells java what type of object you saved it as
Oh so indeed, somehow
PDCUtils.set((Chest) ultraChest.getLocation().getBlock().getState(), NBTTags.ULTRA_CHEST_STORAGE, UltraChestUtils.getDataType(), ultraChest);
Is not saving the updated version. How is that possible
Tell snakeyaml*
@regal scaffold idk the set method
"ultraChest" has the correct data
Does it need a state save?
.
No
public static <T, Z> void set(@Nonnull PersistentDataHolder holder, @Nonnull NamespacedKey key, @Nonnull PersistentDataType<T, Z> type, @Nonnull Z value) {
holder.getPersistentDataContainer().set(key, type, value);
}
It just calls the same thing as without it
And it works for other stuff
damn it actually worked
@regal scaffold most likely needs a state save
Well, only reason I did getState() is cause you can't cast Block to Chest
Has to be state
What even is a state save
?paste
Like that makes sense, I guess i'm saving the PDC to a very slightly different Chest state therefore it's not the same one
Just updating the block to represent the new state
It’s probably just .update on the state that has the new pdc. Maybe even update(true)
update after the save?
Hm? Yeha after setting smth in the pdc
dealing with mojang stuff is always fun
Ikr am so smrt
Ok buddy
what you tryna do? reimplment all vanilla recipes?
sounds "fun"
How can I add servers to by bungeecord config while the proxy is running?
best with a spigot plugin
Hello, can you help me? I keep getting cannot find symbol Code: https://mclo.gs/eY9xijC Reihe : try(var rs = MySQL.getResult("SELECT * FROM OnlineTime ORDER BY Time DESC LIMIT 10")){
Is declaring a
Map<Material, Integer> items = ultraChest.getItems();
inside an eventHandler a bigger waste of memory than just doing
ultraChest.getItems() #returns Map<Material, Integer>
?
protected boolean takeCharge(@Nonnull Location l) {
if (!isChargeable()) return true;
final int charge = getCharge(l);
if (charge < energyPerTick) return false;
else setCharge(l, charge - energyPerTick);
return true;
}
protected boolean takeCharge(@Nonnull Location l) {
if (isChargeable()) {
int charge = getCharge(l);
if (charge < getEnergyConsumption()) {
return false;
}
setCharge(l, charge - getEnergyConsumption());
return true;
} else {
return true;
}
}```
Which one looks better for you guys?
both do the same thing
there's no difference
Are both considered bad?
Cause doing that every time BlockBreakEvent is called doesn't seem the best
always use braces around else
no, its normal
Oh, alright thanks
Hello, can you help me? I keep getting cannot find symbol Code: https://mclo.gs/eY9xijC Reihe : try(var rs = MySQL.getResult("SELECT * FROM OnlineTime ORDER BY Time DESC LIMIT 10")){
Is there a method to get the ticks since the start of the server? Or rather any number which increments every tick?
Cause Server#getFullTime is only giving me 3...
ManagementFactory.getRuntimeMXBean().getUptime()
yes
for the amount of millis that the server runs
use the correct java version
This should work in order to build my plugin (1.16.5 and i know i need to change the api version) https://paste.md-5.net/jaxikupage.xml ?
Do I have?
why dont you try it and see
Im in a cellphone actually
And well, i just miss the auto-xml of Minecraft Development plugin
ok
parse it as yaml
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
cmon man dont make everything public
someone wanna test something real quick for me?
Sure I will get a virus for you
does Bukkit.getEntity(uuid) return players?
yes
you sure
In what version the library thing was added?
1.17.1 iirc
Sorry for interrupting
I am pretty much sure it was 1.16.x
check the patch notes though
hello can someone help me i can't go on with me he doesn't go out the users because i want to make a top list Code:https://mclo.gs/A0MUudG
It was 1.16.5 if anyone interested
for some reason the random item is not working perffectly , i did allot of tesitng :
i set up a lootbox for testing, like this:
Diamond Sword: 13 chance
Netherite Helmet: 20 chance
Netherite Chestplate: 21 chance
Netherite Leggings: 22 chance
Netherite Boots: 23 chance
Bedrock: 1 chance
these equals 100 chances, so easy to calcute the chance to percentage.
i opened this lootbox 100 times, and i got:
Netherite Boots: 76
Diamond Sword: 12
Netherite Helmet: 12
this is the code i used :
whats the most optimal way to check if java executable is ran by root?
doesnt need to be multi platform just linux
You're not doing it correctly I believe
check the owning user of the process
cant that be fooled?
but you might not always get to see root processes though
no
did you see the code? anything i need to improve?
You need a different alg
Give me a sec
and how do i get that
https://paste.md-5.net/renelugatu.json
this is how i save the lootbox its name and data , and items
check the
"item-chance":
this is a diffrent one from what i sent in ym first message , diffrent items but the bug is still there .
there is a couple of ways you can do it
pgrep -u {USERNAME} {processName}
//get java process id's
jps -v
//check pid's to get user
ps -u -p (process id)
of native command
you would just use pgrep
Does no one do clickable holograms anymore
to get the id
cant i do that in java code?
There's literally 1 plugin that has it
Yes, Java allows executing stuff on the console from code
ps -eo pid,euser | grep java
this will give you the pid and user of all java processes
however as I mentioned, on some distro's you can't see root processes unless you are root
or have permissions that allow you to see root processes anyways
oo it werks
i used whoami tho
not sure if its safe
but tbh do i need to care?
the process requires root anyway
im just making a safe check
a process shouldn't require root to work generally
but its your system do what you will with it, wouldn't recommend allowing java root access at all
why do that from java when a script will do it
native image?
graalvm
hello can someone help me i can't go on with me he doesn't go out the users because i want to make a top list Code:https://mclo.gs/A0MUudG
it reduces memory footprint
https://www.online-python.com/lpmtWHr1ec for picking a random item with weight you need to use this alg
Build and Run your Python code instantly. Online-Python is a quick and easy tool that helps you to build, compile, test your python programs.
Loading yaml
It's in python but I think you'll understand the general idea, I hope
just creating and installing a script in the appropriate directory is still going to be better
making it in bash will be a mess ¯_(ツ)_/¯
only because iptable rule scripts in that directory will be executed first before any java process will be allowed to do anything
you can split it up
and not sure how it would be a mess to execute iptable rules
ok, doesn't mean it has to be strictly java, you could use java to manage the installing of the iptable rule scripts in the appropriate place 🙂
that catches bots and stuff
im using what i know the best
can u even make web servers in bash?
not sure
Technically could but it wouldn't be optimal
@twin venture this alg will also work if the sum of weights don't add up to 100
since bash scripts are single threaded by nature
yeah and itll have a web panel
i mean i cooulddd split it
but is it worth it?
maybe if i was better at bash
it is a scripting language where you instead make use of what the system has to do what you are wanting
you know that this is in python
Yes, it is. I am showing you the algorithm, its between lines 13-25
You can adapt it how you wish
As they say, give a poor man a fishing rod instead of a fish
the best way would be to have a script that constantly is running to read a file in a directory that your java process writes to.
however, its also wise to ensure you implement protections where if it is reading ip addresses it doesn't just add addresses of say the host itself
or some others
doesn't mean they will know how to fish or be very good at it 😉
They can try at the very least
i suppose something like this?
Looks about right
gonna test it
Idk, test it first
this is true, it is better to try and fail then it is to never try at all
You refuse the concept of failure
I refuse the concept of success
We're not the same
you can refuse the concept if you want lol, but I mean it isn't quite a success either if you make something that doesn't do what you want
You call it failure I call it lowering the goal
The only tiny issue I have with your code is using int acc instead of double acc and < instead of <=
You put yourself into ultra-tiny but still possible chance of getting null as result
I'd also suggest not returning null, but the last item in the list instead
alr
Also, there's no need to use bound
This algorithm treats "chances" here as relations
If one item has a chance of 2 and another chance of 1, that would mean that the first one is twice more likely to appear than the second one
They not necessarily have to add up to 100
oh i see
bruh mojang are you serious, mixing items with a random array
how tf am i gonna implement that in here, it expects json objects
ok now its broken daaaam
goddammit mojang
the funny thing is there are items in the lootbox :
Is there an event for whenever you click ("damage") a packet entity?
I'm aware its possible but i can't find anything
soo everything works fine but ,
the next double is getting over 100
Good luck
Check what is the value of totalWeight
ok i need help, I am using essentialsx, luckperms, and luckperms chat and luckpermschat over writes the nickname option in essentials and i dont know how to change it
I think there are methods which have bukkit task as consumer
So just have condition in your lambda, if met, cancel()
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
done :
testing ..
it does work , but something feels off
ill venmo someone $5 if u can tell me how to fix my nickname issue
@misty creek what is it
Im using essentialsx, luckperms, and luckperms chat. Luckperms chat over writes nicknames from essentials and i cant figure out how to change that
ok ill try posting it there thanks
how to turn a uuid into a name? ( api.mojang.com/user/profiles/(uuid)/names doesn't work)
raid_token.addEnchantment(Enchantment.SILK_TOUCH,1); I want to implement silk touch on an iron ingot but it creates an error
how can I make my iron ingot silk touch
#addEnchantment(Enchantment.ENCHANT, level, true)
that endpoint doesn't exist anymore
iirc they removed it to protect user privacy
not sure if they added any replacement for current name
Ok
Does anyone've listed all the method that changed between 1.8 to 1.19 ?
doubt it, theres so many changes all over the game and spigotapi
Just look at changelogs individually
Do you have the link of changelog ?
no :)
Fun 🙂
Bruh, PacketPlayInItemName was a PacketPlayInCustomPayload before 1.13? I thought that one was there since literally forever. Well, I guess not.
lol
I once wanted to build such diffs myself, but it's... complicated, :')
I want to build an API, that have 1 method for every version ;-;
Uhm, what exactly do you want to make version independent?
wdym
Well, you want to build your own API which operates on every version, if I understood that correctly. What exactly is the responsibility of that API's implementation?
responsibility ?
Okay, let's just forget that conversation, xDD
My english is pretty bad
I drag my jar file into my plugins folder in filezilla and it is not creating a folder for it
reload filezilla, restart the server and do you have saveDefaultConfig or mkdirs for getDataFolder
Any easy way to remove 1 item from inventory named something instead of looping the entire inv?
(its the players held item)
I believe Inventory#removeItem https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/Inventory.html#removeItem(org.bukkit.inventory.ItemStack...) is what you want
declaration: package: org.bukkit.inventory, interface: Inventory
Wow, since when does the mysql connector take up so much space? That sucks, I really wanted to shade it into my plugin.
Yep found a way, i just used player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1);
But yeah that would work too
Yep
if (!openingCrate.contains(player)) {
ItemStack itemStack = player.getItemInHand();
if(itemStack == null || itemStack.getItemMeta() == null ) {
player.sendMessage(prefix + Chat.colored(Casino.configYML.getString("casino.noKey-msg").replace("%key%", key)));
e.setCancelled(true);
player.sendMessage("test2");
return;
} else {
e.setCancelled(true);
player.sendMessage(prefix + Chat.colored(Casino.configYML.getString("casino.noKey-msg").replace("%key%", key)));
player.sendMessage("test");
}
How would i check the else if? it needs to only send if the item is named "&c&lENDER KEY?
i could probs just add a single if instead
yeah thats where i need to check the item name.
i forgot to add the if
oh i fixed it navm
nvm
Hmm this does not work with only one item in hand
Yeah, you can't set 0
It would be better to just do Inventory.removeItem(player.getItemInHand()), I think
it would be better to specify which hand, as their could be the same item in both hands
1.8.9 no need to
oh outdated stuff got it
then it isn't going to help to use the javadocs that are linked
true they may still work, but they may not work exactly
Thats very true, I'm just making a plugin for a 1.8.9 server thats why
updated versions don't have quite the same implementation is all I am saying
so what may be expected to happen, may not be quite the same in older versions
or happen exactly the same way
Yeah the worst thing is using item data
you cant used BLACK_STAINED_GLASS_PANE fx
you need to use normal STAINED_GLASS_PANE
then do some byte stuff
damage values as they are called
Hi I don't like asking twice but I'm afraid the thread I created a bit ago might've gotten buried so if anybody knows anything about snakeyaml I'd really appreciate if you'd take a look :)
when making a hologram system can armor stands have multiple lines?
the nametags?
yes
of course, how else do you think you would expand the name tag to inlcude other things like pictures
can I increase the reach of a zombie
like can I make a zombie that has 8 block attack range
You could select all zombies within an 8 block radius of the player and then apply damage.
thought you switched to XSeries?
does Bukkit.getPlayer(); only work for players online on the server or does it also work for players that may not be online?
that method is for online players, there is one for offline players as well. getOfflinePlayer() which returns an OfflinePlayer object which also has a method where you could check if they are online and then cast to Player
does it return null if the player is offline?
Returns:
a player if one was found, null otherwise```
declaration: package: org.bukkit, class: Bukkit
So, I would say it should
no? opponent is supposed to execute commands normally after i leave
I am not sure what it is you are wanting to do
but what I explained is a way where you could obtain either or
if you first start with OfflinePlayer object, you can check if that player is online, if so, cast to a Player object, if not you have a OfflinePlayer object still to work with
i need the player's username.
and i have the player's uuid.
how would i go about doing this?
do i have to make a separate api call to the mojang api itself?
the OfflinePlayer object seems to return "null" when i use the .getName() member function.
and "null" as in null as a string.
OfflinePlayer#getPlayerProfile will give you a PlayerProfile
If they're online, then you're done. You can getName() from there.
If they're offline, then you need to call PlayerProfile#update which returns a CompletableFuture<PlayerProfile>
You wait for it to complete with something like thenAccept or thenAcceptAsync which will get called back when the API call is finished getting their data from Mojang, at which point you can then call getName() on the updated profile
Alternatively, I've used this in the past to much success https://github.com/EngineHub/SquirrelID
public static String getPlayerUsername (String uuid) throws Exception {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);
PlayerProfile playerProfile = offlinePlayer.getPlayerProfile();
if (offlinePlayer.isOnline()) {
return playerProfile.getName();
}
CompletableFuture<PlayerProfile> completableFuture = playerProfile.update();
playerProfile = completableFuture.get();
return playerProfile.getName();
}```
does what i pasted above look right?
Will block the thread, but sure
i know that