#help-development
1 messages ยท Page 212 of 1
Or a runTaskLater every time they pop a totem. Then it only runs once
Yes?
It's deprecated
yeah resting task i like that idea
Any such similiar event?
No, client doesn't listen to the server for tab completion unless there's a /
what is it called when you launch minecraft server in editor itself and test the plugin
Debug?
hot reload?
Like individual plugins? https://www.spigotmc.org/resources/pluginmanager.69061/
But it breaks a lot of stuff
you can reload after exporting plugin
i think its intelij plugin or something idk
but some probably yell at me for this one
looking so bloat lmao ๐
Mango is that DataBase stuff?
is there even a reason to use an uuid representation instead of the standard stuff?
yes
fucking filter
hey, uh the send player message thing is sending multiple times
how could I stop that?
only send it one time
brr
I did
@EventHandler
public void onEntityDamage(EntityPotionEffectEvent e){
if(e.getCause().equals(EntityPotionEffectEvent.Cause.TOTEM)){
Player player = (Player) e.getEntity();
player.sendMessage(ChatColor.RED + "[CrystalBall] " + ChatColor.GREEN + "Your shield is down! Wait 10 seconds for it to replenish!");
Bukkit.getScheduler().runTaskLater(plugin, () -> {
player.getInventory().setItemInOffHand(new ItemStack(Material.TOTEM_OF_UNDYING));
}, 200);
}
}``` @abstract rampart
oh wait
me dumb
fuck groovy
my eyes are burnt because the mf warnings
if you cant implement type checking correctly dont implement it fucking stupid IDE
@abstract rampart doesn't work
Also EntityResurrectEvent
Basically totem use event
so
how would I check for a totem pop?
bro with the pings ;-;
holy shit this is fun
If EntityResurrectEvent is fired, it's a totem use. I would add a print statement before your runnable declaration. If you get that print statement, the problem is in your runnable. If you don't, the problem is in the event
damm didn't know
They chose a terrible name
my bad
probably why didn't think of it
should have done google search smh
Where can i see the changes between CraftServer-Class in MC-1.18 and MC-1.19 ?
?stash
where can i see the noobs
copilot where
cope pliot
cop pilot
coke pilot
cock pilot

fancy
give a chicken a tiny helmet
kfcock
i love me some kfChick
my kfcheeks are full of dope
sourceSets {
main {
java {
String grd = "${buildDir}/generated/main/java"
project.ext.generatedResDir = grd
srcDir(grd)
}
}
}
``` anyone know why it isnt being picked up?
ive included the generated files as a source folder
hey there, what is the difference from normal advancements to recipe advancements?
I need to only register normal advancements and get completely spamed of the others.
advancementdoneevent
getAdvancement()
getType()
might be some of those 3
declaration: package: org.bukkit.event.player, class: PlayerRecipeDiscoverEvent
or this one
basically cancel the event or smth
heeheehee
there's no .gettype unfortunately
also people doing ::isAnnotationPresent and then ::getAnnotation
what questions
why
not my code
oh
just looking at plugins that use mongodb now lmao
cock pilot
dang
highly obfuscated
who tagged me
No
FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
Its imposible because how uuid are generate
How can I change the texture of a placed skull ? i tried with skullmeta but it's not working
how
if that's just a hex representation
you can definitely have all F's
cuz just a number
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Hex are not only numbers
I don't see why this wouldn't be possible.
Hex is a mix of numbers and chars
Not sure if it would cause any issues though.
UUID.fromString("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"); works
all zeros with the same pattern works too
ez
I have this error :
class org.bukkit.craftbukkit.v1_16_R3.block.impl.CraftSkullPlayer cannot be cast to class org.bukkit.inventory.meta.SkullMeta (org.bukkit.craftbukkit.v1_16_R3.block.impl.CraftSkullPlayer and org.bukkit.inventory.meta.SkullMeta are in unnamed module of loader 'app')
and my code is
public static void blockheadBuilder(String texture, Block b){
if(b.getType().equals(Material.PLAYER_HEAD)){
Skull skull = (Skull) b.getState();
SkullMeta skmeta = (SkullMeta) skull.getBlockData();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", texture));
try {
Method mtd = skmeta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
mtd.setAccessible(true);
mtd.invoke(skmeta, profile);
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException ex) {
ex.printStackTrace();
}
skull.setBlockData((BlockData) skmeta);
}
}
got mongodb to work lol
But for a block you have to use what because I have looked at the forums and I can't find anything that works
skullmeta is for itemstack anyways
you'd better create own skull itemstack
and work around it
I have already created a function that allows me to create custom head itemstack I based on that except that it is not possible to setblock with
org.bukkit.craftbukkit.v1_16_R3.block
org.bukkit.inventory
Yes I know that except that if I put setowner I could not put texture no?
it will get the texture of the owning player
my friend put texture of pipe on my skin
so i only have pipe head and no body
๐
and no life
and well, he used this texture in his pipes plugin
doesn't have to be lol
fuck discord scroll
Now make a random generator and see how long it takes to actually get that UUID
L
I think i should use setownerprofile except that it is not available in 1.16 :/
no
is this even possible?
bet not
no to get this uuid
UUID.fromString()
UUID.randomUUID()
probably takes a few days
but my question is not the how, but the if
I mean there's only 2^122 possible UUIDs. Will surely get it in a minute or 2 /s
since UUID is made out of the current timestamp with some extras
few years i guess
also random can give you same uuid twice
"few" years
so...
not really
just if you would generate ~2B a sec
i will just
then you could have a collision
import java.util.UUID;
public class Main {
public static void main(String[] args) {
System.out.println(System.currentTimeMillis());
UUID myFUUID = UUID.fromString("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF");
UUID id = UUID.randomUUID();
while(!id.equals(myFUUID)) {
id = UUID.randomUUID();
}
System.out.println(System.currentTimeMillis());
}
}```
undefined variable ๐คช
done
now add some threading
i would probaby use TimeUnit.YEARS
i don't remember
its java.util
done
use do while ๐ข
why
nanoTime() will overflow until you have a result
nah millis should be fine
jit will optimize so hard
Long.MAX_VALUE leads to Sun Aug 17 08:12:55 CET 292278994 as a date. So you still got 292.276.972 years left for your result
๐
im at around >> 11189327 generations and still didnt found one with nearly the same letters
Quick question, can I add commands to config.yml? (Initalize) And not plugin.yml?
you can inject them in the commandmap if they werent defined in plugin.yml on start
reflections time
now overengineer it and compare every character by itself and show how close you have been to your goal with each generated one (e.g. how many Fs you got or even better: Add up how far you have been on each. E is off 1 D is off 2 etc.)
public static void main(String[] args) {
boolean diff = true;
UUID same = null;
long index = 0;
while(diff) {
same = UUID.randomUUID();
System.out.println(same + " >> " + index++);
diff = hasDifferentLetters(same);
}
System.out.println("Found one: " + same + " >> " + index);
}
private static boolean hasDifferentLetters(UUID uuid) {
char[] chars = uuid.toString().toCharArray();
char first = chars[0];
for (char c : chars)
if (c != first)
return true;
return false;
}

println slows program down
nah make a diff function that returns an int and calculate the diff characterwise
true. Just make it print the closest result every min or so
You B's are broken
ye ik
Hi, any simple way to make clickable text in spigot? (without apis)
I searched on formus and found not many userful things
hoverevent
or whatever its called
Component with ClickEvent
hey guys can maybe i can add some JVM flags
to increase speed of this sheed
Hey guys Can I add tab list group like this?
ik but who cares
What are u trying to do?
it still runs sadly
For sever help please use #help-server
ok
for something like that it really matters. You will easily have times 10 of your runtime by printing every result.
Ik this is all a joke so it doesn't really matter but usually it would
i know, but for this it doesnt.
code performance is literally my specification
?jd-s
i just needed the link
?
id want to see how many uuids could be generated in one second
I just need a life, where i can buy it?
with heating up jit
tf
verano, why dont you put your (idk i forgot the name) region plugin on github?
I would do that
Im still finishing it
I have been working on it 4 months right now
๐
2 million instances per second?
Mongo Pojo?
yes but i hate that you need everything mutable cuz its too stupid
i probably wont use it
Just use document
is easier and works perfect
ye
thinking about a new plugin where ill implement it
hmm how does this work?
ah need to synchronize it
synchronizing it takes 500k less instances per second kek
thats also the reason why println is slowing down the program
why volatile?
so that all threads have the same state of the variable
thread t might have it in its own register, which is not reflected with the main state
so volatile keeps count in the main memory
not directly
count will always be in the main memory
but each processor has its own cache
volatile tells them to not cache this variable and keep the updates to the main memory
public static void run() {
UUID bestResult = UUID.fromString("00000000-0000-0000-0000-000000000000");
UUID fullFUUID = UUID.fromString("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF");
UUID uuid;
do {
uuid = UUID.randomUUID();
if (uuid.compareTo(bestResult) > 0) {
bestResult = uuid;
System.out.println("Best result: " + uuid);
}
} while (!uuid.equals(fullFUUID));
}```
Time to wait
in 5 mins the closest I got is 7ffffffb-e5a5-47e1-b82f-ae4378fcf02d :( didn't even get the most significant F
Wanted to document the error for eternity and then decided not to
?
Someone posted a compile error and then deleted the message
yes
you could... make it multithreaded ๐ค
just for faster efficiency
wondering if theres a max amount of Threads in java
in everyway
Should also buy the newest CPU while I'm at it ๐ค
software optimization is cheaper
and how many threads would a cpu have ๐ค
grab a threadripper
๐คฆ
It even tells you what's wrong
read the error message
rename it lmfao
cum!!!
Hello ppl!
Is there any non-NMS and non-manual way of getting item burn duration and item cook time ?
I'll start cursing like a 14 year old if you ask once more
haha no
afair
learn java moment
also where is stringbuilder
XD
thought so
You are using generics that get erased for the JVM so you basically have public String arenasToString(List arenas) twice
in rust every generic type gets it own 'class' or smth iirc
wtf is wrong with mongo that they cant just use T
just having that method gives me headaches
dont tell me youre throwing that shit into a db
last time i saw someone throwing json into a db
yaml is basically json lol
seems kinda pointless lmao
back to college tmrw
the end of this month
kek
Still running, got to 7fffffff-a189-4016-9e62-0f17b88f232d now x.x
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/InventoryView.Property.html#COOK_TIME
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/InventoryView.Property.html#BURN_TIME
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/InventoryView.Property.html#TICKS_FOR_CURRENT_FUEL
declaration: package: org.bukkit.inventory, class: InventoryView, enum: Property
I wonder if it's possible to display an abstract polygon shape by making a fancy png ๐ค
like a top-down bit where the R value represents the amount of blocks in the Y axis
G would be like how many interrupted blocks we'd have
idfk
just some extreme compression algorithm
20 ticks is one second?
Yes
I am not sure what exactly you are suggesting o.O
uhh
basically minecraft is a voxel game yeah
and we can consider each block a voxel
How would we go about compressing an abstract (random-ish shape) in an extremely efficient way
Right now I'm using something I call "line regions" where each X-Y point has a set of palleted lines in the Z axis
Well, MC already uses compression, as well as re-arranges how coords are stored
but if you want to store something more efficiently, you would start with Y, since it is typically the smallest in most cases
and then x,z
This seems to manipulate inventories.
I see no way of this returning the time an item should burn for.
I basically want to represent the area in as little ram as possible
While still having up to an O(N) contains check
Line regions are good and all
But storing it to a file still gives me like 20k entries
for the bigger regions
toss item into slot, get the cook time.
it should return how long it will take to cook
I was also thinking on how an algorithm that just represented the entire region in as few cuboids as possible would go
this is a non-issue when it comes to memorymapping
still
but MC already stores chunks in that time you are wanting
I'll eventually have to store block data per user on the database
and compresses
yes, in O(n) time
I don't know the size of the region here
or... the shape of it
necessarily
I can do some basic parsing
And convert to a cuboid which is essentially what I do
And the way MC does it still works for you want
there isn't a way to get better then O(n)
I know
which is what MC already does
But MC also stores a lot of unecessary data
if it is a cube easy 2 location points
and some stuff that isn't relevant
1(1)
I am not saying store all the extra stuff
just don't store the extra stuff, use the same mechanism MC does
it is literally what schematics use
reason why they are relatively small given what is stored in them
Even schematics store air data
not all of them do
save -a
but they still store data internally
depends on the implementation
FAWE for example stores air data
you are assuming only one plugin can do schematics
because the default block state is air
sender.sendMessage("ยงaยงlYou gave " + ? (target.equals(Player)) "yourself" : target.getName() );
How would I do this?
Even if you don't copy the air data
I can't use cuboids in my case as I'll have multiple areas next to each other and they can overlap
in either case you are just making excuses in why you can't use something that is already efficient
do you mean if you're sender of the commend?
I've done... like weeks of work on this
its a give command so if your the arg.0 i want it to say yourself
put the conditional operator in brackets
and a schematic can easily convey this easily without saving a bunch of air blocks
so: sender.sendMessage("ยงaยงlYou gave " + (? (target.equals(Player)) "yourself" : target.getName()));
like this
yes thank you!
y'all mfs don't know how to use the ternary smh my head
target.equals(player) ? "yourself" : target.getName()
Sender player name
no wait im messing up
smh
condition ? case1 : case2
lol
I think we're talking about different things honestly
if you are sending command
once i used ternary right way you told me it's stupid hehe
probably, you didn't explain very well what you were wanting except a way to store
sender.sendMessage("ยงaยงlYou gave " + target.equals(sender.getName()) ? "yourself" : target.getName());
It's erroring anyone know why?
Incompatible types. Found: 'java.lang.String', required: 'boolean'
Should be sender.sendMessage("ยงaยงlYou gave " + (target.equals(Player) ? "yourself" : target.getName()));
I have this abstract shape (just the glass blocks) that are flood-filled into a Set<BlockVector>
How would I go about minimizing that Set<BlockVector> into a Set<Cuboid> of a very low size
thank you ;D
the use of it, isn't a necessity in Java and therefore you can get by without ever learning it without it affecting anything
I accept either:
- The lowest cuboid count possible
- The largest cuboids possible, regardless if it adds some extra cubes
@wary topaz
Player p = (Player)Sender;
p.getName() ez
true
Right now my solution is good enough but not perfect, which maps each X-Y point to a Set<Line> where each line is just a range on the Z axis
but p.getName() won't turn into "yourself" ya know
I need to handle stuff like random holes in the set
this is similar to how chunks are sent to the client
then it just String lmao
Is there a way to check if the player is looking at the moon?
Maybe by assuming the position of the moon based on the game time?
yes
the server doesn't send the client a chunk, like you think it would, instead it sends it columns of a chunk with Y being the only factor
you just get players yaw and pitch
But how do you get the position of the moon?
well you would need to manually check it
manually?
no it doesn't but I mean how could it without doing some extra processing? lmao
"0.0.0 -> 15,15,15 is DIRT. 16,16,0 is ANVIL, rest is AIR"
I don't mind the extra processing
i mean you need to get what time is it when moon is right above you
As long as the end result is easy to run checks on
it sends entire columns at a time
it doesn't do it one block at a time on a column
It sends lines not cubes
ya know @echo basalt , there was some guide about how some developers made chunk system. It's not just block positions, and not even "lines".
I'm gonna google and share it
it's kinda complex
but might help you
line and cube are pretty much the same since it is agreed you can't take up less then a block or have things that take up no block space
But what about sending cubes made out of multiple identical lines
That's what I want to do
Grab a set of lines and convert it into the lowest amount of cubes
Imagine sending chunks by the largest cubes of blocks instead of sending each column individually
Well the server ignores large sections of air already when sending those columns
Hello, What is the class "Content" supposed to be? (located in net.md_5.bungee.api.chat.hover.content.Text.java)
public class Text extends Content { ... }
// ^^^?^^^
This should help
We can just send lines like this
but my idea is to make a huge cube represented by the 2 corners where the red points are at
why not just skip air?
so that we're left with another section which we can turn into 3 more cuboids
because I kinda don't have air?
it wouldn't be any more efficient or less efficient to send blocks in the order of most to least since of how networks work. In the regards of storing however, it is generally better to store from least to greatest and not the other way around
This has nothing to do with chunk packets or sending blocks T_T
It has to do with representing abstract regions
How can i convert the ingametime to a position of the moon?
i think i understand the idea, youre trying to store a shape in as little as possible rectangles that are as big as possible?
yeah
That entire example I sent can be represented as 4 cuboids, which represent 43 blocks
then at the point rectangles arent possible anymore, just storing blocks
It's about a 10.75 compression ratio
a cuboid can be 1x1
believe it but i dont want to be the person who has to implement the algorithm
ye i get it
my current implementation can represent it in about 4 line objects
but it still needs like 19 horizontal point instances
you keep using terms that not exactly the appropriate ones to use o.O
how do those lines work? similar to rectangles?
oh saving cpu and ram?
uhh somewhat
basically it just makes lines like these
And stores the lines to a palette
so 1*1* some length?
cant you just extend that so those lines look for neearby blocks which could be added?
1 line huh
Is there an event for when a player changes the direction theyre looking at?
i thought a line was 1*1
well they are
or you mean 17 line instances or whatever
primitive generics when
So basically a vector, where it's start and endpoint represent a corner of the cuboid?
Yeah
make it super slow and then feed it to a threadpool yummy
The flood-fill part is multi-threaded, parsing the line regions is not
I guess my next objective is to group HorizontalPoints where the line region is the same
but how would I go about converting all the points into a set of cuboids
what are you even making?
stuff that is way too fancy
they are basically wanting to come up with a whole different system to store stuff
because you know they want to
not that it is any better or anything
As one does so very often
How can I check if the user accepted a resource pack?
anyways is there a reason to use an uuid representation other than the default in mongodb?
there is BSON UUID
so? :)
ik it saves it to some format internally and is able to get it back to an uuid but im just wondering where the representation is for
MongoDB generates BSON UUID's or it can and therefore answers is there a reason to use something other then the default and the answer is yes
because BSON UUID is smaller at 4 vs 36
so im fine using this?
yes you are fine and MongoDB uses the way you have by default anyways
it just looks different when looking at it in mongodb compass thing
lol
like bindata vs uuid, its just smth i saw idk if its important
No, use a repeating task
player move event triggers when a player turns their head
Yeah thats what i did. Ill schedule it every second
Yes, but you generally want to avoid this because of how frequently that event is called.
whats the best way to make a while() loop (with a boolean) in spigot?
whats the best way to allow aplugin to work on spigot & bungee? should i make a module for each?
Man mongo and it's enormous IDs lol
Well, Spigot doesn't make while loops work any differently.. so what are you actually trying to do?
the frequency the event is called is not relevant. You will use more resources for a repeating task then you would just using the event
well, they lag the server
Then they do something that takes too long for a tick
the only reason it would be relevant is it depends what you are doing, but in most cases you are better off with using the event
yea, because it's going to stop everything so it can finish your for loop. if you want to do something over a period of time in Spigot, you'd schedule a task with BukkitRunnable
basically i want to execute the while loop while the chest inventory is open
and then detect stuff
things and stuff stuff and things
you don't need a while loop to detect most things in an inventory
wdym?
nvm
Okay so uh.. ill use the event then
lol
it was lol
I'm ngl the only time I've used a while loop in java was when doing user input in a cmd prompt
you can use events to detect things in an inventory
Yeah, I mixed up comments while reading up again and doubted myself
maybe i shouldn't try to help here while smoking, lul
so whats the best thing to use here?
true haha
you also use while loops for database things.
while(result.hasNext()) {
to use events until you encounter a scenario that an event doesn't cover
I don't do database stuff, but true. I forgor about some of the matcher regex stuff I do
And why not forMongo?
for instance, a scenario where you might want to have such a loop is when a player is looking inside say a donkey chest and the donkey disappears
you want to close the inventory if that happens
I think that Mongo library is coded better than SQL libraries
MC doesn't do that in some cases, like if the player happens to teleport away lmao
because mongo isn't a relational database
it depends on your use case
Is Location#toVector() an intensive operation?
SQL is pretty good, where people go wrong is making use of inefficient methods for SQL because SQL doesn't do that stuff for you
or setting up DB's in an inefficient way
or not making use of foreign keys
ctrl+leftclick on it and check. I'd assume it's a simple constructor call
or even primary keys
you mean indices?
a foreign key doesn't have an index by default. A primary key does
You can only have 1 primary per record*
foreign keys links data that is relevant together
I know what a foreign key is and that there's only one primary key
but foreign key doesn't help performance at all. It only validates
so if you have lets say 2 tables for users, some data between them is relevant together even though they are stored separate
a foreign key would aide this
Unless you set an index on your foreign key field
it does help performance
not sure who told you otherwise, however if you set foreign keys on everything or over use it, you would be correct in that it could hurt performance
Why would a foreign key help performance? The only thing it tells the DB is that there MUST be a fitting value on the related table
It can and will still result in a full table scan if there is no index
Foreign keys put the โrelationalโ in โrelational databaseโ โ they help define the relationship between tables. They allow developers to maintain referential integrity across their database. Foreign keys also help end-users by preventing errors and improving the performance of any operation thatโs pulling data from tables linked by indexed foreign keys.
pulling data from tables linked by indexed foreign keys
Well yeah they keep the database clean which is good for performance. But if your database is clean (without them) then there won't be an improvement
Which goes back to what I said in people don't setup DB's efficiently
and it is always impossible to setup DB's in a way that there always like this anyways
unless you have a small DB
That's not about the db. It's about how you work with the db
then it which case doesn't really matter much, but when you have a large DB however not feasible because in most cases that involves duplicate data
gotta go for a sec. will be back in like 15 min
if you say so. You can advocate not using them all you want
I will continue to recommend people using Foreign Keys where they are suited ๐
but you saying this, goes against what you said earlier in that they don't help performance.
can u detect from a Player variable if that player has an inventory currently open?
there is an event for when the player opens the inventory but not when they close it, but an easy way to know if they closed it though is if they start moving, especially if their head moves
can't move head position with an inventory opened
InventoryCloseEvent
so like make a boolean (cuz i only need to detect one certain player) and set it to true while they have the inv open?
however if you are making something that encompasses older versions, the older versions don't report when the inventory was closed but I suppose that event works for updated versions
hi a question for a checking a message some player can bypass for example like H e L l O but the plugin only detect hello or in caps how i can prevent this from happening or with numbers?
You could do that if you need to know if the player still has it opened
you would need a more advanced regex
you mean me or the other dude?
the other dude isn't trying to do stuff with chat, therefore what would they need a regex for?
i didn't follow the conversation
the answer for you is simply you need a more advanced regex
however you are going to spend a lot of time on creating such a thing for chat filtering that it will most likely be the thing that lags your chat or possibly your server depending how you do it
Hey is there an Event i can use for when a player die that can give me information about what entity it was that killed the player?
mostly im trying to understand how i can change the number to words and trying getting the correct one
chat filtering SUCKS
?stash
EntityDamageEntityEvent and then check if the players health reached 0
okay, thanks
that event runs before the death event happens
how do i see sources of older versions
I said they don't help performance. And if you do everything correctly (and don't set any foreign keys) they won't help performance.
Only if you would do something wrong without them, they will actually help your db performance.
Don't get me wrong. I'm not suggesting to be like "I do everything right - I don't need foreign keys". I just wanted to mention that an index on a foreign key is the way to go most of the time. You can do it without an index for small tables or for tables that you don't call select on very often
yeah I agree on this.
why tf does this not loop?????

