#help-development
1 messages · Page 649 of 1
For future reference try searching terms related to what your doing on the ?docs such as potion etc before asking here
?docs
?jd
which method
some methods spigot prevents from running async with asynccatchers
you shouldn’t just bypass it
this is probably more of a
?xy
Asking about your attempted solution rather than your actual problem
OpenInventory
show me the async context
why are you in an async section
show us some code
so we can judge it as a whole
I want to run it in AsyncPlayerChatEvent
Is there a way to run it there
you get an error
if you do right
just use a bukkit scheduler to run it on main thread
open it sync but u can fill the items async if u want
I just add an array in my hashmap ?
So to store an indétermined info per player is good ?
Yeah Caffeine does just use maps
you should probably understand the data structures you are using before using them. I mean these questions seem fairly basic
Yes, I wondered if that was possible.
Mmmmmh
whether it is necessary to use multithreading in working with databases
and in which situation i need to use multithreading?
any time u interact with the db u prob dont want to do in a blocking manor
I just interact with a cache all the time and save to db every 5m on a new thread
its ok to use conpletablefuture and executorservice?
like i have func which check if record exist in db
Just make sure you execute it in an async task
its even recommended :)
ty
na
I mean tbh
u should use a connection pool
(perhaps hikari)
and then just use that to acquire connections on the fly
HikariCP?
yes thats the one
Anyone experienced in making minigames, I was just talking to another developer on minigame states and how it could be optimzed more, I asked him about listeners and listener providers which is basically something like, PlayingGameState uses PlayingListenerProvider and Waiting and Starting game state uses PreGameListenerProvider or just gamestates as the listeners themselves. Is there any other method to be used that is even better than the two mentioned?
What does a ListenerProvider do? That name sound like there is an applied disaster underneath.
Imillusion made some kind of guide how mini games should be designed, it can be of use to you https://github.com/IllusionTheDev/Minigame-Demo/wiki/The-basics-‐-Phases
I can already see a problem here. Registering listeners on runtime should (and can) be avoided. Especially if it happens often.
Ah i see what he did there. I guess this is fine but it resembles a bit the one-class approach of alex's BlockData.
GamePhase is a bit overloaded when it comes to responsibilities here
oh sorry I forgot to mention what it does, so basically instead of the GameState having the listener you make a listener class and make multiple gamestates use that listener
Wait i think he doesnt register events on runtime? It depends on the registerEvents implementation...
Could also have a Map<Class<? extends Event, Consumer<? extends Event>> underneath.
oh mb
yeah, you cant?
Yes. This will produce unfathomable amounts of lag.
One player can probably lag out the entire server by
himself.
Its a bit of an overexeggeration but this code will perform very poorly.
Spawners are tile entities.
-> When the chunk loads : count spawners and keep track of that
-> On block place : increase amount
-> On spawner destrcuction : decrease amount
Why is EventExecutor not generic 
Nothing, wasnt directed at you.
Just brainstorming on dynamic event handling for minigames.
any ideas so far?
I got carried away with an idea. Let me quickly read your code.
You dont. Listen for ChunkLoadEvent
just create a single event handler
no need for dynamic events
but wont that need a lot of if statements?
public void deleteGame(UUID uuid){
this.games.get(uuid).delete();
this.games.remove(uuid);
}
Does the same as
public void deleteGame(UUID uuid){
this.games.remove(uuid).delete();
}
no?
Is it right way to use CompletableFuture with jdbc?
Here is code - https://pastebin.com/CpQLZmWJ
call the function in this way - DiscordDataHandler.connect();
assuming you have only a single game
you can have it pretty small
one per game, not per arena i mean
You are not even returning the CF.
Just submit a task to the executor.
PS: Creating executors can be expensive.
cant really understand what u mean
i need to return not boolean but CompletableFuture<boolean>?
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(() -> {
// All your async code here
});
ty
Because it was designed to support invariant events
Wait i dont get why you cant have a generic method for invariant objects...
oh I just saw this message, I actually didnt realize that
Well the idea was that you’d use the same event executor for different event callbacks that callback invariant event types
Like ForkJoinPool::commonPool
Its an executor thats widely used for different types of callbacks
well for checking the states
And also why would u have a type constructor for that if they are just that, invariant
It made sense to me because in my head there is only one EventExecutor per event type.
I dont see a scenario where one EventExecutor is used for multiple event types.
i don't use a lot of states myself, just for so it depends on the usecase
nvm i just used one...
Well there are scenarios where it may be appropriate to reuse the event executor
Assuming it might cache varhandles/methodhandles or other things but yeah
?paste
@ivory sleet Could you look at this and tell me if that makes sense?
Got a bit of a headache rn and im not 100% sure this unsafe cast works
https://paste.md-5.net/jamucimiti.java
If it does then this is a very nice tool for dynamic, lazy event registrations for minigames
yeah everything in their render distance
i think so
seems like its checked
It depends if the population of the Map was done in a safe manner
yeah true but it seems like it is
If you put a Class<InventoryClickEvent> and a Consumer<BlockBreakEvent> in this then it breaks
unless someone fucks up the data with reflection or smth
What the heck is that
yeah ik
I see, would you recommend doing what you've suggested if lets say the amount of states I have is 5
but that shouldnt happen in normal execution right
Depends on the guy that implemented the phase.getEvents(); methods.
The map is not type safe.
yes, usually you need to check for if not waiting and if waiting
I really miss something like that. A map where the key type correspons to the value type.
But this is not possible with type errasure.
Consumer<? extends X> doesnt ever make sense
Consumers are contravariant by nature
you can make one with a Key<Type>
(I mean it can make sense sometimes)
hmm alright I'll probably just use this for now, its more performant compared to each gameState being a listener
Consumer<? extends X> is more flexible than Consumer<X> as it allows accepting arguments of different subtypes of X, but it does not allow modifying the underlying object. You would never use a Consumer<Event> and then pass subtypes like PlayerEvent to that.
You need a Consumer<? extends Event> to pass a PlayerEvent to the consumer
Do you know anything about type theory smile? Else if I say covariance and contravariance it means nothing
what is that
Nope sry. Thats CS theory im not familiar with.
But i can look it a up in a sec.
it does and in that case you need it
there is no covariance when talking about events
you want that flexibility
Yes there is no covariance but there might be contravariance
Ok looked it up. Contravariance doesnt make much sense in java. Let me dig deeper.
how would there be a contravariance
PECS, producer extends, consumer supers
Consumer is a consumer
super is just the java keyword for allowing contravariance, extends is just the keyword for allowing covariance
Yes i think that makes sense. How are consumers inherently contravariant then? This part i dont understand.
well lets turn it around
How are they inherently or even at all possible to have a covariant relation
is it possible to change the amount of ticks to wait between runs of task timer while its already executed
Consumer<Bear> x = bear -> bear.doBearSpecificSounds();
void invokeConsumer(Consumer<? extends Animal> consumer) {
consumer.accept(new Animal());
}
invokeConsumer(x);
this becomes the issue
Now that shouldnt compile if my brain thinks correctly
But just looking at it you’d understand sth is wrong with it
- Create a concrete implementation with an internal counter.
- Schedule this task for every tick.
- Add a field to the class and call it
mod
In your run do something like
if(ticks++ % this.mod == 0) {
this.runAction();
}
- add a setter for your mod
Now you have a scheduled task where you can change the
tick delay with a setter
Yeah this shouldnt work.
Ok and a contravariant solution?
Wait let me try
Yeah (:
Wait... every consumer is contravariant
Yeah well in theory yes
I mean as godcipher said
There are moments when we break theory
Either you make the consumer bivariant, or contravariant yk (:
I got carried away with some question earlier. Something something dynamic event registration for minigames.
Anyways i got a headache. Gonna play with my doggo and do some rl stuff.
The program I installed on Spigot was removed due to disturb, where did you come to such a conclusion when there was not even the slightest impression of it in the program?
what was it and whats the reason despite disturb
and what even is disturb
They didn't say anything about it, all they reported was that the program was not approved.
hello, I have a question about how to store my data.
When a player joins I load his data in an array that I need to put in a hashmap. When he leaves, I don't remove them directly. It waits 10 min and if after 10 min he hasn't logged in, it deletes them. Is it possible to do this with caffeine? Or do I have to make my own system with hashmap?
🤔 why an array instead your own object
caffeine does support automatic expiry https://www.javadoc.io/doc/com.github.ben-manes.caffeine/caffeine/2.5.2/com/github/benmanes/caffeine/cache/Expiry.html
you can easily find examples on google on how that works
Because all player don't have the same amount of the object
Yes but i can Cancel the expiration (if player join) ?
Might need to explain more as that doesnt quite make sense
pretty sure you can set it to expire after access
meaning it will reset the counter after each time you access a key
But if i don't acces wen a player leave ?
why would you care if he gets removed from the cache a bit earlier
When the cache got removed i add it in the db
But yes i can change that at the player leave
This is probally a really stupid mistake but i cant find it. All other commands are basically build the same so i dont know whats the error with this one specific one.
i tried "fusing" some plugins and everything works perfectly up until i added fly to
idk why
did you register fly in plugin.yml?
You probably didn't add the cmd to your spigot.yml
^
i suspect he did not
oh.yh.
i knew it was gonna be stupid
but
this beats all my expectations
thx tho
happens to the best of us, its rly fckin annoying having to double register
Why? It's a common mistake. If you see this exception in the future for when you register a command, you'll be more likely to check the spigot.yml.
Same
I do personally think it makes more sense to not use plugin yml altho the api is designed that way so 🤷
yea same
Like commands are arguably not plugin meta manifest thiny thingy
the way its currently designed in the api doesnt even support creating commands on the fly
yeah
its probably done for the extra information you can provide
like usage i believe?
and permissions
Tbh tho
not sure on that
yea true
i completly forgor plugin.yml was even a thing after not making plugins for weeks x)
is it possible (and good practice) to put these listeners in one?
so have public void onProcess (PlayerCommandPreProcessEvent event, ServerCommandEvent event2)
id just keep it like you have right now
You cant do that
why would u want to do that
but that makes little sense to me
idk seemed like a good idea yesteraday at 2am
its a good idea potentially but the api isnt designed that way
spigot event api go brrrrr
Spigot already has a restart command?
also why sudo
The Spigot restart command runs a script
It's specified in the spigot.yml
eh its a close friend smp anyways
they wont care
(i wont as well)
if its a bigger project then i would consider it
well once u become good at docker and kubernetes you will prefer it over manually program those startup and shutdown procedures
yeaaaa
do you know of any good things to watch/read to learn?
i watched like 1 or 2 yt vids
but then proceeded to just try things with support from their docs
fair enough
also did ask about best practices in comm servers ,:)
goodbye restartcommand o/

