#help-development
1 messages Β· Page 645 of 1
bc they still havent added it
probably never will with all those issues lol
What is vanilla then?
regardless of the hundreds of community made ways to craft it
the bundle item
its literally called bundle
Ah
it stored up to 64 items
like 1 poppy 42 oak sapings, 9 diamonds, 4 netherite, 8 oakplanks
this looks interesting
It is a planned item for like 3(?) versions now. They got plenty of duping issues (that even allowed to create stacks exceeding 64 and whatnot). Still did not manage to fix all of them so it never really got added
it would be nice if they would just let the community handle stuff
like they just introduce the base thing
let the community flesh it out π
At this point it would be kinda embarrassing to do that. "We can't fix it, help pls"
What exactly, while looking at all the code you see on spigot, makes you think this a good idea
do I need to store an entity ID and or entity UUID ?
Well, my point is. The community knows what it wants better then what Mojang does
Yes. Serverside books
Depends on what you are doing. UUID is persistent over restarts and ID is only assigned for live mobs
or another reasonable way to put in lots of text
packet mobs
so ig just ID
Yes in that case the ID
but yeah like 7smile7 said. I mean we already handle fixes for many dupe problems
the only times we can't is because it involves the protocol in some way
Smile kinda said "not a good idea" though
Although optional packages would be fine. Just like plugins basically
I mean the "community" is huge and there are a ton of different groups that all
want different things in the game. Im fine with what we have rn. But i would really
like a server side way to introduce new mobs, blocks and UI elements.
new mobs would be a huge step already
or even custom skins for current mobs without losing the "normal" mob
Last question, what are angles called in protocollib?
PacketContainer#getAngles() isnt a thing
so how do I know which one to write to in a protocollib packet
generally protocollib has docs you can look at
or if you arent using maven/gradle download the jar manually and add it as a api
Player p = Bukkit.getPlayer(e.getInventory().getHolder());
``` Hi! How do I get the player who interacted with the custom gui? (I'm sorry I'm kinda new to this, it hasn't been 1 day since I started.)
This errors
i might be dumb
is this InventoryInteractEvent?
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
getWhoClicked()
uhhh
incompatible types: org.bukkit.entity.HumanEntity cannot be converted to org.bukkit.entity.Player```
am I dumb or am I dumb
nvm we call it type checking in lua
java is stricly typed if thats what oyu mean
finally thank you
getServer().getPluginManager().registerEvents(new XPBottleBreakListener(), this);
getServer().getPluginManager().registerEvents(new ShearSheepListener(), this);
getServer().getPluginManager().registerEvents(new OnPlayerJoin(this), this);
getServer().getPluginManager().registerEvents(new MenuListener(), this);```
also is there a way to shorten this?
yes
gimmie one sec
public void onEnable(){
registerEvents(
new XPBottleBreakListener(),
new ShearSheepListener(),
new OnPlayerJoin(),
new MenuListener());
}
public void registerEvents(Listener... listeners){
for(Listener listener : listeners){
getServer().getPluginManager().registerEvents(listener , this);
}
}```
thats how i do mine
some people would argue its more messy but its up to you
Thank you
Is there a way to create a new instance of a packet without having the paramater to pass in.
Ex. ClientboundTeleportEntityPacket requires an entity, I would really prefer not to use reflection to keep this as speedy as possible, I also don't have an Entity on hand
You can't create object without parameters if default constructor doesn't exist, even with reflection
Not entierely true
In an old project I just made a dummy entity for all packete
How so
but I dont really want to do that
you can do an unsafe allocation and create an instance of a class that has no default constructor
Is that slow?
Also I might be misunderstanding packets as I never worked with them, but why u use EntityTeleport packet without entity
Oh well, sure
Packet entities
Using sun.misc.Unsafe for object allocation is hacky and generally not recommended
Yeah I think I tried that at one point
Why do you need that anyways?
I am trying to send ClientboundTeleportEntityPacket for an armorstand
packet armorstand
And what prevents you from just creating one using the constructor?
The only contructor requires an Entity
actually I can prob use a FriendlyByteBuf
Then pass an entity... You should have an ArmorStand instance for your packet entity.
I don't
Ig I can switch to that
Then rewrite your system to keep track of them.
Write a HologramManager or whatever and keep track with a Map<Integer, ArmorStand>
Are you writing holograms for your personal library?
Display entities are also something to consider
I agree I run the server on 1.20.1 but I want to have support for 1.17+ players and I've had issues with display entities and viaversion
HI, i made a skyblock plugin. How to create an small world "islande"? juste create a normal world? or i use an api like worldedit?
you would have 1 world and use either schematics and worldedit or the structure api and per player world borders
Per player world borders?
declaration: package: org.bukkit.entity, interface: Player
Wait, what?
and how to do if i don't want that in an is, we can see other is near?
add an empty island betwen them
Hi, is there a method to get the block a player is looking at? I have the Vector rayTraceResult. Are there already existing methods or should I create one that checks all the blocks passed by the vector?
getTargetBlock or .rayTraceBlocks
Hello
new BukkitRunnable() {
@Override
public void run() {
PlacedSpawner spawner = Database.getPlacedSpawner(location);
}
}.runTaskAsynchronously(plugin);
return spawner;
}
this code have a probleme (can't return spawner because async)
so what is can use? completablefutur?
i thougth you wanted to use block PDC for that
what the heck is that
I'm talking about the code
ik block pdc, as I've used it myself
(even tho I don't really remember lol)
it's the naive idea of just being able to throw something into "async" and make it work like magic
as if it wasn't async
he's expecting everything to wait for him to get teh spawner before it returns.
._.
he doesn;t understand tasks
but isn't that what async will not do?
typically people then get told to use a future and then they use CompletableFuture.supplyAsync and somewhere else they call get() or join() on that
yep, its magic
and then they think "ha! now everything'a async!"
._.
making async code was always confusing to me
in js you can just put async and await everywhere but not in java lol
in java you never wait for anything async. Imagin it's a completely different worker
You tell it to do somethign and it goes off and does it
oh my testing server is already online
if you try to wait you lockup your own thread. Workers sitting around waiting
locking up the own thread sounds like a very bad thing to do
very
How do you make dictionaries in java
seeing as the server is basically a single thread
it's called Map
ohhh
new HashMap
can I mention folia? or is it illegal here?
its a fork so best not to
Map<String,Integer> myMap = new HashMap<>();
myMap.put("mfnalex", 28);
myMap.get("mfnalex") // returns 28
I also use it but I also need the db
pretty weird idea to store your data twice
makes sense
i have a select
thank you
once you pass something off async you are giving up all control over it.
i can't get it with combletablefutur?
you must allow your new async task the responsibility of dealing with everything from that point
ie, when it gets that spawner it's the async tasks job to handle it
because I also need to access it when the player makes an order the PDC allows me not to make a request to check if the block belongs to someone when it is broken
Is yoru database an ACTUAL database or it is block PDC?
they have both
nice and confusing π
with google translate yes ^^ (sorry) I have to go so I couldn't make a correct sentence
my code work like this
event -> manager -> db manager
my async is in my manager, i need to place my async in my event ?
no, once you went async you are no longer IN your event
good luck with that elgar, I'll go to sleep lol
π
so, how to do?
Your Async code does not run the instant you call run. It executes the next tick, after the event ends
if you pass any work off async you have to deal with everything that happens after in the task
SUtil.delay(() -> {
Bukkit.broadcastMessage(DUtil.trans("&7Saving..."));
Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "fsd");
Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "kickall &cThe Server is restarting!");
Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "stop");
}
}
}```
im getting error expression ";" or "," expected
does yoru delay need another argument?
I'm only guessing as it's your util class, but a delay would need a value so another arg
which would be , 10L
The event don't wait the end of the asynchrone ? (Like asynchrone chat evtn)
no
think of two people...
one is your main server thread (the event)
the second is your async task
is that correct?
spam
once person 1 asks your second person to do the async stuff, he can;t sit around and wait for the other chap to finish
alr ig ill wait
both people go and do their work
what is SUtil.delay ?

does it even matter to use nano time when you're dividing by such a number?
Please create more variables in your methods.
It will make your code way more consize and readable.
ItemStack ironHelmet = new ItemStack(Material[plugin.getConfig().getItemStack("warrior.helmet")], 1);``` Am I doing this right?
no
ItemStack ironHelmet = plugin.getConfig().getItemStack("warrior.helmet")
helmet: IRON_HELMET
oh thats a material
and it would look like that in the config right?
ItemStack ironHelmet = new ItemStack(Material.getMaterial(plugin.getConfig().getString("warrior.helmet"), 1);
are you using vault api
send it according to the response
This is how your code would look refactored:
Server server = Bukkit.getServer();
Map<Server, Integer> smap = RebootServerCommand.secondMap; // This is bad practice btw
Integer current = smap.get(server);
int currentVal = current == null ? 0 : current.intValue();
smap.put(server, currentVal - 1));
if (currentVal <= 5 && currentVal > 0) {
Bukkit.broadcastMessage(DUtil.trans("&c[Important] &eThe server will restart soon: &b" + reason));
Bukkit.broadcastMessage(DUtil.trans("&eServer closing down in &c" + smap.get(server) + " &eseconds"));
} else if (currentVal <= 0) {
Bukkit.broadcastMessage(DUtil.trans("&c[Important] &eThe server will restart soon: &b" + reason));
Bukkit.broadcastMessage(DUtil.trans("&eServer is &cshutting down&e!"));
cancel();
SUtil.delay(() -> {
Bukkit.broadcastMessage(DUtil.trans("&7Saving..."));
Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "fsd");
Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "kickall &cThe Server is restarting!");
Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "stop");
}, 10L}
...
thanks
you would just overwrite essentials commands
been as ur new to java, id recommened doing some coding, learning stuff in/about java that can help you with making the plugin

