#help-development
1 messages ยท Page 2083 of 1
+rep for senior team
Intellij comes boundled with its own maven instance
only for like a very short time window
member when donald trump was still president? oh yea i member
you had to be super quick to get in on that deal for the oil prices XD
was better than free
xD
got this error tho:
no nothing political
economical*
hes replying to me
referencing the best series
ever
Then change the maven directory used by intellij
lul
and the place won't fall apart chaotically
to what?
oh its the man who steals top slot on server boosters from me
path to your maven binaries
he is very good ๐
Also @noble lantern what happened to that test?
so the file I downloaded from there? https://maven.apache.org/download.cgi
couldnt get it working ngl
But bundled should work without any problems
yeah doesnt tho idk why
and compile takes 1 mins i got bored of recompiling to test
i suspect my pom.xml isnt even setup properly but whatever, it works xD
it isn't that hard to change the TPS ๐
i would of assumes it would be a variable
but nope
its probably something deeper than the main class
Yeah then just change the path to your maven bins
wouldnt you just divide 1000 by the tick time in miliseconds
Oh boy, is this lag free?
the issue is theres no clear indication how the servers really processes those ticks
Its literally just a field. But changing it will result in weird behavior.
theres TPS = 20 but changing it past that doesnt change anything, unless /tps is lying
Plus was just doing it for fun
@wet breach what would you say to my approach to write my own permission system using the scoreboard teams as its backbone? (its already working xD for the most part) xD
Wont be consistent because the runnables might be ran in different orders.
why do you want to change tps
get this now: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project plertanixplot: Fatal error compiling
just wanna see what happens frost said it was fun
Whats the fatal error?
what would it be used for
i think it would rather use the tick time
that it is terrible
for calculations
Look at how they did it:
https://www.spigotmc.org/resources/overdrive.73779/
there is api methods in regards to permission related things
idk where can I look that up
Click higher in the hierarchy
ah
I think that plugins broken tbh
There you go. Invalid target release
theyre changing the minimum length the tick is adjusted to
is that with the plugin or your own code
Make sure to use the latest version of the maven shade and maven compile plugins.
both
ah
i know its not really possible with a plugin past jdk 12 as you cant edit public static finals really
already tried it
and where do I get them from?
ohhh okay thank you a lot
can i force a scheduled task to wait until a different scheduled task finished?
memory usage is so dumb
the server only deletes data when he needs memory
if u give it 32gigs itll first fill 32gigs before freeing memory
Kind of. What speaks against making the second task simply start another task after it finishes?
they're called unaware of each other, and passing one to the other would be difficult
How about you optimize your gc parameters. Then this wont happen.
i figured out the problem my spawn chunks has 10k tile entities somehow so i legit couldnt do 17tps
Would you mind explaining the overall task that you want the tasks to accomplish?
this is cursed oh nice laggy video
I have a config filled with 'effects' and a function that translates them into a hashSet of EffectPreset extends BukkitRunnable, iterates it and schedules them. The issue is that one of those effects is supposed to read in coordinates from a lodestone locked compass and another effect is supposed to use those coordinates. The reason they're separate effects is bc there's more than one effect that's dependent on those coordinates.
from what ive learned, mc by default tries to keep as much in memory as possible like chunk data so players can move forward and backward in the map without reloading chunks every single time
but the way the server does so
is quite exentive
as its just swallowing all the memory for this
This can all be configured. You would need thousands of players in a world to "swallow" 32 gigs of ram
at some point the cpu will be the problem anyway
Im not sure if i understand this. Whats the problem with the one task reading and the other task using the coordinates?
they have no relation to each other, they can't pass information to each other. It iterates through the entries in the config and translates them into the BukkitRunnable extending Effects & calls them
Hi does Java has some handy way of loading Resource files to code?
sounds like you just need to make a method that is intermediary that allows them to exchange information with each other
I hope you have something like a Map<UUID, LodestoneLocation> or some other centralised data structure that is accessible from both effects.
cant parse information. For that to work one would need toknow the UUID of the other wouldnt it?
Hey do you know why I can't do that ?
because setDroppedExp doesnt return an int
There is too much unknown information... Arent the effects per player?
Yes for the variable initialisation. Very basic Java.
So what he want ? ๐
To initialize an int variable you need an int...
no, they're in the config to get changed easily manually. it's something like this
effectList:
effect_1: grab_coords
effect_2: playsound_lightning
effect_3: strike_lightning_at_cords
And they are being ran after another?
HashSet<EffectPreset> effectsMap = DetailsConfig.getEffectDetails(echo.r_details.getConfigurationSection(spell));
for(EffectPreset preset : effectsMap){
preset.trigger_effect();
}
yes and no
the reason i ask if i can make one task wait for the other is because of the nature of HashSet to not have a ordered structure
Then why do you use it?
because the order of those effects isnt particularly important since they're all BukkitScheduler instances that call themselves
I do not understand what you want say
?learnjava
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.
But if one effect tries to grab coordinates and the next one needs those coordinates then the order is important. Crucial even.
yea but
even then theres still the issue of parsing the information from one task to the other
Ok let me show you a mock up.
Example number one:
public class EffectContext {
private final List<EffectPreset> effectList = new ArrayList<>();
private final Map<String, Object> dataMap = new HashMap<>();
public void runAllEffects() {
for (EffectPreset preset : effectList) {
preset.trigger_effect(dataMap);
}
}
}
You use a List so you have a fixed order. You then simply pass a Map<String, Object> to every effect in order.
The first one can write something in there, the next one can read something and so on.
This would run all those effects in one tick after another.
being dependent on ConfigurationSectoin.getKeys() it would only work if that returned a usable list
but it returns a set not a list
when im trying to reach arraylist from another class it makes the arraylist empty why is it
Example number 2:
public class EffectContext extends BukkitRunnable {
private final List<EffectPreset> effectList = new ArrayList<>();
private final Map<String, Object> dataMap = new HashMap<>();
private int currentIndex = 0;
public boolean hasNext() {
return currentIndex < effectList.size();
}
public void runNextEffect() {
effectList.get(currentIndex++).trigger_effect(dataMap);
}
@Override
public void run() {
if (!hasNext()) {
this.cancel();
}
runNextEffect();
}
}
The effects will be run in order but only one per tick
Because you always create a new instance of that class. Simple java concept.
in either case how can i get the effects in their proper order
I cant reload the pom anymore now it says this. log: https://gist.github.com/ItzJustNico/6fba3978e8b12f387fab4d9b7fd3741a
Then dont use keys because they are useless here. Just make it a List of Strings:
effectList:
- grab_coords
- playsound_lightning
- strike_lightning_at_cords
And then get it using FileConfiguration#getStringList()
thanks, i always tried to reach it with get
i use the keys so i can parse arguments to the functions via the config. For example, the volume, pitch, and relative coordinaet shift of the playsound_lightning
But i hope you dont use the keys to store any data...
no
Then i dont see why you would need keys
Restart your pc
because the keys indicate where to grab the configuration sections indicating the effects:
effects:
a:
type: sound
pitch: 2.5
shift:
x: 10
y: 0
z: 10
So like this?
effectList:
- grab_coords
- playsound_lightning
- strike_lightning_at_cords
Another yml
effects:
playsound_lightning:
type: sound
sound: LIGHTNING_EFFECT
pitch: 2.5
shift:
x: 10
y: 0
z: 10
How is your data structured
well like what i showed as example. 'a' is a generic key, and the function instantizing the effects does for(String key : section.getKeys(false))
i just number them 'a' 'b' 'c' etc because its fast
fast in what way?
in typing in
still the same ๐ฆ
also its helpful to name them like that because if i want to indicate a more uncommon effect the name of the key doesnt matter
so i can name it like 'explosion_effect'
Im now completely confused how your data is even structured and i dont see any reason why you would need keys at all.
I am not sure how you are dealing with the people here @lost matrix lmao
I don't recommend running your server in a google drive folder
Anyways if no other server is running delete the session lock file
barely
?paste
https://paste.md-5.net/ehohumukaq.apache
visual section
i dont even run a server i just wanna reload the pom
running a server in google drive bru
right click file -> maven -> reload
assuming you use an IDE
i am not sure where else you would reload a pom or would need to ๐
@smoky oak
What is the purpose of the key here?
And how do you even know what type of effect "a" is? By just the keys in that section?
Dont have your projects in drive folders and also delete the lock file.
i told you before the names of the keys dont matter. Their purpose is to separate the effects from each other. The key 'visual' is there because I have a scheduling class, which gets extended by different effect classes - audio, visual, and things permanently changing in the world
i iterate over each key in the sections 'visual', 'audio' and 'world', adding the effects to the HashSet and returning it to the main function, which then calls the for loop to schedule them all
maven doesn't work every well in google or one drive directories because the software involved with syncing those directories with the services, locks the files and prevents maven from being able to use them. If that isn't the issue then the pom is opened up somewhere else.
That is a super weird and hacky approach...
and inefficient
if it works without noticeable lag its good enough
again what i really need to do is to parse some information from one effect to the other
yeah if you like degraded quality sure
hwo would you do it then
probably something similar to what 7smile7 would do it lol
idk, when you got two pretty decent developers here confused in what you are doing or how you are doing it, odds are it probably isn't a very good way lmao
Still not 100% clean but its def better than what you are doing rn:
public class EffectContext {
private final List<EffectPreset> effectList = /*load the effects in order*/;
private final Map<String, Object> dataMap = new HashMap<>();
public void runAllEffects() {
for (EffectPreset preset : effectList) {
preset.triggerEffect(dataMap);
}
}
}
Load them in order and pass some sort of data structure between them. From 0 to N.
about that... i remember having an issue with my IDE telling me its not possible to call a function with a HashSet<Item> when the parameter type was HashSet<Object>. Do you know why that is?
I am assuming you were having issues in that it doesn't have a .get() method
Yes sure. A HashSet<Item> cant be implicitly downcasted to a HashSet<Object>.
HashSet<T> then?
well if they were referring to casting, think they meant the other way
ah no
but now we are getting into the realms of generics though
which I doubt you are ready to really mess with
Yes. If you want to allow any type of collection you can either do this:
private <T> void call(List<T> list) {
}
Or use a wildcard:
private void call(List<?> list) {
}
where's the difference between T and ? then?
The one makes the method generic and the other makes the type a wildcard. It has a ton of implications depending on what you
are trying to do with the list internally.
very good reason for you to not mess with generics right now lol
For example:
This is not valid
public void otherCall() {
List<String> elements = new ArrayList<>();
String element = "TEST";
call(elements, element);
}
private void call(List<?> list, Object obj) {
list.add(obj);
}
While this is allowed:
public void otherCall() {
List<String> elements = new ArrayList<>();
String element = "TEST";
call(elements, element);
}
private <T> void call(List<T> list, T obj) {
list.add(obj);
}
But lets stay away from generics for now...
maybe context for this one
public static boolean allOne(HashSet<HashSet<Object>> tHashHashSet){
for(HashSet<Object> tHashSet : tHashHashSet){
if(tHashSet.size()!=1)
return false;
}
return true;
}```
This function is uninterested in the data type the inner HashSet contains so i wanted to make it generic but neither Object nor T work here
Use a wildcard instead. Also: wtf
lmao
worked thanks
not sure if we should be worried about that
I suppose we find out when they come back and complain about something along the lines of they can't read from their generic method but can write to it or vice versa ๐
context for this one, i iterate through a list of locations and get all item entities in a bounding box of loc, loc.clone().add(1,1,1). I require that each of those bounding boxes contain exactly 1 item entity
You should use the lowest interface that still respects the liscov substitution principle.
So
public static boolean allOne(Collection<Collection<?>> nested) {
for (Collection<?> collection : nested) {
if (collection.size() != 1) {
return false;
}
}
return true;
}
This would have the same functionality but a broader use range.
probably better if you use that instead of generics so you don't run into issues that you don't quite understand yet ๐
wait isnt that again not able to get parsed?
Funny enough, ? is probably better than Object there
Ah beat me to it lol
lol
so wait
it can parse HashMap<HashMap<?>> to Collection<Collection<?>> but cant parse HashMap<HashMap<Item>> to HashMap<HashMap<Object>>
Maps and Collections are different, so no
well the first matches because it is using wildcard generics
? is a wildcard so it could be either Item or Object
the second way you are attempting to implicitly cast which isn't allowed in this way
How would I create an item? I want to override a BlockDropItemEvent, but the event.getItems() doesn't take ItemStacks
wait what does HashSet have that Collection doesn't?
a set
HashSets are Collections, they're just a more specific type of one
Collection -> Set -> HashSet
Order I suppose?
Sets don't allow duplicates and aren't ordered, but HashSets operate on the hash values of objects so #contains() operations are faster
oh right there we go
Because it contains Items instead of ItemStacks. You can remove Items from there to prevent them from dropping.
Adding is now allowed.
Yes, I want to add items, but how would I actually make an item to add
Use set when you dont do contains() then?
If you want to take a peek at the Collection interface on the Javadocs (https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/util/Collection.html) you'll find a lot of different types of collections that all serve a different purpose and fit best in different situations
Note: There are some sets that maintain an order like TreeSet or LinkedHashSet.
Mhmm
i used this as a guide thus far
I guess order isn't really a specification of a Set, just a HashSet
Well someone is certainly getting a free lesson in advanced java this morning lol
Yeah, List/Set/Map are probably the three you'll use most often
ArrayList/HashSet/HashMap implementations generally
Until you explore alternative options you'll be okay with those lol
You listen for the BlockDropItemEvent and simply spawn additional Items on the broken blocks location.
well every bukkit plugin ever I've seen has used HashMap instead of Map
BlockDropItemEvent gives you a mutable list, doesn't it?
Yes
I thought that adding items wanst allowed. Only removal.
Yeah, https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/BlockDropItemEvent.html#getItems() is mutable. You can add a drop to it
Oh you're right
mbmb
No additions
You should use the highest type when possible and not the lowest. Unless you making an API and sometimes it is quite the opposite
You'll see Map<K, V> map = new HashMap<>() very, very often as you really don't need to know the implementation type in most cases
It provides no benefit
(again, in most cases*)
I'm more curious about the reason to use HashSet instead of Set. I dont call contains() at all
My problem is whever I make an item using new Item(), it wants me to override all methods in the class. Obviously I'm using the wrong constructor, so how should I properly do this
Use World#dropItemNaturally(Location, ItemStack)
Maybe not right now you don't, but you may only use #contains() exclusively in other scenarios
And not ConcurrentQueueLinkedTreeHashMapSet?
What if you're keeping track of a set of player UUIDs that are able to perform some functionality?
You'll add to/remove from it, then #contains()
Ok, thanks :D. Wouldn't have thought of that
(though for reference, a HashSet is a Set much like how a HashMap is a Map)
Oh i havent meant overall. I meant is there a reason to, in an instance i know i will not call contains(), to still use a HashSet
Maybe. If you aren't iterating either (because iteration tends to be slower in sets) but you don't want duplicates, a Set is probably ideal over a List
It's all extremely situational
Duplicates
Ah yeah my bad not a server. Solution still applies. Make sure only one instance is running and delete session lock
Ah that would be a reason. I do iterate that HashSet in particular quite often
also Set still cannot contain duplicates right?
Dont optimize your code before writing it
I've written most of it already
All set implementations do not have duplicates
Well still dont optimize it
If it doesnt need to be
to clone my earlier question
spawning 40000 Particle.DustTransition in causes them to appear over a few seconds in the order they're initialized in, but the method is supposed to run in one tick (50ms) and also tells me it finishes in that time in the logs. Any idea why?
so yes
optimization might be useful here
if i ever find out the reason it doesnt work like it says it does
I dont think you will be able to do this in one tick
the server says it works in one tick
it also says if i call /tps immediately afterwards that the tps of the last 5 seconds was 20.0 tps
Well the problem is
You have to send 40,000 packets to the player
Thats easy
Sending packets is easy
I think there would be a client limitation at this point
They may not be able to receive all of these at the same time
i recall that issue not happening with lower amounts of particles
but i use so many to generate a continuous shape
While this may be true, you shouldn't limit yourself to API options just because you are not making use of them. There isn't any loss of benefits by using a HashSet over a Set even if you are not making use of the extended features in fact you have more benefit because later down the road you won't have to spend time refactoring code because it turns out you do need that extended functionality.
most of the time where you have to worry about these things is if you are making an API where you would return the lowest type instead and let the user decide if they want to make use of a higher type because you don't know what the user would want.
What do you mean running there is nothing running I just want to reload the pom and where is that session lock?
doesnt set still have the contains function? wouldnt the onyl thin i need to change be the implementation method behind the instantication of the set?
Set<Item> itemSet = new Set<>() -> Set<Item> itemSet = new HashSet<>()
well that answers that question bruh
imma take a break and then deal with the part of my code thats not working
that sounds ideal since you basically got a crash course into some advanced java stuff ๐
40k packets is nothing ๐
im unsure if its 4k or 40k packets
40k would be a lot
i call spawn particle 4000 times with 10 particles each
I usually try to keep lower than 1200 for complex visuals
spawn particle packet contains the amount i think so it would probably be 4k
You can also use the debug screen in minecraft to see if your client is receiving all the packets
where?
no in the debug screen
Oh
if each packet is 60bytes which is their max size, that is only 2.4mb of data
must be a client issue then
โrxโ
I mean 2.4mb is still significant
is tht over the lst second?
yes and no, network hardware pads out the packets to their max size usually ๐
makes it easier to handle in this manner
Im just thinking like
That requires around 20mbps internet
Which most have
But a decent chunk dont
while true, the packets are not sent or received all at once
I think these are?
so while total it is 2.4mb they are not coming down the pipe all at the same time
it goes up to 5000 rx over a few seconds then drops down
isnt rhere some conpression on the minecraft networking
yes
so it will prob be a bit lower than 60 bytes/packet
doesn't change tcp packet sizes though, just changes the size inside of the packets themselves
Should emphasize i have no real expertise
me neither
So take anything i say with a grain of salt
lmao
well networking is actually an area where I am an expert at ๐
nice
didn't take 52week course in Satellite communications to not know anything ๐
lmao
idk maybe yoy can help with this problem
The issue is trying to send 40k packets alledgedly
Theyre not all appearing at once like he wants em to
however while the packets are padded to 60bytes, the nic will discard those empty bytes upon receiving ๐
Server says they were all sent in a 50ms interval
well this is going to be probably an issue along the route as well as the receiving ends hardware and setup
wait a fucking second
I just sent a quarter million particles in 25k spawnParticle calls stretched over 2 seconds
no lag
while the server may have sent those packets, that doesn't mean none of them needed to be re-transmitted
TCP requires acknowledge packets in return
if it doesn't get one, it will send a new one
so if the client cant recieve that many packets they get resent
hi! How can i set an item to be unpickable from the ground?
resulting in the stuttering display?
give it a tag in pdc then cancel whatever event is called when it get spicked up
would this work?
that isn't how it works
network hardware takes care of the re-transmitting the mc server wouldn't even know about it
Ya
oh talking about something else
Also i believe there is a packet loss metric
i meant client side
server side there seems to be no issue considering the function finishes within one tick
yes but this only applies if the client knows it was supposed to receive it
so if the server sends 40k packets, the client doesn't know it was suppose to get 40k packets
Right
Server does
Just unsure if there is any feasible way to know
Probably not
Mhm
IE, you send 40k packets, client then reports back to server how many it got
hm i recall one of the things i tried - i set the particle display to decreased
can you spawn in particles without nms that only those whose setting is all see
however though most of the time 40k packets isn't an issue for most people
minimum down speed someone would need for that is 5mb/s
maybe even 2 or 3 would just be fine too
client tick rate is the same as that of the server
so as long as they can get all the packets in 50ms
or even 100ms
then it shouldn't be an issue lol
Right well that doesnโt explain why its not working
no it does work
it stutters
but the server says theres no lag at all
must either be the client or the transmission then
well that is going to be more of a case of client lag then it is a network problem
if the client can see all the particles but it is stuttering then that means the client got all the packets or most of them anyways
Ya thats what i said
well theres no actual lag on the client
but the particles appear over time
not at once
How much over time?
server lag isn't going to affect the displaying of the particles on the client side
I bet the server is throttling the sending of the packets
throttle limit is for both tx and rx
uh if i spawn in about 2000 * 10 particles
Yea yhats also something i was thinking
SOMETIMES they appear over time
I am thinking its client related
Wrong pdc data type or smt
if you wanted to be sure it wasn't hardware related, send a custom ping packet from your server terminal that is 60bytes to the client system
the weird ting is that while it may stutter one time, the other time it eats three times as many particles without any issue
?? how could it be wrong?
@glossy scroll for not being an expert in networking at least your intuition wasn't off base either ๐
in the error it says NBTTagByteArray
but i never mention arrays
Darn i cant find the gif of my tornado
lol
does it tell you about where the offending line is?
man this is the error
he means 'shouldnt there be a caused by below that'
you misinterpreted the error
you are trying to store an integer when it wants a bytearray
you need to declare thedata type youre storing in a pdc
it only allows primitives, byte array and string
need to serialize your data or put it in a string
true! but i'm using a library from @tender shard
doesn't mean it is perfect ๐
thats the DataType thing
or you are not using it correctly lol
I am not familiar with alex's lib
it worked perfectly until now and also i stored integers really well
I mean, you are clearly accessing one value as an int and then the same value as a uuid
The error doesnt lie
so i don't really understand whats wrong
whatever value is stored under WillowCore.entity_data
well that isn't true
UUIDs?
Do not claim to have perfect code if it errors out
rarely it lies about the error ๐
you read it once as an DataType.INTand once as a DataType.UUID
๐
That explains
I do hate it when java lies about the error though
glad that isn't a common thing for people to complain about when they come here ๐
what does that mean?
11.04 14:19:21 [Server] Server thread/ERROR Error occurred while enabling PlayerControl v1.0 (Is it up to date?)
11.04 14:19:21 [Server] INFO java.lang.ClassCastException: class java.util.HashMap cannot be cast to class java.lang.String (java.util.HashMap and java.lang.String are in module java.base of loader 'bootstrap')
rankPermissions = (HashMap<String, ArrayList<String>>) Utils.deserializeFromFile(permissionFile.getPath());
is it not possible to serialize/deserialize an object
like a hashmap
that holds another arraylist?
public static HashMap<String, ArrayList<String>> rankPermissions = new HashMap<String, ArrayList<String>>();
where does the error occur
with this line
it serializes just fine
ive read the file
but when its supposed to deserialize the object
weird
it throws an error
Error says your cating hashmap to a string though?
but code says im not
when are you casting it to a String wtf
im casting a hashmap holding a string as key and an arraylist as value
ik it says im casting it to a string
but i dont see where
thats lit a 3liner so far
It is possible
the arraylist itself holds strings ya
but yet again, im not casting to a string im casting to a hashmap holding those members
Has to be the way your storing it
public static HashMap<String, ArrayList<String>> rankPermissions = new HashMap<String, ArrayList<String>>();
@SuppressWarnings("unchecked")
public static void loadPermissions()
{
File permissionFile = new File(Utils.getOwnDir + "/RankPermissions.bin");
if (permissionFile.exists())
{
rankPermissions = (HashMap<String, ArrayList<String>>) Utils.deserializeFromFile(permissionFile.getPath());
}
}
public static void savePermissions()
{
Utils.serializeToFile(rankPermissions, new File(Utils.getOwnDir + "/RankPermissions.bin").getPath());
}
``` this is the whole code
so far
its like nothing
ik
Whats it look like when stored in a file also whats serializeToFile method look like
Utils.getOwnDir works fine, it just gets a static reference to the main class and then parses it to its own directory
so i can move plugins in different directories and they still find their own directory
where theyre supposed to store data
Wait ik
DeserializeFromfile
Does that returns a string itself
And not a type of Map
Check if its instanceof String
sec
this is still more or less from a tutorial which ive alternated to fit my needs
public static Object serializeToFile(Object obj, String str)
{
try
{
ObjectOutputStream s = new ObjectOutputStream(new FileOutputStream(str));
s.writeObject(obj);
s.flush();
s.close();
return 0;
}
catch (Exception e)
{
return e;
}
}
public static Object deserializeFromFile(String str)
{
try
{
ObjectInputStream s = new ObjectInputStream(new FileInputStream(str));
Object ret = s.readObject();
s.close();
return ret;
}
catch (Exception e)
{
return e;
}
}
and kept a few placeholders where i dont need them like the return value just in case
How can i listen for the Enderchest open event?
InventoryOpenEvent check if instance of players enderchest
ty
Map<String, List<String>> ranksPermissions = new HashMap<>(); :)
did i initialize it incorrectly?
ye but it looks ugly
tho this works fine too
public static HashMap<String, String> defaultMsgs = new HashMap<String, String>();
im keeping a bunch of config data in memory yes
serialize the list on its own?
never worked with serialisation ๐๐
its anoying to get into
but its very handy
imagine writing pagefiles when ur provider only gives u 4gb ram
its just maps and objects :}
Fantastic until Gson does something stupid
We dont talk about gsons stupidites
Theyre features
Okay?
Jackson has that feature too
ObjectMapper
im going to try just for a quick debugging to change the data type of the hashmaps value members
doesnt matter since its an empty snipped so far anyway
"ok Gson go save this int"
"ok"
"Can I have that back now Gson?"
"yes but I put a .0 at the end so now it's a double"
so its storing 2 strings instead of an arraylist
๐คฃ
but that shouldnt make a difference
because all hashmap, arraylist and string inherit Serializable
implement*
NodeJS does the same bullshit sometimes
Though not as serious in Java, still annoying
ik what the problem might be
i keep storing the same corrupted arraylist
from before
nope
still corrupted
wtf
why wont it load its both strings now
even my uuid works
How would I go about making a server selector in Bungee? What I think I'll try is make a command in bungee and whenever I click on an item in the server selector inventory I run the command with the name as the argument
can someone explain me what bungee actually is?
though in js its just "number"
is it just an api to work with mmultiple servers or what?
a proxy that bridges multiple servers together basically
player connects to proxy
player connects to server thru proxy
what is a proxy :kekw:
well the way i think of it its like an extra layer
In nodejs you can check its type :p
node.ts ๐
a layer of networking stuff?
manages and redirects connections to servers
just forwards the packets
that
but you can handle them before they reach the actual servers
Ts i nice for js ngl I love having explicit types
and you can teleport players to other sevrers
but proxy doesnt send game packets and stuff
And not some wildcard variable that thinks it can be everything
it'll send the casual handshake and login probably
oh yeah
but for game packets thats from the backend
oh
okay ive copied it 1:1 from my working project
its still not working
so i guess ik where to look at
and ive found it im so dumb
@noble lantern
public static Object deserializeFromFile(String str)
{
try
{
return (String)DeserializePtr.invoke(UtilsPtr, str);
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
e.printStackTrace();
}
return null;
}
try return kek
ive already fixed it
its working now
the problem was that i actually access the method using reflection
and my wrapper function was returning a string because ive copied that wrapper from alot functions
because i outsource all standard methods i use into another plugin to access them via well reflection
Do custom channels we register in BungeeCord act the same as the default BungeeCord channel?
Im a bit annoyed trying to do this in block place event
- If claim exists, allowed players to place blocks (if they are inside the users)
- if claim doesnt exists claim another
whats annoying about doing that
I have this code but im not secure about it
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
Claim claim = this.claims.getClaim(event.getBlock().getLocation());
if (claim != null) {
if (claim.getUser(player.getUniqueId()) == null) event.setBuild(false);
}
this.claims.create(new Claim(player.getUniqueId(), "test", event.getBlock().getLocation()));
}
No, just the location
well every location of the blocks of the claim?
My claims are based on 1 location (the center block)
And them virtually im creating 2 corners
uh lol
Well you know you're always making a claim right?
Whether there's one there or not.
im thinking that you have a weirdly designed claim class
I explain, the claims have 1 location, and them i convert that location into a cuboid (to generate 2 virtually corners)
what if players place a block on a location that is not the middle of a claim, will that allow them to place or not?
Yeah that's a fine way of doing it.
oh god
gotta tell u, as long as u dont expect a user to manually update the file like for example using a config file, serialization is so useful esp because its super easy to use.
also for networking
the hell is event.setBuild(false) tho
since when is that method there
ye
i was thinking that
ah lol there's actually a method setBuild
screenshots on linux go brr
nah just shareX and press ctrl + printscreen
and it automatically copies the screen to your clipboard
๐ค
sharex is only windows
:(
screen capturing thing
its easier than pressing a few buttons
I only use ShareX if I want to make a gif
i have one of my mouse buttons bound to snipping tool
best decision ever
Dessie and Fourteen this how looks now:
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (!event.getBlockPlaced().getType().equals(Material.BEACON)) return;
Claim claim = claims.getClaim(event.getBlockPlaced().getLocation());
if (claim == null) claims.create(new Claim(player.getUniqueId(), "test", event.getBlockPlaced().getLocation()));
}
i got a button which is basically ctrl now
why not use the window's snipping tool and just press prt scr
no need for equals, == comparing for enums is fine
I seen and still wrong the code
idk lol
That why im so messier lmao
Because i need to:
- Create claims when a claim doesnt exists on the location and if block placed is beacon
- If claim exists, allow to place blocks (the owner) and his team users
is there a map with the claims?
i would do java Location loc = event.getBlockPlaced().getLocation(); Claim claim = claimsMap.computeIfAbsent(loc, () -> new Claim(player.getUUID(), "test", loc));
or well instead of new claim just claims.create
returns a claim too i guess
claims.create(new Claim()) wha-
no wtf
heh?
u cant have duped keys in a map
and even if u can u shouldnt do that
ur gonna have a few ten thousands of entries for each claim
i know that, computeIfAbsent just creates a new claim or returns the claim if it exists in the map
bro
u shouldnt use that type of map
anyways
ur map will look like this according to ya
HashMap<Location, Claim>
which sucks ass
Exactly
So im messed in the event
then tell me that >_<
sure
when im done with rust i'll make a claims plugin too
there are many
and a home plugin.. smh soo much more to do
no one will ever make something better than the existing one
I wouldnt bother
and even if you do
no one will use it
i dont care about making it better i just want to try to make one
oh ok
My claim store (owner, name, location, team users)
For checking the blocks inside the claim i use a cuboid class
So i store a single location of the claim (the centered block)
Because its a block protection plugin, so the claims should be created base on a center block and protect all blocks around in a radius
mwe
How do i get the port of the spigot minecraft server?
I know how to get the ip address but there is no get port method
๐ค
getServer().getPort() i guess
Yeah
bruh
it is there :)
And maybe try using a good IDE or use github copilot
i was trying to work with
MinecraftServer minecraftServer = MinecraftServer.getServer();
No that no the spigot api
of what though
uhh about what
Could u read my explanation?
lemme write something rq while u try to explain
I already explained
there its start
Well that doesnt look awesome design
Oh u can help me a bit?
ok
are you on java16+?
then make it implement the Cuboid class
with the methods that are for a cuboid
like
contain() etc
any method related to radiuus shouldnt be in cuboid interface
and override them in radius implementation of Cuboid
and later if you want to
u can just implement Cuboid
to make a
SimpleCuboid or smth
which accepts 2 locations
Hex, So cuboid interface should contains methods:
void expand(T location)
boolean contains(T location)
T getPos1()
T getPos2()
No sorry
np
Im trying to do cuboid multi version
So be able to use it from 1.8 to 1.18x
If not i would be using BoundingBox
๐ฎโ๐จ
I mean sure
you wanna make it generic?
I mean that makes sense
since not all cuboids are bukkit location cuboid
short question cause i cant test it rn, if i do String.replace("{break}", '\0'); will this cut the rest of the string off as it would in C?
no.
cut the string off?
using a null terminator character
Hex i make the interface generic, because you can have location cuboid or vector cuboid
aight teye
But the difficult thing for me its the math lmao
Because based on 1 location i should calculate 2 corners
that wont work anyways
Hex can i letter dm u?
String.replace is not static
Allr
But dont yo u get mad i tag so you dont orget the message?
Because if you dont tag then you lost messages
I had many times losted my questions
Because this chat its so active
its fine
yeah
makes sense
UHH
i failed in math cant help u with tha
LOL
Yah dont worry the cuboid class i had was working great
also always get the -X -Y -Z corner and X Y Z corner
So i just need to do it inside RadiusCuboid
private double x1, y1, z1;
private double x2, y2, z2;
public Cuboid(Location location, Double radius) {
this.x1 = location.getBlockX();
this.x2 = location.getBlockX();
this.y1 = location.getBlockY();
this.y2 = location.getBlockY();
this.z1 = location.getBlockZ();
this.z2 = location.getBlockZ();
this.inflate(radius);
}
void inflate(double x, double y, double z) {
if (x != 0) { x1 -= x / 2; x2 += x / 2; }
if (y != 0) { y1 -= y / 2; y2 += y / 2; }
if (z != 0) { z1 -= z / 2; z2 += z / 2; }
}
boolean contains(double x, double y, double z) {
boolean xCheck = x >= x1 && x <= x2;
boolean yCheck = y >= y1 && y <= y2;
boolean zCheck = z >= z1 && z <= z2;
return xCheck && yCheck && zCheck;
}
public void inflate(double radius) {
this.inflate(radius, radius, radius);
}
public boolean contains(Location location) { return this.contains(location.getBlockX(), location.getBlockY(), location.getBlockZ()); }
so do like some Math.max and Math.min shit
That work really wells
yeah but if the second corner is at -X -Y -Z it wont
so make sure the first is always - and 2nd always +
hes saying
it should always be
0,0,0;1,1,1
OR
always
1,1,1;0,0,0
so you know for a fact the bigger position
@granite owl
System.out.println("{break}".replace("{break}", String.valueOf('\0')));
this will return nothing
but if you need two arbitrary corners it might be useful to force them to be correct
just a line break
And it most diff because its a 3d, so i dont just have an x and z i also have Y that i dont know how it works
I will have to read about x, y, z
whats now the problem in fact?
dunno why i was writing this but ye
Works great?
Another bootleg BoundingBox?
nah i decided to write smth for verano
Math.min, Math.max
i forgot whats the problem actually lol
@sterile token Just use Spigots BoundingBox
I cannto since i want my cuboid support 1.8x until 1.18x
If not i would already be using it
i hate maths lol
Which is the math to calculate 2 (3d) corner based on 1 centered location and a radius
Then copy paste the class from spigot.
did you fail 3rd grade geometry
center.add(radius, radius, radius)
center.subtract(radius, radius, radius)
I never had geometry its my first year of computer science im just 15y im a child lmao
wait what circles in mc ๐ค
Or you could just literally copy paste BoundingBox from spigot because it will work in all versions.
ehh still
๐
That why im so dumb
your age shouldn't really matter for these basic things
Minecraft terrain:
= claim block
$1 = corner 1
$2 = corner 2
--$1----------------
--------#---------
--------------$2----
and what are you trying to calculate?
I did the draw
i wrote some simple class
Oh oik
Really thanks people
I will check all your suggestions and accept then
That why i love this community
is that contains method properly working? because you have to check if the provided x and y are between the x and y of the obj
Because other people will say me "Verano, dont fuck with cuboid and use WorldEdit"
Isnt the same code i send?
when
it does calculations to ensure the first corner is always the smallest and the second the largest
yeah
lol
im still wondering what hes doing
anyways is Object#clone returning an object with the exact same fields and stuff as the original or do you need to set them yourself?
it does return with the same fields
i was underestimating the C impl lmao
The fields are all set. But if the clone is shallow or deep is an implementation detail that might vary for different classes.
Hello, I have a question does anyone have an image plugin for 1.16.5?
A deep copy would go through all fields and create a new object for each one. And it would do that recursively until it reaches primitives. So a ton of new
objects will be created in the process. A shallow copy only copies over references to already existing objects.
teye gonna try that in a few
ah so a deep copy is slower
but it basically does the same as a shallow copy
No the outcome is very different. The objects might look the same but they are not.
So which final code i have to use people
And the radius part?
what was the issue actually?
I dont know which code to choose
hey does anyone know how to get the map color of a block? I Found the MapPalette class but I have no clue how to get one, and it looks deprecated. Is there a API way to get this data?
if (item == null || item.getType() == Material.AIR) continue;
player.getWorld().dropItemNaturally(player.getLocation(), item);
}``` it doesnt drop the items
is there something in the inventory?
yes
old username :C
still dutch
ye

cuz
i want to do the title thing
and player.respawn buggy
yes but
i want the player to respawn instantly
and player.respawn buggy
sysout the contents
before and after
and use early returns smh
do people even know that those exist
same with && thing
i have no idea what that means
So what class shoud l isue
I so confused
Because i need to calculate 2 corners knowing the center location and a radius
i barely know what you are talking about
1.8
he?
e
if i schedule two things, at different times (1 tick delay more), no matter how long the first one takes, will it finish before the second or does it run async?
you are talking the whole time about corners and radius but i dont know what the actual problem is
no memes in general, they go to #help-development
I dont know how to get the blocks inside the claim
all of them?
hi
is there any package/api i can use to get player list?
like the whole list
of players
not just number
no no
im coding a dc bot
its javascript
true
well
ty
bye
wdym
what players? from the discord or the mc server?
mc server
im confused
I want to fetch the list of the players in the mc server
whats wrong with Bukkit.getOnlinePlayers then?
there is no way to interact with the server via javascript
can someone help me compile something?
unless theres native support iirc ๐๐
Oh lmao
furniture engine
not
i have no idea how to compile it
well
is it from github?
im So messed up i will finally search on google how to calculate 2 corners knowing from a centered location
you know how to?