This sk89qs getCardinalDirection method which returns where are you facing:
?pastebin
?paste
But for some reason it returns the cardinal direction to the right of me
So if I'm facing north it returns west
@vital ridge public static BlockFace getFacing(double yaw) {
if (yaw > 135 && yaw <= 180 || yaw < -135) {
return BlockFace.NORTH;
} else if (yaw >= -135 && yaw <= -45) {
return BlockFace.EAST;
} else if (yaw < 135 && yaw >= 45) {
return BlockFace.WEST;
}
return BlockFace.SOUTH;
}
try this
I mean east*
probably the -90 isnt needed anymore
Why does he does all the calculations doe like %360 etc
why wont he take the raw yaws
and just do comparisions
wait this is all i need for the thing?
removed it now it returns the opposite direction
I could add 180 degrees
i guess its + 90 then xD
depends on what kind of server
and server version
as well as playerbase
thats plenty
^
ah well fair enough.
no it is not, are you using paper by chance?
no
helo guz
anyway, came here to ask a question, is this method applicable to the entire inventory? it seems that it fails to remove an item in the second hand, though i did not debug enough yet
how i can call server.craftItem() without player
server is what class exactly
declaration: package: org.bukkit, interface: Server
ah
yes
well you probably cannot because the argument of Player is not null. try calling it on the first online player and see if that works for you
it will call craft event from that player
yep
The World and Player arguments are required to fulfill the Bukkit Crafting events.
bad
you cannot avoid it most likely
Why don't you want to provide a player?
i assume there's no player for them and they just want to craft an item from ingredients
instead of using Objects.requireNonNull i would reccomend a proper null check
👍
For what even is Objects.requireNonNull meant to be used?
basically it throws an error if the paramter is is null
so you wont get an NPE, you just get a different exception but i really wished intellij didnt reccomend it
Cause it aint just gonna magically create an object
So it's similar to assert obj ! = null
public static <T> T requireNonNull(T obj) {
if (obj == null)
throw new NullPointerException();
return obj;
}
im wrong, you still get an NPE just in a different place
how can I Block.setType to String, it gives me error
used to be "String" gave the same
Don't use legacy materials
before that it was not legacy
String is not block
potato is not block
so what is this
Refering to exeption
so what shound I do?
Don't use the legacy material
yes, but I don't want the timer to start until the player has left.
with Material.STRING was the same
u trying to place that?
yeah
Can someone help me understand bounded generics? I don’t get them
I’ll just use list and number as an example
public class Value<I_THINK_ITS_VALUE_YES_IT_IS_OMG_GENERICS_IN_JAVA_OMFG_YES_YES_SKIBIDI_DOP_DOP_DOP_DOP_YES_YES_YES_YES>
Why would I ever use
List<? extends Number>
Over
List<Number>
Can I not put integers and whatnot in the second list
Why do I need the first
idk
Hello, can we talk about mod programming too in here?
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!
Alright
the ? prevents writing
I can’t guarantee you’ll get an answer
But you can ask
Being new to modding, I just started a fresh new mod in Intellij.
But when I launch gradlew genIntellijRuns I get
> startup failed:
General error during conversion: Unsupported class file major version 64
java.lang.IllegalArgumentException: Unsupported class file major version 64
So how would you fill the list?
Yes, that's what I thought
That's forge 1.16.5
you prefill it, and this can be exposed as an immutable number
But that’s <?> vs <? extends T> not <T> vs <? extends T>
I tried a bunch of parameter changes, but nothing seems to change this error
Can I cast a List<Number> to a List<? extends Number> and vice versa?
you can cast it yes, as long as the list you're casting is at least a number
Being new to modding I just started a
Lol
I mean List<? extends Number> supports a term of the type List<Double>, List<Integer> and so on
Its also considered to be a read only list as its pretty much is a producer and allows for covariance
Ohhhhhhhh
OHHHHHH
okay I was confused because
A List<Number> could contain a Double because polymorphism
where can I find the indexing for player inventory? specifically, which slot is mapped to which number for setItem and other operations
But that helps a lot
Yes but thats on an object/term level
There’s an image somewhere
3 people will send it
All at the same time
fine by me
tyty
I feel like that image should be pinned
It’s not even right for spigot
it isn't?
0-8 is mapped to the hotbar
@tender shard has one for spigot
actually i don't think that the crafting matrix is even available to setItem
so yeah this does seem to be inaccurate
imagine spending 30 mins to make the image and it's not even right
i guess it's right somewhere
don't know where though
i don't think it was created randomly with no thought put in
Probably packet level
perhaps
I know this is probably a very bad idea. Can Java internally compile source code from input string(s) and execute it without writing them to a file?
uhh i bet that some niche library can parse java in real time maybe possibly perhaps
why though?
Yes
with no external libs?
Is there a way to put clickable links in a kick reason?
Yeah
how so?

