#help-development
1 messages · Page 772 of 1
im getting this error, i think i didnt close my connections properly, but even after restarting the db and my pc it still says this.
My guess would be me.galtap.customblockdata
hm
i use 1.20.1
that doesn't tell me anything
bukkit api
I'm asking about the jar, not version
oh
your plugin jar
java version?
i try but this not work
not found class
how can I have one main Team and of that I want to create copys of the team and set custom suffix for each player thats my code for the teams in general: https://paste.md-5.net/gofiqerogu.cpp
ye, that was not your issue
I just pointed that out 'cause it was incorrect anyways
when you run the maven build or whatever it creates these jars
which one do you use
that is my plugins id
yours would be different
this?
How did you get to Task Manager
write task Manager in search engine
they are asking why tf
he did not mean that literally
man what is going on lmao
Press control shift and esc at same time
steve wanta to know why tf ur in task manager
Guys, I do really bad with language barriers
what next
@ivory sleet is this accurate
not how to get there
i got it they just goofy
What plugin jar do you put into your plugins folder ?
You might be using the wrong one.
@upper hazel
i was do this but the same window
BarrelMarket
What is the full file name
That is not the name of the file
just BarrelMarket.jar
thank you conclube

When to expect that?
I'd probably be biased and remove magma's messages from my search index lmao
Lmao
Long overdue
Illusion, just… can variables be synchronized!?
p sure static variables can
Svelte reference
Still svelte reference
but there's volatile which ensures that cpu caches n stuff are synched between threads
innit
except for doubles and longs, field assignment is atomic
because it may happen in two 32-bit steps
Ahh
oh wait i now see i need shodow plugin
it's not guaranteed it'll be atomic, but it's also not guaranteed it won't be
but "jvm implementations are highly encouraged to make it atomic"
GSON - Expected BEGIN_OBJECT but was STRING
but you can however use a Double/Long field and its assignment will be atomic :pepw:
at the expense of boxing ofc
or just stick an atomicfieldupdater/varhandle in there and it'll do the job pretty well done
I have more to do with my life than learn about jvm internals thank you very much
very true
volatile 😡😡
you see, i used to think the same
but then i got the itch
i get this itch, it's awful, i need to test all the time, keep testing
maybe you just need friends
i see you haven't played portal 2 D:
im getting this error, i think i didnt close my connections properly, but even after restarting the db and my pc, it still says this.
no one wants to be friends with emily
oof
oh shit
bro has a socket leak
congrats collin
you're lucky i can't send images in here
yes pls help me
you're too scared to verify
i hate my nickname on spigotmc
pay 10 dolla
can't

broke
gov restrictions for international payments yada yada
@echo basalt how do i fix a socket leak
What if you have MD fly to you and pay him directly
Where are you from
being unverified is cooler anyways
You guys can change names still
i was about to say something very racist
Can't ya
Please do
lmao no
👀
This server is NOT family friendly
Fuck fuck
How would I synchronize real life time with ingame world time?
Not too hard, just gotta do some math to convert the time
😢
Well
and resync now and then due to lag
I was asuming you wanted to do it to a single timezone
Photography reference?
Photography reference.
Do you want just one timezone or do you want it per player
here it translates to "rule of 3 simple"
im getting this error, i think i didnt close my connections properly, but even after restarting the db and my pc, it still says this.
https://paste.md-5.net/enekayewon.sql
pls help me
it's like
I cant use the players timezone. Has to be the servers timezone and time since each player can join from different areas of the world
x - y
z - ?
? = z * y / x
Alright
Then you gotta get the local time of your machine
If you give me like 40 mins I can give you the whole code for it lmao, I wrote it once
literally any number
You can get local time various ways
No its ok Ill write it myself
Ok
I like a challenge xD
let's say you have a 2:1 ratio
One thing that might catch you, minecraft time is from 0 to 24000
and this works for anything
Seconds should be the closest
you can use seconds and do the rule of 3 to convert it
add an 18000 offset
and mod by 24000
Yes exactly
Alright thansk
LocalTime has getSecond :p
LocalTime 🙏
Waiting for when Java API adds LocalTime.toMinecraftTime()

