#help-development
1 messages · Page 783 of 1
do sculk sesors call player interact events
Probably not unless touched
... How I am I one version behind already, I literally just built the server with buildtools. :/
Updates ftw
this is because spawn is kept loaded
So is there a way to get the spawn chunks then (other then doing a hard coded check around spawn)? Since I need to know when a chunk is loaded to be able to grab my PMC data off of it for for custom gui related blocks in the chunk.
plugin load: STARTUP
I guess I could get all loaded chunks at startup and process them. That would work.
you know, its not hard to grab the spawn point either
typically most people don't change their spawn point, and is often times at 0,0
How can you prevent players from breaking a block owned by another player? Say we already have the hashset of chunks to player mappings done
Cancel the blockbreakevent
I'm aware of the javadocs haha! This was more about how to cancel the events
There is literally a setCanceled method. Just saying
event.setCanceled(true);
How does the underlying data structure look like?
uuids mapped to custom chunk objects storing x y and world
So Map<UUID, Set<ChunkIdentity>> something like that?
Make sure your custom chunk object implements equals and hashcode
ignores the field in ser/des iirc
why the fuck
Yeah marks the field to not being serialized. Gson for example makes use of this.
persistent data container im assuming
This just means one of the armorstands in your collection doesnt have a pdc.
yeah but why would it stop entire loop
Nvm... you are going through all entities in the entire world
oh jinkies
This includes the players, all zombies, skeletons etc.
And many of them dont have a PDC value
items too, paintings, exp orbs
thats the thing
Show us the exception pls
duh, cuz you return instead of break
after this blue text
Oh yeah. return exits the entire method ofc
bro I dont care how optimized can be I want it to work first 😭
"why doesnt it continue??"
literally tells it to return
Also, arent server armor stands less effective rather clients one?
You dont want to exit your method at this point.
You want to skip this value in your loop.
This can be done accordingly:
if(value == null) continue;
right, because if you have thosens of them. Then you are over loading the user experience thats really funny tho
I am not going to make separate method for 3 lines of code that ill execute once wtf
Server sided armorstands generally have a much higher impact on the servers performance than virtual ones.
You should def create quite a few more methods in this code. Really.
But ive posted the solution to your problem above.
As a result of searching for a solution to generating a vanilla modefed chunk, I got the following answer - "Look at the net.minecraft.world package, all the necessary classes are there (or in sub-packages).
But this will probably not give you much, because
In vanilla there is no class ,,generation, - there are layers. (Several variants of smoothing, scaling, borders, bumps, noises, etc., in total more than 50 classes, if you do not count the classes of biomes, decorators and structures).
If you want to tweak the generation, it's better to use special events.
" - I came to the conclusion why I need it. And apparently I will have to use a resource-intensive approach and replace blocks via random in blockPopulator. But who knows if there are ways to "optimize the randomizer" to find the right biome with a higher chance?
is there some sort of
public static <T> CompletableFuture<List<T>> allOf(CompletableFuture<T>... futures);
which completes with a list of values
when all futures are complete
wdym I didnt really have much problems reading my own code so far
Could just make your own util for that
i will
This looks outdated... im pretty sure i can make it more compact in the current java version
public static <T> CompletableFuture<List<T>> allOf(CompletableFuture<T>... futures) {
return CompletableFuture.allOf(futures).thenApply(unused -> Stream.of(futures).map(CompletableFuture::join).toList());
}
Here
go update the answer then :)))
100p he’ll be downvoted and banned for no reason
I have a badge on there 😄
is there a way to cancel a scheduled task? I'm changing blocks in the world and storing them into a hashmap, but if the entity uses that ability again to change the blocks it will get overwritten, so when the block change starts happening, i revert the old hash back to its old state, and then repopulate the hash with the newer blocks.
that's one way of the blocks reverting, the other is if the ability isn't used again in a set time, if it's not after a short delay the blocks will revert automaticlly. what happens, tho is that it also clears the map once it's done, so is there a way to cancel that task if the ability is called again?
Seems its not a bug, since the plugins are unloaded before the world is.
would this be more efficient u think
Ah ok
There is a better approach for this, but you can cancel tasks.
How this is done depends on how you schedule.
What would be a better way?
wow I figured out the other problem
turns out that I have to use Health Bar Manager method first and then apply Damage
Having a single task dedicated to restoring blocks. This task starts with the server and never stops.
does it come with the other solution as well?
hm?
a bit of a joke 😛
I need blocks to restore after like 20 seconds of them being changed.
Hm. Yeah this is fine. But your lose the determinicity for which thread completes the future.
Then do that
does allOf not lose that?
doesnt rlly matter to be but im curious
as i can imagine allOf being implemented in a similar way
at least following the concept of completing the compound future when the last one completes
Yeah looks like it does as well
how bad is looping through living entities and deleting those who are armorstands and have specified PDC that also has a value tied to player's uuid?
is there anything to improve?
I dont think i could come up with something worse right now.
Just have a reference to your armor stand
a simple pretty bad would be enough
why is it bad then
Uuid is fine too
Just hold weakreferences if you want 🤷🏽♂️
^
not really you suggested it while I was trying to make code work
Honestly though an Entity reference should be fine if you weak ref it
doing 2 things at the same time when ur code doesnt even work doesnt sound smart to do
Usually you would design the entire system in a different manner.
Its missing a lot of classes which are crucial for organizing your objects.
For example a PlayerOwnedMobManager which internally keeps track of every entity owned by a player.
Then you detect entities in the ChunkLoadEvent and ChunkUnloadEvent to make sure you dont miss
any rogue ones. Removing all entities owned by a player would be simply
UUID playerId = ...;
this.getOwnedEntities(playerId).forEach(armorstand -> armorstand.remove());
You can also be lazy and set the entity to not be persistent
Then it’ll get yeeted when the chunk unloads
why this. and what's ->
I dont really rember I probably came up with an idea after I asked and did my own thing
Lambda
oh yeah okay
well Rome wasnt built in one day idk what utility classes I even want to have
because I dont know how I want it to work
Here an example on how such a manager could look like
public class PlayerOwnedMobManager {
private final Map<UUID, Set<UUID>> playerOwnedMobs = new HashMap<>();
public void addPlayerOwnedMob(Player player, LivingEntity entity) {
this.playerOwnedMobs.computeIfAbsent(player.getUniqueId(), u -> new HashSet<>()).add(entity.getUniqueId());
}
public void removePlayerOwnedMob(Player player, LivingEntity entity) {
this.playerOwnedMobs.computeIfAbsent(player.getUniqueId(), u -> new HashSet<>()).remove(entity.getUniqueId());
}
public boolean isPlayerOwnedMob(Player player, LivingEntity entity) {
return this.playerOwnedMobs.computeIfAbsent(player.getUniqueId(), u -> new HashSet<>()).contains(entity.getUniqueId());
}
public Set<UUID> clearPlayerOwnedMobs(Player player) {
return this.playerOwnedMobs.remove(player.getUniqueId());
}
public void removeAllMobsOf(Player player) {
Set<UUID> mobIds = clearPlayerOwnedMobs(player);
if (mobIds == null) {
return;
}
for (UUID mobId : mobIds) {
LivingEntity entity = (LivingEntity) Bukkit.getEntity(mobId);
if (entity != null) {
entity.remove();
}
}
}
}
what does PlayerOwnedMobManager mean
Yes I can see
lol
It is a manager which manages mobs owned by players
I am asking definition of the name
He told you
what does "player owned mob manager" phrase mean
It is a manager which manages mobs owned by players
but how owned
whata is the sound effect called when you enderpearl somewhere
what does it mean that player owns a mob
The mob is in some shape or form associated with a player.
You spoke of ownership earlier so i just called this association "owning".
I have no idea what this.dosomething means
You can call this class however you like. The purpose is this map:
private final Map<UUID, Set<UUID>> playerOwnedMobs = new HashMap<>();
It maps a players UUID to a set of entities UUIDs
and why there are methods that literally just return shit
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.
@quaint mantle u okay?
u okay?
Ah, ok. You should try to get away from writing all your code into EventHandler methods as soon as possible.
Which are in the same Listener class i assume?
sometimes yes sometimes no depends
which still doesnt prove this point
What do you mean by that? I haven't put forward any thesis in that message so there is nothing to prove.
assumption that I am sticking everything to listeners
while I was already asking a few days ago about utility classes and splitting shit into methods
? someone else? xd
Keep your listeners clean. You will gain a lot of tools if you learn about classes and how to manage your data in them.
Take a look at this Listener of mine. It delegates all the functionality to another class instance and only has one responsibility: Listen to events
None of the methods in the manager are getters btw
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.
which listener is interacting with boat with chest
the more you use it the less inclined I am towards actually clicking in one of those tbh
then how do you expect to understand the help or responses o.O
I dont expect to get answers at all at this point
so just asking for help when you don't need it?
it doesnt imply that I dont need it
but it wastes peoples time to explain something you don't understand
that is what it comes down to and why some of us who may be more experienced and capable of providing you answers on a silver platter choose not to as we just see it as a waste of our time to do something like that when you don't even understand what is presented to you.
Okay, so I am trying to get an EntityType from a NamespacedKey that is a key I got from an EntityType (I am saving an EntityType into PDC as a STRING) But looking at the EntityType Javadoc it has methods from getting it by name and id but none for NamespacedKey. Any ideas other then interating over the whole EntityType Enum?
i need help, i made my code so that if the player is blocking it will return, but it still continues in game
if (target.isBlocking() || taserati.contains(player.getUniqueId()) || ammanettati.contains(player.getUniqueId())) { player.sendActionBar("§cNon puoi eseguire questa azione!"); e.setCancelled(true); return; } player.sendActionBar("§eStai ammanettando qualcuno..."); target.sendActionBar("§eStai venendo ammanettato..."); try { Thread.sleep(3000); } catch (InterruptedException ev) { ev.printStackTrace(); } ammanettati.add(target.getUniqueId()); target.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 5, false)); player.sendActionBar("§eHai ammanettato qualcuno..."); target.sendActionBar("§eSei stato ammanettato! Non puoi muoverti.");
I guess not
For loop here we goo
Thread.sleep(3000); will fk your whole server for 3 seconds.
valueOf looks for a string exactly matching the ENUM's elements name. For example the EntityType.CREEPER requires the string "CREEPER"
Thats a function right from just a Java Enum
Registry.ENTITY_TYPE.get
I forget that the Registry stuff is even a thing. (Especially when it doesn't show up when searching for EntityType.)
Registry class best class
Does the async pre login event happen on only 1 thread?
There is no guarantee
how does Hypixel do this thing where there are skyblock islands for each player?
And do blocked by bukkit's connection delay also fire the event?
There are a ton of different approaches depending on what your goals are.
Either spreads them apart in one world or creates many worlds
curiosity
Or many servers even
L'ho modificato facendo un runnable ma il problema dello scudo persiste
They have resources for that
why?
Elaborate
isnt that giving away their server code?
How tf am I supposed to know what your asking
if (e.getPlayer().getInventory().getItemInMainHand().isSimilar(Items.handcuffs())) { if (!ammanettati.contains(target.getUniqueId())) { if (target.isBlocking() || taserati.contains(player.getUniqueId()) || ammanettati.contains(player.getUniqueId())) { player.sendActionBar("§cNon puoi eseguire questa azione!"); e.setCancelled(true); return; } player.sendActionBar("§eStai ammanettando qualcuno..."); target.sendActionBar("§eStai venendo ammanettato..."); Bukkit.getScheduler().runTaskLater((Plugin) PoselloCore.getInstance(), new Runnable() { public void run() { ammanettati.add(target.getUniqueId()); target.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 5, false)); player.sendActionBar("§eHai ammanettato qualcuno..."); target.sendActionBar("§eSei stato ammanettato! Non puoi muoverti."); } }, 3 * 20);
When i try on someone that is blocking it still works
I can only make an educated guess on how they achieve this.
But i am strongly leaning towards an architecture which can be deployed on CPUs with limited
single core performance but immense horizontal scalability. Such as having a separate
thread for each island, while still existing on the same server as others.
Where shared regions like the main island need to be deployed on high performance core CPUs because of
minecrafts core loop limitations.
They might very much have their own server engine
please help
What happens and what did you expect?
Dont use isSimilar for custom items. Add a PDC tag on items and check for that.
Do you have any exceptions in console?
Add debug messages. Which if-condition is failing?
when i test it on someone that's blocking the event still continues, i wanted it to send the actionbar and then stop, what happens is the actionbar is sent but the event still continues
I wanted that it sends the action bar and stops there, doesn't continue while blocking.
But it sends the actionbar and continues with the other ones that i didn't want while blocking
PlayerInteractAtEntityEvent
Do yoy
Not understand your own code?
?pdc
what
Add debug messages and tell us what is happening
Because I don't know what tessaretti is
its an italian word
That's not what I meant
Remember this:
Always debug
The if
Checks
And then when you see which one is failing
You trace it back to the assigning
And figure out the problem
We have no idea how your code works and you can easily work it out
The code is to make an handcuff, when i rightclick on a player after 3 seconds it gets handcuffed, and if it's already handcuffed the handcuffs get removed, i made it so you cant handcuff someone that is blocking, but that doesn't work, the player still gets handcuffed
I already told you
Why would they have resources for making such islands
How to solve this problem
Debug
The if statements
And check for the failing
It's how everyone does it
As it's the most effective, fast and accurate method
Because they make millions of dollars each month?
And the island itself is probably not resourceful
and its literally the opposite of what they should be doing
you dont just share how you do stuff that makes you so much money
Did you even listen?
.
We have no idea
Which way they used
yes?
you literally said that there are resources for it
Well then you really suck at understanding
language
Telling someone that he sucks is rude
I know
yes I must not get it but what do you mean
I did it because I'm annoyed
You said here
What's everyone doing?
yeah I wouldnt share my resources if it was giving me decent amount of money
Nobody ever said they did
Are you perhaps not english-native?
Feel free to block anyone that annoys you 👍
👍
£2.50 how's that 😛
For what?
whatever you was talking about haha
It's a communication problem rather than someone misbehaving
So no need for that
They have resources for that -> They gave resources for making such islands
okay but we talking about sharing their method of making them right
like it implies that they did share their resources on how to make them
Resources as of: Computational resources for island managment
oh
bro
why not say computing power or something like that
Cause it was implied ahaha
Because it's widely used
yeah but since its help related channel I link resources to something else
And I've never once had someone misunderstand it before
and it sounded more plausible to me
yeah island management I would set a limit for each server as it would be less lag aswell
I'm decently sure that's what anyone would do
And what threads do by default
yeah I was just sharing it because some people will try and make it on one server haha
In a way
I mean it ain't impossible
Well no but you imagine the amount of data that server would have to handle haha
Some good CPU and RAM, custom server engine for packet managment and custom plugins
And multi-threading
The new AMD CPU with 128GB of ram 😛
@lost matrix would that armorstand management thing you showed me be useful for making pets that'd be floating heads?
CPU is usually the main issue
would need a decent amount of cores aswell
Yeah probably. All manager classes have pretty much this structure.
you would also need a good plugin to do all of this
They have many full-time developers
hey whats the code for making something choose a random number
I know I wish I could be haha
And somehow they still pay ppl to create their useless anticheat
new Random().nextInt();
You got Math.random(), RandomGenerator, Random, ThreadLocalRandom.current() and some other stuff
Oks thanks
Or ThreadLocalRandom.current() ...
You can generate a random number in java using the Random class.
A common impl is ThreadLocalRandom aaand conclure sniped me
For concurrent
Wow that is like 5 ways to make random ima use Math.random() since i am familar with that one
:>
That's just Random with a fancy name
so uh
yeah, it just uses a static Random object under the hood though
Id first have to think about how I want to make it as scalable as possible?
I would suggest using ThreadLocalRandom. But Math.random() will be nice for learning some basics
there is a bit more to it
Mm
The seed is like more randomized?
Cuz the gen methods just link to a normal random
do you think theres a way to load bytecode for a multitude of jvms, basically sharing the code in memory
yeah ive no clue how it works, just that its fucking slow because its secure yk and may invoke low level stuff to ensure that
could be useful for startup time and memory usage
Sounds complicated
probably
sounds like a custom jvm impl almost
true lol
So it uses a native method?
"it depends"
arent there new ones that do support 128 bits w RandomGeneratorFactory?
Just query the api for cosmic background radiation if you want a true sochastic random
We are still talking about randomness XD
I never knew randomness was complicated lol
I once found like 10 Random classes built-in in the newer java versions
used to be simple :>
Some stuff like JVMRandom64x32X
entropy is struggle
Does anyone have any good videos or series on intelij coding since I am trying to get into the coding scene and was wondering if anyone knew a good youtuber that could teach me the basics
Thanks ill look at it
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.
which one of those is the most comprehensive
I wouldnt go for the oracle one
Jetbrains academy should be good
Its only kinda usefull if you hop from another language to java
IntelliJ focused’ish too
really?
that sounds new user friendly tbh
I learned java creating an anticheat with one guy helping me set up the start and from the spigot java tutorial
Good times
Anyways, goodnight y'all
does world edit have a copy and paste for their API for maven anywhere or am I gonna just have to figure this out
I am trying to get the rail shape directly through the nms but when I was looking into the CraftBukkit's code I found this
how can I get the rail shape though the nms?
https://worldedit.enginehub.org/en/latest/api/ this i guess
I'm looking at that 🥲
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Someone made this
U just gotta update the version prolly
guh don't get what is so hard about just having atleast a repository to copy paste
Just click one there thoo
Oh
oh weit nvm
Update java
great
really
grate
i have to use older version of java for some of this stuff to work
lile
like
cmon
also java 17 aint that old
i did
Is there any nice way to get a BoundingBox from a World edit CuboidRegion
I didn't know that would get the position in the world though
cuz I'm grabing it from a clipboard
technically wouldn't be in the world yet
Hey, how could I format DD:HH:MM so I can get the values of each one?
how do I run a test of my code to see if everything is printing properly in intellij
The run button seems to skip my onEnable do i need to force onEnable to start somehow?
you can't... uhm well it doesn't work like that. You need to compile your plugin put it in the server. You can use MockBukkit + Junit but that only goes so far
Ok ya ill just get the server up and make me pc go brr
is there a way to check if entity is touching armorstand or anything like that?
or maybe scan area around armorstand for entities in a small radius?
entity#getNearbyEntities for this in specific
as for this, I'm not sure but maybe there's a way
well by touching I meant to check if they are near them
but what you said here basically checks it
ye
I want to utilize armorstands as hitboxes
🫡
bru
you can also just get the player's disntance
with armor stand's location
and see if it less than whatever you need
I feel like using armorstands could have more flexibility
in what sense
I want to use them as hitboxes to abilities
like here
rn it damages clicked entity
That's one way armor stands are usually used iirc
but I want to make it castable without need to have entity nearby and just damage all detected enemies in like 1x1 range of armor stand
just make an invisible armor stand, get the entities around it and then damage those entities
yeah thats about it
I thought it would be harder but
there is literal method for that
the new ones?
ye those are awesome
it's just sad mojang didn't implement them earlier
Are interact entities basically what you mentioned earlier?
Interaction entities are entities useful for map or data pack creators to see who the last player to click on a certain spot is. They can only be created with the /summon or /execute summon command.
Interaction entities are invisible and of a custom size. Their boundary box can be viewed via the F3 + B debug shortcut.
It's those entities added on 1.19.3 (or 4 idk)
So it would be better than using armorstands?
I mean, their main function is to be used as a trigger or just as a placeholder entity for stuff like what you need
I'm not sure but they should also be better in terms of performance
They have a customizable hitbox
Yeah and a tiny one
that's dope
In true minecraft spirit:3
Yeah minecraft hitboxes are always the same size in the x and z axis
Exactly 💯
Is interact entity like 1x1x1 transparent block?
Idk why that’s just how Mojang rolls
Or how should I imagine it?
It’s an x * y * x box
Okay
bumpity bump bump, More information :3
https://paste.md-5.net/rigivizosa.java this is my oh so elegant code if it somewhat helps. I don't know what to do 
get the world check if it exists
and/or matches the players world
convert to region/cubiod region get the corners create the box poof
well the world fsfs exists
check it matches though
why wouldn't it match it quite literally has to
This is reading from af ile
a file*
which is the difficulty
oh its a schematic
si senorita
you can probably get the data from the schematic
Oh you can :3 but it won't be representitive of the world
the clipboard has no clue where in the world its been placed at
shouldnt you know that part
uhm well kinda, but I'd need to scan every block in the strucutre 😭 also well I can only kinda of know that information too
give us more info
i mean yeah, a clipboard is dimension unaware
erm well https://paste.md-5.net/mobujitozo.java this is my place method for my MultiBlock structure (i gave up on making my own api fuck multi blocks). Anyways, I am placing this in the world with the code in this paste, however, once its placed, well how tf do I know where in the world it is. Most unhelpful is the WorldEdit API when tackling this problem as it provides 0 information on placement details. I do know the schematics width and height, but the placement in the world is relative to what position the schematic has been copied from
I was thinking about spawning it in the same place as armor stand since armorstands in my case hold bones in their arms as part of ability hitbox
How can I get entities that are inside of them?
using all of my brain your probably going to need 4 different rotations of the mutliblock
copied from the block that will trigger the place
I solved this by making my own schematic reader and writer and pasting system
might be back to square one of making my own API here. I hate geometry, yes even cuboid geometry, why do I do this to myself
That way I always know where it gets placed
you tell me
you were the one to have friends
especially friends that want that pluigin
very much so >:(
math is fucking great, geometry makes me want to end my life
I can deal with it easily enough in 2d graphs, but god damn 3 dimensional worlds guh kill me
can i add items to player inventory faster than PlayerInventory#addItem();
What
okay guys really dumb question but do exception messages use periodts at the end? 
Doesn’t look like it
can i get PlayerInventory#getContents without empty slots
why is your username so quirky
how would one send colored console outputs now that the chat color api is deprecated
ChatColor is not deprecated
ah nevermind
(it should be tho)
It should. Shoudl be pointed to bungeechat
enum sure
It’s only 255^3 entries
Only requires about 66,325,500 bytes of memory (about 66MB)
github struggles to show it
Fun fact, this was written by hand, not a script (/s)
how much time
Time is an unphathomable concept when programming a feature like that
did you write it choco
I wish I had that level of patience
you dont?
lmao no
That's generous

what a nice webpage
int randoms = new Random().nextInt(11);
does this give me a random number between 1-10?
0 to 10
0-10 ? Ok thanks
I am getting this error:
[18:11:07] [Server thread/ERROR]: Could not load 'plugins\originswapper.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.20.2
at org.bukkit.craftbukkit.v1_20_R2.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:303) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3926-Spigot-dba3cdc-ffb1319]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.loadPlugins(CraftServer.java:437) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3926-Spigot-dba3cdc-ffb1319]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3926-Spigot-dba3cdc-ffb1319]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:954) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3926-Spigot-dba3cdc-ffb1319]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:298) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3926-Spigot-dba3cdc-ffb1319]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Is it because my plugin yml?
name: OriginS
version: 1.0
main: skii.untitled.OriginRandom
api-version: 1.20.2
api-version 1.20 not 1.20.x
Ah
wait .x?
Ok just 1.20
got it
i knew there was something wrnog with me yml thanks
@worldly ingot im looking at potion, the key is on the itemstack not potion so would i convert the potion type to stack, to nms potion and get thekey
PotionEffectType (CraftPotionEffectType) has a MobEffectList instance as its handle which has a getDescriptionId()
You'll have to touch the PotionEffectTypeWrapper as a result
ill save that one for tomorrow, how do i get the nms enchantment from bukkit enchantment name, bc the build in registry takes generic which for enchant is int i think
infact
ill do that all tomorrow
zombie = world.spawn(loc, Zombie.class);
LootTable table = new LootTable() {
@Override
public @NotNull NamespacedKey getKey() {
return new NamespacedKey(Domon3.getPlugin(Domon3.class), "loot_table");
}
@Override
public @NotNull Collection<ItemStack> populateLoot(@Nullable Random random, @NotNull LootContext lootContext) {
Collection<ItemStack> stack = new ArrayList<>();
Bukkit.getLogger().log(Level.INFO, lootContext.getKiller().getName() + " killed my mob!");
System.out.println("Working?");
ItemStack is = new ItemStack(Material.BONE_BLOCK);
stack.add(is);
return stack;
}
@Override
public void fillInventory(@NotNull Inventory inventory, @Nullable Random random, @NotNull LootContext lootContext) {
System.out.println("Working");
}
};
zombie.setLootTable(table);
hello, I have this code to create a custom loot table when the zombie dies but the populate loot function is not called. Is there a better way to set the loot table of a mob?
Hey there, is anyone familiar with an uptick of reports where eclipse cannot import Gradle projects?
Specifically 7.X Gradle projects
Sounds like you should accidentally download intellij 
Im sorry you had to deal with jetbrainless syndrome
Your treatment should begin immediately after you download Intellij
Nah, the context shall remain a mystery to you forever.
I just want to know whether it is a common issue that people cannot import Gradle projects - however it does not look like it so I now know where to (not) search
lmfao
I never heard of it and my gradle 8.3 projects work fine in latest eclipse. Is it just specifically gradle 7.X or anything newer than 7?
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
What event fires when player lowers shield ?
p#isBlocking its not an event though not sure if there is one
you could loop until they arent blockinh anymore after blocking
actually scratch that
.isBlocking is depricated and related to Sword blocking
i think
Specifically 7X
And use what exactly instead?
There simply is no viable alternative
Mind you that I often work on 5+ Projects parallel to each other, IJ simply does not support that outside of Mac systems
[ERROR] location: interface net.minecraft.core.Registry```
what is this in 1.19.3+?
Registries#BIOME I think
yeah thats right
intellij
Not a viable alternative
Opening more than a project at once?
why would that not be possible in intj xd
It simply isn't - or at least noone told me how you can do it
Apparently it works on macs though, whatever
it works on windows and linux too
Yeah, but not at the same time
yes at the same time
yes you can
Hm, how though?
select „open in different window“ instead of open in same window
Opening in the same window replaces the project
file -> open project, prompts new or current window dialog
Ah yes, how could I be so dumb
(irony)
At that point it is performance bye-bye
well then whats the problem
what no
And productivity goes down the floor as you'd need to open every project
if your computer cant handle multiple windows of intj you got bigger problems
what r u saying that doesnt even make sense
Hm. I'll take a closer look again
Well I am just accustomed of the eclipse workflow of having different projects be tightly interlinked but I never paid much attention to IJ as I always assumed they were separate processes
ij is memory hungry, but you can get it to a surprisingly workable consumption if you're willing to spend some time tuning
Apparently not though, so I'll give it a go I guess
Also sorry for my tone, I am feeling unwell
flu season
is there a non overly complicated how have recursive maps?
i have an arrays of strings {"a", "b", "c"}
I wanna create a map of maps like so
a{b{c{}}}
chat gpt wasnt helpful
What
I gave it a go
Hello, this is Bing. I can help you with some Java code. 😊
A recursive map is a map that contains other maps as values, and can be nested to any depth. One way to create a recursive map from an array of strings is to use a loop and a helper method. Here is an example:
import java.util.Map;
import java.util.HashMap;
public class RecursiveMap {
// A helper method that creates a nested map from a string array
public static Map<String, Object> createNestedMap(String[] arr) {
Map<String, Object> map = new HashMap<>();
for (int i = arr.length - 1; i >= 0; i--) {
// Create a new map with the current element as the key and the previous map as the value
Map<String, Object> newMap = new HashMap<>();
newMap.put(arr[i], map);
// Update the map reference to the new map
map = newMap;
}
return map;
}
public static void main(String[] args) {
// An array of strings
String[] arr = {"a", "b", "c"};
// Create a recursive map from the array
Map<String, Object> recursiveMap = createNestedMap(arr);
// Print the recursive map
System.out.println(recursiveMap);
}
}
The output of this code is:
{a={b={c={}}}}
This is one possible way to create a recursive map from an array of strings in Java. There are other ways to do it, such as using recursion or streams. You can learn more about maps and other data structures in Java from this tutorial. I hope this helps. 😊
Source: Conversation with Bing, 10/11/2023
(1) java - Recursive merge of N level maps - Stack Overflow. https://stackoverflow.com/questions/25773567/recursive-merge-of-n-level-maps.
(2) java - Is it a good practice to use a recursive Map (Map of Maps .... https://stackoverflow.com/questions/50490482/is-it-a-good-practice-to-use-a-recursive-map-map-of-maps.
(3) How to implement map, filter, and reduce with recursion - freeCodeCamp.org. https://www.freecodecamp.org/news/implement-array-map-with-recursion-35976d0325b2/.
(4) Recursively Flatten values of nested maps in Java 8. https://stackoverflow.com/questions/37462264/recursively-flatten-values-of-nested-maps-in-java-8.
Is there a way to deep a deep merge of maps in Java? I've seen a couple posts about it but most seem solutions seem to only deal with one level of merging or are of tedious.
My data structure (usi...
I found this old code snippet which uses a Map of Map of Map:
Map<String, Map<Long, Map<String, String>>> sMap = null;
Besides adding unnecessary complexity to the code, it is m...
Array.map We all probably know Array.map. It transforms an array of elements according to a given function. double = (x) => x * 2; map(double, [1, 2, 3]); // [2, 4, 6] I’ve always seen it implemented along these lines: map = (fn, arr) => { const mappedArr
thanks
I am about to go insaneeeeeee
Good
[butiw, arnyou] should be but, i, warn, you
?
working on segmentation of words
I have a filter which can't filter words like youareanasshole
so I am trying to split it to you are an asshole (or even you are an ass hole)
that has a far longer runtime
I'm going off of https://github.com/keredson/wordninja/blob/master/wordninja.py
it is better
and I don't mind using up some more time
best_match is what gets me
I don't know enough python to convert it lol
You can embed it
Lol ok.
Would be funny to ask chatgpt-4 to convert it
Send me your prompt
Its using words.txt anyway lol
Yes, but it doesn't check them
it uses them to compute some probabilities
and then maths to split
just convert to Java with the code behind it, I'm not a "proompt engineer"
I am too lazy to copy it on phone give me sec sigh
Also you can use https://www.geeksforgeeks.org/what-is-memory-mapped-file-in-java/ for faster file load time.
Vector maths probably?
Just adds a value to a vector, gets the block and checks it
afaik
isn't there multiple algorithms for that tho or is it just the approaches and gets close and closer
For those huge methods (many parameters), wouldnt it make more sense for like a RayTraceSettings object
If you want type safe queries then try QueryDSL.
For connection pooling i would also recommend HikariCP
thank you
PR it
Which one
I use REST PAPI plugin.... but the developer is really busy with his life and does not respond
i installed the plugin into my server (i have papi installed too). the plugin has no config or wiki to refer to...
the only thing is the spigotmcpage (same stuff as readme on github). in the How Does It Work? section, it says
http://backend.ip: port/<player-uuid>/<placeholder-without-%>, so an example would be:
http://example.com:8080/da8a8993-adfa-4d29-99b1-9d0f62fbb78d/player_name (returns json containing "Fredthedoggy")
here it uses port 8080, how would i use that with my server? the same port as my server? (that does not work!)
the 8080 does not work too! Client sent an HTTP request to an HTTPS server. (probably cause i have a website [pterodactyl] hosted on it?)
what do i do?
not sure if this was for #help-development or #help-server so i sent here cuz its more related ig
don'T send a http request ?
HUH?
it should be accessible from the browser too!
the error above shows up ONLY when i use 8080 which is NOT the ip for the server
Which part of this do you want to "remake"
the ip address remains the same
lol
Well yea, obviously its a different port
what would happen if i have more than one server hosted on the same machine?
they'd need different ports
Yes i saw it. Which text algorithm do you mean exactly?
it reads from a config here
it probably just doesn't create that config ?
no
i have to fork
oh
Anyone know what I need to set for a protocolLib respawn packet (1.20.2). Wiki is pretty confusing and I cant seem to find anything online that helps.
it doesn't create it by itself because the author I guess did not want that ?
this is just dumb
I have seen nicer code yea
package me.fredthedoggy.restpapi;
import java.util.Arrays;
import java.util.List;
import static java.util.UUID.randomUUID;
public class RestPapiLoader {
private final Restpapi parent;
public RestPapiLoader(Restpapi parent) {
this.parent = parent;
}
public void enable() {
this.parent.webServer = new SparkWrapper();
org.eclipse.jetty.util.log.Log.setLog(new NoLogging());
this.parent.getCommand("restpapi").setExecutor(new RestPapiCommand(this.parent));
this.parent.getCommand("rpapi").setExecutor(new RestPapiCommand(this.parent));
loadWebServer();
}
public void disable() {
System.out.println("[RestPAPI] Disabled Webserver");
}
public void loadWebServer() {
this.parent.config.addDefault("port", 8080);
List<String> defaultTokens = Arrays.asList(randomUUID().toString(), randomUUID().toString());
this.parent.config.addDefault("tokens", defaultTokens);
this.parent.config.options().copyDefaults(true);
this.parent.saveConfig();
this.parent.webServer.create(this.parent.config.getInt("port"), this.parent.config.getStringList("tokens"));
System.out.println("[RestPAPI] Enabled On Port " + this.parent.config.getInt("port"));
}
}`
this is the code for the config
what do i put in my config.json lol
They literally just add a bunch of spaces until every line is roughly the same lenght
yea...
When you have a line of text: Add a bunch of spaces until it has the same length as your other lines of text
it rquires a token sent in the http header or some shit
Well yea
i know
in the same config you smack the port into 😅
it doesnt even print anything in the console saying you didnt specify a token
i get that part
there isnt
and apparntly, im not the only one
see discussions tab, last post
i cant send pics but
Guys I need help. There is no config file in the RestPAPI folder
Somewhat correct ?
They also add a small one pixel dot and they color it gray so it is less visible. You can actually see it right next to the text if you look closely.
I believe I once stole a piece of code that does that.
But doing this with the vanilla font has the disadvantage of maybe being incorrect if ppl have resource pack that changes the font.
I usually just force a monospaced font in my server resourcepack and add spaces. Cleanest way for sure.
But for the vanilla font you need to do some trickery.
With a few lines of very basic code. Try to figure this one out.
https://github.com/steve6472/StevesFunnyLibrary/blob/41465cf9da001627331b1eac8ae54399e9be7439/src/main/java/steve6472/funnylib/util/MiscUtil.java#L382
(Also includes the source of the code)
This one centers it but the main part would be the line width probably.
I'm developing a "custom chests" plugin that, basically, allows players to have paged ender chests. Players must also be able to search items by query, and that's when I need a way to identify each item (I need to know their page and slot in the chest) to implement applied changes in the chest. The problem is that I cannot use NBT tags (nor ItemMeta, since item meta is just a wrapper for NMS tags) because I need items to keep stackable. After checking out NMS code, I found out that it's because two item stacks must have the exactly same NBTTagCompound in order to be stacked. My current solution is either patching the server (not preferred) or modifying the equals method using a bytecode editor, both to skip tags with a specific prefix from the comparison
I'm wondering if anyone faced this problem before or has any better idea
Neither will work well
The client will still think they cannot be stacked, causing a lot of weird behaviour
makes sense
to implement applied changes in the chest confuses me ?
Player searches items and potentially removes them from the chest ?
Sorry, I'm not a native english speaker. Yes, they may remove items from the search menu
The search inventory is not the chest itself is it ? What prevents you from just keeping the page+slot number attached to the search inventory in regards to the displayed item
You can have a seperate index that keeps track of what item is in what slot
Like, you know what items you are showing in the search menu because you searched through your enderchest.
You hence also know where you found those items
listen to the removal of said items and yank them from the enderchest as well ?
Is there a way to suggest to the VM that it should turn some certain reflections into bytecode?
Bruh
Isn't this still slower in the long run?
Since reflections called upon many times are turned into bytecode
And I'm looking for how I could suggest the VM to do it right away
just have the Method/Field/Constructor in a static final field, the jvm will do what it deems necessary
"right away" is not a thing the vm does
the jvm's philosophy is that a piece of code will essentially run as few times so there is no real need to optimise things right away, then it'll keep statistics for every function invocation and when it does run more than a certain amount of times then it will optimise things
The VM does not care for your mortal requests
Also, if we could specify, by "bytecode" they mean direct memory access?
Like player.handle.connection equivalent?
Those being variables
What are we doing with bytecode and why
technically in bytecode you can?
Just use reflectasm
I'm just curious of how that works
reflection is just fine for that, again just keep the reflection things static final and the jvm will inline the calls eventually into their actual instructions
Reflections.
mmyeah just use normal reflections and let the JVM handle it
alternatively you can use methodhandles/varhandles but yeah, more of the same things, maybe more raw but still needs to be inlined later by the vm
Yeah, but when they say it turns into bytecode, what exactly does that mean?
Doesn't reflection use handles internally now
18+
idk
Java
but using handles directly is faster
It gets turned into raw java bytecode
So no kids got it
it means it'll turn into jvm bytecode
Which is basically as low level as java goes
I didn't realize at first
bytecode is bytecode, it's what makes up a class file, it's what the jvm reads directly and interprets and eventually hits c1
So it accesses the memory place directly (field/method etc.)
like if you have a static final MethodHandle for some static method, once you call it enough times it'll be compiled into the respective invokestatic instruction
"yes"
Like if it were a direct call
yes
technically it already is, but there is some indirection going on too. the jvm will later get rid of that indirection and inline it
What does inline mean?
And this is why spigot isn't super fussed over our reflective event system
I recall the old event system
the problem with it is that the Method is not constant (static final) so the jvm won't really inline it
unless you turn on some experimental jvm flag
I could update it to method handles
but that can break other stuff ofc
I trust non static final things
wouldn't be too hard