holy shit
New skript just dropped
yeah i was just thinking that a scripting language for a plugin could be java itself lmao
but it's less of a hassle to just make one's own
Clickable links in Kick Reason
Yeah you can make a scripting language that compiles to native code if you want
did you add the essentials dependency to pom?
you ideally never manually type in the import value, it should be imported automatically or by auto suggestions
and you really should
well it's never too late to learn
your ide should have a creation wizard for a maven/gradle project
just create one and start going with the flow. when you don't understand something, look it up and really soak in the information and then try to apply what you've learned
when you stop learning, you start dying
(c) some guys signature on spigot
be aware that everybody here is happy to help you as long as you try to really understand what you're being provided, as long as you really want to learn and as long as you are not trying to be spoonfed
it won't take long to port your code. it's as much as copying the files from your old project to your new project and then actually adding dependencies instead of whatever you have now
i miss eclipse
hey, I'm trying to create an interface for certain kinds of classes and everything I do there has to be static, but apparently static methods in interfaces have to have a body and in abstract classes static is not allowed at all
uhh
please elaborate
?xy
Asking about your attempted solution rather than your actual problem
use an abstractclass instead
._.
interfaces are strictly for contracts
and the phrase "everything i do there has to be static" is kinda throwing me off. is this a utility class? why would you need to abstract a utility class?
it basically is
you don't need abstract when using static
static is bound to the class, abstract is bound to object
please explain exactly what you are trying to do
is there a way to make mobs ignore a specific player
basically, I need to have a class I can implement/extend to create other classes with certain functions, such as getId(), getItem(), and something like that, but I don't need to be creating a new class each time or having one before because
I can't explain I'm confused as shit now
yeah why static????
you are not calling getId() on nothing
so I don't have to new the class each time
it's on something
and that something is already implied to exist if you're calling the method
I just want a template for my classes
it's not like you call a static method "getId()" and it just understands what object for id exactly you want
yeah i guess, gradle is harder for newbies
Wdym
Like having that many in your computer?
Is what possible
You have to be more specific
Minecraft is mostly single threaded
The main code at least
Certain parts like the packet handler run on other threads, and even more parts run on other threads on paper
But your plugin can use as many threads as it would like
So erm interfaces and abstract classes?
Maybe what you need is not this
But just one class
With multiple instances for each version
So it can like return it’s id for example
But you would pass that id into the constructor
Instead of having a bunch of classes
Just an idea
Minecraft is single threaded.
A 15 core cpu running spigot is like having 15 developers thar have to share one pc
Fight me.
Most of Minecraft’s code runs on one thread (similar to one core but not exactly)
A couple things run on some other ones
If you make a plug-in, that plug-in can then use more cores if you want for its own code
Yeah I’d say more than just a couple of things
Buts it’s unlikely that will be helpful to your plugin
Sorry didn’t mean it in a rude way
Was literally asking if you understood
Not trying to be harsh or anything 😅
"Hey Alexa, what are abstract classes and interfaces?"
plz don't ping me i'm rather busy rn. i've never worked with eclipse so i can't assist you here
but i bet that there are tutorials you can easily find
i can help you with general maven help but not with eclipse unfortunately
U should probably use intellij
i mean it's personal preference so there is no "should/shouldn't"
for me intellij is better yeah
15hrs of coding in a day will make you cognitively responsiveless
my record is 13 and i was trying to run away from reality so there was no other rock bottom anyway
you should do at a max 10 hours a day and if you can only do 7-8
if you are not about to commit blanket please do not code more than like 7-8 hours a day, and even that is quite a reach
with breaks between it all
that is gonna lead to really simple bugs
coding while tired is painful
you are gonna miss stuff in plain sight because you're really tired
you must have some strong ass motivation and/or coffee
go sleep
well generally don't code this much and especially stop as soon as you're feeling unwell
'm a coffee addict
good for you
this is concerning fyi
this is not normal
though same
but it's not normal
you might
so it's best to check that as soonas possible
yeah please do
do you live alone
Use the community edition
live probably
even regarding actually health??
whats the package name of the full bungee jar not just the api on maven
shit sorry about that
you're starting to code at a finely young age, good for you
But thats against discord's tos..
Aight im not gonna snitch
tbh i don't give a fuck
if a person is adequate why'd i care
what is the best way to know: "if the player looks at the block of glass for 3 seconds, then ..."
discord terms of service say that a user must be 13 or above to use it
Lucky you
I tried to code when I was 13 but I have no motivation back then
I regretted quitting
You probably just have to check what the player is looking at every tick
i started coding for minecraft in 14
I could've been alot better now
ive got a plugin thats almost done, can a competent java dev PLEASE check it over for me/add some final touches?
Same it's only been like 3 days since I'm using it
But I'm currently making my first project now :D
Sure
Im 15 now lol I think its not too late yet
It'll never be too late
check onMove and raytrace from the player, if they are looking at a block of glass, put them in a map<UUID, Int>, which you monitor with a per-tick scheduler and increase the value by 1, when it reaches 60, the player has been looking at a block of glass for 3 seconds
but also make sure to check onMove to see if they are still looking at the block of glass (if they were, but now they aren't, remove them from the list)
There might be a look at block event idk just search around
check dms plz
i started "coding" at 8 and i was doing silly scratch projects, i found python at like 10 or 11 and then i started coding for spigot at 12 or 13
i like my journey
atleast skript isnt in it
hello
Everyone in a programming community said python was ass
don't listen to opinions too much while coding
And that I should pick a different language for my 2nd language
never a good idea
i want an plugin that allows players to join 1.16.5+ version can someone help me?
So yeah I kinda picked java
via version and via backwards
not working
?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.
It works just fine
Via rewind
That's for 1.7?
Well they're alot more experienced than me
Python is slow
Idk
It's fine for scripting things though
python is good for some things and bad for some things
java, too
like automation and such
you should pick whatever you feel like picking
you can go learn cobol no one is stopping you
Well here I am now
You can earn big money with cobol
Already started and I'm kinda liking it
I'm making my first big project now (a hologram plugin which u can edit your hologram through a custom gui)
good for you
yeah i think it's used in banks or stuff?
Yeah banks still use it
just rewrite it with rust 
which is why it pays very well
Imagine intruducing a infinite money bug in the bank system
lmao
that'd be funny
They aren't taking any risks
Can a Dev please help me make a plugin? Really simple, just disables tipped arrows and netherite armour. Will pay in nitro
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
mb
whats the package name of the full bungee jar not just the api on maven
Should i just ping md_5
no
It probably isn't on the repo
pinging anybody will not do any good for you most likely
except discorauging the person in question from helping you
Just like you can't get an actual spigot.jar from the repo
You can just get the spigot jar on maven
At least it containing nms
I need nms on bungee
bungee is a proxy with open source code
nms is net.minecraft.server, a name of a package for spigot
what exactly are you trying to do
There is no nms in Bungee... it's a proxy??
If it's about the packets you will probably find them under net.md_5.bungee.protocol.packet
Just look at the github
Ok so i need jank got it
public void onBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if(event.getBlock().equals(Material.OAK_WOOD)) {
player.sendMessage("Hello :)");
}```
Why isnt the message being sent?
ok, i will try it, thank you
public void onBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
UUID uuid = player.getUniqueId();
if(event.getBlock().getType().equals(Material.OAK_WOOD)) {
player.sendMessage("Hello :)");
}```
it still doesnt work, did i implement it wrong?
use ==
Im currently trying to get colored nametags working, i found out that using the Play.Server.SCOREBOARD_TEAM Packet is best to use. After alot of trial and error i need help with that.
private PacketContainer generateCustomNameTagPacket(Player p, WrappedChatComponent nametag) {
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.SCOREBOARD_TEAM);
packet.getModifier().writeDefaults();
StructureModifier<WrappedChatComponent> chatcomponentsModifier = packet.getChatComponents();
chatcomponentsModifier.writeDefaults();
String name = UUID.randomUUID().toString().replace("-", "").substring(0, 12);
packet.getIntegers().writeSafely(1, 0);
packet.getStrings().writeSafely(0, name);
chatcomponentsModifier.writeSafely(0, nametag);
return packet;
}
Thats my current state of the packet but it doesnt work. I know that the write-operations may fail because of an OutOfBounds Error...
looks fine, you are sure you are breaking the right block ?
yes
Also are you sure the event is registered
public void onEnable() {
PluginManager manager = Bukkit.getPluginManager();
manager.registerEvents(new TESTLISTENER(), this);
an angry test listener 
yes
nice kekw lynx
shush
well, make sure you are breaking an oak wood block, not an oak log block I guess
oooh
I-
shit i thought it was a log
idk that oak wood == planks
it doesnt
WOOD
oak wood is its own block

WHAT
it works with oak_log :)
there
well done lynx
why would :ke be the fucking flag
go and sue discord for emotional damages
when it could be kekw
HM ?
why can they not store that preference info in my user profile ?
why does it reset when I jump to a superior distro ?
obviously
int number = 1 * 1.1;
Why doesnt it let me define stuff like this?
A double isn't an int
i cant take this anymore
oh man :(
?
sir this is logic
a number with a floating point cannot be an integer because an integer is a number without a floating point
Anyone got a plugin to disable pie ray?
i don't think it's a thing, pie ray is client-sided
i believe there is one that spams the client with non-existant block entities
some big servers have it
ah, that could be a solution
not aware of one though, sorry
might be better for you to refer to #help-server
ive got the github for one but cant figure out how to compile it
link?
i know, but this error was so obvious that i couldnt take it anymore
ah xD
I'm sorry what... Did I just get a Concurrent Modification Exception on an Iterator?
[10:38:26] [pool-7-thread-1/WARN]: Caused by: java.util.ConcurrentModificationException
[10:38:26] [pool-7-thread-1/WARN]: at java.base/java.util.HashMap$HashIterator.nextNode(HashMap.java:1597)
[10:38:26] [pool-7-thread-1/WARN]: at java.base/java.util.HashMap$KeyIterator.next(HashMap.java:1620)
[10:38:26] [pool-7-thread-1/WARN]: at sh.miles.townyleveled.calculation.TownValueCalculator.get(TownValueCalculator.java:55)
[10:38:26] [pool-7-thread-1/WARN]: at sh.miles.townyleveled.calculation.TownValueCalculator.get(TownValueCalculator.java:25)
[10:38:26] [pool-7-thread-1/WARN]: at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
[10:38:26] [pool-7-thread-1/WARN]: ... 3 more
if (retrievedWorker.isDone() || retrievedWorker.isCompletedExceptionally()) {
retrievedWorkerIterator.remove(); // TownValueCalculator.java:55
chunksLeft--;
}
anyone have any knowledge of gradle?
me
does gradle build and gradlew build both not work?
clone the repository and open it in an ide
actually even no need to open it in an ide probably
just clone it with git
and then run the command in the folder
one sec ill build it
TYSM
you don't need to install gradle in order to use it
just, open a terminal in the cloned folder
and run gradlew build
or ./gradlew build
depends on your OS
windows
then the first
can i please have it as a jar?
if thats possible
idk shit
gradlew.bat doesnt wanna build
odd
@empty basin
tysm
this is probably the most I've ever been confused when coding. For some reason my iterator is throwing ConcurrentModificationException... I feel like I'm not getting the full stacktrace here. Something important is being left out because Iterator#next should never throw ConcurrentModificationException.
https://paste.md-5.net/ufarojivuh.md
https://paste.md-5.net/xiyobeqiju.rb
I mean, looks like a race condition
iterators are not magic
they don't protect you from racing a different thread
🤔 do iterators update if the list is updated
Yes, iterators don't clone your list or anything
I mean, technically depends on the iter implementation
yeah hmm okay that's it
because when looping the array an element could be filled in
I could see a concurrent modification exception in that case
Like, ArrayList iter is just a fancy counter 
what is the event for using a hoe on a dirt,grass,podzol block?
interact
Essentially I'm waiting for a bunch of CompleteableFuture<BigInteger> tasks to finish when all tasks are done I return the resulting BigInteger 🤔. How would you reccomend I go about this I mean before. I would loop the list, but removing from a list while looping it is an issue to say the least
maybe I clone the iterator and remove from the list
Is There Any InteractType Enum Or Something?
Action
How could you play the chest opening animation to a player
packets
they thought i meant path blocks
to one player or all?
one player
Alr thanks
I mean+
an dpackets are annoying
List<CompletableFuture<BigInteger>> list = new ArrayList<>();
CompletableFuture<Collection<BigInteger>> ints = CompletableFuture.allOf(list.toArray(CompletableFuture[]::new))
.thenApply(ignored -> Collections2.transform(list, CompletableFuture::join));
works
protocollib could work
ye ?
wasnt expecting it
Netflix also had some cool libs
has some nice helpers if you work with it a lot
hmmm I'd say my issue with this is I want the tasks to stay on their thread until they're done. I'm tracking how many tasks have finished then removing them from the list of futures and adding it to a running total
they are in that version
thenApply is only executed when all of them finished
allOf awaits all of them / executes if all are finished
ohhh okay
is that a spotify method xD
Well
who was the person who said why do newbies always use hypixel at the start of their plugins name? im back with another plugin:
public final class HypixelCustomItems extends JavaPlugin {
alex
hmmm sounds worth it to me
it is a nice lib if you work a lot with CF
iirc still maintained too ?
yea looks like it
I use CF a good bit in spigot and non-spigot projects
its my preferred way of Threading in most cases
Yea then go for it, the lib is like ~7 classes
I love the CompletableFuture api its so nice to use
until you have to manage errors 
should i make a custom item like this?
public class CustomItem implements Item {
it added like 50 methods
Guess your arror does not have custom effects then
so it isnt a custom effect
no
then how
use pdc to identify it
I don't mind it for errors I think its pretty graceful. I mean you can use Exceptionally or just use whenComplete and push the error out 🤷♂️. Granted I don't work with much super complex multi-threaded projects
Too old! (Click the link to get the exact time)
the other guy
just, if you wanna check for tipped arrows
there is a whole interface there
for you to instanceOf against
makes this whole thing a lot easier
Cant tell you how often i produced hidden exceptions when i started using CF the first time.
where ?
yeaaa xD finding those fuckers is terribly annoying
What was the issue ?
if you obviously also checked for custom effects on those, that would not work out either
oh god reminds me of my first time using em. I'd do something it just didn't work and i'm like what... no stacktrace??? huh...
Show use the code that applies custom effects to your arrows
they don't
from the looks of it
just normal tipped arrows
looks good ?
yea

it is ?
oh

then ignore me
tipped arrows are just arrows with potion effects
@eternal oxide
the base effect is what you are after then
hmmm actually just realized. I'm waiting on the main thread to get my CompletableFuture's, I mean I could stall my async thread until I recieve all of them, but I feel like I should be processing them if some of them are in the list
@EventHandler
public void on(final ProjectileLaunchEvent event) {
if (event.getEntity() instanceof Arrow arrow && arrow.getBasePotionData().getType() != PotionType.UNCRAFTABLE) {
arrow.remove();
}
}
e.g. this
i know this isnt realated to the spigot api and everyone is gonna say ?learnjava but is there a way to assign values to enums? like assigning a text and a ChatColor to an enum to use later
hm ?
yeah
how?
edit: lemme guess, ?learnjava
hmmm actually yeah you're right I'm thinking about the logic of how to sum it wrong. There's no point in summing some of it if I don't have all of the ChunkSnapshots from the main thread yet what good is a half answer
public enum Enum {
COOL("sus", ChatColor.RED);
String string;
ChatColor color;
public Enum(String string, ChatColor color)
this.string = string;
this.color = color;
}
// getters
}
Alr Thanks
Enums can have fields. But you should not create mutable fields in an enum.
Explain why you need this. I suspect an xy problem.
Item Rarities
for custom items
Ok, go on
Why does your rarity need mutable fields?
(And which fields)
What is the enum used for
@remote swallow
Any exceptions? Is the listener registered?
@lost matrix

there is your message
I mean it literally says "hii"
unless I am missing something
How do I get only the full number and 1 number after a dot from a double converted to a string? (or is there any other way than converting stuff)
isn#T that what you wanted ?

why am i not getting the message
I mean
outdated plugin jar in server folder ?
did you mess around there ?
what is your current code
You mean actually rounding the number or only displaying them in a String?
I want to have the exact number in the background, but the player should only sees the rounded one for less complexity @lost matrix
DecimalFormat
literally works fine for me ¯_(ツ)_/¯
public static void main(String[] args) throws InterruptedException {
double value = 4.12445D;
String message = "You have %.1f $";
String formatted = message.formatted(value);
System.out.println(formatted);
}
Out
You have 4,1 $
Process finished with exit code 0
This formating uses your Locale
thank you
thank you
The formatting is a more classical approach used in other languages like C.
DecimalFormat gives you a bit more freedom when it comes to the actual format.
okay :D
Hello!
Can someone explain to me why I can't use the Player#performCommand() method to open a menu from for example DeluxeMenus or ChestCommands? It always say Unknown command, even if it works manually... Does this have anything to do with the fact that commands are often defined in the file and not directly recorded in the plugin.yml?
Thanks!
discord srv does not let players join to the server until it is fully loaded. how i can do this?
Show the command
Do you prepend your command with a "/"?
Oh, well, let me try it
But no, it works with any other command so I think it's not necessary
Deluxe commands may not properly register commands
I'm making a block regeneration plugin and would like to know if it's reasonable to just save the locations in the database or in a file and after introducing what real /regen command to compare through the for loop?))
lol really?
Regeneration of worlds is a pretty hard task. Simply looping over all locations and restoring them might
very well crash the server.
Looks like it's the same for several menu plugins unfortunately...
Even more surprisingly, DeluxeMenus can't open my menu by command (even though it's registered in the usual way in the plugin.yml file and with registerCommand()), but ChestCommands can.That's some pretty strange behaviour
But thats essentially coreprotects approach.
They get the query from a DB and restore them over time
so this is why i want know you have idea how optimatzation this
?workdistro