LocalEmily
share
this my path - me.galtap.barrelmarket.CustomBlockData - but server not can find java.lang.NoClassDefFoundError: com/jeff_media/customblockdata/CustomBlockData - naven -> https://paste.md-5.net/atipavuwos.xml
lets me script stuff like wait 30 ticks
oh wait
Does it just schedule a task :p
maybe
I just have a Time class for my other projects with a basic parser
lets me do stuff like
TimeParser.parse("2 minutes 5 seconds").toTicks()
My life is an Illusion
I should get something like that for my api
Maybe I should dedicate a day to working on my api
Send the TimeParser class here right away
I currently have no use for it but it looks sick so I want it
im getting this error, i think i didnt close my connections properly, but even after restarting the db and my pc, it still says this.
Nice
yes I could implement checks so that idiots don't put 1 second 1 second and end up with 2 seconds
but do I care
For some reason I thought it was like a 400 line class with a shit ton of parsing utilities xD
what item can i use for discord that is not a player head
Yeah the discord icon head looks pretty good
not compatible with my custom items api
Then your api is incomplete
alr imma make a PlayerHeadCustomItem
yes
I'll keeop coding
public abstract class CustomItem {}
public abstract class PlayerHeadCustomItem extend CustomItem {}
I don't see why you would need to define specific logic for player heads
When it's an item like all others
would that work
I have no idea what your current system is and I don't have enough patience to study the code
So I can't say yes or no
But I can say that this approach feels scuffed
Because PlayerHeadCustomItem implies that it has different logic from other custom items
Which is simply not true
It has its own meta yes, that's not a problem though
Store it like any other meta
i want my project to be as structured and scalable as possible
which class would extend PlayerHeadCustomItem
WearablePlayerHeadCustomItem
So you are going to make a class for every item?
Every Item Type
Seems like you need a util method not a class
My custom item classes just wrap an itemstack
Then you can have interfaces to add for different stuff
oh my fucking god
please do not
do that
do not make a class
for every type
there is literally 0 reason to do so
imagine u have like 100 items
less code is better code
type
You custom items shouldn't be bound to minecraft types
They should be bound to their different functions
I have my custom material class
that just wraps a custom namespacedkey class
and it all goes in a custom registry class
public ItemStack build(){
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();;
meta.setDisplayName(name);
meta.getPersistentDataContainer().set(IranSkyLobby.getPlugin().getItemKey(), PersistentDataType.INTEGER, id);
meta.setLore(Arrays.stream(lore).toList());
item.setItemMeta(meta);
return item;
}```
its a pretty simple custom items api cuz its only for the lobby
You could have a generic CustomItem
Then various interfaces like UsableItem, TickingItem, etc
Arrays.stream(lore).toList() ?
and my custom itemstack class with my custom meta class handles all the item stuff which is then adapted with a custom adapter class into a bukkit itemstack
smile lurking
who needs List.of
i used String[] cuz it was easier
In what world
How about Arrays.asList(lore)
Just use an array list and define the size you want
lemme try
It makes arraylist as fast as arrays
yeah that works
No but that's really thr only valid justification for not using an arraylist here
Fair
You'd be a good lawyer
What is the default list size? 10?
ArrayList is just a simple dynamic array
Yeah but it has a default size
I usually manually set it if I have a ballpark estimate
Yeah it's 10
And then it grows by some amount if it gets full
Which I think depends on impl
Iirc it's 1.5 or 1.25
Gg
@lost matrix do you know?
how can i modify the username of the playerhead
Hm?
Wait, oldCapacity is right shifted?
java makes no sense
Ah and added to itself
bump
Not easily
Makes a lot of sense actually. Just not comprehensible for my eyes that do not do shifting ever
You could do some custom display/interaction entity magic
Or a bunch of packet fuckery
Change the name of the PlayerProfile on that head
Oh wait playerhead item
does it need NMS?
Not the name above the player
no the head that it displays
Set the skin base64 in the PlayerProfile
^
You should really be using a new player profile
Or you can pass an offline player directly
Copilot... why u know my ingame name?
URL skinUrl = ...;
ItemStack head = ...;
SkullMeta meta = (SkullMeta) head.getItemMeta();
PlayerProfile profile = Bukkit.createPlayerProfile("Mr Bob");
PlayerTextures textures = profile.getTextures();
textures.setSkin(skinUrl);
profile.setTextures(textures);
meta.setOwnerProfile(profile);
head.setItemMeta(meta);
why does it know my alts name 
You guys use copilot?
yes
'setOwner(java.lang.String)' is deprecated
should i care? theres no way to create a new OfflinePlayer
I had it off for a while bc it kind of suggested a bunch of mumbo jumbo to me
Did you look at the code ive sent you?
oh yeah it turns to garbage if you invalidate your caches
and sometimes you gotta really insist
but it's still helpful
except when I want it to be helpful
oh i didnt notice that
it has days where it's great at making garbage but struggles to read a byte[] from a file
packages
as in, public methods, private methods, getters/setters, static methods
im on 1.16.5 and theres no createPlayerProfile
static fields
fields
constructor
most used / important methods up top
garbage / filler methods at bottom
Yeah that's logical
// static fields
// static methods
// space
// class fields
// constructor
// methods
// public
// protected
// private
oh yeah I leave a line in between like every other line
is there a head database API that i can compile into my plugin?
I really like to separate static from the rest
But its more conventional to put them somewhere down
mmm
nevermind imma just use blue concrete
Good think IJ has formatting rules for that 🙂
fancy
The only thing im not sure about are the order of those two:
init blocks above the constructors, always
static { }
{ }
Constructor() { }```
They're unnamed constructors
Hm? They get executed on class loading...
static init blocks *
If i see you write non-static init blocks then you get a slow headshake in disbelief from me
And the static ones are insanely dangerous bc they can create horrible classloader exceptions that are hard to debug
i mean sometimes you don't really have a choice, but they defo should be kept minimal
my favourite thing about init blocks is that you can have multiple of them lol
it's horrible
Oh yeah. That sounds nice 🙂
What plugin You are using for that.styling You sent in the picture
Also welcome yo the stuff, really nice to see You un the stuff with Coll
It’s great
Copilot is great for making mundane, routine tasks quick
Ye
I don't really use it for coming up with code but holy hell it's saved me tens of hours just repeating code
It does great at some tasks
how can i change project java version in IJ using maven
im trying to stop players from dropping an item from their inventory, they can move it but not drop it and this is what i made so far :
@EventHandler
public static void onDropItem(PlayerDropItemEvent event){
if(!hasCustomTag(event.getItemDrop().getItemStack())){return;}
event.getPlayer().sendMessage("§cYou are not allowed to drop your §4§lRelic§r§c.");
event.setCancelled(true);
}
and it has a few problems:
1- if i open inventory and then click Q on items, they disappear but i get the "u are not allowed ..".
2- if i drag the item and right click outside of the inventory it gives me the item x2 (dup)
it only works well if i throw items from hotbar without opening the inventory
survival
InventoryClickEvent triggers when dropping from inventory
tysm
Hello, i want to code a gun plugin. Now I want to do this animation when player shoot like in this video? how is this possible? I mean that the gun in the itemHand gets down and then up:
https://streamable.com/c596in
Does the TabCompleteEvent contain the command the player is tab completing?
Think it’s the buffer
My guess would be to change some random NBT (PDC) of the item.
I think that causes this "pickup" animation.
okay, then i have to change my texturepack too?
what
That’s indeed what he suggested
yep, just have some random boolean in
it should cause it
How can i spawn a platform in glass at world generation ?
?blockpopulator
Oh wait just once
Look at world events or whatever is used for creating the worlds
okay i will try it
IT WORKS!
thank you very much
when i try use lib i have expetion notClassFound https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/ i was think bc i was do mistake when try paste path in configuration but my path written correctly
How do you build your jar ?
wdym
Depending on the IDE, you probably can just run the code lol
It's gonna compile, at least on IJ
For maven it's mvn clean package
For gradle i think you just run gradle build
But I'm not experienced with it so I might be wrong
Eeeh not really
not if you use maven
yes, but you have to setup the run profile thingie
whaT
Just run the command
I am not asking
yes
Ohh my bad
I am asking the guy how he builts the jar
I thought you were asking for help lmao
Mostly fine
Why mostly?
Ah, gotcha
Otherwise the task would be shadowJar
so i need shadow?
yo, what's the use of shading? Never used that jar out of the three of them
Probably not super needed with the newer plugin lib loading
But it’s a way to include the libraries that you use within your jar
oh, alright
How is the Vault API used?
API Component of Vault. Contribute to MilkBowl/VaultAPI development by creating an account on GitHub.
wait wrong link
can i spawn a beacon beam as indicator or is that bound to the beacon block
nvmind its client side
nvm the right link
is it smart to make runnables used in exactly 1 class as static inner classes?
actually why does IJ suggest making inner classes static anyway if my code instantiates em?
probably because you are not using enclosing class members
in that case, it can be static
fields from class that is not nested xd
i mean, static fields for dynamic stuff sounds like a good way to screw stuff up
Generally you shouldn't ever really come across inner classes that are non static
A non inner static class would signal a tight coupling with some non static field from the parent class
Which imho is just an anti pattern
are you implying that inner classes get instantiated with the outer one?
No they aren't but they can use fields from their respective parent instantiation
hm
public class Foo {
private final int a;
private final int b;
class Bar {
if (a == 2 ) {
// you can access "a" here
}
}
static class Bar2 {
if (a == 2) { /*compile time error, "a" can't be accessed*/}
}
}
I'd give an example but I'm on my phone
tldr to make instance of Bar you need instance of Foo
there probably would be some comments if its not reliable lol
for the purpose here (ie, no inner/outer class crossing stuff), can i treat inner classes as if they're in a separate file? it's only to be used in the parent class
currently im just passing the required data on instantiation of the inner class in the constructor
why not just use COUNT(*) for that ?
You might actually benefit from a non static inner class here of it will never be used elsewhere
not sure i understand
i just thought its to make code cleaner
Because then you'd have no need got a constructor you can simply just use ghe fields
the stacks basically this
Event
-> effectively static eventHandler method
-> BukkitRunnable instance (of inner class of eventHandler class) for timed effect
Yeah lemme see
https://paste.md-5.net/ufobebosos.java this the relevant part
the rest is just world scan stuff
actually those ints can probs be static
Seems overcomplicated why can't this be done with a lambda and a util method
because with a lambda and util method it'll become one congested line of code and more importantly you cant debug lambdas
my priorities here are
- can be tested
- can be read
- everything else
You can debug lambda they give fine error codes
yea thats true but im not talking about that
this results in some very funny syntax when the inner class ctor is public new Foo().new Bar()/foo.new Bar()
im talking about that bug icon where you can go through ur code as it runs
which isnt available for lambdas
bc they get created at run time
like
Debuggers people use those?
Wtf that's wild
half of this is math
so if i just get a black circle i ned to know when it fails
not just 'this block of 100 lines math failed'
Ahh I usually just use unit tests makes sense
And sysouts
did that for a while, then i tried to get it to chat, then i gave up cuz that also took forever
Otherwise yeah that should work though you can make ot non static
like is there an effective difference?
web says something about static nested classes not taking up memory
Not really just is more logical considering your using it for botbing else
I'm sure theor are weird jvm quirks as always but I'm sure it's no big deal either way
Usually we're talking bytes of memory with those optimizations
eh tbf theres only going to be one instance of any of those at a time
yeah List/Set definetly isn't a thing
btw
i have 2 runnables, 1st calls 2nd, 2nd needs a value from the code calling the 1st. should i pass it to the 1st runnable or do it some other way?
it definitely is, on intellij at least
¯_(ツ)_/¯
like the code ran for sure
half my current project is lambdas and I can confirm that the debugger works
actually I wonder how many indys there are on this project
Hello! How can I cancel so that a hen does not spawn from a certain egg?
Which event are you thinking of? So when a player throws a special egg, this egg should not be able to spawn chickens
how i can add tnt in head like tnt tag
How to make CraftItemEvent work with shift click? If I set current item, it will set only first item crafted. Ex. If I craft 4 pieces of shoes, the item I set will be crafted only once (first item)
I just want to make sure, is this how I pass an instance made in main class to another class?
so that I'd be using the same instance in two classes
yep
im getting this error, i think i didnt close my connections properly, but even after restarting the db and my pc, it still says this.
What operations r u doing
Collection<Entity> nearby = center.getWorld().getNearbyEntities(center.clone().add(0,radius,0),radius*2,radius,radius*2);
there a simpler way of doing this?
(values subject to change)
Because I’m a bit lazy and busy rn ill just point you to the NQ model
how can I store ItemStack type in config?
ItemStack::getType and Material.getMaterial iirc
as in Material.getMaterial(AIR) for instance?
either make a parser yourself or use ItemStack#serialize()
and add it to your config
Not really sure how to do it
you got an itemstack ye
ItemStack blahblah = whatever;
Map<String, Object> configShit = blahblah.serizlize();
FileConfiguration myFunnyLittleConfig = stuff;
myFunnyLittleConfig.set("item", configShit);
conversely
ItemStack.deserialize(myFunnyLittleConfig.get("item");
hm. I want to apply a potion effect as if were the lingering potion on the ground (specifically instant damage) for faking a 3d effect cloud. Does anyone know the timing and damage value of lingering instant damage?
or if not where to find them? Googling only gives wiki entries which arent that useful
oh, I want to read it like that, so that I can read ItemStack from config when giving a certain item
you're probably best off making your own parser then
also don't' prefix the materials with Material. in a config that's just terrible ux
your users will hate you
users of what
the plugin
This looks like it has a few extra steps (just came here)
ItemStack item = ...;
FileConfiguration config = ...;
config.set("some.path", item);
// Later
ItemStack deserialized = config.getItemStack("some.path");
bold of you to assume i have users
yeah im not going to post any of my plugins public
nor my server will ever be public
still better to design it incase you werent using it
you should always design with UX in mind
ux?
User Experience
so I make it like that?
oh my god
that is evne worse
do you hate yourself?
krystalowa:
type: chest
what is wrong with this ^
why can't you just do that?
I would suggest not writing your config by hand. Write a class which generates you the default config.
here it saves item to some.path and that item is literally new ItemStack(Material.WHATEVER)
so why would it be ItemStack item = chest;?
you can't load objects like that from a string
you need to first serialize then deserialize the configuration entry to do that for you
its not as striaght forward as writing the code in your config
do you not write your configs by hand? I always do is there some reason you shouldn't?
new ItemStack(Material.WHATEVER) is calling a function and creating an object.
Its literally useless in a data standpoint
so I just do ItemStack chest = new ItemStack(Material.CHEST) and then use chest in config?
Preferably not. Just create a class BaseConfiguration, let it implement ConfigurationSerializable and throw it in a File when the server loads.
I am using configs with intention of manually adding new stuff fo them
I write my configs in Json
Yeah that too XD
But json has no comments
is there some actual advantage to doing so though? I always felt the starting values were rather arbitrary and hard coding htem has no specific benefit
And then i end up with meta information like that
Usually I have a readme :P call me crazy but I like it
So, i restarted my server with my plugin and the plugin isn't on the server anymore, can anybody help ?
Stop the server, upload the plugin again, start the server
must be another plugin trying to eliminate the competition. fr though ^
Doesn't change anything
That is extremely unusual. Files dont randomly disappear.
maybe if its some crappy panel or something its possible the panel is glitching out
would it be good enough?
please no Material#matchMaterial
Is the File actually gone or do you just not see your plugin ingame
why
plugin in game
reundant and inefficent
isnt switch case literally made to not make redundant stuff
no not at all
Imagine if you'd want to parse any material, your switch-case would get huge. There are just better and easier solutions with way less hassle
You can shorten this code and make it scalable
String typeName = lootboxConfig.getCustomConfig()... etc;
Material type = Material.matchMaterial(typeName);
ItemStack item = new ItemStack(type);
Now you support every item type there has ever been and will ever be.
make sure to throw helpful errors if the type is null
Then you have an exception on startup. Send the error pls.
Hello! How can I cancel so that a chicken does not spawn from a certain egg? So when a player throws a special egg, this egg should not be able to spawn chickens
Hey, there's the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/CreatureSpawnEvent.html and an EGG reason
declaration: package: org.bukkit.event.entity, class: CreatureSpawnEvent
[19:33:24 ERROR]: Error occurred while enabling uhc-ffa v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins\uhc-ffa-1.0-SNAPSHOT_RunServer_plugin.jar
at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:252) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:239) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at be.artex.uhcffa.Main.onEnable(Main.java:24) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched_1.8.8.jar:git-PaperSpigot-445]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:203) [patched_1.8.8.jar:git-PaperSpigot-445]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched_1.8.8.jar:git-PaperSpigot-445]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_382]
Yeah fix that. There is no config.yml in your plugin.
Checked it before, but can I retrieve the egg that the player shot somehow?
You can cast the Entity instance to "Egg" and use its getShooter method
literally ignore intellij its so stupid
you should probably put that in a string variable
though
Yeah but doesn't it appear on run ?
and getEntity() is the egg entity itself, if that's what you are looking for
sounds redundant to me
its not
thats called you use it twice don't write the entire thing out twice otherwise its an eyesore. You have so much memory to use don't save it for something so dumb
getEntity is chicken
I dont know what that means.
Your plugin doesnt have a config.yml file in it.
Oh right
Does the custom configuration file get created on start* ?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Possibly ProjectileHitEvent could be an alternative
oh yeah any idea why this happens?
dw about it bukkit auto adds a fallback
that's only there if another plugin has a command lootbox so your command can still be run
okay
Have tested, entity.remove doesn't work but did you think like cancel event or something?
I'd give cancelled a try, ye
Do you want to prevent spawning from eggs all together or only for certain players?
I want to check if an egg has a certain nbt tag and make this egg unable to spawn chickens.
There's an event for when a player throws an egg
That lets you set if it'll hatch or not
PlayerEggThrowEvent
yes
Well the value can technically be changed
So you've checked for null at some point but then magic happens and the value is not the same
Which is why you save it to a variable before doing the null check
Not only does it remove the possibility of the value being changed, it also makes your code more concise and readalbe
can I store list / array in config.yml?
hi, does anybody know a way to make the client update and start an Interpolation of a DisplayEntity at the same tick it is getting spawned?
abc:
- hi
- hello
getConfig().getStringList("abc")
As long as the objects in this list are primitive or ConfigurationSerializable
I just want strings and integers
Well yeah this should be fine for you
how can I access them in that case, do I just do this.that[0]?
I mean this is valid in kotlin
yeah I just dont know syntax for configs in this case
if you try to do it on the same tick, by default, it just teleports without actually doing the Interpolation as defined
Is it possible to use player#setGliding(true), to let a player elytra fly without having an elytra?
List<String> myList = getConfig().getStringList("abc");
myList.get(1);
// in most use cases you don't get a certain item
// but instead iterate through the whole list
// but ofc i don't know your use case
// so do what you need to do
I think there's getList() that just returns a List<?> but I might be wrong
If you add any object to a config, then you should always load the whole object and keep it loaded.
Dont load the entire List and then only get one element from it. If you have to do that, then your design is faulty.
Yes but you also need to cancel the toggle gliding event
https://paste.md-5.net/cuboreyalu.cs
would this be correct?
alright, another question lol. How would I rotate an ItemDisplay so that it looks in the direction my Vector is going at?
The simplest way would be to let your spawn location have a direction
hmm, well I think that's hard to do
I am spawning my DisplayEntities based on a List of ProjectionPoints where I can calculate the Vector from
how can I apply this Vector to the Spawn Location as a Direction?
Vector vec = ...;
Location loc = ...;
loc.setDirection(vec);
doesn't the Length and so on matter when setting Directions?
no
world.spawnParticle(Particle.DUST_COLOR_TRANSITION,l,1,colors[colorCount]);
colors array of Particle.DustTransition
->
Particle DUST_COLOR_TRANSITION requires data, null provided
chat, am i stupid? Am i bad?
oh well then, imma try, thanks xD
alright so I tried doing that with:
List<Location> projectionPoints = getProjectionPoints(handLocation, player.getEyeLocation(), player.getEyeLocation().getDirection());
Vector dist = projectionPoints.get(projectionPoints.size() - 1).toVector().subtract(projectionPoints.get(0).toVector());
// divide by bullet speed multiplicator
int duration = (int) Math.round(dist.length() / 7);
ItemDisplay bulletDisplay = player.getWorld().spawn(projectionPoints.get(1).setDirection(dist), ItemDisplay.class);
Direction still stays the same
Oh you want a projectile to follow a path?
In that case be prepared for a ton of math. Spigots methods might not suffice. You need to apply your
calculations on the transformation matrix.
well it's a straight raycasted line
and yes it has a LOT of maths for Intersection and stuff haha
Lets me see if i can come up with something real quick.
Do you want the movement along the line to be interpolated or do you plan on moving the object per tick?
the raycasting is also a custom implementation of an algorithm I wrote
the displayentity is using interpolation
I came across the issue that you have to wait 2 ticks after spawn for interpolations to work, but yeah imma try if it still looks fine with 100ms delay
Im guessing that you are calculating the interpolation duration via the distance?
yes
Ok let me play around for a bit
sure, take your time. Thanks a lot already!
Configuration.get().addDefault("lava", true);
``` can any body say why this ```java
if (Configuration.get().getBoolean("lava")){
p.getInventory().addItem(new ItemStack(Material.LAVA));
}
``` doesn't work
I'm confused that screenshot is of a config not a pdc
its of console
Depends entirely what Configuration.get is doing and what is in the config
I printed retrieved value of PDC
but for some reason
it prints that weird MemorySection thing
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Nothing there prints to console
the thing is that it prints this instead of just 'krysztalowa'
yesterday when I was working with PDCs there would be no issue
If you have an issue with what is being printed we need to see the printing code
sharpness on sword: 1
golden apples: 1
golden heads: 1
protection on chestplate: 1
protection on helmet: 1
sharpness on leggings: 1
sharpness on boots: 1
lava: true
Lava can't be added to inventory in 1.13+
NamespacedKey key = NamespacedKey.fromString("lootbox");
lootboxMeta.getPersistentDataContainer().set(key, PersistentDataType.STRING, lootboxConfig.getCustomConfig().getString(MessageFormat.format("{0}", strings[0])));
lootbox.setItemMeta(lootboxMeta);
It was that thanks
Make sure you are testing a new item. You can use /data get to see what the PDC is
still same
how can i stop an item from dropping from player inventory when he dies
there isnt a method for that
oh md if youre here, do you know where i can see the damage a lingering potion of harm deals? I'm trying to find the timings + damage but google only spits out the minecraft wiki and the api neither of which seem to have the numbers
KeepInventory
Isn't it based on level or something idk potions are confusing
hi cute @sullen marlin
its the server that calculates light level right?
Yes
public void onDoubleJump(PlayerToggleFlightEvent event) {
Player player = event.getPlayer();
if(player.getGameMode() != GameMode.SURVIVAL || player.getGameMode() != GameMode.ADVENTURE) {
return;
}
if(player.hasPermission("Perks.perks.elytraPerk")) {
event.setCancelled(true);
player.setGliding(true);
active.add(player);
player.setAllowFlight(false);
}
}```
why does this event still fire even when the player is in creative mode?
because it's ToggleFlightEvent
when you hit double-jump in creative mode, you Toggle Flight
yeah but if(player.getGameMode() != GameMode.SURVIVAL || player.getGameMode() != GameMode.ADVENTURE) {
return;
}
well thats OR
Your game mode can’t be both survival and adventure
^
Just change your || to an &&
Yeah
&& will make it worse ??
no
yes
it means that it needs to be NOT adventure mode and NOT survival mode
Well let’s says you are in survival mode. The left part of the or evaluates to true, but the right side evaluates to false
So your code continues
your current code tells "it needs to be EITHER not adventure mode OR not survival mode" which is always true
So I made a custom simple lootbox plugin that takes into consideration adjustable odds, names and types in form of config,, is it any good looking?
https://paste.md-5.net/evafahiyeq.cs
im a bit confused, when u use getDrops() u get a Set<ItemStack> and when u use .clear() or .remove() u do that to the Set<ItemStack> copy u got in return not the original one that will actually get dropped,
so how are you stopping the item from getting dropped
is my brain not braining or its a a bukkit thing?
Just Use PlayerDeathEvent#setKeepInventory(boolean flag)
Pretty sure the list is mutable
It's not a copy
i thought about doing something lik that, like keepinventory -> remove all items -> dropping all items in the coords where he died exept the specialItem
so if i edit it the original one will get edited too ?
the list should be mutable then you can just remove them
considering its mutable I'd say its more likely than not
ig i will try it and see what will happen
Yes
does it makes sense to put the @NonNull annotation in the Optional type?
no
Optional implies the result will never be null
also why anotate WorldHud with NotNull when an Optional Implies it could be null
if it is true that WorldHud can't be null then an optional shouldn't be used at all
the Optional#get() never returns null
if the value is null it throws an exception, yk
thats fine
seems redundant tbh
it is
I mean mostly u prob wanna have a @NonNullByDefault or something wizardlybump
so u dont have to clutter it all with @NonNull
WorldHud can be null though even if it throws the value itself could be null. I feel like that annotation would imply #get is a safe operation that won't throw
Those annotations are redundant as hell and confusing when surrounding an Optional
Finally found an affine transformation working for minecrafts scuffed coordinate system.
Lets hope the translation can just be done with a simple transformation composition.
alright, let me know when you have more info lmao. Seems like it's not as easy as I expected at first
?paste
looks great, thank you for sure! If you want I can credit you in my code for that^^
Nah its fine. I got a new util method from this.
hold up chat I'm doing like actual stuff with the world in my plugins for the first time in decades
/**
* Checks if an area around the provided location is free of obstructions
*
* @param center the block to use as the center point
* @param width the block area around the location.
* @param height the height of the expanse
* @return true if the space is clear of obstructions otherwise false
*/
public static boolean isSpaceClear(@NotNull final Block center, int width, int height) {
Preconditions.checkArgument(width % 2 != 0, "Width must be odd to have a center point");
Preconditions.checkArgument(height > 0, "The provided height must be greater than 0");
}
Basically goal is to implement and check if a set area around the center block is clear of obstruction.
Kinda need to check top left and bottom right or vise versa of an area and need to iterate through those blocks and see if they are not filled by other blocks.
What would I do to grab the top left and bottom right of the area though.
alright then
wait I think I got it
holy cursed
Block corner0 = center.getRelative(0, height, 0).getRelative(BlockFace.SOUTH, width - 1).getRelative(BlockFace.EAST, width - 1);
Block corner1 = center.getRelative(0, height, 0).getRelative(BlockFace.NORTH, width - 1).getRelative(BlockFace.WEST, width - 1);
public static boolean isSpaceClear(@NotNull final Block center, int width, int height) {
Preconditions.checkArgument(width % 2 != 0, "Width must be odd to have a center point");
Preconditions.checkArgument(height > 0, "The provided height must be greater than 0");
int dw = (width - 1) / 2;
Block upperCorner = center.getRelative(dw, height, 0);
Block lowerCorner = center.getRelative(-dw, 0, 0);
}
Ah height is not bidirectional for you
oh shit I forget I ened the bottom corner on the second one
yeah height only goes up
what does getRelative(modx, mody, modz) do does it just get the relative displaced by x amount of cordinates
Yes
ahhh okay
that'd be difficult to find out tbh because being knocked back or other things that indirectly move hte plyaer would be impacted as well
then their velocity would be 0 as they're neither accelerating nor moving
well technically they could be accelerating with out yet affecting velocity, but that'd be very nieche. I don't know if that is possible in minecraft
That?
yeah pretty much
Ok thanks
why isn't y in player's velocity 0 when standing still?
I dont have any potion effects applied or anything
I guess if y was 0 player wouldn't be able to jump? is that the jump "boost" value? or is that gravity?
Because of how the Y velocity is calculated
yVel(t) = (yVel(t-1) - 0.08) * 0.98
This might be the wrong place to ask, but is it possible to customize a Spigot store page by using HTML?
Thanks
The 0.98 is a little bit off on some older versions but the general y Velocity is -0.0784 wjhen standing still
This is the formula for falling
As there is no previous "off ground tick" (which is the "t")
This is the recursive formula up until the 6th air tick
Since arithmetico-geometric sequences have explicit formulas, we can build non-recursive functions to calculate simple but useful results, such as the height of the player on any given tick, or the distance of a jump in terms of the initial speed and duration.
Definitions:
v
0
...
And here is 7+ air ticks
https://youtu.be/KPoeNZZ6H4s?si=g2o2RoJx6_sGDLl6&t=420
I find this a cool resource
It's been a while since the last video hasn't it? I've made quite a bit of progress since the last update, and since one of the things I worked on was some procedurally animated characters, I decided to make a video about the subject. In particular, this video highlights the entire process from initial motivation, to the technical design, techni...
when working with a 3d array it goes like
int[x][y][z]
right
If that’s how you ordered it then yes
erm well I hope that's how I order it
Ig we'll see
int[][][] x
Whats T
I need help creating a project. So, I want to create a config system like the mmoitems skills example:
ability1:
ability2:
and I want the plugin to detect that there is 1 or more abilities, which can be omitted from the config file. At the moment I want to create a system that through a file a user can create items (taken via id from the oraxen api) and that for each item there is an id and a boost value like "1.5". I would like the file to be structured like this:
items:
1:
oraxen-id: "test"
boost: "1.5"
2:
...
...
And that a user can add as many items as they want. Anyone know how to do it?
That is a lot of work, I'm making a similar project myself. I store a UUID in the item and connect that UUID to essentially a list of abilities via a hashmap.
Obv I use wrapper classes and have a custom made structure for it all, but essentially that is how I do it
butIf I create a class, with a constructor. And I run the constructor for how many items there are, changing the arguments inside it?
wdym you create a class with a constructor? You can might as well say you write code. Do you mean like a container class for a list of abilities?
Why a uuid and not just a string
I could, but that would require that all names are unique. Say an admin made different loot box or whatever idk and wanted to call them all loot box or smth? It's dumb but they can. Also, using "invisible" uuids instead of customizable names allows me to guarantee that names do not clash or that dumb bugs appear
As all editing is done via GUIs (no configs ever) they don't need to know the uuid anyways so
just like this
?conventions
It also improves performace? Although insignificantly. As the item id has to be linked to the corresponding list of abilities sometimes hundreds of times a second using .equals() on a uuid is faster than using .equalsIgnoreCase() on a string
Oh yeah, im dumb lol
Well I guess that will technically use .equals, but yeah
Anyways, it seemed simpler to use an "invisible" uuid than a customizable name
The user can not see a difference, apart from the fact that there are no naming restrictions for the items in game
I have my plugin setup in a way that there are what I call scripts. Each item is linked to one or more scripts and when activated the script executes a list of abilities. So I'd suggest not doing what you've done here, and instead do a script class, map each id to a script or a list of scripts, and execute said script whenever you want them to
They are? 💀
hey how do you get a direction to which player is facing? eg.: EAST, SOUTH-EAST, WEST, etc..
nvm I figured it out
Entity#getFacing right?
Well somewhat :p
mmoitems items has theirs, eco has libreforge now
Well that's great
I did that before
But remade it to a GUI based pl
Was scared too many were doing yaml based
I mean
You can always have a gui for the yaml
It’s nice to have the direct file option for power users, it’s usually a lot faster
Ig
this is why ini files continue to be a thing
I am writting a plugin where I need to check the player inventory before he drops an item. The problem is that in the PlayerDropItemEvent the inventory is already changed. How can I check the inventory before the change?
Wait, why are you doing this? Cant you use the item from the event and the slot index to backtrack it?
I thought the event was called before change but ig not
but why u put NonNull on everything lol
Yeah literally
Just get the item(s) dropped
Or that if the slot is irrelevant ^
I cant just use the item dropped
You are trying to get the inventory before the item is dropped
Get the inventory, add the dropped item to it
= You have the inventory before item is dropped
in console?
but if on server, it should be at the start of the logs also, or maybe shown if u use like spark
yea
my favourite part about java -version is that -version and --version show slighlty different outputs
but why
u sure?
ah ur in the server
i said console
mye ma bad
didnt your host let you choose your java version
surely there's a setting for it somewhere
alternatively you can check the beginning of the server log
hi. what happened to the maven repository? why the snapshots repo no longer contains things like net.md5.bungeecord-chat? https://hub.spigotmc.org/nexus/content/repositories/snapshots/
there is something like https://hub.spigotmc.org/nexus/content/repositories/approved-sonatype-nexus-snapshots/, but it doesn't seem to work with maven either even though files seem to be there...
ok, with mvn -U it fetched the files from the "approved" thing. but I am still confused why is this a thing that's contradicting the docs like https://www.spigotmc.org/wiki/bbcode.8842/archive
Why @NonNull?
it can be null?
Yeah what if they press q on an empty slot
Is there a way with nms packets to render an entity at the players y-level continuesly, without having to teleport that entity over and over?
Basically follow the up-and-down movement of a player
Non null is pretty much the same as not null
well its true
but a event can be null?
The instance inside a listener probably not but the nonnull is probably so someone doesnt call method(null)
K thx
?learnjava! @lost matrix
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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif

Damn
ew new orange names
When I'm creating a class with methods how can i create methods with children, for example player.getLocation().getX()?
so that after 1 method i see more ?
they are good orange names
RandomStroll.stroll(0.5f) to 2
val mat1 = Matrix()
val mat2 = Matrix()
val result = mat1 # mat2
gg on helper, unless u had it for ages i aint notice

u2 conclube
Now ban some plebs
camel case name 🤓
conclubes had it for ages
well shit
coll is the other new helper
Ohoh
hey
what's a bigger operation, comparing Location's x,y,z and world variables or comparing an entire getLocation with other object
playerStartLocation and player.getLocation(), Yeah pitch and yaw doesn't matter..
only x y z world
Should I write more code and compare these values instead?
It’s an easy way
doesnt that have to go through both location and block
You can also just compare blockx y z and world
Ok nice thx
Hmm, this seems like an xy, why do you need to be super efficient with this?
Comparing two locations with .equals is not that bad. It does depend on how much accuracy you need tho as they must be identical
I like efficiency xD
I doubt these have any impact on performance
In order to compare location objects you need the xyz to be ints and not doubled or floats otherwise you will have lots of locations that wont match even if its essentially the same spot
yes
getBlockX,Y,Z I've finished the class :D
And if we are going to go that route i will turn these into binary and do a bitwise compare