you either have to modify essentials' message configs, or make ur own command to handle it all
I thought I could learn it while making plugins
lol
yeah thats the better way
What do you mean? You can just create a /bal <player> command and request the balance from vault, then print it in chat
i'm just relying on my common sense rn I mean every function seems understandable if you know english
lol
yeah
sorry for asking but wouldn't Material.valueOf be used here?
*If you read properly written code.
There is actually a quote i like from a respected clean code author:
"Good code should read like a book"
you are probasbly one of the few people that is actually learning java, instead of just begging for help here being sent the learnjava command every few messages
e my code is garbage rn
either could be used
you learnt early returns yet?
The Material class has a custom matchMaterial(String) method which is more
safe than valueOf() because it doesnt throw an exception but rather returns null on a mismatch.
in some cases yeah, but its instead of doing something bc a condition is met, you return because it isnt met
ohh theres something like that in lua too
https://medium.com/swlh/return-early-pattern-3d18a41bba8#:~:text=R eturn early is the,when conditions are not met. this is somewhat decent at explaing
lol
damn they exist here
very useful for making code more readable
Let me show you an example.
Ah but for asyncchatevent, all the event is in other thread, so he wait the end on azync ?
So i cant request my db in asynchrone on event ?
you are not in an async chat event though
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
Entity defender = event.getEntity();
if(attacker instanceof Player) {
Player attackerPlayer = (Player) attacker;
if(defender instanceof Player) {
Player defenderPlayer = (Player) defender;
if(!CombatUtils.areEnemies(attackerPlayer, defenderPlayer)) {
event.setCancelled(true);
}
}
}
}
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
Entity attacker = event.getDamager();
Entity defender = event.getEntity();
if(!(attacker instanceof Player)) {
return;
}
Player attackerPlayer = (Player) attacker;
if(!(defender instanceof Player)) {
return;
}
Player defenderPlayer = (Player) defender;
if(CombatUtils.areEnemies(attackerPlayer, defenderPlayer)) {
return;
}
event.setCancelled(true);
}
You simply return early if a critical condition is not met
the way I heard that quote is similar. Instead of book, it was story
Something, something, cant remember correctly
yeah I used it alot in luau too
getServer().getPluginManager().registerEvents(new XPBottleBreakListener(), this);
getServer().getPluginManager().registerEvents(new ShearSheepListener(), this);
getServer().getPluginManager().registerEvents(new OnPlayerJoin(this), this);
getServer().getPluginManager().registerEvents(new MenuListener(), this);
getServer().getPluginManager().registerEvents(new KitMenuListener(), this);```
I still dont know how to make this shorter π
vararg method
for example https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/AsyncPlayerChatEvent.html this event is well done in async?
In theory yes. But thats meta programming and can lead to problems quickly.
damn
public void registerListeners(Listener... listeners) {
for (Listener listener : listeners) {
Bukkit.getPluginManager().registerEvents(listener, this);
}
}
alr i'll figure it out on my own
aaa no more spoonfeeding
i'll figure it out eventually
1st person to ever say that here
I mean it ruins the fun when someone does the work for you
Are you talking about my message?
Nope
sorry
I see triple dots, is that a variadic function
All good
ohh cool they're called variadic function in lua
or maybe i'm mistaken
probably multiple names
Sorry for late reply I fall a sleep. π Thanks that will be realy awesome. Most of the time I just take a look on what methods IDE suggest or just google it.
hi , did anyone work with LocaleDateTime before?
weird problem .. i set the diamond sword to have 1 hour usage :
https://prnt.sc/nb02BEKG2-FC
but its not making a custom timed items , i already have the structure ready , only the time problem ..
any idea where could be wrong?
broo imagine how fast java could be if the std library was implemented as primitives in the jvm
actually maybe the JIT sort of does that already but it prob still has some overhead
hi, if I need to do something asynchronous in a synchronous event so that the event waits for the end of my asynchronous task without blocking the main thread I have to use a CompletableFuture right?
I already told you, you can NOT wait for a response to an async task in an Event without hanging that event
for example, if I have to query the database in an event, do I have to do it in async?
I mean
You donβt have to
But its recommended
Since a query might take really long to execute
And then if its sync, it means code flow will wait for it to finish and then as elgar said you hang the server
Since every mob, every chunk and so on has to wait for ur query
yes, that's why I wanted to do it in async, but it doesn't seem to work.
show ur code then
get ready for the same code
what?
Just send it
I and others have told you, You can NOT wait in an Event for your database response. Your event has to continue. Your Async task can not return a value to be used IN your Event without haanging your server
time to learn about completeable futures for him then
so I have to find a way not to have to query the database when an event occurs.
Na bro
You need to either pre-load whatever data you need, OR pass off all code you would normally do based upon the response to your async task to perform.
Send code
id say this data should be cached
Either u cache the data in an earlier stage, or you use some sort of polling design
polling? what do you mean by that?
the cache problem. I have to load my whole table on startup, and I guess that's not a good thing either?
it's divided into several files, so I think it'll be easier to explain it to you (if you really want the code because you didn't understand it, let me know).
then.
When a block is broken, if it's a spawner, I have to check whether it belongs to a player. To do this, I make a select request to the db, sending the block's location. At first, I loaded my entire db into a cache, but I realized that this was a bad thing.
you don;t need to load any data on a block break
You pre-load the data for all blocks in a chunk you have data on in the ChunkLoadEvent.
discard it in ChunkUnloadEvent
runnable to set item lore each 1 second , what's the way to do it?
all you need to do is add a two colums to yoru tables for world and chunk x,z
each 1 second the lore is changed :p
Bukkit scheduler is the easiest
i want the best for performance
when i do weird bug appear
ItemStack is far from performant in the first place
If you want the best performance, like going to the extremities then you wanna use nms all the way probably but (almost) no one does that
i have a bug i don't know how to describe it ..
Can u record it
there is nothing i can do to fix it?
oh no ..
?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.
Thats client side, no way to stop it. When you change meta on an item teh client replaces the current item in your hand.
so even if i use nms or packets with protocollib , it won't fix it?
There is no way that I know of
alright thanks ..
explain your problem
show a part of code related to your problem so we can know what's accutlly wrong
you can;t getPlayer for an offlinePlayer
but in this case, too, I'll have to make a lot of synchronous requests, won't I?
if you like, but I've changed it a bit so you won't see anything more than what I've explained.
I want to know if it is registered in the db from its location.
and why can't you just load a set of locations during onEnable
you should not be storing blocks in your database based upon location
or check whether that block is a "registered block" using CustomBlockData
if someone pushes a spawner with a piston, your database is now broken
i was doing this at first but i was told that when there are too many spawners it won't be possible to load everything. and that it was a bad thing to do this.
do you expect to have more than 20 thousand spawners?
I mean just show the code, u said it wasnt workingβ¦
Only so much we can do w/o it
no , i dont think you need to do that :
just do return Bukket.getOfflinePlayer(name).getuuid();
His design is all wrong at the moment but, yeah
oh god no dont loop all offline players
if you wanna check if they've actually played just use #hasPlayedBefore
yea
yes exactly
Yeah wouldnβt surprise me but like that would be just impossible to identify w/o code at hand
Especially since they updated their code
why arent they just saving the players data when they leave and loading it on joi n
if you do that and get thousands of players join intotal you will loop them all
thats very resource heavy
the problem is that I can't use only the pdc because I have a command that allows players to see the list of their spawners with coordinates and with the pdc I can't access it.
probably not
literally all you need to do is ```java
private UUID getOFflineUUID(String name) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(name);
if (offinePlayer.hasPlayedBefore()) return offlinePlayer.getUniqueId();
return null;
}
getOfflinePlayer(String) is deprecated and causes a blocking web request.
getOfflinePlayers() checks the playerdata folder's files but doesn't open any of them
so both would need to be done async
just load the data from db when they join
update it periodically and when they leave
ah yes
@sterile breach
he answered
where
but I'd still have to do an insertion in the db when the spawner is broken in addition to the pdc, isn't that a problem?
so dont use pdc then
then there's no problem in just loading a Set<Location> or whatever in onEnable
jsut store it in a map, you dont need to instantly update the db
add it to the map then update it every 30-60 minutes
thanks for the information .
jsut store it in a map, you dont need to instantly update the db
add it to the map then update it every 30-60 minutes
why did you just send my message back to me
why did you just send my message back to me
I'd highly suggest you to use ACF, then you don't have to do all this command parsing
in ACF all you'd need is this @quaint mantle
@CommandAlias("balance")
public class BalanceCommand extends BaseCommand {
@Default
public void onBalanceSelf(Player sender) {
sender.sendMessage("Your balance is " + getBalance(sender));
}
@Default
public void onBalanceAnother(CommandSender sender, OnlinePlayer anotherPlayer) {
sender.sendMessage("Balance of " + anotherPlayer.getPlayer().getName() + " is " + getBalance(anotherPlayer.getPlayer()));
}
private String getBalance(Player sender) {
double balance = getBalanceFromDatabaseOrSomething(...);
return String.format("%.2f", balance);
}
}
it automatically does stuff like "Can only be executed by players" or "Player not found or online" etc
what about console
oh
why would you disallow the console to check player's balance
there you would want console
console's a creep and checks balances all day
trying to find someone to sugar parent
console needs a sugar daddy
you just pinged a random person
console has no gender
so it can be a daddy if you want
you can be a daddy if you want
in russian console is female, i bet in some language it's male, so it probably has gender dysphoria
i'm lacking money for that
no one said sugar daddy
in german too
Die Konsole
to be a daddy in general is not cheap
being called daddy doesnt always mean being a parent
and i'm too young for being called a daddy by anybody adequate
public class Messages {
public static void msg(Player p){
HashMap<String, String> messages = new HashMap<>();
messages.put("welcome", "&6&lSCEPLIX: &1&lWELCOME " + p.getName());
messages.put("warrior-kit", "&2&lSUCCESSFULLY EQUIPPED WARRIOR KIT!");
}
}
will this work lol
sure but it's 100% useless
you create a hashmap that gets GCed without being used once
I thought storing messages in another class would make my code more cleaner
use an enum or public static final stuff
oups
all the blocks in a map? (I did that at the beginning) but now when I update it I'm forced to delete the table content to put the whole map in. Isn't that a bad thing?
you are storing it inside of a method rn
and you are not even using it
oh damn
dont put the entire table in the map, get the data for each player as they join
cant i inherit those in another class
if you want to use something like player's name just use a placeholder like %player% that you replace when using the message
make it a global map and add a getter
I see, and for broken blocks I'd have to make an insert in the db anyway.
okay I don't know those stuff yet, it's only been day 1
even better, fetch your messages from a configuration
no you wouldnt
you'll get there
start with something that's not too hard
welp time to make more crazy stuff till I learn new stuffs
there isnt really ever a need to instantly update a database, you should update the data stored periodically and update it when they leave
and make sure to be at least knowledgable of java before coding plugins, because it's going to be very problematic and difficult if you are not familiar with the language
but I'm obliged to store them.
yeah
you can store it in amap
either a multi map or a Map<UUID, List<>>
then every 30-60 min you use workdistro to save all the data
but in this case I can't just load the connected players, I have to load all the players.
can 1 player see another players spawners
no, but let's imagine that x is connected, if x breaks a spawner that belongs to y. y's data won't be loaded, or else y's data won't be loaded.
i did, I made a simple kit pvp thinggy a while ago
i'm proud of it, I didn't copy anyones code π₯³
acknowledge that it happened then an update it
you dont nseed to fully load their data
and the kits are fully customizable in the config file
that's very nice
the player isnt online it doesnt matter when their data is updated
in that case it shouldn't be too difficult for you to load messages from a file
i think you can do that
yeah I just need to know how to inherit stuff from other classes
I'd do it sth like this
public class Messages {
private final Plugin myPlugin;
public final Message WELCOME;
public final Message RELOADED;
public Messages(Plugin myPlugin) {
this.myPlugin = myPlugin;
this.WELCOME = new Message("welcome", "Welcome to the server, %1$s!");
this.RELOADED = new Message("reloaded", "Reloaded config.yml.");
}
public class Message {
private final String text;
Message(String path, String defaultMessage) {
this.text = myPlugin.getConfig().getString("messages." + path, defaultMessage);
}
public String getText() {
return text;
}
}
}
wdym?
oh yeah that's a good one
like yk get stuff from another class
you mean like Class.map.get?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
yes, since there's the pdc, I can already "cancel" the event and then I can update it in async because it doesn't need to be done in the current event.
you really dont understand this
wait why are you cancelling the event
can a player break someone elses spawner
I don't cancel it
seems complicated but very understandable
so use a completeable future to update the db
how's that complicated
okay I don't know what im saying
it's pretty straightforward
yes, but he won't get it back and it's the owner who can get it back in a gui.
it's only been day 1 π
i'm not familiar with those stuff
so I'm making an insert.
yes
yeah well okay, then I agree that it's complicated lol. But once you understand it, it's straightforward and easy to extend
and I have to do it in sync
man lua is far more easier than java
i can in async
i don't think so
e.g. what the heck is the difference between : and . in lua
idk ask chatgpt
I know the difference, it's just confusing
Well
I asked anyway
In Lua, the colon (:) and dot (.) are used for accessing fields (members or methods) of a table. The main difference between these two notations is how they handle the self parameter when calling a method.
- Dot Notation (
.):
In the dot notation, you explicitly need to pass theselfparameter when calling a method. This means that you have to manually include the reference to the table as the first argument of the method.
Example:
local myTable = {
value = 42,
func = function(self)
print("Value:", self.value)
end
}
myTable.func(myTable) -- Output: Value: 42
- Colon Notation (
:):
The colon notation is a shorthand in Lua for method calls that automatically passes the table itself as the first argument (self) to the method. When using the colon notation, you don't need to explicitly pass theselfparameter; it's implicitly added.
Example:
local myTable = {
value = 42,
func = function(self)
print("Value:", self.value)
end
}
myTable:func() -- Output: Value: 42
So, using the colon notation is just a convenient way of calling methods on tables when you want the table itself to be automatically passed as the first argument. It is commonly used in object-oriented programming in Lua to represent objects and their methods. If you use the dot notation, you have to provide the self parameter manually.
yeah it's a bit like the "receiver parameter" in java
another question. Maybe I didn't understand what was explained to me about async in events. But isn't it possible to make a future completable in an event, for example, in order to make a request in the event without cluttering up the main?
you use whenComplete if you need to do something when its done
im gonna call this a day
if you call .join or .get that blocks the main thread
yey i've accomplished alot today, I made my very first plugin (a shitty kitpvp with nested code)
so in theory it's possible to make an async request when a block is broken and wait for the response without cluttering up the main, then contniue the event? (I don't intend to do this).
you would have to finish the event in whenComplete but most likely
you cant cancel the event or uncancel it but other stuff you can do
and practising this kind of method is a bad thing, I suppose.
running code after a future is normal
and in my current case, making a future claim when a block is broken is not as good as doing what you advised?
yeah i know what a completeable future, whats a future claim
I made a mistake, I meant completeable future
okay then, if you makea future and run it async on a block break to update something in a db thats fine in most cases
but making one in every block break is the issue
but every broken spawner in itself isn't so bad?
why for every spawner
you shouldnt only need to update the db for players that arent online
you store the player its owned by on the spawners pdc, and use that to update the db
yes yes, I'm asking for information to better understand when and how to use completables future . I know that the pdc method is better. But in theory I could also make a completables future on each broken spawner and see if it's in the db (I don't plan to do it).
yeah you could but you in 99% of cases would never ever need to query the db directly for something
okay, thanks for all the clarification anyway.
How can I "register" something into the server physics engine? What I mean is let's say there is a point, in mid air, and then it gets affected by gravity (serverside), moved by water, etc. Similar to how dropped items work but that is mostly clientside . Maybe experience orbs too, they get a force when near a player. Is there a interface such object should implement too?
well the system just ticks it basically
checking for collisions, intersections and so on and then performing movement
Yeah, is there a way to let the server do it instead of writing code for it?
Also orbs are entities that literally target in the same way mobs do to achieve the force effect
wdym "in the same way"? Mobs use ai for pathfinding, orbs just get a force like a magnet
do this after the arg check
No? They get a trigger an entity target entity event
is that an IDE?
this is eclipse
this looks like md5 pastebin
it is md hastebin
well it seems so
but why does it not use monospaced font
ok good lmao
it does probably
i changed my font
wtf
illusion doesnt like my smooth font
yeah that looks correct
who uses a normal font for code lol
i could understand coding in comic sans
no you couldn't
what the fuck alex
yo guys what's wrong with mah code it no workings
i would refuse to provide any help at all
Broo that looks like coding on a samsung phone lmao
no it doesnt
my phone font looks nothing like that
on older samsung phones it looks basically like comic sans
Well, an average samsung user sets their font to that scribbly weird font
I have a samsung and I use a normal font too lol
i think it's not prevalent on modern phones
but like 4 years ago it was there
I remember a guy who would flex with his samsung phone and his font lmao
From my mom tbh, but doesn't matter lol
Well, yeah
my dream phone is a samsung but they are so fucking pricey
buy referb π
referbished
I want a good samsung mobile device setup but bro samsung tablets are so trash
Cpu supports 64-bits, can fit 8gb of ram, gets a 32-bit os and 3 gigs of ram
got my note 10 + 3 years ago and did replace my charging port yesterday myself π
nice job
are they? i've heard good things about their tablets
life hegg: you can recharge the old one
its actual capacity is like 70% now probaby
if it's inflated just pop it with a needle
yeah it was a joke, you know
works like a charm
Well, when you are a gamer who needs a lot of ram and good power for gaming the tablets aren't good
yr
r/spicypillows
is there any easy way of changing players name above head like maybe using protocol lib? just tryna add a bit of colour
ah, that's fair
its always in you best interest to buy an ipad even if you dont like the eco system they outperform in many ways even year old models
i REALLY don't like the apple ecosystem but it might be wise yeah
I can't even start newer games on my current tablet
F
Because for some fucking reason it comes with a 64-bit supporting cpu and a 32-bit os
same here but android tablets aren't the way to go π
i want a tablet for notewriting, i take a lot of notes especially when learning a language, and it's my dream to actually have a device where i can keep handwritten notes organized
ΡΠ΅ ΡΡΠΎ
is there any easy way of changing players name above head like maybe using protocol lib? just tryna add a bit of colour
just a bit crispy
ΠΡΠ»ΠΈ Π·Π°Π²Π΅ΡΠ½ΡΡΡ, ΡΠΎ ΡΠ°ΡΡΠΌΠ°
ΡΡ Π·Π°ΠΏΠ΅ΠΊ ΡΠ»ΠΈΠ²Ρ Π² ΡΡΡΠ΅?
was that cooked in a fire box
ok that might be fair
yeah i would really recommend an ipad tho π
Ρ ΠΊΡΠΏΠΈΠ» Π΄ΠΎΡΠΎΠ³ΠΎΠΉ ΠΏΠ°ΡΠΌΠ΅Π·Π°Π½ ΠΈ ΠΏΠΎ ΠΈΡΠΎΠ³Ρ Ρ ΠΌΠ΅Π½Ρ Π±Π»ΡΡΡ Π½Π΅ ΠΏΡΠΎΠΏΠ΅ΠΊΠ»ΠΎΡΡ ΡΠ΅ΡΡΠΎ Π° Π½Π°ΡΠΈΠ½ΠΊΠ° ΡΠ³ΠΎΡΠ΅Π»Π°
i just wonder how i would transfer data to an android tablet if needed later haha, because again their ecosystem in that regard is quite flawed
ΡΡΠΎ Π»Π΅Π³Π΅Π½Π΄Π°ΡΠ½Π΅ΠΉΡΠ°Ρ Π΄ΡΡ ΠΎΠ²ΠΊΠ°
pizza looks better than the plate it was baked on hehe
About the iPad thing tho, a lot of my stuff I do either requires jailbreak for apple systems or isn't available there at all
Π° ΡΡΠΎ ΡΡ Π·Π°ΠΏΠ΅ΠΊΠ°Π» ΡΠΎ
Π ΠΏΠΎΡΠ΅ΠΌΡ Π² #help-development
you can still use the lightning cable to transfer files to your pc π
ΡΡΠΎ ΠΏΠΈΡΡΠ°
oh right, makes sense
Π²ΡΠ³Π»ΡΠ΄ΡΡ ΠΊΠ°ΠΊ ΡΠ»ΠΈΠ²Ρ
Π½Ρ Π»Π°Π΄Π½ΠΎ
Π°Ρ Π°Ρ
i'll go on coding
cya everyone
have fun
bye
freejava
English only @icy beacon @sullen canyon
Is there any convenient way to regnerate a world at server runtime?
you can delete the world and then create a new one with the same seed
if thats what you are looking for
Creating the world with WolrdCreator?
Can i only delete a world with deleting the dir?
I'm making some block animations where a block spins and stuff at an angle, would I want to use an armorstand's hand or helmet?
you'd use a BlockDisplay
I've had weird issues with text display's and via version, not sure if block display's share the same issue.
what formula does minecraft use to calculate the jump height with a jump boost pot?
It looks raw and overdone at the same time
pitsa be like
are you sure
yes

1.2522 * (1 + 0.5*level) iirc
actually that's wrong
0.0308354 * level^2 + 0.744631 * level + 1.836131
:)
We love magic values
and why did my copilot die
okay I think restarting IJ fixed it
what was the thing to check if a player is allowed to fly?
what is OfflinePlayer supposed to mean? A player that's offline?
Yes
then shouldn't PlayerQuitEvent.getPlayer() return an OfflinePlayer?
The event fires before the player is removed
ahh alright ty
is there any way to detect if the player is currently climbing a vine, ladder of a scaffolding?
It can mean either
hm
Player extends OfflinePlayer
Player extends like 4 classes or something
basically a class can only extend 1 class
abstract or not
but they can implement multiple interfaces
however an interface can extend interfaces
an interface is basically just a template for a class though
Hm
If I had some classes and I had a function that would only accept certain classes of those, I could make it accept all classes that implement the interface, right?
wdym
I don't mean anything
Hey, does anyone here with some experience making Spigot Plugins have a minute to help with somethin?
Yeah
or just ask or smthn
Β―_(γ)_/Β―
There's this Plugin that I used a while back and I tried coding in some functionality but I couldn't figure it out since I don't do plugin dev. Essentially the only thing I needed to do was to make something configurable in the config file. Here's the repo: https://github.com/ericyoondotcom/MinecraftManhunt
In the TrackManager.java there is a list of songs, and I'd like to move that to the config
RIP, it uses neither maven nor gradle
what does it use then
oh wait, it does. the pom is inside the directory
How so? I'm pretty sure I compiled it succesfully a few times
it has a pom so shoudl be maven
Yep it does use Maven
yeah it's confusing, there's an IJ project file at the root but a pom in a subdirectory
weird layout
Weird
Modules
Kinda
the "trackURLs" is a map that's created in the field declaration. you could just remove all the put statements, and then in the constructor loop over the config and add them manually or sth
we-eerd
for biden
No advertising
Got no hosting rn anyways lol
Look at this tho, isnt it nice
sth like this should do https://github.com/ericyoondotcom/MinecraftManhunt/compare/master...mfnalex:MinecraftManhunt:master
Alright I'll give that a try, thanks for the help. I'll let you know if I need anything else
Mfnalex, how can i make a block face somebody, do i need to get the Furnace Meta?
i haven't tested it btw, i dont even know what that plugin does
Yeah I'm aware, all I needed was just a way to move that to the config
furnaces are probably Directional
so you'd get the BlockState, cast it to Directional, and update it accordingly
Got it
Mfnalex, is there anything you do not know about spigot or bukkit?
Its Furnace furnace = (Furnace) block;
block.setFacing();
no
the BlockState
you cannot just cast a block to a blockstate
Directional directional = (Directional) block.getState();
if you already have a Furnace object, you can also just use that
Furnace extends Directional
1.8 shit
and many other things
Can you give one example?
i cannot give examples of things I don't know because if I could, then I'd knew them
π
Hmm lol
ok here's a thing I didnt know
declaration: package: org.bukkit.material, class: FurnaceAndDispenser
there's a class called "FurnaceAndDispenser"
You speak a slavic language, right?
wtf is that
why
probably some 1.8 shit
Dispefurnace
yeah it's extending MaterialData
it's 1.8 shit so no wonder I didnt know it
if you ever see "MaterialData" somewhere, run away fast
I have an idea
Lets make a furnace that would be able to look it any direction and spit out the item when it cooks and also emit a redstone signal
https://pastebin.com/fngvUSbL
The second if(DiscordCodeHandler.isPlayerHasCode(playerUUID) and getCode function works but for some reason e.dissalow does not work. The player calmly logs on to the server.
No errors in the console
quick trivia question out of my discord quiz bot's "spigot api" category:
Which enum class defines the fields \"Highest\", \"High\", \"Normal\", \"Low\" and \"Lowest\"?
the question doesnt state that it ONLY defines those fields
^
fuck you
he's right tho
yeah
ServicePriority
uh
?
correct. that's unfair choco, you probably PRed that yourself 20 years ago
where?
Bukkit's standards weren't well established back then
Man this fucking plugin
I mean they weren't really well established until we took over
i always thought it was a general java rule to use ENUM_NAMES
like ClassNames and STATIC_FINAL_FIELDS
It is. Not in C++ though. Some people come from different languages. Like I said, there were no standards on the Bukkit project back then
it's nice knowing that even the world edit guy was a noob once
Don't think he was a noob. Just probably worked with C++ before Java
that explains it too
In C++, uppercase enum names aren't standard because it conflicts with the naming conventions of preprocessor macro definitions
but this FurnaceAndDispenser thing is funny, I added that to my quiz as well
hm... what can be a furnace or dispenser? Of course: a FurnaceAndDispenser
I'm gona memorize that
There weren't many types that adhered to the byte data of furnaces and dispensers then
Directional, yes
quick, who knows this:
How many PrimitivePersistentDataTypes does the Bukkit API provide?
Back in Ye old days when dispensers could only face 4 directions smh
ΓΎ > y > th
oh fuck off choco. I thought someone would look it up and say 13
Is it actually 12? 
yes. and then I could be like "no, you boon. boolean is not a PrimitivePersistentDataType"
Well now it is!
it's 12 primitive datatypes, 13 with boolean
string is a PrimitivePersistentDataType
they all are PrimitivePersistentDataType except boolean, which is BooleanPersistentDataType
a "primitive" persistentdatatype has the same T and Z types
do we include the boxed primitives or no?
You're a weird name
Okay βchocoβ
Okay "Coll1234567"
okay gamers

it's "primitive" because it just returns the input
that is a doctor's chair
I wanted to change my name here, but now that I'm known as Raydan by too many people (more than 6) I think I shouldn't lol
"Fr-thirthy-three-styler"
Well it does not
It's a combination of two random words
I gotta change my name from RaydanOMG to RaydanOMS (Oh my Schnitzel)
When I set a players walk speed will that stay consistent over a relog or a server restart? or do I have to set there walk speed every time they join.
i'm pretty sure that it's an attribute so it stays
alrighty.
What is Player#isFlying()? Does it indicate the player is currently flying (like in creative) or that the player can fly?
So, currently flying?
isFlying means is actually flying
Wait, that exists?
Yes
How long has this been a thing
the other is get/setAllowFlight
Oh
Loooooong time. Very early Bukkit
I didn't see it because I did ...is
Yeah, sort of a meh method name
Is it?
Effectively, yeah
Wait, do sponge got mixins?
They invented mixins
Completely different API than Bukkit. Much more difficult to use
I have expected exactly that
is there is a plugin that makes certian mobs doesn't wander too far and tp them back to there defined spawn location?
hi , uhh in 1.18.2 , how i can send a packet that use nms ?
Gonna need to be more specific. What are you trying to send to the player?
@sinful kiln this is you with the structure PR right?
Yes that's them
ok, just wanted to ask then, why is it needed to create a block state with a specific location? I think all the methods surrounding that take a location or x, y, z coords? Since they are unplaced with no world handle or world, I think them having a location just seems weird
a BlockState is a snapshot of a Block and a Block can only have one location
I have no idea what relevance that has
BlockState's are no longer just snapshots of blocks
Material.STONE.createBlockData().createBlockState() isn't a snapshot of a block
the location returned will have no world, and be 0, 0, 0
thats an experimental method for later use in things like Schematics
?nms ServerPlayer#connection#send
well the methods that are being added in the async structure PR aren't marked as experimental, and I was wondering what is the point of creating it with a location? the location's world isn't applied to the block state, only the x, y, z coords of the Location object
ther'es also Server#createBlockState(int, int, int, BlockData), that doesn't have a world either
because Schematics are not locked to a world
but for the async structure PR, what is the point of adding it. I understand the theoretical point, but where in the structure event PR would such a state be used?
Probably in saving. I've not looked at the PR
well tbf, that's why I asked the author directly
if i do this , i can't use EntityArmorStand anymore ..
okay, but that's how you send a packet
A BlockTransformer returns a BlockState there
That's why a BlockState was needed in that case
And just BlockData would not have been enough for my use case
oh so it supports changing the position of the transformed block?
ani have them both?
use mojmaps
Looks Great
You have full access to the chunk
right, but all the chunk methods take an x, y, z or Location when setting a block state
i need to use EntityArmorStand ..
So changing the position would be supported
MojMaps have equivalence
use a mapper
there is no setBlockState(BlockState) method is there? on LimitedRegion
Spigot maps are trash anyways they don't cover everything
so its kind new to me
Yeah that's true
also, the position from the block state returned by the transformer isn't used anywhere, it still uses the original position
but that's beside the point, I think the block state returned should also be placed at the same position as the x, y, z in the parameters
Tbh I don't really remember why it the methods have a location value in the first place
as mentioned earlier when I was talking with ElgarL, there is a use case for creating structures and what not, but that's not what this PR is, so I'm not sure they need to be added here
I think it was something that I talked about with DerFrZocker about being able to move block states and stuff but then I decided against implementing that so yeah
okay I remember why I added the createBlockState methods.
The position is not required which is correct however I can see a plugin replacing the BlockState with the BlockState of another type of block
mfalex ishere ?
and since the BlockState is not placed until after the transformation that's why I needed the createBlockState method
I agree, but there already is a method for that on BlockData right? since the positino doesn't matter, why can't that one be used?
Maybe
As I said that was added after my PR
oh right ok
My PR was started on 3rd of March
how can i create custom clickable messages in chat ?