the only option for?
Well
"for"
Coreprotect maps each block state to an int to save space
I believe they also map each player to an int for the same reason
You can tackle it however you want. Just make sure to not do everything in one tick.
And you should group all blocks that are in the same chunk.
Ah thats a good idea
This way you can locally cache a Map<Integer, BlockState>
It also means you only need to store the int in the db
With an extra table int | VarChar
How to set head texture of player head block data
does anyone have any idea how I could make totem packets always register before death packets?
i dont undestand how numbers help
You mean on the client side?
hey, I've always been curious about what approach is the best for map regenerating, like if I was making a plugin for bedwars. my current idea of how this can be done is with saving the world in a different folder and then just copying it. are there better practices for this or is this one basically the go-to?
but I realized that such plugins eat a lot
Its just caching Bukkit.createBlockData(String) because thats expensive
Plus int is smaller than varchar
hey how obaut delete oldWorld end create new void world with structure]
"regeneration"
for skywars
This is a common problem. Loading a clean world from a template would be my way to go
if spigots world loading wouldnt block the main thread with IO.
server side if it's possible
The server doesnt register any death nor totem packets...
oh ok mb I'm still learning
What is your general problem
ocasionally totems "ghost" when you offhand them just before you take enough damage to kill you, which results in the totem not registering, but still showing as being in your offhand in the respawn screen
I wanted to see if its possible to stop this
Apparently its because the totem packet sometimes get sent after the death packet
bukkit api is not a good tool for big projects
This sounds like some plugin fks up your totems. That should never happen in vanilla mc.
It's a known thing that happens in vanilla minecraft, it mainly happens in gamemodes like crystal pvp
There are even mods that fake totem ghosting: https://modrinth.com/mod/minecraft-ghost-totem
If two classes always come together, is there some way to make a "combined generic"?
For example I have:
Class A extends Letter
Class B extends Letter
Class AConfig extends Config<A>
Class BConfig extends Config<B>
Is there a way to combine
Class MyClass<L extends Letter, C extends Config<L>>
to something like
Class MyClass<X extends *object that represents combination of letter and config*>
and use that reasonably? Maybe something like a wrapper?
Or should I just stick with specifying both even if AConfig only comes with A and same for B?
I feel like im missing information in this question
Is it possible to make an event be sent to only one consumer in Apache Kafka?
in what?
I tried to ask a generic as possible. I'm using this for inventories that modify ConfigurationSerializables that all extend the same class.
All of the relevant (config) files also extend the same class.
Now I want an Inventory to edit all types of those ConfigurationSerializables.
Basically:
public abstract class FieldEditInventory<A extends Configurable, C extends ConfigurableConfig<A>> extends InventoryGUI {
in pub sub you dont usually do that, but if you must you would sent like a name or id of the one you want to message
Use a topic with only one subscriber?
I should have a couple of them, but only one should be consumed
Just for clarification, it does work like that but it feels like I'm duplicating information. So I was wondering if there is another way
Hello, with placehoder api. if I have an extenre plugin that displays my placeholder. Knowing that the placeholder changes often, will it update automatically?
Ehm
What exactly are you trying
class LetterConfigWrapper<L extends Letter, C extends Config<L>> {
private L letter;
private C config;
public LetterConfigWrapper(L letter, C config) {
this.letter = letter;
this.config = config;
}
...
->
Class MyClass<X extends LetterConfigWrapper<?, ?>>
I guess? Im not 100% i understand the question
I just don't want to duplicate the code for editing the fields so I try to have one generic class for all of them
Not in spigot. I think there is a lib that does it.
i think u can use the inventoryChangeEvent
Well having X<C extends Config<L>,L extends Letter>> is reasonable
Since there are essentially 2 types you construct from
But as said
This feels very over engineered
I would try not to go with a transparent bivariant design or whatever u call those
Go away with your lingo. You had type theory this semester or what?
Lmaooo
lol
#1100941063058894868 message this guy had a similar problem
I was basically hoping for one generic that can then derive the other.
Or well “design issue”
adapter moment
I mean one way is to just have C extends Config<?>
public abstract class FieldEditInventory<C extends Configurable, B extends BaseField, D extends ConfigurableConfig<C, B>> extends InventoryGUI {
Because this looks meh
or just if u dont need the C type go with <L extends Letter> and then just use Config<L>
so what do you do then?
This looks like typescript
And java isnt structurally typed
So big issue
Fork spigot and load worlds non-blocking
fair enough, I'm working on a personal project onyway
How about, we finally look into this and see if we can pr something reasonable.
World loading and deleting was an issue since i started
Yeah I think the api is a bit too scarce thats just it
Hmm but I need to know those classes to access to be able to call methods with the right fields in the right config.
It would probably work like that but the same Configurable always comes with the same Config and the same BaseField(s) so it's kinda dumb having to specify all three
You just over engineer it as I mentioned a couple of times
A class needing more than 3 type parameters is rarely ever a sustainable design
Yes I like over engineering if it saves me from duplicating a function
But even 3 is kinda 
No its not about DRY
Pretty sure you can solve it w/o having tons of type parameters
container classes
its not that difficult, i think. Let me check somethin
Hmm?
Like a class to just hold multiple things
Record
I might be able to save on some generics when implementing the right functions in those classes. I'll review it again. Thx
why i have this problem
Was prd and rejected i think.
array, Map, Set etc
Or generics e z
though, what's a valid approach without making a fork? I am indeed considering forking it for personal use but I'm wondering what can be done with just spigot to approach this problem