why java say 59/60*238 = 0 but windows calculator say 234
how would i go about making a custom anvil recipe
when I use .setresult in anvilprepareevent
the item shows up
but i am unable to interact with it
so i need to do : int dura238 = ((long)icont.get(dura, PersistentDataType.INTEGER) / icont.get(maxdura, PersistentDataType.INTEGER)) * 238; ?
There is no way to get explosion location?
ik
Yes. If you start with a floating point number Java will keep the accuracy. If you start with an Integer it's rounded
59/60 is 0, 0 * 238 is 0 (talking int division that is)
probably typed it in differently on the windows calc
actually no the windows calc doesnt round in between operations
thats the reason
yeea it work thx you !!
when doing math such as that you need to use things like floats or doubles
so that decimal isn't just like axed off
you can use an integer but you need to use Modulo to do so
i use !e.isCancelled() for block place event because I have worldguard plugin but it didn't work always returns true
It doesn't address your problem, but you can also set ignoreCancelled to true in your EventHandler annotation so you don't have to make a check yourself
anyway to improve the performance of this? It's still really good but im worried about like sorting 2000 variables
for (String s : list) {
UUID uuid = UUID.fromString(s.split("::")[1]);
if (isLoaded(s)) {
Variable var = VariableAPI.getVariableorCreate(s, 0);
sorted.put(uuid, var.getParsedLong());
continue;
}
sorted.put(UUID.fromString(s.split("::")[1]), VariableSave.getJson().getLong("storage." + s));
}```
What are u doing?
im sorting
but there
im grabbing the variables
public static Map<UUID, Double> sortDoubleVariables(String name) {
Map<UUID, Double> sorted = new HashMap<>();
var list = getAllVariables(name);
for (String s : list) {
UUID uuid = UUID.fromString(s.split("::")[1]);
if (isLoaded(s)) {
Variable var = VariableAPI.getVariableorCreate(s, 0);
sorted.put(uuid, var.getParsedDouble());
continue;
}
sorted.put(UUID.fromString(s.split("::")[1]), VariableSave.getJson().getDouble("storage." + s));
}
return sorted.entrySet().stream().sorted(Comparator.<Map.Entry<UUID, Double>>comparingDouble(Map.Entry::getValue).reversed())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (value1, value2) -> value1, LinkedHashMap::new));
}``` here's the whole thing
works fine but im worried about performance
What does that do?
it just sorts variables, let me verify so i can send images
this is my old account but whatever
@sterile token ^^
it sorts the variables
but is there a better way of doing it?
since im worried about performance
since that's only 2 variables
im planning on sorting 2500 variables
ish
Hey guys, is there an api to use for custom localisation in plugins? For my last plugin I sort of rolled my own but wondering if there's anything else I don't know about
๐ซค
What?
"custom locasilation"?
๐ค
All im asking is if theres a better way of doing that and if that will cause a lot of lag while looping 2500 variables
Map#sort() or Map#stream()#sorted()
I dont think it would but i used to use skript and im always worried about performance which probably shouldn't be my biggest concern
Im doing that, im mostly asking about the loop
Hmn i dont still udnerstand why you need that
Because im using a class for variables so i gotta retrieve the variable name then its value, or if the variable isn't loaded onto the memory it'll get the variable value from the storage file
Im guessing it'll be alright but im just double checking
Since everytime the player leaves all their variables get unloaded from the memory to minimize memory leaks
How to ignore a specific file inside sub folders with .gitnogre?
I am trying to remove a single item from an inventory, and give a percentage of the buy price depending on its durability. Currently, it comes with an error saying that ItemMeta cannot cast to Damageable ```java
for (ItemStack item : player.getInventory().getContents()) {
if (item == null) {
continue;
}
if (item.getType() != keys.get((finalX * 6) + finalY)) {
continue;
}
Damageable meta = (Damageable) item.getItemMeta();
conquest.get().addGold((int) (weapons.get(keys.get((finalX6) + finalY))(meta.getHealth()/meta.getMaxHealth())));
item.setAmount(item.getAmount() - 1);
break;
}
what's the logic behind waiting 1 tick and then reopening an inventory?
is there a way to unregister an event listener?
HandlerList.unregister(Listener)
thanks
next time you can try google ;)
yeah i wasnt thinking, lol
Hi im using api from github for tablist (since i dont know how to use NMS) and there is some PacketPlayOutPlayerInfo but im not sure from where should i import it
i dont even have any sort of like import suggestion
i can just search for JAR on web
but we all know that is pointless
so any ideas what dependency i should add or something
also EntityPlayer
That is nms
?nms
whatโs the prefix
!nms
-nms
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
here you go
what exactly ?
PacketPlayOutPlayerInfo or EntityPlayer
or even both
Both
EntityPlayer might not be if you can import it regularly i havenโt checked.
but CraftEntity is apart of nms
well to be honest i once used this api and im looking what i added as dependency in maven because in files there is nothing related to NMS
and really i cant find nothing
Send me the api you are using
but im 100% sure i have found something
Iโm not sure I fully understand your question
I see
you can take the jar it gives you and add it to your intelliJ project and server
but if itโs not any of the supported versions I doubt you will have any luck
yeah i see there is some kind of spigot.jar ill try to add it rn
yup you are totally right that gives me all the imports and im feeling sad and dumb for not seeing it even before lmao
Glad I could help! happy coding ๐
How can I get the characters from the last character of a string in a lore to the end of the line that that string of the lore is in if the lore contains that string?
what the, youโre trying to like the last letter in a piece of lore right
well the last few letters
ok
ill tell u exactly what im doing to explain better
I have pickaxes that you upgrade through and I want to get the number after the string "&8pick_tier: " so I can get the tier of the pickaxe to see what pick to give them next
xd
so like char lastChar = str.charAt(str.length() - 1);
^ for storing levels on an item this would be more efficient
I think I have an idea
?pdc
How can I open an inventory in AsyncPlayerChatEvent?
Why not?
Why canโt you just schedule a run task later with your inventory ?
either that, or doesnt know how to use DI
I am using runTask
I'll try runTaskLaker
its a class of mine
public void openInventory() {
this.player.openInventory(this.inventory);
}```
which code?
?paste
I think it might be because the Chat event is async
and openInventory is sync
idk
Yu have to run full code on the scheduler
There you are doing "async + sync + async"
You have to move everything into the schedule
so would be:
void event(Event event) { runTask(plugin, () -> { all other cod ehere }) cancel; }
ok my bad
runTaskLater() queue them right?
It worked, thx a lot guys
You too ๐
So here you learn, that when you have async things you must run all of them async, if not you will have concurrency problems (if im not wrong)
is it called concurrency? or ima wrong
Also why the heck InventoryHolder allows me to call the methods from a class implementation?
yeah
๐ค
where i casted it?
oh ok
I didnt kno that tho - thanks
Wait now i have a dude
How would i know if the event holder equals to one of my InventoryMenu repository?
the holder returned from the event*
ik that, but i have a Set<InventoryMenu> as repository
I dont have 1 inventory
Isn't that for string?
wait wait
That is my repository
You understand now?
"Im asking how i get a MenuInventory instance from the repository using InventoryHolder"
If inventory contains in map?
Elaborate more please
Yeah i seen that
So i need to use that method right?
Hehe now having lambda problems i love them!
hehhee
Yeah my bad i realize that
Just thinking about something
What the quick way to get any angry entity
Does that return anger?
If any entity angry
Make happy
Just for lolz
So there is an event? Nice
Share
I wanna take a look later day
Gimme both
create your own chat and your packs there
Anyone know what i could be doing wrong?
https://pastebin.com/mQN0zBQV
I know the code is triggering because the splash color changes to be red but the player still takes damage
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
urls*
So im using TabAPI which allowes me to use old tab look and that i can modify it on spesific way i have added everything as it should be as i assume but i get this on start of my plugin
?1.8
Too old! (Click the link to get the exact time)
does anyone know how to change the java version that gradle uses with intellij
shit keeps trying to use java 8 when the project version is 17
bruh its the ch4r0n guy again lmao
gradle.properties I would imagine
I think intellij is bug or smth like that, because i have a created a java 17 project and is using java 8
yeah yeah i know 1.8 is not supported anymore and i know it is old and only reason that im using it is because minigame is pvp oriented so im going with it ๐คท๐ปโโ๏ธ
dont support 1.8 pยดlayers
its such a pain lmao
well i just need help with this tab and it is done so ๐คท๐ปโโ๏ธ
i would help but i dont like legacy versions...
found it
build.gradle
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
bruh
I didnt see this
maybe this makes a difference
maybe it doesnt
ehh ๐คท๐ปโโ๏ธ
try there maybe?
I don't use gradle much I was only just messing around with architectury and their build.gradle uses this to do java 17
also anyone have any idea abt this XD
that "shit" compiles as java 8 even though you set project version to 17 or ?
go to settings > build execution deployment and go under compiler and find "Java Compiler" option
why not openjdk ?
ehh yeah i guess so
have you tried anything in your build gradle file
not yet that structure is very different to mine
yeah this one does some fun stuff
https://hastebin.com/ekowezowid.kotlin this is mine atm
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
why is gradle even a option
maven is 100 times easier to use
and easier to find everything you need
lmao i dont even know who records tutorials on 1.19
maybe kody simpson has something
he does some tutorials here and there
He does but he using spigot's nms, im using a mapped version of mojangs
Because im using paper since it has better performance
But i cant find any tutorial on it
True
is there a way to check permission with only having uuid of offline player?
i need it in AsyncPlayerPreLoginEvent
not really
ah shit
you would need to directly access your permission plugin and query it
yeah im on it but im too idiot for that xd
Look about the permission plugin and his api
i do but its too complicated lmao
simplest is to hook vault and require that
or change your plugin design so you don't need the permissions that early.
that why!
We already tell that a guy
When something is run async, you must run your code async. If its sync your code should be run sync
whats the best way to allow aplugin to work on spigot & bungee? should i make a module for each?
Just set(path, value)?
A string list?
I'm trying to add or remove something from a string lisdt
list*
will that work?
oh wait it does
thanks
Anyone have the slot numbers for the gray glass panes? just to save me time
you can do something like this:
ItemStack item = /*your item*/;
String shape = " "
+ " xxxxxxx "
+ " xxxxxxx "
+ " xxxxxxx "
+ " xxxxxxx "
+ " ";
char[] chars = shape.toCharArray();
for (int i = 0; i < chars.length; i++)
if (chars[i] == ' ')
inventory.setItem(i, item);```
no need to use the + in the string too
I break the lines just to make it better to see
๐
thank you
how might I use getLineofSight?
for detecting if there is a block in front of the palyer?
my current code
List<Block> sight = player.getLineOfSight(null, 2);
if (event.getItem().getItemMeta().equals(ItemManager.GravHammer.getItemMeta())) {
if(sight.contains(null)) {
Location playersDirection = player.getLocation().add(player.getLocation().getDirection().multiply(2));
player.getWorld().createExplosion(playersDirection, 5f);
System.out.println("I work");
}```
im stumped here
declaration: package: org.bukkit.entity, interface: LivingEntity
as per documentation you get air only if you set null for the materials
yea, i want the explosion to haapeen only in the air
so how do I set the explosion to create if it is 1 block away
or theres a block in the way
So you want it to explode if there is a block within 2 blocks range?
I want it to explode if there is air in the range
if there is a block within that range
or below
then do if(sight.isEmpty())
what if theres a block there
how would I spawn it on that block
ok wait it returns a list of blocks
yea
so basically you want an explosion only if:
- the first block is air && the second block is an actual block
right?
https://paste.md-5.net/enasugevet.java
How can I check if the players inventory is the one i created?
eh, its more of, if the first and second block is air,
if there is a block on the first or second
spawn it on that block
so what do you want to happen when there is only air?
create explosion 2 blocks away
ah I see
I already ahve that down
then basically get 3 blocks in line of sight
but it doesnt check for blocks

