#help-development
1 messages · Page 1972 of 1
you'll also see your own inv in the lower half
yeah, that's possble via-command. But, chat has a 255 symbols limit iirc
for longer commands use command blocks
512
well to get skulls, why not just use /give @p minecraft:skull 1 3 {SkullOwner:username}
not sure what the 3 is for, I just copied it from some website
That’s a legacy give command
oh
3 was the old metadata for a player head
Look i am very confused. when i did + it took away 10 lol i guess it works now
What are you trying to do
durability is actually "damage" and not "durability"
owh lol
0 durability = perfect item, higher "durability" = broken item
what u tryna do
Ah
How would I change how much damage my custom mob does?
Pretty sure there is a nms way
I am using nms but not sure what the remapped function is called
Just edit its attributes
How do I do that?
ping someone? 😦
then you imported the wrong attribute class
@lost matrix So did you fix the Workload distributing thing
Should I import the bukkit one or nms one
bukkit, obviously
It doesn't work with this.getAttribute doe
You’d have to do this.getBukkitEntity.getAtrribute iirc
Yes. Look at the thread. Posted an update about 2 hours ago
tysm
I know
Doesn't exist
what I want is to send the request to a specific IP address
e.g. something like new HttpUrlConnection("1.2.3.4", "https://myserver.com");
yeah but how
Do you know the best way?
thx, merged!
nah
it must include the vhost of course
every webserver uses the "Host: " header to decide which website to deliver
e.g.
it's all the same IP of course
the webserver needs the proper header to know what website to deliver
read my above messages pls
What is the problem?
I need to create a HttpUrlConnection but I also want to specify the IP
What do you mean by "also"? Cant you just define an URL by using the IP?
no
^
https://[IP] is different from https://someAddressThatTranslatesToThatIP
no. Http works like this:
- someone enters google.com
- Look in DNS: whats IP for google.com
- Send "I need google.com" to the IP from step 2
so in my case
Ok but thats for the DNS to decide. Im not sure what you are asking. You cant tell the DNS what to resolve...
I can't just say "I need 1.2.3.4 from 1.2.3.4" but "I need api.jeff-media.com from 1.2.3.4"
I know, but you can tell your browser what to resolve
and so I am pretty sure that it's possible with java too
i dont get why
You don't get why what
what I basically want to do is avoiding people blocking requests using /etc/hosts
We poll an element. Then we compute it. Then we add it at the back.
If we would do that without stopping at the last entry then we would constantly cycle over the elements until the time is up.
Been a while since ive done http stuff (low level). Maybe you can define that in the http header.
yeah probably. I just thought maybe there's an easier way. but yeah I guess I'll just do it using headers then 🙂
thanks
I need help in vault economy plugin..
you might want to be a tiny bit less specific in your question. all those details about what exactly you need help with are hurting our brains
blew a bit of air out of my nose
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
If i have 100,000 and someone pays me just 500 is it a very small amt. he payed me? @tender shard
I'm out
wdym
Yes
No
...
Yes
hmm I wonder
if I have a a string
abab
and I split it using split("b)"
then [0] is a and [1] is a too
but what if I split it using "split("a")"
since a is the first char
I think empty Strings are truncated
so if ask the man to pay a 300k what will be my balance?
so split[0] won't be null or sth?
bruh troll somewhere else
At least 3.2
Bro i asked for support please
10
in numbers fully
3.2 is a number
really but how?
what r u guys tlling?
C3500
Unless he rides on a horse. Then its what mfnalex said: 3.199999999999999999
open a thread for this please. this is too complex for most of us
i am having 100k right so if it is 300k is it a high amt.?
in zimbabwe dollars it's still not very much
No. Unless you have permission of your local bakery. Then it might be medium to high.
the value of an amount all depends on how easy it is to earn that amount.
don't forget the event priority though!!!!
u will only constantly cycle over the elements if they should be scheduled tho
i still dont see the problem
If they return false then they get discarded.
One moment ill make an animation
fancy boiii
okay srry for wasting ur time
the load wont run if u just stop the code if u reach the load
cuz like when u compute, and readd the load its added to the tail
and ur checking if tail is the next load
and then stopping the code
so it will never run after running the first time
gosh im overcommenting
or am i missing something
how bad can that be right
The tail will be updated the next time it runs
huh
String asd = "delim1userdelim2";
System.out.println(asd.split("delim1")[1].split("delim2")[0]);
this prints "user"
so it actually does NOT ignore starting "null" elements
Basically it just doesn’t let a load run twice in a single execution loop (in the event the load is rescheduled)
so it doesnt let it get ran twice in the execution run, but it lets it leaves it for the next time run() function is ran?
well still
what if the shouldBeRescheduled
is that last one in the queue
this is confusing
i dont get it
what if the shouldBeRescheduled is the last workload added, when the run runs, the lastElement will be the shouldBeRescheduled workload, and when its its turn to run, it will check if next load == shouldBeRescheduled, it will return true and stop it from running
So here is the problem:
This animation represents a single tick.
If we dont stop at the first element then all elements will constantly be
re-added to the queue and maybe called several 100 times. But in one tick
we want a workload to only tick a single time.
If there is only 1 workload it will never run
Just using diagrams (drawio) then exporting single pngs and adding them to a gif
last workload will never run either
Oh thats a good point
do while loop perhaps
if its last, it will be checked in the run(), and it will get not run
I updated the code to reduce nesting and missed that part. Let me update it right away.
even if theres more than 1 workload
the last one wont run
it checks if the last one is the next one
or actually
yeah
Wait. With one element it will def run because in the first conditional check the nextLoad is null.
what about the last one
it will get saved as last element before the loop, and when itss turn comes it will not work
But the last element wont run. I have to change peekLast() to just peek()
so I was somehow right?
Hmm. changing to just peek wont solve it either.
maybe
hasRan()
in the workload interface
its default false
u set it to true when it ran
then u check if it ran and if so stop it from running
Huh? No. I will def do this with identity checks.
oh ok
Also this would destroy the workload as it removes its FunctionalInterface status
yeah ig
To be honest... the code looks right to me.
The last element will run and the loop will also work if there is only one element in it.
why the fuck does this work
public static void doStuff(Plugin plugin) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, InnerRunnable::new);
}
private static class InnerRunnable {
}
But then again im tiered
shouldn't that throw an error because InnerRunnable doesnt extend BukkitRunnable
Won’t having only 1 element immediately trigger the check if the current element is the last one
because it takes a runnable?
yeah but InnerRunnable is just an Object
lol. Yes take that GC!
nah, InnerRUnnable doesn't even have any run() method
the very first check will always be null == lastElement
So thats not an issue.
oh I understand now why it works
it just wants a lambda which returns nothing
hi, I'm about to loose my shit with java. I got https://gist.github.com/UntouchedOdin0/5d76c939aaa4e6e622dda81b8e9412dc what outputs https://paste.bristermitten.me/isofodiwum.yaml to the console, the thing is, I don't know why the spawnPoint and corner1 is the same and also the corner2 is null anybody got a idea how to fix it? It's driving me crazy.
Uhm. Not really. It can be any functional interface really.
Ah
I dont see any problems atm.
Conclusion: My code was correct to begin with.
The question is
Prob will need a separate web server
Does it automatically stop if the tick time reaches 50ms
huh no, I just need to specify both IP and Host header
I elaborate that in the thread. Thats only possible on paper.
isn't there sth like ServerTickEvent?
nop
ah ok
Elaborate cause I’m not too familiar with http
yeah okay but in theory, couldn't you schedule a running task that runs every tick, then puts the timestamp in a map, then in all remaining tasks you can check how much time has passed?
relativePointsWE7.getCorner1() != blockVector3
Dont check objects via identity.
a webserver takes a request. e.g.
"get me website "google.com"" that's sent to IP 1.2.3.4
I could also ask "get me website yahoo.com" also to IP 1.2.3.4
You dont know if relativePointsWE7.setCorner1(blockVector3); clones the object internally
server at 1.2.3.4 then checks all it's vhost, and then delivers whatever matches google.com or yahoo.com
But you don’t want a host name right
I wont to use a vhost name
What you mean by that? I can get the code for that part if you want? It's just setting a field in the code
but I also want to be able to specify the IP address that gets called
normally java just resolves google.com to 1.2.3.4, then asks 1.2.3.4 for google.com
I want to be able to specify the value of 1.2.3.4 AND google.com myself
Then i dont understand the whole point of this code block
relativePointsWE7.setCorner1(blockVector3);
if (relativePointsWE7.getCorner1() != blockVector3) {
relativePointsWE7.setCorner2(blockVector3);
}
no in this example, 1.2.3.4 is the webserver that actually hosts google.com
like the A entry of google.com
Because corner2 will never be set
Oh ok
Ofc
you can avoid their license by just saying "adobe.com = 127.0.0.1" in your hosts file
and that's what I want to prevent
Oh ok
I never cracked it with hosts they always had 1 file that was the authentication basically
i'm trying to make sure that the 2 corner locations aren't the same
idk if i'm just dumb or if this is stupidly hard
yeah okay but at least that's the easiest way to bypass any similar stuff, so you get what I mean 😄
Yeah lol
I thought this would be a quick thing to code but nope as it's world edit it can't be a easy thing to code
Not hard at all. Look at the code again. The if statement will always in any circumstance be false.
Idk if this is what you are looking for
If you are using Java 8 or older you can do:
You can set the system property sun.net.spi.nameservice.nameservers
In my eyes, the code is fine but I can't see anywhere what could be causing the issues and yes I know that's bad
Well I guess that’s not what you’re trying to do
I’m still not very clear on the desired outcome
hm maybe but
I thought checking that it's not the same block vector 3 would be correct
I don't wanna mess with the system's DNS servers, and also those will never be called if someone just uses /etc/hosts
So you set corner1 as A
Then you check if corner1 is not A
And in this case you set corner2 as A
But if you set corner1 as A then it never be not A
Yea true
and I also can't use the IP directly because my webserver obviously doesn't have any certificate for the IP itself
it only has certificates for jeff-media.com and *.jeff-media.com
😦
I think in any case that you use a host name hosts will be able to block it
Yes but you are doing noting there. Your code is literally
if(false) {
doSomething();
}
So doSomething() will never be called.
is it https://paste.bristermitten.me/nihobeniti.less this area what's wrong?
I think I'll just get an additional IP that's used only for this API but that's another 3€ / months lol
I wish you could block ips in hosts that easily
Yes
I wish you couldn't, lol
would
blockVector3 != relativePointsWE7.getCorner1()
be better?
dont compare objects with != or ==
ok... ill write a short java example on what you are doing...
I thought that was not equals?
what about !blockVector3.equals(corner) {
}
?
I'm getting so confused here sorry
public static void main(final String[] args) {
final Data data = new Data();
data.cornerA = 100;
if (data.cornerA != 100) {
data.cornerB = 100;
}
}
private static class Data {
int cornerA;
int cornerB;
}
Does this make sense to you?
Do you grasp why the if statement will always be false?
Yo I think I found a way you can at least check to see if someone has a entry for you in hosts
yeah i do
Ok. Good. That is 1:1 what you are doing right now.
HostsFileNameService.extractHost
hmmm
that's very interesting
thanks, I'll take a look ❤️
hm I doubt that it'll work in some kind of chrooted environments, like e.g. pterodactyl that runs all servers in a docker container
Oh yeah I wouldn’t even know where to start with that
nothing
an itemstack will never be equal to any Material enum value
well
it will throw an error once any slot in the inv is empty
but besides from that, it won't do anything
yeah but first check if the itemstack is not null
if (itemStack == null) continue;
Is there anyway to combine these events?
One fires when clicking a player the other when clicking the air
Nope
You can just write methods and delegate the event content to those methods
Is there anyway to make it more efficient? Because if you click the player in the head it fires the playerinteractevent even when the player is flying.
Thank you! I will look into this.
iirc PlayerInteract events launches both for entities and blocks
not sure tho
no
there's PlayerInteractEntityEvent for entities
for blocks or air, it's PlayerInteractEvent
but... then why is PlayerInteractAtBlockEvent a thing? (I don't remember exact name)
PlayerInteractAtEntity is for armorstands and whatnot
Isn't that PlayerArmorStandManipulateEvent
PlayerInteractAtEntity just contains the location of the interaction
Ah
Hello, could I store any object in an itemmeta's PDC?
I'm stumped on how it's supposed to work, I wanted to store maybe a runnable to it but idek if it's possible
why would you want to store a runnable?
anyone know why my playerInteract event runs twice?
each hand?
possibly to run it whenever something happens with that specific entity? like "teleport the player up 10 blocks with a certain chance 2 seconds after the entity is hit". A workaround would be to store a key in the PDC and have a hasmap with <String, Runnable> to activate it
wat do you mean?
that it calls an interactevent for both the left and the right hand
This sounds hacky. Separating data and code logic is crucial here.
Just have one runnable that always runs and add entities to it when they get loaded/ remove them when they get unloaded or killed.
You cant store functionality. Only data.
what do you think
is this dirty hack acceptible or not
Bukkit.getScheduler().runTaskLater(this, () -> {
if(Bukkit.getPluginManager().getPlugin("ChestSort") != null) {
Bukkit.getPluginManager().registerEvents(new ChestSortListener(), this);
}
},40L); // Yeah, waiting 2 seconds is a dirty hack. But since ChestSort softdepends on ShulkerPacks, I don't see another way. And tbh noone will use any shulkers within 2 seconds of server start
that's in ShulkerPack's onEnable()
(well not yet but I think I'll PR it like this)
Ive had a similar problem with PAPI placeholders because they are registered async on another thread. So even when i did depend
on PAPI i could not use their placeholder right away. My fix at first was also to wait 2 seconds. But after some thinking i just made
my dependant parts lazy.
yeah there's probably a better solution
but tbh I don't care, I guess it'll work fine
and if it works fine, no need to worry I guess
But im not sure if i understand what your problem here is.
This is in the onEnable of ShulkerPack. And ChestSort depends on ShulkerPack?
Are you authoring both plugins?
my plugin is chestsort
chestsort softdepends on shulkerpacks
but I have to add this listener to shulkerpacks to avoid a weird duplication/item loss bug
so shulkerpacks can't softdepend on chestsort
nope, just doing a PR for shulkerpacks because shulkerpacks author is on vacation rn or sth like that
probably waiting 1 tick would be enough
are socket connections still open when shutdownhooks run
netty connections? Unlikely. NIO connections? Not sure
PluginEnableEvent
Just make a listener that listens for ChestSort being enabled which unregisters itself once it is
does raw use of parameterized hashmap affect my code
new HashMap();
new HashMap<>();
not really
alr ty
its just sloppy
mk
But you shouldnt do that. There is not much of a reason.
Rather do unchecked casts that are strongly encapsulated so you can assure type safety.
thanks
anyone got recommendations of a nice intellij syntax highlighter
or theme
good old dracula
What is the proper way to define what a @command annotation does? commandExecutor method conflicts with it
I dont think there is a Spigot annotation called command...
im using an @interface
something that tells normal classes and abstract classes apart
idk
will that work for the plugin annotations?
LowOnEspresso
What
thats annotation processing
Never seen that before. But to be fair i have used the spigot command api for like 3 months and then i switched to something else because i thought it was tiring.
It is very tiring
I am aware, I am trying to figure out how to resolve my build conflict
maybe send a screenshot*
Do you use those annotations + implement CommandExecutor?
doesnt need a screenshot, the issue is pretty clear:
error: incompatible types: Command cannot be converted to Annotation @Command(name = "Author", desc = "Author command", aliases = {"author", "authors", "Authors"},
if I disable the commandExecutor it goes away but is not useful
and vice-versa
yay finished tabcomplete api
so bukkit command is overriding the spigot plugin-annotations - hmm maybe
to me it merely sounds like you use erroneous imports
Would you mind providing some code?
java.lang.NoClassDefFoundError: com/clonkc/vlands/kitpvp/utils/ColorUtil
any ideas
i literally just
its there
?
Do you use this class from a dependency?
nope its literally my class
it just converts the chatColor.translatewhatever into a sinple .translate()
This sometimes happens if an exception in a static initializer block is thrown
hm
was working before tho
i havent changed that class since i started this project
last edited 03/02/22, 07:13
So you dont have any dependencies and this is just a random class in your project?
And this class is not used by one of the dependencies you have?
i read it wrong, it was my logger class:
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
public class Logger {
public static void log(String msg) {
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
}
}
dependencies as in what
maven?
java... dont care what dependency manager.
its my class and its not used by any dependencies
Full stack trace pls
not really anthing to share, but i figured out where i need to look for more information. The annotation processing is not actually generating the command and permissions in plugin.yml, so I need to see why. It is possible they are not fully implemented in 1.2.3
And I am unsure that it makes sense to use oracle's
Just recompile. And make sure the class is actually in the compiled jar
i can check if i decompile it
right
because if it isnt then my IDE is doing some funky stuff
You can also just open it. Its just a compressed archive like zip
open the compiled jar?
just used jd gui as i have it on my desktop
its. clearly in the jar
idk whats wrong with it
And if you run the plugin now? Does the exception still occur?
so i have a json file like this (IGNORE THE NULLS IT IS INTENTIONAL FOR POSITIONING) and as you can see it includes itemstacks AS WELL AS other data, how would i serialize the itemstacks AND this other data together?
i legit do not know why this is happening :/
I would start by lowering the U of your Utils package.
Json is already a serialized format
thats another thing, all my packages are lowercase but when i decompiled it it still shows the package names from a few versions agao
should i reload my ide
i refactored all of them like an hour ago to become lowercase
i am using gson to deserialize but it can't deserialize itemstacks without an adaptor and most if not all of them are ONLY for itemstacks
Register a custom type hierarchy adapter for ItemStack. Then make sure you use this to serialize and de-serialize the ItemStacks
bro i need an adaptor for all the data, since it's in the same file
imagine that i'd have this field in a class, would the compiler do optimisations on it? just wondering
private final Integer i = null;```
You dont use gson like that. You let it (de)serialize everything and if it cant do that for one type then you register a sub-type adapter for it.
what
how??
Where do you get this json from?
ok so uh my ide isnt even compiling my code properly
it can serialize but not deserialize
when i compile it, it works but everything isnt updated
Found what I needed in the note at the bottom! I was calling the command not the class name https://hub.spigotmc.org/stash/projects/SPIGOT/repos/plugin-annotations/browse
You should register a type adapter so it can handle ItemStacks both ways. Let me write you a very simple one that is backed by spigot serialisation real quick
How do I get an url of an image of the texture of a player’s skin’s face?
ok thanks
any suggestions
on what might be causing it
(intellij btw)
public class ItemStackSerializer implements JsonSerializer<ItemStack>, JsonDeserializer<ItemStack> {
@Override
public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject jsonObject = json.getAsJsonObject();
Map<String, Object> data = context.deserialize(jsonObject.get("item"), new TypeToken<Map<String, Object>>() {}.getType());
return ItemStack.deserialize(data);
}
@Override
public JsonElement serialize(ItemStack src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject jsonObject = new JsonObject();
jsonObject.add("item", context.serialize(src.serialize()));
return jsonObject;
}
}
so i put this in my class?
Then when building your Gson instance.
Gson gson = new GsonBuilder().registerTypeHierarchyAdapter(ItemStack.class, new ItemStackSerializer()).disableHtmlEscaping().create();
ok
ItemUtils.toString(item) 🚎
kek
BukkitObjectOutputStream base64 encoded?
Using spigots serialize method?
Yep
Takes the Map<String, Object> and uses my json library to serialize to a string
Or you just use Gson to serialize that map as shown above...
You mean by hand? You can just go on a random website and search up a players skin.
By code. .-.
Get his PlayerProfile and read the URLs from that
oh god
bruh
Don't use the api serialisation for itemstacks, it's bad
combined with lombok
Why would you do a repeatable annotation
https://paste.md-5.net/awuduxazus.cs now it gives me this error @lost matrix (sorry for ping)
1.8 
Yes let me ping someone and then say sorry for ping in the same message rather than just not pinging them
If you want you could always use my library which has ItemUtils.toString and ItemUtils.fromString, zero effort
Should be pretty self explanatory. Make the serializer null safe
Besides that I dunno how to use gson so I can't help with this lol
i just told you
like
you store a workload if its last
how do i make the serializer null safe
then u check if nextload is the one u stored
if it is then u do not compute it
which means the last workload will never work
my ide is just completely ignoring my changes :/ any help?
in fact what does null safe even mean
Nope. Works as intended.
Maybe if you could elaborate more
What does "completely ignoring my changes" mean
How am I wrong then
refactored some stuff, looked into the new jar file and its still the old version
How are you exporting
Try deleting the old jar
It probably does work, since you have more experience than me you wouldnt code something that would just break but I want to know where am I wrong
Run it again and make sure it generates it again
Then make sure all your changes were saved
anyone else in this channel that wants to help
Maybe you can help 7smile explain
Im too tiered for this. Redempt could you pls verify that this works?
Concern is that the queue gets cycled once when the run() method is called.
Pretty sure my code is fine.
Redempt, my point is the last element workload that gets stored
will never run since nextload != l ast element check
thats what my problem is.
it isnt saving rhe changes
Wait are you just trying to have a loop of the same tasks that will be repeated in the same order forever
i move 3 packages into a new package and it didnt show up in rhe build
Pretty much. Just one full cycle per tick
Ah
Wut
That's not how I would do it
LinkedList?
No
but ur removing the loads from the queue
.poll
Rather than moving stuff around you just loop over it and only call remove if shouldBeRescheduled is false
benchmarked LinkedList vs LinkedHashSet vs ArrayDeque
ArrayDeque came out on top
two questions: what is null safe and how do i do it
Though I suppose you could always do Iterator#remove on a linked list as well
I don't like messing with iterators directly though, they're very annoying
Java basics. Search with your favourite search engine for that.
Just the cycle logic pls so hex is satisfied with a second opinion -.-
i did that and it's just a bunch of stackoverflow questions with answers that use a million terms i don't understand
It seems a little strange but it looks like it should work
How am I wrong then
I dont think there is an alternative for the implementation.
I cant just use a LinkedList and call removeIf() on it to cylcle through because the iteration might
randomly stop because of the time restraints
the last element is stored, then when used it checks if its not the last element stored
Last element gets always called
Yes, but hoow
Yeah you can't use removeIf
But you could easily keep a list of the tasks that were run and then call removeAll
Or just keep two separate queues why don't you
One for tasks that should never be rescheduled and only run once
Though I guess that would run them out of order, which you probably don't want
Object x = ...;
Object y = ...;
ArrayList<Object> list = ...;
list.add(x); list.add(y);
for(Object o : list){
if(o.equals(x) continue;
System.out.println(o);
}
will not print x
and thats practically the same case as I see
Ill write a quick piece of code you can run. One sec
it just doesnt make sense, u store an object, loop through a list of similar objects, and if the object at the position is the object u stored u dont run code for it, so how does it run
It starts as null
It's assigned at the start of every loop
And then the condition is run before the start of the next loop
So at the beginning of loop it will always be the value from the previous loop
On the last loop, it will be the second-to-last element. Then the last element will be put in the variable, and the next time it checks the condition, it will be equal to lastElement, so it'll stop iterating
Like I said it's a bit strange but it should work
wait i got eclipse on my pc
how could I make a player stop eating? I don't want to use e.setCancelled() as it doesn't stop the eating animation
You could cancel the PlayerInteractEvent which is fired when they begin eating
what if its the first time run() runs
Does that also cancel the eating animation?
the order of the loads will be the order you addLoad()'d in
Do you mean if there's only one task in the queue?
No, many but you added them
public static void main(String[] args) {
ArrayDeque<Task> tasks = new ArrayDeque<>();
tasks.add(new Task(0));
tasks.add(new Task(1));
tasks.add(new Task(2));
tasks.add(new Task(3));
tasks.add(new Task(4));
tasks.add(new Task(5));
Task lastElement = tasks.peekLast();
Task nextElement = null;
while (nextElement != lastElement) {
nextElement = tasks.poll();
System.out.println(nextElement);
tasks.add(nextElement);
}
}
private static class Task {
int id;
public Task(int id) {
this.id = id;
}
@Override
public String toString() {
return "Task: %d".formatted(id);
}
}
Outputs
Task: 0
Task: 1
Task: 2
Task: 3
Task: 4
Task: 5
I believe so
but its the first time run() runs
whaa my first plugin
oops
smh
old shit
fuck im dumb
ok plain java was better
Could you not just keep a counter though?
Get the initial size, and a counter that starts at 0
Hmmmmm
Stop once the counter reaches the initial size
just understanding what nerds in this chat say is a flex alone tbh, yall geniuses
Unless tasks are scheduled by other tasks that should work fine
I'm 20
Imagine If I can get maybe half of your knowledge in 4 years
must be hard
if not impossible
dunno
I dunno
💀
8
yeah thats a ton of time holy
teach em while they are young
Its not. Ive started a bit over 3 years ago. You just need to keep digging.
ic
Yeah it's been 8 years since I started java but I didn't really do much with it for a long time
what ill do is when i finish the list of sort of advanced topics conclure sent me
ill ask here again
I'd say I started actually going hard with java ~4 years back
i started two years ago 👀
im 17 and i started 2 years ago, I'm definitly not the best but I'd like to think I am atleast decent at java and spigot
I don't know what time is
Yeah
I can provide you with one or two quite hard java assignments from the technical university of munich if you want to. (1st semester but still damn hard)
yayy
L imagine needing plugin.yml laughs in lib
I can share interview questions I've seen with you guys if you want
i wanna see 👀
Uhhhh Sure :D tysm
yk what ill also do them
wanna see how hard they are
one price to this is my ego going up, but ig i can just come here and lose a bunch of it again /j
Yeah sadly it doesn't look like it does
Yeah imagine not doing
basic player:target {
help This is a demo command
permission pluginname.basic
}```
i'd be interested too 👀
i just realized ur pfp has hair in its face
lol
I am not a clean shaven boy
i would always shave
Too much work
too lazy
imagine having a beard
I used to shave back when my facial hair was all scraggly and uneven but it's pretty nice now
dumbledore moment
cant imagine a developer looking fancy (im totally not insecure about my looks!)
nah m8
@BaseCommand(name = "test", usableBy = CommandUser.PLAYER)
public class TestCommand {
@SubCommand(path = "/")
public String runner() {
return "&6Test!";
}
}
```you can also add way more things, this is a basic example
We can do commands in both and see which is cleaner
my bet is redempt
lets go to #general
Ok
wait wait,
so here:
.peekLast is 5.
while ((next)null isnt 5):
next = 0;
while(1 isnt 5):
next = 1;
while(2) isnt 5):
..etc
while (5 isnt 5): <------ this is what i was talking about
does peekLast return 0????? - no, it returns last out which is 5
ike
:yooo:
or wait
its while(1 isnt 5):
next = 2; i think
yep
its while(n isnt x):
next = n++;
wheres the sauce
Touch grass
how many digits in the code tho
as I seem to locate a fellow
Heya guys, does anyone know a good lib for custom recipes?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/RecipeChoice.ExactChoice.html doesn't support stack size
I don't think you should .run() tho @lost matrix
cuz like
what if it was the last time the runnable should run
and then u still ran it agaain
why is the stuff in compute() even necessary
it will stop being rescheduled with the boolean below it
I’d like this too
Its all in germen. Ill translate on of them over the days and send it
😮
Wouldnt make much sense if it did...
whats the point of the code in the compute method
incrementing a tick counter, checking if its a mod of the delay and then executing the runnable if it is.
u couldve done if(!(ticksAlive++ % delay == 0)) return;
without runnable.run(); right?
or wait
OH
the runnable passed is supposed to be a new runnable
to be ran alr
alright okay i thought you were passing in the WorkloadRunnable
Believe it or not, i actually check if the code i write makes sense and if it runs.
I know it runs
But I don't know if I understand it or not
it might've been some weird shit i dont know, thats why I asked
not because you're wrong lol
How do I achieve
ShapedRecipe compassRecipe = new ShapedRecipe(new NamespacedKey(plugin, "compasst1"), tier1Compass) {
@Override
@NotNull
public ItemStack getResult() {
ItemStack result = super.getResult();
ItemMeta im = result.getItemMeta();
im.getPersistentDataContainer().set(compassShelfLife, longType, System.currentTimeMillis() + ThreadLocalRandom.current().nextLong(60_000L, 240_000L));
result.setItemMeta(im);
return result;
}
}
correctly? (this does not work as bukkit seems to cache the item result)
double increment = 1 + (plugin.getConfig().getInt("FarmLevelIncrement") / 100);
Is there anything in this line that shouldn't work? This is the line in my code that doesn't work. The output value is 1.0 with an input value of 10... This shouldn't be the case.
Not in the recipe object itself
Change 100 to 100d
thanks
Sure you need to listen for the event and change the output. But you can do it via a custom recipe implementation
I just posted something about that here:
https://www.spigotmc.org/threads/custom-recipe-with-differents-lore.547834/
Yeah but that’s not having a dynamic output in the recipe object itself
That’s having a dynamic output using the event
I mean. Technically its in the object.
Regardless, doing it like this is not possible
:p
true
Dont even try to implement custom recipe choices
Thanks, I didn't know you could do that.
Sadly :(
Thats a minecraft limitation
Wont be implemented because it could leak quite easily
not really. It could be done
it can be, but i doubt spigot will support such hacks
Its just not implemented because it will lead to memory leaks as devs are dumb
Recipes are sent to client
Doesn’t it only return the link of the entire skin texture, and not just the face texture?
There is no separate link to the face texture
The game knows what area to use
uh, I don't think that PrepareItemCraftEvent even works as there is no way to set the itemstack afterwards
There is. Look at the post ive sent earlier. Explains how to have dynamic recipe outputs
Eh, hopefully just setting the item meta suffices and it isn't cloning anything there
You need to get the inventory and then setResult
^
In case you missed it:
https://www.spigotmc.org/threads/custom-recipe-with-differents-lore.547834/
Ah, I'd need to implement my own recpie class
but that is the thing I'm already doing, gah
oh, just setItemStack
Eh. You dont need to. But thats a clean way of keeping track. You could also just have a Map<NamespacedKey, Function<ItemStack, ItemStack>> laying around
I'm already using the PDC to store stuff that is unique to that item, so i'll just use pdc
do we have a place here to hire a plugin developer?
Sure
Where?
You need a given amount of posts iirc
well that's silly.
And how do I make a compass point to a given location?
((CompassMeta)im).setLodestone(new Location(evt.getPlayer().getWorld(), x, 0, z));
Does not appear to work from what I see (it changes the compass to a loadstone, but that is it)
it is as it enourages spam, but spigot is moving more and more to a post-requirement system
and people like me that rarely post are paying the price for it.
Though it could also be to enourage a give-and-take environment, idk what the actual plan is. You'd have to ask md for that
That actually would ENCOURAGE spamming. spam a bunch of posts so I can post that i want to hire a developer? hmmmm.. would be their own fault for doing it that way
lmao
Another prominent thing is to DM a bunch of people on here - but it has meager changes of working and if it does the quality you get is according to what you ask for (i. e. pretty bad)
lmao. yeah.. I understand that. Seems like what I want would be simple but then I know absolutely ZERO about creating mods. I don't even know apps they use for it.
My avatar is one of those apps actually heh
Whats the scope of the project? Is it something smaller or something extensive?
small. Basically a container like a single chest that holds just 1 type of item such as iron ingots but will hold unlimited of that item.
I liked energetic storage until I realized there was a limit and I was losing stuff.
@waxen plinth
Schools encourage bullying because they make you interact with humans!
it doesnt work like that
you got that crate plugin
crate?
they make you post messages, if you spam none of their business
yeah
So? It does the exact opposite of what it intends to do
Spamming is a problem with the user, not the requirement
which has its solution (aka punishments)
However the spamming is encouraged (post farming) by such requirements
yep. it is. also drives up the forums post count as well. I used to mod at another site. They never deleted members or posts. Just had a hidden forum they moved all outdated posts too to keep the post count high.
Spamming is sending useless messages over and over which may end up as annoying, you're encouraged to talk, not to send garbage over the website
wat
It never encouraged spam
'more and more'
if you get encouraged to send garbage when there are requirements to talk, it's your fault, not the website
Well, PMs are locked behing a post-requirement system, services & recruitment, hiring, premium. Sure, some of those used to be there for some time, but others are rather new from my perspective
actually someone like me that doesn't post much has to send garbage to get the post count up to make the post otherwise we would never be able to find developers to do what we need. as such it encourages garbage
services and recruitment - since the entire existence of the site
premium resources - since the entire existence of premium resources
PMs - since spammers signed up and sent pornography to 30,000 members
all of these requirements make sense
Exactly
to a point they do yes. but also to a point they do not.
which one's don't make sense?
The only thing i could find was this premium plugin.
https://www.spigotmc.org/resources/⭐advancedchests⭐-unlimited-sizes-holograms-✨upgrades-✅sells-⚡sorter-☄️-compressor.79061/
But there is a decent possibility that a free solution exists out there.
If you cant find anything feel free to write me a message then we can figure something out.
even if people somehow own very weird working brains, and get encouraged to spam by such requirements, it has more Good results than side effects.
Uh.
((CompassMeta)im).setLodestone(new Location(evt.getPlayer().getWorld(), p2d.x(), 0, p2d.z()));
((CompassMeta)im).setLodestoneTracked(true);
Also does not work. What the hell am I doing wrong?
services and recruitment / premium - to ensure community contribution
PMs - spam filter
people overuse PMs anyway
plugins have public support threads for a reason
your support doesn't need to be in private, especially for a free plugin
Yeah, that I can agree
ohh. That advanced chestst might work. worth a few bucks to try. Thanks.
Answer: #setLodestoneTracked must be false if arbitrary blocks should be tracked
ill try that too.
if a player equips armor by a dispenser what event is that
?paste
BlockDispenseArmorEvent? not sure
Why does world guard give me an error when I am trying to spawn a custom mob
world.addFreshEntityWithPassengers(mob, CreatureSpawnEvent.SpawnReason.CUSTOM);
anybody know of a library with an event that gets called whenever a players armor is changed? including death, dispenser, etc
redempt should make that
I think alex had forked something like that
honestly i think md5 should consider
im trying beta barrels now
has 4 ItemStack methods and a ItemStack[] method
for getting the new armor
maybe 5 more for the old set
maybe not
thanks
Are middle mouse inventory click packets no longer sent to the server in 1.18?
ok so betabarrels cannot be hopper fed. dang
(Paper)
But its still awesome. I like it.
How can I tell if a player has a lead attatched to a mob?
@waxen plinth Thank you so much for pointing me at that beta barrels. I LOVE it. Its perfect with the exception of not being able to be hopper fed. Im gonna be using it until I find a hopper fed one like it.
What
Do you know what the mob is
They can be fed by hoppers though
no
You can insert items into them with hoppers and remove them with hoppers as well
Make sure you have hopper events enabled
Sometimes people disable hopper events in their paper.yml to reduce lag
But there's no way to know when items move between inventories without it
I have spigot
I'm not sure that you can then. If you have the mob, you can check if the player is leashing them. But afaik not the other way around.
how do I find my version?
U can
hmm, ig brute force with checking the mobs 10 blocks around the player is the best option then
my minecraft is 1.18.1
There is a leash event iirc
Then later just use it
Either that or tracking the leashes on your own using PlayerLeashEntityEvent. Although, not sure how you'll know if they're unleashed.
Then do that
The event works for both un/leash I assume
and another time - when standing on a big dripleaf, the playerinteractevent with the action PHYSICAL is fired, however it is not supposed to cancel that but just to not destroy wheat, how can I differ between wheat and a big dripleaf?
Or make a scheduler every period of time to check, which maybe inefficient but you can do it asynchronous if that's worth it
Ill test that out but since im pressed for time today ima do a quick and dirty fix for it then implement the best practice
ok yeah. Hoppers are working now.
Asynchronous in the main thread btw, or another thread if the methods are safe, but u might need to ask other people about this
Checking player location possibly
well, I should define every dripleaf on the server? 🤔
you said location - aka defining every dripleaf location to check if it's matching with the player xd
That's not how anyone would understand it but ok
so, how can I check the block type if there is just BlockFace but not Block/Material itself? 🤔
BlockFace is a direction
Why is there just BlockFace
You can get one block relative to another
But you can't just get a type from a BlockFace and nothing else, because there's no position there
yeah, I just could use the player location, calculate -1 in the height and check if it's a big dripleaf and if, it should not be cancelling
that's one thing I could do
player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType()
I'm not sure if it's any different, but it might be more consistent using relatives
ah
that way
well, it is still cancelled
and it spams my chat xd
and wheat is cancelled as well
how do i obfuscate a plugin without obfuscating library inside of .jar
Why not not
check if the entity has a leash or no leash
If the event isn't fired when they unleash how is that gonna work
Why am I unable to make World into String? I have World world = block.getWorld(); String blockWorld = world; and IntelliJ is giving error: Incompatible types. Found: 'org.bukkit.World', required: 'java.lang.String' even though I have java.lang.String already imported.
hey @quaint mantle (i dont know if im allowed to ping you, sorry if not), im trying to compile plotsquared, and i cant seem to because it keeps checking for checkLicenseMain task and failing there
should i just ignore it?
> Task :PlotSquared-Bukkit:checkLicenseMain FAILED
Execution failed for task ':PlotSquared-Bukkit:checkLicenseMain'.
> Header does not contain any of the required keywords: map(extension 'license' property 'keywords')
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
oh nevermind, i did compile a jar
i guess it did not matter
thanks, that fixed the error.
what tf does this mean???
how do i fix it
what is args
i never made anything called args
Your config has a custom object without the type being specified
w h a t
can someone tell me what this guy said
the docs are gold
what it means
except for where they fall short
Yeah I just searched "Leash" and called it a day LOL
Apparently that's not good enough for it to filter UnleashEvent also
rip
help
I am working on a minecraft plugin that makes a sound when a player is mentioned in chat and I was wondering how I would be able to check to see if a player's sent message contains a player from the list of online players?
Anyone could link me to a resource where talk how to create a custom abstract event and them show how to implement the abstract event?
Really thanks, and sorry for being egg breaking all time
if (Bukkit.getOfflinePlayer(uuid) instanceof Player) .sendMessage(u.f(message)); isn't there a way to do this that also makes a var out of the getOfflinePlayer?
yes
if ((Object)Bukkit.getOfflinePlayer(uuid).getPlayer() instanceof Player player) {
player.do();
}
after doing some testing this is not true ://
from player.damage it'll also factor in your armor enchants
protection can negate it
https://paste.md-5.net/yukihocayo.bash can someone give me a solution since idk what the hell this means
How can I make it so it checks to see if a player from the list of online players is mentioned?
Why convertin player list to string?
That would generate an error
I was trying different things bc I didn't know what to do
Did you learn Jaav?
?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.
Hence the Object cast
ah
Yes I did as I said I was just tying random stuff
xd now it's calling the cast redundant
Yeah
bump
That would be only checking to see if you said your name
can anyone help me with intelij idea
?justask
You modify btw
Its not difficult
We cannot cut and serve you the food on plate
That's a new one for the book
ok
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
ok
ok
Looks like Java problems¿?
Conclure, handlerlist should be put it on my custom event implementation right? Because i have a custom event called MenuEvent and then implementations like: MenuOpenEvent, etc. So in this case the Handlerlist should be done on MenuOpenEvent right?
Sorry for tag
Yes
intellij seems to be deleting the object cast whenever i try pushing the changes to my repo, which then also creates real errors.
Strange
https://paste.md-5.net/yukihocayo.bash okay then how do i fix this?
i already have jdk installed
Did you post code?
Start by providing some relevant code
Do you have a 64-bit version?
uhm how to see
https://paste.md-5.net/axuqasigom.java i did, here
this?
follow those steps they gave you
when i define a java home it says |no vm options| ithink
You already explained him....
- i dont have a java_home
Looking him imagine me when i was like him. Asking everybody to cut and serve food on plate
I remember that i ask everybody discord when having issues
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
