#help-development
1 messages · Page 326 of 1
main: dev.alex.net.command
core: dev.alex.net.command.core
bla bla
technically you should only use dev.alex if you own alex.dev
I know i dont have a domain that why
Just let go up to find the problem because everything looks fine
why are you thread.sleeping
...?
using the scheduler is the entire point to replace that
because i want to wait one minute before sending another thing
Thread.sleep() will make your entire server to wait, if you doing it incorrectly
ahhh ok
Remember minecraft is not multithreaded
na no problem, that why spigot implemented an schedule system to do that type of things
yea
So you dont have any idea why the problem is caused?
?scheduling
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Do you know what can cause issues? Because i just realized that i cannot even access to core classes, when adding as dependency spigot module (but its implement core module), so i must be able to view all classes (spigot and core module classes)
Maven weird bugs momment
@quiet ice what do you think tho? I already find what you asked me
the mvn dependency:tree of your command-example module
ok
i dont do maven or multi module stuff lol
Could not resolve dependencies for project dev.alex.net.command.core:command-core🫙1.0.0: Could not find artifact dev.alex.net.command.api:command-api🫙1.0.0 in central
(https://repo.maven.apache.org/maven2) -> [Help 1]
what does core depend on?
Really shity maven, trying to download the api from remote repo 🤡
Yeah, what is interesting me more is the tree that it should've printed
it's not maven what's shitty, but your project setup
So explain how you will setup if you know 🤔
Eh fuck it, just fork me over your project in a zip
your modules probably depend on each other, right?
Yes the next:
Api -> Depends on bungeecord-api
Core -> Depends on api module
Spigot -> Depends on core module and spigot api
Example -> Depends on spigot module (where im having issues)
if that's indeed all, then it should work
mvn clean install -X on the parent pom and send the full log
yes that why im really mad becaue it must be working
or just upload it to github
Cannot resolve method 'scheduleSyncRepeatingTask(Main, Runnable, long)'
?jd-s
?paste code
Does Main extend JavaPlugin?
ahh, no, but i only want to run it once
runTaskLater(Plugin, runnable, long)
yeah noticed lol
Use hte method I linked
repeating task is for repeating tasks
use scheduler.runTaskLater(this, new Runable(), longDelay
use runTaskLater
I got a question, I have a physical economy and want to be able to deposit specific items in a players inventory so I need to remove 6 specific items, they are same material same lore but have almost same name so I need a way to remove all of the specific items in the players inventory
Or scheduleSyncDelayedTask
i am using that
but i have a problem
give your custom items specific PDC data, then identify them by that
you are not
Cannot resolve method 'scheduleSyncRepeatingTask(Main, Runnable, long)'
how often do we have to repeat the same thing?
is that the right method name?
not runTaskLater or scheduleSyncDelayedTask
do you actually read what people write?
but i want to repeat that
you just said you want to delay it
earlier you said you don't want to repeat but only wanna run it once
Then have two longs
yea, it works before
no
@tender shard
ItemBuilder(Material.IRON_NUGGET).amount(amount).name("&f$int &cFlash Coin(s)")
.lore("Universal Currency, Visit Spawn To Visit the Universal Trader!").build()```
$int is the number i switch between its `1, 5, 10, 20, 60, 100`
yea, but i want to have 1 that only execute once, and another who executes more times
give your currency a custom pdc tag, e.g. "myplugin:worth" -> PersistentDataType.INTEGER with values 1, 5, 10, etc
Full project here: https://github.com/Alexito2060/CommandAPI
every itemmeta has PDC
i didn't set it
you can add pdc quite easily
yeah I meant, you should add it for the future lol
mfalex i sent the repo, i will be seing my self too whats happening
@tender shard ill look into adding it
you can use this regex to get the number after you threw the item name into ChatCOlor.stripColors(...):
^(\d+) Flash Coin\(s\)$
match 1 group 1 will be the amount
hi guys again. How can I write permissions? I wrote this, and I don't need to register anywhere else? further to give it rights through luckyperms?
trcked it down to getconfig().getlist
doing debugging now
@tender shard , its really weird the issue, cuz the IDE recommends me the method but when i call them i get the error i said before "cannot access dev.alex.net.command.core.CommandHandler"
everything except the spigot module compiles fine for me, because you are not overriding getCommand(String) from the core COmmandController
Your list path must be nul
@sterile token build using mvn install instead
im an idiot i think
mvn package is bricked
Im overriding it? Weird
Taken form spigot controller
you fucked it up using the relocations
do not shade the core into your api, then relocate the core
remove all your <relocations> and it compiles just fine
it seems a bit weird that you shade core into API anyway
Im shading api, into core? its not wrong or yes?
🤔
typically speaking, API is just a bunch of interfaces
and so core shades API, not the other way around
oh sorry, other way around
you are shading api into core
and then you even relocate it
that makes no sense
yeah idk about that relocation, but the shading is correct depending on how your setting up the API
I'd set it to scope provided
if your API is just a bunch of interfaces and DOES NOT rely on methods from core, then that's fine
if for whatever reason your API actually uses shit from core, then needs to be swapped
as said, without the relocations it compiles just fine
The issue is caused because shity maven removed the example module, that why i having that issues
whats best way to retrieve DataContainers on an item
Hello,does anybody know how can I set type of block on stone and after few seconds set it back?
?scheduling
public PersistentDataContainer getPDC() {
if(!stack.hasItemMeta() || stack.getItemMeta().getPersistentDataContainer().isEmpty()) return null;
return stack.getItemMeta().getPersistentDataContainer();
}
maybe?
raw slot is dependent on whatever inventory they have open
i wanna check if offhand slot is involved e.g
check google for an image
try 45
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thank you, and is there the same for slot ids?
(not raw)
ive got no idea lol
so i don't have to add a check the type of inventory
this is normal i think
that is from 10 years ago iirc
ah
@tender shard from what I gathered is this correct
public ItemBuilder pdc(String name, JavaPlugin plugin) {
ItemMeta stackMeta = stack.getItemMeta();
PersistentDataContainer pdc = stackMeta.getPersistentDataContainer();
NamespacedKey surnameKey = new NamespacedKey(plugin, name);
pdc.set(surnameKey, PersistentDataType.STRING, plugin.getName().toLowerCase());
stack.setItemMeta(stackMeta);
return this;
}
public PersistentDataContainer getPDC() {
if(!stack.hasItemMeta() || stack.getItemMeta().getPersistentDataContainer().isEmpty()) return null;
return stack.getItemMeta().getPersistentDataContainer();
}
i just need the non raw slot id for offhand
that will not work
oh wait
it will
im blind
i thought that was 1 method not 2
its 2 lol
(so like the unique identifier of offhand, globally, not dependent to the inventory)
yep looks good
i'm updating my ItemBuilder
that gives a rough idea
create a new instance of itembuilder, do stuff to it then set the itemMeta
so you arent needing to call getItemMeta afor each method
@remote swallow can I use this?
yeah
It's so much nicer than mine
ive been meaning to update it
lol Java isn't my strong suit Kotlin is
a few things i need to add


no kotlin
fair
@tender shard so whats the best way to go about getting the items based off PDC and removing all of it
to remove all pdc on an item loop over the keys and call pdc.remove(key)
loop over the inventory, get all items, check if they have your pdc tag, if yes remove them
How to remove the entire thing not just one?
3 different people have 3 different ideas on what he meant
I'm very confused on how that works
that's quite funny
a call to Inventory#remove(ItemStack) will remove the exact number present in the ItemStack
errrrr
i totally havent just realised a totally not breaking bug with better item config
what
can you tell whats missing
the other handlers
the name
i just got name, lore, effect one done last night
openeing ij now
it wasn't ever the end of the world because, remember that the current system is incredibly expansible
all I'd need to do would be to define my own ItemFactory instance
public static final ItemFactory ITEM_FACTORY = new ItemFactory.Builder()
.register(new NameHandler())
.register(new LoreHandler())
.register(new CustomEffectHandler())
.build();
this is most definately gonna be painful to wikify
btw epic
Is drop a item of item editor?
if (section.isSet("amount")) {
builder.amount(section.getInt("amount"));
} else {
builder.amount(1);
}
can just be
builder.amount(section.getInt("amount", 1));
So much i really don't understand about spigot

it can cant it
like I don't understand tab complete
i forgot i can def that
How does one tab complete
one moment
same way for executor but make the class extend TabExecutor and ij should give you the method to add
then just return a list of tab complete options
or return StringUtil.copyPartialMatches(args[num], list, new ArrayList<>())
all i want to add to tab complete is player names
ig it returns 0 when its not set?
just online players or all players
Onnline
yeah it should be 0
@remote swallow wait u can also do all?
yeah
Bukkit.getOfflinePlayers
wondering why they arent using optionals
My lookup cmd is useless i don't remember offline names lol
because md5 doesnt like Optional
setVelocity trouble
Optionals are a plague
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
switch (args.length) {
case 1 -> {
List<String> players = new ArrayList<>();
Arrays.stream(Bukkit.getOfflinePlayers()).forEach(offlinePlayer -> players.add(offlinePlayer.getName()));
Bukkit.getOnlinePlayers().forEach(player -> players.add(player.getName()));
return StringUtil.copyPartialMatches(args[0], players, new ArrayList<>());
}
}
}
``` most definately a better way but it explains the concept
anyone have a good purchase verification bot?
I got one
what is it?
well my own one
your moms so ugly
okay? that doesn't really help me
it generates a verification file that you then have to send on my discord
acf > bukkit > brigader
at somepoint ill manage to make my own framework
that only uses bukkit command system internally
yea
because i dont have a framework
yo guys, does anyone know how to send title in 1.19.2? On 1.16.5 it's PacketPlayOutTitle, but I didn't find it on 1.19.2.
player.sendTitle
why the heck would you use a packet for that
yeah maybe in 1.8
oh shit, that exists, i didnt know it, thank you so much
(pls check threads if you havent already)
even in 1.9 there was Player#sendTitle(...)
so no idea why ANYONE would use packets in 1.16 for this
I believe 1.8 still had #sendTitle() but there was no overload for #sendTitle() with timings
ye i just didnt know it existed
That was introduced in 1.9 last I recall
thanks guys
how do I prompt input from console?
im trying to create an interactive command that works with both players and the console
but I just realized there isnt really an event for console input
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/conversations/Conversation.html the Conversation API would work
declaration: package: org.bukkit.conversations, class: Conversation
unless you listen to ServerCommandEvent which is sort of janky as it can mess up other commands
https://docs.google.com/document/d/1ofTMA6dv7Vk3v4kKhLTC1sUooHgTq71ti44AI09OsNM/edit there's this a good explanation about the Conversation API here, don't ask me why it's a google docs file lol
Bukkit Conversations API Overview: The new Bukkit Conversations API provides a native way to create a back-and-forth dialog between the player and a plugin. Using the Conversations API, you can create anything from a simple series of prompts to an elaborate, evolving conversation tree. Conversabl...
Hello. Is posible to use the dropItem with a object of items editor?
dropItem works with every itemstack that's not Type.isAir()
oh thanks
Oh
And how can I do It?
How can I get the Code of the item?
hmm and how about action bar?
what even is items editor?
player.spigot.sendMessage(actionbarthing i dont remember)
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, "asd")
okay thank you so much
also does bukkit have a built in tool to view other plugin's plugin yml files?
A plugin to create ítems with special properties
im just manually using a zip libary to do that rn
What are you reading from the plugin.yml?
main class
does it have a method that returns ItemStack
declaration: package: org.bukkit.plugin, class: PluginDescriptionFile
no like without the plugin being loaded in
Im tryna replicate what plugman does but a bit differently
Then you will need to use that zip lib
oh nevermind you can just do that with tthe Bukkit API
Ok, thanks
alr
it probably has an API, you gotta look through their documentation whether they have any
I looked at it
all it does is change displayname
and lore
oh well then just create those items yourself
create an itemstack, get the itemmeta, change th ename and lore, then set back the itemmeta to the itemstack
ok, manny thanks
Anything I should be aware of before jamming in a web server (like Ktor for example) in a Spigot plugin? Aside from making sure to run it on its own thread
for a private or public plugin?
potentially public
it have one, but it is not oficial. Is the same?
You don't have to worry about threading, ktor and most libraries do that by default
yeah, suspected as much
well for a private plugin, you are way better off running an actual webserver. and for a public plugin - I guess most MC hosters don't allow you to use any ports besides the one they assigned you
so kinda useless 🤔
unless I somehow accept HTTP traffic on the same port I run the MC server on
Not possible
HAProxy
yeah, some proxy solution was what I was thinking
I mean, there are quite popular plugins that use integrated webserver, for example dynmap
but sounds like I'm better off just not doing it, and have a separate web server instance
And people use it ig
so if people can't get that working, it's not my problem 😛
because getting around only one port issue is annoying as it is anyway
Will still require additional configuration which hoster probably won't allow
If that was your first argument
perhaps I just make it, and people can use it if they are able to 😛 can always just make a plugin that can also run standalone for those who wish to do that
anyone happen to know any forks of Bukkript/KotlinBukkitAPI that are up to date btw?
true
One works to edit. Not to give
typically http port 80 is unblocked
so you could try hosting an embedded webserver and hope its open/unblocked 😛
but not 443? guess I can always just run https off of 80 😛
also keep in mind you can absolutely have 2 services using the same port as long as they are making use of two different protocols
http is a different transport protocol then just pure TCP
typically 80 and 443 are not blocked, not always the case but you can try it, also my above comment
since many don't know you can run multiple services from the same port 😛
yeah, I don't know much about this, I just know that HTTP is built on top of TCP
TCP happen on layer 4 or something, then HTTP on layer 7 iirc
yeah, that part I know ^^
either way, I will just make these things configurable, so whoever installs this plugin (if it ever makes it out), can decide what's more suitable to them
its not about whether they use TCP or not, rather if they make use of different transport protocols or not. Because you can have multiple connections on the same TCP port, so it only makes sense it works the same way the other way around
ah right, makes sense, I think!
Minecraft has its own protocol, just like HTTP does
yes
But as long as they are not making use of the same ones. IE if mc was uing HTTP
it would interfere with the webserver and only because the nic and OS wouldn't know which service needs it
since the packets would be identical
for either one
anyways, usually easier to just use a better hoster though
instead of having come up with some odd setup/solution to what should be not really much of a problem 😛
that slider on the side is really small
quick questions , what can do this?
idk why , but armorstands , entitys
everything is upside down
yeah, definitely agree, but hey, people be people! 😛 I will mostly focus on what's more ideal, but will try to the best of my abilities to also cater to those who are less experienced and/or less fortunate with their hosting environment
I do like the bottom one though because it makes it easy to know the slider belongs with the box, the box is nice too because for finer adjustments I can use the box
hmmm ok thx I'll think about it
hm actually the slider seems big enough, it's quite easy to select an accurate value, and even if not, there's still the jspinner with the arrow keys
yeah it looks good
is there a way to know if a chunk has been "created"? I assume loaded is different than created
I would like item drops to be directly added to the inventory of the player, but it doesn't work when my inv is full and I already have the block, it still drops it to the ground
you would need to listen to blockdropitemevent
oh that exists?
yeah
lets see if it works then
So the pwnplantgrowth plugon I am guessing is causing lag issues due to its nature but the logs are poop for seeing.
If any of my dev inclined friends here could have a gander I would appreciate ^_^
I have a feeling its the issue of a lot of extra math being done on the main thread which tbh, doesn't need to be
there is a method called isNew() I think for chunks that are loaded. Basically tells you if its a new chunk that was generated or not
but in the code
if I try to get a Chunk, does it load automatically or can it return null if doesnt exist?
im doing a code where it checks 100x100 around me chunks. will it return null if a chunk hasn't been "created"? or some way to check this?
or will the chunk be created if i call for it?
🤔
depends what methods you are using
the chunks won't be null unless for some reason it failed to load. But the objects you use to access the world object for the chunks could be null
if the chunk doesn't exist, some methods if not all of them will cause the chunk to load/generate
still doesn't work, #addItem seems to fail even though I got one of the item in my inventory
Because you are cancelling the event and then dropping again
No no
Yo should cancel at the end, because if you cancelling the event and then dropping block agains. They wont get dropped
didn't change anything
my problem is that my inventory is full, but I already got one dirt block. When I break another dirt block, instead of it getting added to my inventory, it drops to the ground
Wat are you trying to do?
the block is supposed to go to my inventory upon breaking, unless there's no space for it
then it's supposed to drop to the ground like vanilla
no need to check if remaining is empty
removed
private void giveOrDropItem(Player player, Block block ,ItemStack... items) {
Map<Integer, ItemStack> map = player.getInventory().addItem(items);
for (ItemStack item : map.values()) {
player.getWorld().dropItem(block.getLocation(), item);
}
}
literally same thing lol
still giving it a shot
im guessing it wont work because you create the map of items that arent being added during the for loo
thanks, your code worked
get fucked
fourteen when he says its the same thing but then has a different outcome
I finally decided to write code after a long time
turns out that like
shit likes to work in a very funky way
you forgot how to code
this just confuses me
pc 01010101 numbers
angle of attack
I get that it's angle based
and hippity hoppity your ip is now my property
delete delete delete delete
here I'll make it spam particles at me
are you like getting the block they are looking it with no max range
because thats the only way you would get like y20
from y36
or somethin
range is 5

mm this explains a lot
also who is minecollar
dont ask
are you under nda to not say
It's more like a small team
It's me and a friend of mine doing the coding
then guy that sponsors it all
How can I get the amount of items that drop when a block is mined including enchantments
block drop item event
do you people reuse existing GridBackConstraints or create a new one everytime?
are constraints are sooo annoying
omg
I looked on google and all I could find was nms, reflection and a bunch of no
Prob for older versions
Is there a specific way in saving data that I want to be deleted when the server shuts down? I am not sure what the best way to do this is using Minecraft plugins but I am here looking for suggestions.
For example: If I were to want to save the players killstreak.
thank you!
I hate the constraints things so much
I stay far away from java swing and java awt
honestly I think if I ever do UI with java I'ma just use JavaFX
I honestly don't understand where tf I'm going wrong with this code
are you putting the maps or the particle stuff on the wrong block
the particle stuff should match the maps
because I use the same location in both cases
but depending on the orientation it's completely off
did you manage to fuck the math up or something
maybe
or are you somewhere taking the players ange into the math
rubber duck debugging
I mean
it shouldn't matter
I'm just rounding up a location to the nearest block
but still
and I might've made the thickness so small
that this doesn't actually detect my clicks
I might actually need to detect the actual exact corner depending on the rotation
this might be a bigger pain in the ass
or just make sure your rounding is consistent even when comparing with other locations
if you round down all the time for example even if its .9 it should work
or if you round up
but you would have to do it for all the fractionals and not just some
that is round in a consistent direction
I already have a version of this working but it's really bad
my problem now is that the thickness algorithm is a bit clonky and I need to figure out a way to use negative thickness for negative axis
this should work
wait I can run the debugger on a runServer thing?
woot
```why can't i create a object like this?
well you don't necessarily need negatives for opposite axis
I mean
because that's not even valid java syntax
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
x=0.999,y=85.12149592250223,z=2.695547134350819
minX=0.9836707073975663,
minY=83.9022688857353,
minZ=1.3203729714867958,
maxX=0.9936707073975664,
maxY=85.9022688857353,
maxZ=2.3203729714867958
hm
these don't look right
yeah that's the problem
if you really need to create items from this json-like string, you can do it like this
ItemStack item = new ItemStack(Material.WATER_BUCKET);
item = Bukkit.getUnsafe().modifyItemStack(item, "{CustomModelData:1, Damage:0}");
the x=0.999 is fine
as that's my border estimation part
which helps with performance
however you shouldnt do that and there's literally NEVER a reason why you would need to create items from this json-like stuff
but the hitbox should be between 0.999 and like 0.899
ok, thanks
and what is the other way?
creating the item manually
the proper way is using ItemMeta
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("my item");
meta.setLore(Arrays.asList("my","lore"));
meta.addEnchant(Enchantment.CHANNELING, 1, true);
item.setItemMeta(meta);
now, I need to offset the initial location by the corner
as it's just like a decimal thing atm
I'm thinking maybe location.toBlockLocation and then snap it to the corner based on the direction
yea.... but i can't, because i want to create a list in the config.yml like this:
Items:
- "minecraft:water_bucket"
not sure how you are determining min/max
assuming I only have the block location and the direction of the board, I first assume where the frame is
So that if I'm looking ahead, I know that the frame is basically attached to the block behind it
and facing me (the opposite direction I'm facing)
This helps with accuracy
So let's say I'm looking at this frame
I first obtain its hitbox (where I'm failing now)
which is where the trapdoor is
Then I do 1 cast per block, until I hit a block that has a hitbox under it
So basically the block where the trapdoor is
Then, based on the current position and the position of the trapdoor's thinnest side, I can make a very small but accurate raycast
Hey! I am confused why I went onto spigot and noticed my plugin was removed or maybe marked as private? I didn't receive an email or anything?
And end up with the perfect pixel coordinate, in distance(player, frame) + 1 iterations
The problem right now is that the hitboxes don't match
I know why one of the positions is a bit off
And I'm struggling to think of a solution
Basically, when I spawn a frame at a location, I just pass the playerlocation + whatever offset
And minecraft automatically snaps it to the block (that's how itemframes work)
But for accurate positioning I need to know the actual corners of my image instead of just wherever the top-left point is
Easier said than done, given I have 6 axis to work with
I have some point in the middle of the trapdoor
How would I get its most top left corner, regardless of rotation
ok, but that doesn't seem to matter when it snaps to the block
so get the middle point afterwards?
I start with the middle point
When I spawn the board, I just use the player's location + the direction offset
its not needed if you know the size of a trap door
It's needed if I want to know exactly where in the trapdoor I'm looking at
sure, but if you know the size of the trap door, get its location and facing after its snapped to a block
then you should know where exactly mid point is
I think it is just your order in doing things that is screwing it up
To know what pixel I'm looking at, I need to know where x0y0 is at
What if I don't know where x0y0 is at
I'd need to calculate it
that would be impossible unless you didn't know the size of a trapdoor
The size doesn't matter, I just need to know what block corner the top left corner of the trapdoor belongs to
but it does matter because your 0,0 on the trapdoor is arbitrary according to everything else so to make sure it is center you need to know the size of the trap door to have your offsets from the block face location
and then you just use the size from there
if I use North,South,West,East I know it's always at a top corner
I can then estimate the edge it's at
🤔
Can u give a tldr?
you don't even need to estimate here
but if you want to do it the hard way go for it I guess
but the order in how you do some of these things is also a factor too
can't just be applying the size of an object to another if it suddenly moves and you didn't account for it for example
Here's how it starts
notice how the 2nd param is not an integer location
Now, that second param is meant to be the corner location
Where the top-left 128x128 frame is at
playerLoc.add
on the imageboard constructor
Any following frames are calculated here
the reason for the trapdoor thing is that they're basically itemframes with maps, but actually have a thickness, yet hang onto the block the same way
Yeah so basically the corner location is skewed
and I want to fix it with code
Now, how would you go about fixing it?
Just toBlockLocation from the start?
get the location of the trap door, and since it doesn't sit perfectly even with the block minus its size with the size of a block. Gives you the offset all around. From there its not hard to get a mid point of the trap door
this would be harder if you couldn't look up the size of a trap door
or it couldn't be known
as for your grid of 0,0 you would just map the point you found as being the center to being now 0,0
minus its size with the size of a block
as in?
I think you're thinking about snapping it to the lowest corner of a block
where everything has no decimals
well itemframes and maps do
what I meant is they don't take up the entire block face which you have to account for
com.mojang.brigadier.exceptions.CommandSyntaxException: Expected '}' at position 45: ...{Name: '{'<--[HERE]
How can i solve this?
otherwise you are not going to find mid point
ItemStack item = new ItemStack(Material.DIAMOND_SWORD);
item = Bukkit.getUnsafe().modifyItemStack(item, "{HideFlags: 4, Damage: 0, display: {Name: '{'extra':[{'text':'hola'}],'text':''}'}, AttributeModifiers: [{Name: 'generic.movementSpeed', Operation: 0, UUID: [I; 1461744232, -864534134, -1964839385, 1725294635], Amount: 2.0d, AttributeName: 'minecraft:generic.movement_speed'}]}");
they are incredibly thin
ok, we were talking about trapdoors
trapdoors are basically these but with a thickness
which is important for raycasting
but thickness isn't even a factor in regards to finding mid point
The current issue I have is that the corner location is not perfectly aligned with the location of the actual frame's corner
so if I spawn it while I'm standing in the middle of a block, the whole cuboid is shifted by that middle thing
and I can't just round it down because well... if I have something downwards-facing it would be offset by a whole block
I could know the size of the pic
and I do actually
But that doesn't help much, does it?
Well I'd need to start from a known anchor
which is the trapdoor and the block
not really because the trapdoor's top left corner can actually be in different "block corners" based on its rotation
those are already known sizes, all you are doing is overlaying a pic, which is calculatable to know its offset
does its size change?
not really
Not sure what size has to do with this
it can be 1x1 or 100x100 the top left corner is still the top left
the position of the pixel at x0y0
because its static, the only difference is where the bottom of the trap door is at, but its size is always the same
once you know where the bottom of the trap doors is at
that is the direction of your offset
isn't the bottom just top + size?
don't remember off top my head, but once you have that, when you put the pic over it you can figure out where its corner is at, using the offset you obtained from the trapdoor combined with the known size of the pic
I don't think you get the idea that all the known positions are skewed by the same offset to each other
that should make it easier then
I don't know that offset
and I'm trying to figure out where they should really go so I can calculate that offset and fix it all
anyways I'll just commit, go to bed and try again tomorrow
they change every time I spawn them
because the offset derives from the player's location
well you derive the offset from the players location
these items are not changing sizes
I still need to calculate stuff because if I just subtract stuff I'll end up with wrong results
therefore the offsets which there should be 4, can be pre-calculated
as for the player perspectice that is a different calculation but you need to know the location of your corners or at least the mid point at minimum
so you need to know all the various offsets that the pic/trapdoors can have. They are not going to magically change unless mojang decides to update the sizes one day XD
hey
How can I prevent a player from being able to fly in a specific world
Is it bad performance wise to loop through every player and check location?
Not sure how much it would affect
I wanna make them stop flying and not allow them to do it again while they are in the world. Ideas?
github copilot knows their shit. everything below 12% is barely a proper wine
Alex help a brotha out
can'T you just set setALlowFlight to false in PlayerChangeWorldEvent ?
np
inb4 you have /fly
Does /fly bypass setAllowFly?
all it does is set it to true
sure
or just disable that command in that world
PlayerPreprocessCommandEvent or smth
Does that work for other plugins commands?
well for most.
Wait so you're saying usepreprocess to check world and disable that?
Unless I add delay that wouldn't work
yeah cancel the event should they use that command in the other world.
I think best aproach is custom /fly
sure
Cause if they switch worlds and they're flying
you will listen to both events obv.
Gotta wait for them to do a command in the world or delay
Well yeah true
Alright thanks, got an idea
Just finished adding autocollect supporting all enchantments
With infinite storage
if they have a permissions plugin they could deny permission for that command
bukkit.commands.fly
Oh yeah
Also an option but on worldchange
Luckperms have contextual permissions
But doesn't disable flying if they already are
.
This and the other suggestions in tandem.
What would event.getplayer.getworld return when PlayerChangedWorldEvent
but what it would do is stop them from using the command without you having to implement checks for command usage
We are not suggesting you to do only one thing.
Is it the new world at the time of the event
?jd-s
Got it
if its done too soon it will return the previous world
nah it runs after.
Priority = low
I didn't see the event part, thought they were doing player
so it depends which method 😛
?tryandsee
if you do player.getWorld() from the event method
you would get the previous world if done too soon
if you do event.getPlayer().getWorld() it should return the world they changed to
Hence the event.getFrom
Yes, that's what the doc say
Oh where are yo ugetting this player from?
if you use event method, I am saying if you invoke the player object not from the event
Well he shouldn't have a player object
Indeed I don't
alright well I am pointing out the caveat in how you can get the previous world lol
How may I include a annotation for intelliJ to show when I start wring a method
Like I want to remind myself that this 1 method doesn't need X
Asking about your attempted solution rather than your actual problem
comment stuff?
Actually don't know how it could display
hmmm
nvm don't think it's possible
Just gotta remember
// this is my totall very cool method
public void shut() {
System.exit();
}
Atleast use javadocs comment
lol I forgot the name of the argument shows in the autocomplete
That was simple
remember lowercamelcase
I just did
good
why is runTaskAsynchronously way slower than if i use a server scheduler(which can bring lag to server)
or should i be using a different way for running Asynchronously?
It is not.
well, using "normal code", in 3 seconds this checked all the blocks in like 25x25 chunks
now it's taking like 2-3seconds per chunk
what are you running async???
im testing this async to see how it works
so im checking the average of blocks per chunk, loading all the blocks in a chunk and counting them
and without using any runtask, it was like 3 seconds of a full server lag to do 25x25 chunks data
now it's that time but per chunk(but server doesnt lag)
is that perhaps why its way slower?
Also ask on paper.
You sure?
i only code in spigot
send me the function you are getting the chunks async
Bukkit.getScheduler().runTaskAsynchronously(Main.getInstance(), new Runnable() {
@Override
public void run() {
long timestamp = System.currentTimeMillis();
HashMap<Material, Integer> blocks = new HashMap<>();
Chunk originalChunk = player.getLocation().getChunk();
for (int chunkx = -44; chunkx<44; chunkx++) {
for (int chunkz = -44; chunkz<44; chunkz++) {
Chunk chunk = originalChunk.getWorld().getChunkAt(originalChunk.getX() + chunkx, originalChunk.getZ() + chunkz);
checkChunk(chunk, blocks);
}
}
Main.getInstance().getLogger().info("-----");
for (Map.Entry<Material, Integer> each : blocks.entrySet()) {
Main.getInstance().getLogger().info(each.getKey().toString() + ":" + each.getValue());
}
long timestamp2 = System.currentTimeMillis();
player.sendMessage("§7§oThis took " + (timestamp2 - timestamp) + "ms.");
Main.getInstance().getLogger().info("§7§oThis took " + (timestamp2 - timestamp) + "ms.");
}
});```
this?
Why are you calling getChunk and getChunkAt async. They're not threadsafe
so should i get a list of chunks before using async and then run through that list in async?
sorry i dont know, as i said i was testing. im new to this async thing
spigot doesn't load chunks async and you should be careful with block manipulations async
just testing thigns out and trying to figure it out
all good, but the reason it is slower or just as slow is because even though your code is async doesn't mean the methods you are attempting to use are made for async or also run in async as well
you can go async then back to sync because the method you used is sync
but wouldn't that be as fast as sync?
sometimes
or does it take some time to switch between sync and async?
cause it was like 20ms to get a full chunk in sync, now 3 seconds if i do it inside async
does anyone know how to fix this error when trying to use structureblocklib?
[15:36:42 ERROR]: Could not pass event ProjectileHitEvent to Plugin v1.0.0
java.lang.NoClassDefFoundError: com/github/shynixn/structureblocklib/api/bukkit/StructureBlockLibApi
are you shading it
so i can get a list of this chunks in sync and then go through them in async? 🤔
sure
U can go thru the snapshots
yeah you can get chunksnapshots
what's that?
What are you doing tho?
its a snapshot of the chunk so you can use it async
shading?
What are you checking a chunk for?
Well, I wanted to know the rarity of certain blocks so im calculating all the blocks count in the the chunks around me. but it breaks the server in sync so I started to play around with async
If you use Paper, they have a way to get chunks async safely.
idk, probably quite a bit.
nah, im a spigot enjoyer
you need to shade the library because otherwise those classes dont exist
🗿 🍷
maven or gradle?
depending on the server sion obviously @fervent aspen
server sion?
maven
cause a chunks storage is 2kb
i have it in my pom.xml as a dependency
That depends on the world generator no?
version* @fervent aspen
oh i see its a class
look up maven shade plugin, and set the scope on the dep to compile
alright thanks
when your typing can't keep up with your brain it starts to combine words
exactly like chunks but used for different threads
1.12.2**
makes sense then
so i assume ChunkSnapshot only allows to read blocks and not edit them?
Yes
that's exactly what i wanted, ty
i mean yeah, but for vanilla, if u get like 100x100 chunks data, it should tell +- the average
Ig
i wanted just to know +- how rare are diamonds and other ores compared to normal stone
to create a shop with "fair prices"
thats all
You could just look at wjat tje generator does tho
nah, i just want to check really
Also it's seed dependent
That's not a feature, i was thinking blockstate
🗿 I just want something simple
Remember villager trades are a thing
in 5 minutes i discovered it, that option u talking about sounds like a lot of hassle for not something i need
Tha can mess up ur economy if not taken into account
i know but i will also think of it when making the prices
also this is for a "community storage" which has a limit per item, so its not like they can "abuse" it too much
if an item gets sold too much, then nobody else can sell it.
so im not too worried with that
--
alright aside from that
ChunkSnapshot does not have isLoaded
do i need to check this as a chunk beforehand? 🤔
you can't get a snapshot without a valid Chunk since that is where it comes from
ah ok, just checking
declaration: package: org.bukkit, interface: Chunk
if(chunk.isLoaded){
ChunkSnapShot snapshot = Chunk.getChunkSnapShot();
}
or something to that affect
right now i have soemthing that checks if its loaded and if not loads and asks again after a tick
i will change it around and come back if find more sussy stuff
thanks for the input guys
What would be a smart way to prevent someone from running a command if they have been hit recently
add their uuid to a map with the unix time they got hit, if they ran a command with X seconds of that unix time dont run
but but
If I make a hashmap how can I access it from a command file
Like my structure has commands separated from events
make the hashmap in main class then, you can easily get it from anywhere then
Could make it static in a third file but is that good?
Is that good practice?
What you just said
What else
want to know a better way then this?
yes ofc
just invoke the load method
if its loaded it does nothing
if its not loaded it loads it
no need to check if you need it loaded anyways
What other alternative besides a static hashmap on main class
now i have this
Is passing the same instance of main to both files better efficient wise?
i suppose this is +- what u are saying to do
so instead of the if check
replace that if with just a load method and then start your for loop
so you could do if (chunk.load())
got it got it
yes it returns a boolean
makes it easier
yeah but now i have to fix this code
since it is async then sync then async then sync again per chunk
😂
well that is just part of development you know
Does the spigot.yml file have a mob cap when spawning mobs
@compact haven
I read back over the convo we had yesterday and I think I found where the disconnects were. The first one being the names you used for the columns. I have since changed them for my sake. Doing so helped give me a better understanding of the table as a whole. For the second one, I wasn't realizing that since defaults were being defined that I wouldn't have to supply those parts of the query. 😅 The dots were not connecting there. My bad. lol
Which yea, when looking at what I would need to write, is much simpler and pretty cool that it can be that short.
The other thing I wasn't understanding, and kinda still don't understand fully, was the the sudden switch on how the timestamp were being stored. Was it because there wasn't a good default for BIGINT? Or was it something else? I understand that I might not need millisecond accuracy. I'm definitely not displaying milliseconds anywhere. However, I'm concerned that it might effect statistics that I might want to pull. If players have entries with the same timestamp, which is more than possible, how would it affect statistical data, if at all? Or am I'm just overthinking it and it's actually a non issue?
Let me explain better. I have spawners for a mineshaft that players move through. Once i went past 64, The newer mobs spawn then immediately despawn. Could this be spigot limiting mob spawns? Sorry if this is in the wrong channel. If it is redirect me. Thank you.
@atomic spoke once what goes past 64?
Once i go past 64 mobs spawned
Bukkit is set to a 5k limit
which ill readjust after the fact but that didnt correct my issue
You world be sorting by interaction_id, not timestamp, so no problem there. Even if you had two interactions with only differing milliseconds, I don't see much of a problem. As for why we are storing INT instead of BIGINT, the reason is simple- MySQL only can provide the seconds since unix epoch, and so upcasting it to milliseconds is just a larger number for no reason. In that case, we just allow MySQL to provide us seconds, as an INT, and store it as such, The other alternative is to * 1000 and store it as a BIGINT, but that's 4 extra bytes per timestamp for no reason, because the precision is still merely seconds.
i came across another issue, perhaps u may know
perhaps
it only did 7.7k chunks when they were supposed to 9801
code:
Bukkit.getScheduler().runTaskAsynchronously(Main.getInstance(), new Runnable() {
@Override
public void run() {
long timestamp = System.currentTimeMillis();
Chunk originalChunk = player.getLocation().getChunk();
World world = originalChunk.getWorld();
ArrayList<Chunk> chunks = new ArrayList<>();
for (int chunkx = -44; chunkx<44; chunkx++) {
for (int chunkz = -44; chunkz<44; chunkz++) {
Chunk chunk = world.getChunkAt(originalChunk.getX() + chunkx, originalChunk.getZ() + chunkz);
chunks.add(chunk);
Main.getInstance().getLogger().info("Chunk done. (" + chunks.size() + ")");
}
}
player.sendMessage("Total chunks:" + chunks.size());
long timestamp2 = System.currentTimeMillis();
player.sendMessage("§7§oThis took " + (timestamp2 - timestamp) + "ms.");
}
});```
any reason for 2000 chunks to not be listed? 🤔
or is 7744 the max amount of a arraylist?
Folder:
-> Main:
-> Commands instance of cooldownmanager
-> Events how to share same instance to initiate a cooldown on event
-> CooldownManager
is this a question or what
The question is in the explanation yes
clearly not 💀
Assuming its manager, you probably want your CooldownManager to be singleton
don't know your usecase, but yeah
I see. I was under the assumption that we were just going to skip the database trying to convert it and were just going to store the long values. Then convert them as necessary in code. Was there any issue with doing it that way?
what do you mean by set the scope on the dep to compile
I am trying to register the listener in the class added using the add method. It keep saying that it requires a listener however whenever I try to put in the class it just says cannot resolve symbol getClass().
public static void add(Check check) {
// Register Events
Probability.getInstance().getServer().getPluginManager().registerEvents(new check.getClass(), Probability.getInstance());
}
Any suggestions?
Dependency injection
What?
wdym trying to convert it
this is accurate given the code you gave
Don't think that was for me
the database doesnt convert anything. unix seconds and unix milliseconds is independent of timezone, it's from Jan 1970 UTC (no offset)
it's still storing just a number, it's just an int not a long
on your dependeny do you have <scope>provided</scope>
You create this manager in main class and put it to constructor of classes that depend on it
Convert it in java code. Grab the long value from the database and convert it to an Instant or whatever was necessary.
true
Hmmm
to understand how it is accurate, you are starting at -44 but only letting the loop go to positive 44. So the math is as follows 44*2 = 88 * 88 = 7,744
Good point
Thanks
yeah
fcking hell
if you want to make it an Instant you are still going to convert it mate
uhh no
its supposed to be 49
wait yeah
you yourself said you didnt want to "redo your entire system"
so I told you how to get it as a long
that's all
oh change that to compile
ty again mr frost
anyone know if an/what event is called when you use a hoe on rooted dirt and convert it to dirt

wait no
Can't do that
Why?
Because the commandfile never gets called from main
I mean it does eventually I guess?
goes to a cmdImplement then register
Do I just drag it down the path lol
But command class is created in main as well