yo lyxnplay
im still suffering with the REST API thing
it requires a token and i cant figure out how to use it
There are some other improvements that could be made
Doesn’t the event system compile to asm
that is paper
d*wnstream
like?
p*per
Oh i see
Ability to use consumers for events would be cool
i mean
oh fair
^
do your own event executor
p***r
Well yeah, but simplifying it would be nice
syntax sugar is always great yea
can I run a mc server directly from IJ
makes code taste better
I usually write over the event system for good syntax sugar if i do something large
I wonder if there would be any noticible performance gain from skipping events altogether if nothing is listening to them
Like, skip constructing the object + callEvent
Probably not any major difference
you pass it ?
I presume
as a header with the name of token you pass the token
Might help for some high frequency events
Idk I imagine the JVM is pretty optimized for object creation
fixed the issue by using https instead of http
now the new issue is:
{"error":"The required authorization heads were not present in the request."}
the plugin uses "tokens" for authorization... how do i send them in my https request? tried searching for them in the network tab to no avail
Could just be a boolean check
Like, every server gonna have a a dumb plugin listening to PlayerMoveEvent
so now you won nothing just another thing to check
surprisingly
not so much
Yea I guess ?
I mean it's fast
Valhalla
but not that fast
when
I kinda want events for more things
same
But they might be too high frequency :c
how are you constructing the request
just check against last pos per tick 
I wanted to allow injecting callbacks into anything that ticks
unfortunately that didnt work
But apperently having server code directly call plugin code is against our API design
can you provide some code
Yea I mean
once that plugin unloads
its pretty not fun
now you have something referenced by the server that might capture god knows what
I mean cleaning them up shouldn't be that hard
const token = 'none' // 'none' is the actual token name
const response = await axios.get(`https://ip:8080/${playerName}/vault_eco_balance`, {
headers: {
'Authorization': `Bearer ${token}`,
},
});
'token': token
tried that too
ehhh
Multimap<Plugin, Consumer<>> with weak keys mayhaps
Well depends
yea but now your listeners need a plugin instance to register their callbacks
Yeah that's the only annoying part
Plugin instance needed for many things
make me sad
I mean, "callbacks into anything that ticks" also just like
error: 'The required authorization heads were not present in the request.'
Slightly faster than keeping the stuff in a list and using a scheduler
Probably not by much tho
:p
const token = 'none' // 'none' is the actual token name
const response = await axios.get(`https://ip:8080/${playerName}/vault_eco_balance`, {
headers: {
'token': `${token}`,
},
});
The github source code does not produce that error o.O
it just gives you back "Unauthorized"
its an axios error
ig
Yea I guess
probably just yanked back for any 401
You just noticing the copilot thing now?
yea ig
Yea lmao xD fucking copilot
It’s true
what do i do now
Somewhat
i dmed the dev
yea or that
hes busy tho
uuf
talked with him about a month ago on some random shit
Break open source licences 500% faster with copilot
and i dont know enough java to make my own rest api for papi


500 exposures
na
I code for exposure its worth it. I mean exposure is really worth it. I've dev'd for thousands of startups for exposure and profit shares once the server makes it big
as you can imagine I'm still poor living in my moms basement
ill actually pay u 1 iranian riyal
Are you telling me their million dollar server idea was not in fact a million dollar server idea
(defo didnt search what the weakest currency is)
apparently not
sounds like a....
skill issue
I have worked on servers that didn't release though
but the thing was I was payed hourly
so like idgf
I've done one commission so far
I'm in highschool still technically
The server made it like a month
same here

ik then you get more comissions 😈
I always find spigot pr's much more fun than comissions though
I wanna say there was a spigot thingy
I had to run
to check their shitty checkstyle settings
I would do it privately otherwise you will loose some money
anyone with a quick hint before I go on a quest to finding it
you want to know how to check style
lol
could you possilby be talking about the development profile
mvn whatever -P development
👀
At least it's not BuildTools with C# style {}
Do I not run this on CraftBukkit ? xD
Holy fuck
the amount of random errors don't event fit my terminal view
you do :3
did you apply patches 

