#help-development
1 messages ยท Page 2270 of 1
.minecraft/logs/latest.log
[02:01:05] [main/INFO]: Connecting to 127.0.0.1, 25565
[02:01:06] [main/INFO]: [CHAT] Bienvenido/a a Topo PR3C14D0
[02:01:08] [main/INFO]: Stopping!
[02:01:08] [main/INFO]: SoundSystem shutting down...
[02:01:08] [main/WARN]: Author: Paul Lamb, www.paulscode.com
literally
xd
now worked
ah
i have no clue
this is an ancient version
im not gonna look at the obfuscated code
xd
ye
any good motd generator?
?paste
can someone take a look at my code and tall me if I did something terribly wrong?? This broke my server...
your while loop will never exit
Single thread, you can't wait for things to happen
but when there is no one in the ArrayList the while loop doesn't do anything...
right?
make a condition for breaking
thx
once two players are incombat your server will lock up and die
but that is not motd gen
yes.. that's what happened lol
it gives you a chat componetn you can use in motd
so just make a break condition when no one is in the array?
._.
I have an item that players can create that will allow them to fly so wouldn't they just be able to overide it and be able to fly again?
that's my problem I had when I first attempted doing this...
your combat terminates after 60 seconds
that sounds like an issue you need to solve
It can only be fixed, if something is constantly being appliead to overrull them from turning flight back on...
at least i know of..
sounds like you need to put in some sort of internal access
like isInCombat
and your item can look at that before making changes
I could do something like this...
Change your while to if.
Put enable flight in the runnable when combat ends.
Don;t have your item enable flight, only set flying IF flight is enabled.
Thank you so much!! that did work. idk why I was making things so complicated... Now it is just time to make everything look good..
is there a function for getting a players head? i'm not seeing it anywhere in docs
Wait i forgot, can i ask for paid plugin devs here
What you need?
how do you register events after servers startup..
getServer().getPluginManager().registerEvents(PUTEVENTHERE);
no.
not that
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
what are you looking for?
basically, thats meant to be used in public void onEnable, it doesn't work.. Basically its a GUI menu. I can get it opened but because i have an argument in the constructor for a Player object, i cant use it in the onEnable because it will try to open the GUI on startup for null player and then fail to enable the pluigin. I am trying to register the event when a command is executed but putting this getServer().getPluginManager().registerEvents(PUTEVENTHERE); on command execution doesnt work either. So basically in the end i have a menu that can be opened but players can just drag objects around, close it and get more into there inventory
Can WeakHashMap's have duplicate keys?
that inventory setup sounds way too complicated for no reason
yeah...
yeah,but i plan to have multiple pages, because its a report menu
why are you registering an event with the menu?
not sure if i can make that ll in one class
make them separate
It's more organized as well
im trying to make it where, there is one command class, and multiple other classes for screens
i am trying to have them separate
โYou have insufficient privileges to post hereโ
bruh, who though it was a good idea to not allow file uploads
virus?
You just need to verify
oh
brain
Dont name your classes ...Class
FirstScreen, SecondScreen, ThirdScreen are horrible names for classes.
Not very descriptive.
How can i post
If i dont have privileges
get involved in the community
theres other forums to post in
reply to messages, etc (just dont spam)
I have a plan, to complicated to explain rn. All i need to figure out now is how register the events in FirstScreen when executing ReportCommand
?xy
Asking about your attempted solution rather than your actual problem
you're not telling us really anything
this seems way too much to achieve something simple
oooh so mysterious
Dont register listeners on runtime.
Only once when the server starts.
i have another idea
what's wrong with registering listeners post runtime?
not trying to be snarky
just question
no need to mock me, im just trying to get this finished soon, and i only want to get an answer on how to register events post start. It's either a yes (here's how), or no (and i say alrighty)
Quite expensive and sign of bad design. There is no need to dynamically re-establish an interface (in the api sense, not abstraction)
because once you listen to an event you have established your connection to it.
Every time you register an event, the registered listeners have to be rebaked
i should know this, i literally just made a pr in this LOL
lol yeah
ah yes throw those listeners into the oven like a good baker
pretty sure it was in that very method
baked?
once again this is one of those things i personally havent really done before but always nice to ask
Go through all the Listener instances, find their event handlers, sort them by priority, etc.
so what i am asking for is "technically" possible then
You should abstract GUIs away. This is what most people do that write a bit more advanced plugins.
One listener per event and a gui registry that scales O(1) with the amount of GUIs.
Want me to give you a quick mock up on how to achieve this?
yes plz
i am a complete tard when it comes to mc plugins. Just switched over from c# .net core web dev, which i guess is a bit easier than not knowing anything at all, but still fucking up left and right......
Well yes, use registerEvents like you normally would
to unregister a listener use HandlerList.unregisterAll
im assuming that wouldn't be very resource friendly tho... if i did it every time a cmd was executed
i mean once again you're not really giving us the full picture
so we dont really know
if you're just registering one listener with like 2 events in it, it probably will be fine (allbeit still not the best thing)
so should i just shove the GUI into where the CMD's are?
what
nvm, i dont want to confuse you further..
I would make an interface that your inventories use that have necessary methods that mirror the events you need
have a main controller that listens to these events
in in that controller call the respective methods in the active inventories
So here is the highest abstraction layer that made sense to me right now:
public interface IMenuHandler {
Inventory getBukkitInventory();
void handleTopClick(InventoryClickEvent event);
void handleBottomClick(InventoryClickEvent event);
default void handleClose(InventoryCloseEvent event) {
}
}
First question was: "What does a Menu react on?"
Here is the singleton that hosts your open menus:
public class MenuManager {
private final Map<Inventory, IMenuHandler> handlerMap = new HashMap<>();
public void register(IMenuHandler handler) {
handlerMap.put(handler.getBukkitInventory(), handler);
}
public void unregister(IMenuHandler handler) {
handlerMap.remove(handler.getBukkitInventory());
}
public Optional<IMenuHandler> getHandlerOf(Inventory inventory) {
return Optional.ofNullable(handlerMap.get(inventory));
}
}
optional very useful
K
dang you wrote that up pretty quick
And here is the listener for it:
@RequiredArgsConstructor
public class MenuListener implements Listener {
private final MenuManager menuManager;
@EventHandler
public void onClick(InventoryClickEvent event) {
Inventory primary = event.getInventory();
menuManager.getHandlerOf(primary).ifPresent(menuHandler -> {
if (primary == event.getClickedInventory()) {
menuHandler.handleTopClick(event);
} else {
menuHandler.handleBottomClick(event);
}
});
}
@EventHandler
public void onClose(InventoryCloseEvent event) {
menuManager.getHandlerOf(event.getInventory()).ifPresent(menuHandler -> {
menuHandler.handleClose(event);
menuManager.unregister(menuHandler);
});
}
}
Now you will only have to register your listener once.
After that you simply implement the interface IMenuHandler.
And use it like this:
public void openSomeInv(Player player) {
IMenuHandler handler = new YourHandlerImplementation();
menuManager.register(handler);
player.openInventory(handler.getBukkitInventory());
}
5 million IQ, only I would have used InventoryView instances > Inventory
why differentiate between MenuManager and MenuListener
Separation of concerns. You never want to pass around Listener instances.
lol, ur able to make an entire plugin inside your brain bro
I'm learning lots today.... ive always passed around instances of listeners ๐
He's like make 50 plugins just by helping in this channel
I feel like 7smile7 has been around long enough to know a couple things ahaha
Are you calling him old
i mean
Me personally

and transcribe it into code
his brain: "these stupid ammatures"
like i essentially laid out the plan here
he managed to put it into code though haha
I guess ive just done this quite often now.
public class LevelToHealth implements Listener {
@EventHandler
public static void onLevelToHealth(PlayerLevelChangeEvent event){
Player player = event.getPlayer();
if(player.getLevel() >= 20){
Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).setBaseValue(Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getBaseValue() + 1);
player.sendMessage(ChatColor.GREEN + "Granting a half a Heart every level");
}
}
}
I understand that this keeps going on on and on, but Is there a similar way of doing this, but it stops granting health after level 60, and wont grant health if they have already achieved this level aka level 22 ( goes and enchants now level 18 ) they get to level 20 again and they are granted an additional heart..
I don't know if this is viable and not really looking for a solution more looking for a shove in the right direction..
Is there a straightforward way to set an event priority based on config value? Obviously just when the plugin first enables and I register the event
You can somewhere maintain a persistent Map<UUID, Set<Integer>> so you can keep track of when a player already reached a level once.
But levelups happen so rare that you can as well just store an int[] inside the players pdc and be totally fine performance wise.
do you have a resource for persistent maps?
I just mean a Map of which the content is persisted when a session ends.
mhm okay
Player joins -> you load the data into memory
Player quits -> you save it back do disk/database
alrighty, thank you
Not a "straightforward" way i can think of. Annotation attributes need to be constants.
String rawURL = MiniMessage.miniMessage().serialize(e.message());
int messageLength = rawURL.length();
String shortenedURL = messageLength >= 32 ? rawURL.substring(0, 30) + "..." : rawURL;
Would this be a good way to shorten an URL a user pasted into the chat?
if you're not interesting in actually preserving the data i guess. this would work with any string honestly not just urls
Use one of those url shorteners that give you revenue for each click 
he's not even shortening the url, he's just truncating to the first 31 chars
The actual URL is saved as it is pasted, I just want to send the player a message back that the url [URL] was accepted and there I don't want to paste the whole URL as it makes the message ugly
ah.
I think he should at least create hover component that shows the whole url
It's in an action bar which lasts like 2 seconds
So you cant even click on it...
Sounds quite useless. "Hey here is a nice url. But only half of it and you cant open it."
Nooo let me explain in more detail :D
I ask the user to input a valid URL containing an image
and after he did it and the URL was valid (contained an image) i notify him that the URL he provided was accepted
and in that message i put the shortened url if it is too long
Makes sense. No need to show the user his own full url then.
what arguments am i supposed to provide for a namespacedkey
yes! that was the plan. Since action bars can go out of the visible screen I want to keep them quite short even if the URL is very long
?jd-s
@winged storm
What do you not understand
Whatever the javadocs tell you ๐
ideally you can also download a sources jar
i dont understand what the javadocs are telling me though
hey, so dont call me stupid but if I understand correctly, an example of abstraction is as follows: Lets say there is Vehicle, and a class called HondaAccord. HondaAccord would be the abstract one? The absract just builds on top of something existing
key - the key to create
An instance of your plugin and a String representing your key
other way around
Vehicle would be the abstract class or interface
like this?
HondaAccord would implement/extend Vehicle
If your plugin was called foobar and you wanted to make a namespace "foobar:baz" you'd pass in your plugin for first arg and "baz" for second arg.
Uh oh...
yeah thats what i meant.. i just didnt know which one was considered abstract. Thanks! ๐
yep
Also kinda unrelated but I don't actually know what namespaced keys are even used for in a plugin? That's just because I'm big dumb though
your implementation would be HondaAccord
i dont read books, last time i did was 9 years ago
rather, HondaAccord would be an implementation of Vehicle
so if someone tells you to "implement something" they may mean extend/implement another class
or "create an implementation"
How did you survive writing C# web backends without tons of abstraction? XD
(of course, implementation has many meanings... requires some context)
NamespacedKeys are minecraft's namespaces
uh oh?
we mainly use them for persistent data containers
it allows spigot/minecraft to uniquely identify where a piece of data is coming from
so like commands and what else?
and it allows you to reserve a piece of data
no... not realyl commands
like in NBT
oh i just thought commands because you can type stuff like /minecraft:tell to specify plugin
no that's different
similar idea, but completely different
we use plugin.yml for that
is it possible to make a crafting recipe call for multiple items? like 2 diamond blocks in each corner and 5 gold blocks for the rests to make 1 item?
"well yes but actually no"
well i mean
its a good observation
and it uses the same pattern
but namespaces are not used in commands
yes
So you're saying I can actually store custom data in mobs and stuff now? I've read the docs on namespaced keys but it focuses more on how to create one rather than what you can do with it afterward...
okay!
yes with limitations
do you have a good link for obtaining this forbidden knowledge? :D
?pdc
cheers
how do i get the instance of my plyugin
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
so true
I've always just done static MyPlugin instance and set it on enable but that might be bad practice?
an OOP elitist may deem static use to be frowned upon
most servers do that, dw
in the end as long as u can get ur plugin
u still get ur plugin
so if it aint broke, heavily consider if it needs fixing
I've always viewed OOP as a tool for use in conjunction with functional programming anyway
most plugin devs are also very inexperienced and dont know what they're doing
you should follow the article on dependency injection
sounds scary, its not
When its getting the instance of a plugin, it really doesn't matter, when it's literally everything, thats when its an issue
will do.
sure, nothing really matters if it all works
so therefore its not worth to have good practice
The article looks like an extremely verbose way of saying "Pass your plugin in child class constructors instead of accessing it statically"
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
well yes, but its always good to have a reason why
fair
you don't wanna remember a specific instance of an object where it doesnt matter, which is where static abuse comes from
@vagrant stratus its Slava Ukrainie, not Ukraini
static abuse is more than that
as the article mention, any unit tests that relies ona singleton pattern can easily break
exactly, everything more than that is static abuse
what you should be saying, is "the way newbs use static is often bad"
im not saying that though lol
idk why the heck it's called dependency injection though lol
because its kinda what it is
dependency injection
you have a dependency and injection
but is your own plugin a dependency on itself??
you're injecting something a class needs into it when its created, injecty
its the fancy way of saying constructor thingy
because many people tend to think of constructors that use many different instances
in this case, our constructors use an instance that is meant to only exist once
by use, i mean its parameters
this is not appropriate here
@idle pier you in the wrong channel
;|
man just wanted to share his music
#general
no u ^
I'm making a pig shooting gun and I was wondering what the best way to go about tracking the pigs movement would be. How can I track when the pig hits a block and then create an explosion?
an interesting way to do it is to disguise an arrow as a pig then detect ProjectileHitEvent
otherwise i dont really know a simple way
Hm I could, but I feel like I've seen a much better way of doing it in the past somewhere
ive seen it done by getting the blocks immediately around the pig on a timer and cancelling it causing the explosion when it gets near enough to a block, but that might be intensive
you could go the yandere simulator route of programming and check every tick :3
but like mart said, disguising a projectile as a pig is the best idea since it already has that landing mechanic
I'm just going to make a runnable that crashes my server at this point xd
Alright cool thanks I'll do that
i wonder if that's how essentials kittycannon implements it
essentials is not the best role model
well yeah but
nah it doesn't depend on it, pretty sure essentialsx is open source
the cat just blows up after a second
oh T_T
healer.setIngredient('W', (RecipeChoice) FeederUtils.createFeeder());
java.lang.ClassCastException: class org.bukkit.inventory.ItemStack cannot be cast to class org.bukkit.inventory.RecipeChoice (org.bukkit.inventory.ItemStack and org.bukkit.inventory.RecipeChoice are in unnamed module of loader java.net.URLClassLoader @2e5d6d97)
Isn't Recipe choice how you use custom items to make another custom item?
oh IntelliJ just auto casted it...
can anyone help me with this? it's not related to spigot but this happens a lot
Failed to delete C:\Users\--------\Desktop\Code\Wired\target\maven-status\maven-compiler-plugin\testCompile\default-testCompile\inputFiles.lst
It makes me manually go and delete it...
Super dumb question, but how would I send a message to everyone?
Bukkit.broadcastMessage("Test"); It says java 'broadcastMessage(java.lang.@org.jetbrains.annotations.NotNull String)' is deprecated
Yes, 1.19
thats why
paper wants everyone to use adventure text components instead of strings
Oof, I can't use that in my instance lol
Yes and no... we plan to have it switched to spigot every update, hence why I can't really use adventure
ah
i say use what you always want to be compatible with
so if u want to ensure spigot support use org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT
Okay, thank you!
any reason this is giving a illegalargumentexception for "not a json object" with gson? looks like an object to me https://paste.md-5.net/lomaparoda.json
code:
File file = plugin.getLoggerFile();
try(JsonReader reader = new JsonReader(new FileReader(file))) {
JsonArray arr = new Gson().fromJson(reader, JsonArray.class);
if(arr != null) for(JsonElement element : arr) logs.add(TradeLog.deserialize(element.getAsJsonObject()));
}
Thats a lot of base64
yep
ok fixed it by doing this incase anyone finds this problem in the future somehow
I haven't devved since 1.12... Custom items are a thing now?! How do I do that?
you create an ItemStack
to create the item ofc.
then I make a shaped recipe, then add it to the server making the result my custom item from the ItemStack
An item stack just represents a stack of an existing vanilla item, not a "custom" one. Don't get my hopes up like that ๐
Yeah then you use Listeners add what you want to it... Make it have attributes.. whatever you want..
I have an item that you create with a custom Recipe, when you right click it your saturation is full... aka a custom item.. cause that is not in Vanilla minecraft.
OK I thought you meant like, it had its own item id or something
Well it does but has more functionality then just that.. can make it do whatever you want..
Like I have a bunch of bows on my server that do a bunch of stuff, Like summon lightning on the target, as well as one with a tnt bomving, blows up 16 tnt on the location the arrow lands.
So the client sees minecraft:bow but it's different on the server side?
What I'm confused about is the actual part where you define the new id
wym by new id? like modded items with their own ID to use with /give ?
Well you keep saying your bows are different, but how are you identifying whether it is vanilla bow VS your bow
well normal bows don't summon lighting...
and using a name..
i set a display name then check if they are shooting a bow with that name
and if they are, do whatever the bow is suppose to do
Okay so just item/lore checks then. Hasn't changed from 1.12. I thought you were talking about some new feature
Like storing persistent data in the item stack or something
I only started doing this around 1.16
I am having trouble saving an arraylist of UUID's to a JSON file. The list in the file remains blank. https://paste.md-5.net/ozunanakub.cs
I am able to save a UUID to JSON just fine, so what is it about an ArrayList that changes things?
how can I make an entity (baby villager) jump on a Player entity, want to make it look like its kickin the player in them ballz
How do I change an entity on EntitySpawnEvent
bro wtf
wdym bro
solved btw, just cancelled the event and spawned the entity there
how do i setInvul to EntityWither? I have tried with this method but it didn't work
What does setInvul do?
it can set Wither size on Normal vanilla command
Didn't know Wither have size.
in the vanilla command I can make the wither size bigger than usual. well here I want to find out so I can make it like that in nms.
Are you sure 1500 is the valid value?
Maybe there is a cap so if it's exceeding the max value it's gonna be set to default.
ah i just found out about this one, its turns to normal size because it need to be higher value.
my bad
thank you
I am working on a plugin that uses a MySQL database to keep data consistent between servers, but instead of config/hardcoded password/user (since then hackers can in theory hack the server get the config file and read the login) I added made a php server handle requests. If I make a table with server ips and a boolean (ex 127.0.0.1 | true) meaning this server can access the user database and when pulling data just request server ip and if its true provide data
How secure would this be?
fmee fmoo
should I send emails asynchronously?
because I looked at my spark profiler and it was quite high
for emails*
If someone was to hack their server, and steal their data, how much use would a localhost-only sql server username/password be? I don't think your plugins data would be that valuable compared to the other data they'd have access to. Also, if it's IP based and they really wanted to access it they'd just send a request from the server machine. Not to mention that unless you apply some API key any plugin can use your new php database thingy
uh correct me if I'm wrong but even async threads shouldn't have a Thread.sleep() in bungeecord right?
If you're Thread.sleeping you're probably doing something wrong
Yeah not a dumb idea if they make requests to external io devices
Thats LocalHost. Not accessible to the outside world. Completely secure.
It becomes insecure once you use non local
locking to a specific IP is good though
however you should really have some kind of authentication
even if its somethign simple like SSL
Yeah, but if someone hacks your server and can access the config with the db details you've got a bigger issue than your plugins data
true
Why's this giving me a visual glitch on 1.16.5 at least?
what glitch?
Oh the null thing
getAttribute can return null if thereโs no attribute instance for the given attribute
not this one
the health is resetted but the client still sees the old value
until he takes a hit
anyone worked with snakeyaml ?
what is that
shouldnt you set the player health to maxHealth or something ?
just asking if you checked it or whatever
idk your code ๐
Oh @lilac dagger youโd have to set the normal health to the max health in case itโs above the max health
iirc
Sth like that is done in implementation at least
That shouldn't be required to just raise the max health.
For setMaxHealth
if he wants to keep the current health the same but increase teh players max
It "should" update the client
Well it has been required
Since the attribute api is a direct adapter api design to normal nms attributes
Is there a way to copy something to a player's clipboard?
Idk if they changed it tho
requiring to full heal a player to notify of a maxHealth change?
I guess you could set teh current health to max, then reset it to what it was, after teh client gets its update
Not fully heal
But if normal health exceeds max health, set it to max health
Or sth
i dont thnik so considering what that would make possible. The copy to clipboard from chat feature requires user confirmation too, so i doubt it
Idr the impl that well
That woudl be needed if you were reducing MaxHealth
Yeah
:(
Whichโฆ wellโฆ might be the case for freestyler 
I'm making a backpack plugin, what's the best way to storage items? Presistent data storage to store ingame then sync with database for every minute or something?
save when player closes backpack
no sync issues
database access too is not something that takes too long
Why do you need two data storages?
I'm just asking, to not make server killer with huge performance issues
Well first of all you probably just want a single storage source
well you wont call such methods too often so you should be more worried about corruption and desync than speed here
Whatever you use as moterius pointed out, direct save after an action is ideal as you can keep your storage most up-to-date
whats the need for a database
if its already in the nbt no point having it on a db
Ok so no pds ๐ฅด
Pdc?
PDC has a completely different issue
just use pdc exclusively
i mentioned this yesterday
someone pointed out PDC is part of NBT
as such it gets sent to the players
if the PDC gets too big you bookban the player
I donโt think public bukkit values tag gets sent, does it?
I recall that tile entitiy NBT does get sent
you do realise how much data has to be on it to bookban right
its A LOT
like you ahve to go out of your way to jam that much data onto it
Very well then
i managed to generate like half a MB of PDC on accident
trust me
i can manage to do that unintentionally
But yes PDC isnโt that vertically scalable probably
code better then lol
thats not a flaw with pdc
if i had the option of pdc and a db i would go pdc anyday
^ as long as you use it reasonably, then no issues should arise
see I'll just code save, store stuff in separate files, and not have that issue at all
Thatโs true
๐ธ๐ฌ
?
๐ฉ๐ช
๐ธ๐จ

๐ฟ๐ฆ
nope, most of the times the health differs from the max health one however the client still sees only the hearts before the max health has been changed
was trying to show my friend that poland indonesia and singapore are not the same flag
sorry guys
say i set the max health to 3 hearts then run those 2 lines of code where both max health and current health are 20, the client will show 10 hearts but only 3 hearts full
and if i take damage, even 0 it'll update
i think the sethealth function lacks an update health count
so the client knows
oh there is? ๐ฎ
Yee
Well idk when it was added but if youโre on a modern enough version that method should be accessible (:
uh
yeah ๐
not much help then
it's 1.16.5
should be pretty recent
i guess i gotta use nms for it then
finally
it seems craftbukkit has sendhealthupdate in 1.16.5 just that it isn't to bukkit ๐ฆ
I PR'd this to paper in 1.18 I believe
?api
?jd
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
wow
?h
can anyone show me a way how hypixel skyblock does their health system? they have lots of hearts on the action bar ( need to know how to do ) little to none on the actual hearts ( also need to know )
My server is getting people with close to 200 health, and hearts are getting in the way of the screen and they need fixed...
Spigot has heart scaling api
yea just use that ^
As for the actionbar simply use chat component api
when using that you can make 20 hearts worth 200 for example
nah gralde betetr
alr
also wtf is this
use a hashmap
or smth
one of the fastutil maps
bet its faster than this
how do i pr smth
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
i got the jira access
it tells you in that spam how to pr
what
im looking at adding a tonne of entity api, but need to do it cleanly lol
will give them a read
is this just like sending a player message but changing it to the action bar?
OKay and im just getting confused here...
spigot.sendMessage(ChatMessageType.ACTION_BAR, new String[]{ChatColor.RED + player.getHealth() + ChatColor.GREEN + Objects.requireNonNull(player.getAttribute(Attribute.GENERIC_MAX_HEALTH)).getValue()});
IntelliJ is telling me to add a contract for the getAttribute?
Well that's not a chat component
Anyways it's just that Intellij doesn't know if the attribute will exist on the player
Yeah, well I don't know what you mean by component, I'm using the spigot API component for sendMessage, and I can only see using ChatMessageType.ACTION_BAR
Can bounding boxes be rotated?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
No
im trying to contribute to CraftBukkit, but maven cant find the bukkit api dependency
i cloned it exactly from the https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse repo
its declared as
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
and it says its trying to resolve org.bukkit:bukkit-api:jar:1.18.1-R0.1-SNAPSHOT at minecraft-libraries (https://libraries.minecraft.net/), but it cant find it
<modelVersion>4.0.0</modelVersion>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<packaging>jar</packaging>
<version>1.18.1-R0.1-SNAPSHOT</version>
<name>CraftBukkit</name>
<url>https://www.spigotmc.org/</url>
``` this is the project configuration i cloned
is it in your local
there we go then
thats cause it tries local first, and then the repos
install it to local, and then try cb
alr
You should be using BuildTools for contributing to CraftBukkit
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Read ^
it says nothing about buildtools anywhere lol
except at the end for testng
Read this
although that says not to use buildtools
u need to run it
for source projects
then u good
kt hanks
you just need the decompiled jar for applyPatches
Hey, what's the best way to store multiple objects with a single uuid?
I wanna store a list of objects for each player

of objects
do NOT store the player object
UUID, SomeObjectContainingStuff
This
i mean like player data object
not the Player
but like some PlayerData
Is there no easier way to just store the Map? ๐ค
I tried doing sql stuffs but damn that is complex lol
Doing that isn't exactly hard though ๐ค
you could use something like mongodb
for storing more complex objects
also pretty simple i think
I mean, mongo isn't that good is it?
I saw how it looked and it's not exactly tidy.
?
@EventHandler
public static void onHealthChange(EntityRegainHealthEvent event) {
if (event.getEntity() instanceof Player player) {
Player.Spigot spigot = player.spigot();
spigot.sendMessage(ChatMessageType.ACTION_BAR,
new TextComponent("" + ChatColor.GREEN + "" + ChatColor.BOLD + "Health: " + ChatColor.RED + "" + ChatColor.BOLD + player.getHealth() + ChatColor.GREEN + "" + ChatColor.BOLD + "/" + ChatColor.RED + "" + ChatColor.BOLD + Objects.requireNonNull(player.getAttribute(GENERIC_MAX_HEALTH)).getValue()));
}
}
@EventHandler
public static void onDamageHealthChange(EntityDamageEvent event){
if (event.getEntity() instanceof Player player) {
Player.Spigot spigot = player.spigot();
spigot.sendMessage(ChatMessageType.ACTION_BAR,
new TextComponent("" + ChatColor.GREEN + "" + ChatColor.BOLD + "Health: " + ChatColor.RED + "" + ChatColor.BOLD + player.getHealth() + ChatColor.GREEN + "" + ChatColor.BOLD + "/" + ChatColor.RED + "" + ChatColor.BOLD + Objects.requireNonNull(player.getAttribute(GENERIC_MAX_HEALTH)).getValue()));
}
}
Anyway to make this always show?
is there a way to easily close all open files in intellij
Right click: close all
right click on the file name at the top
What ? ๐
I've criticised someone for using it before as it didn't seem tidy
You will need to keep sending it every few ticks
?scheduling
^ read this
if something internal only has a getter, but no explicit setter as it is done from within another method, should i include a new setter for the api or just the getter
i could extract the setter but that would increase the diff
by like quite a lot
missing entity API
specifically, setting a wolf to wet
there is a isWet()
but no setter
Wouldn't having a setter be a good addition
Assuming it works when called in a plugin
not sure what this byte is
Probably the event packet id
I forgot which one
for mc protocol
I don't have access to my PC for a while so I can't help you find it
Anyways setting the wolf to wet would just cause it to shake off water
So maybe a setter isn't the best idea
Does any1 have equation for horizontal helix?
can't find it anywhere
Just a circle with a third linear distortion
ye but thats vertical
i want horizontal
pfft just that easy
so flip it
^
i suck at math but somehow managed to understand that damn i feel smart

You mean in the direction the player is looking at?
ye
Hm. I would get the normal of your direction vector and rotate it by using the direction as an axis. One moment
for(double y = 0;y <= 50;y+=0.05){
double x = radius * Math.cos(y);
double z = radius * Math.sin(y);
w.spawnParticle(part,(float) (loc.getX() + x), (float) (loc.getY() + y), (float) (loc.getZ() + z),0,0,0,0,1);
}
``` this is what im using
works fine for vertical
Hey! My plugin depends on the Multiverse-Core api and it does work on my local server, but how can I export the jar to my main server. Does the dependency break, because the path is different?
name for the method describing whether the warden is going into or out of a block? isDiggingOrEmerging ?
thats the nms name
main server also needs the dependecy
Wdym the server needs it
Main server requires Multiverse
can i make a substraction between bigdecimal and an integer?
in /plugins folder
Dependency on your code is like an interface. Export the plugin without building mvcore on it, put the plugin on your server and also put mvcore in it
I don't understand what you'd like. Can you describe the movement precisely (by mentioning the axes) ?
k ig. Thx
If you convert the integer to a BigDecimal
I would like the Z axis
I currently have this:
but I want it to be horizontal ( z ) not y
You dont want it to be horizontal. You want it to be relative to a dynamic axis.
so how do I adapt my code to it?
Im thinking. Just wrote an exam so i might send some poop code in a minute.-
How to? Because intellij surely wont recognise the path of the depency because it's on the server
yeeey poop coode
How did you import mvcore ? Maven ?
use maven dependecies
ye
Then just maven build your project and it will all be fine ^^
nice, appreciate it!
Wow this is parabola's
How do you usually build your plugin?
I have always wondered why parabola's exists and where do i use that
double rotateZ = Math.toRadians(loc.getPitch() + 90);
double rotateY = Math.toRadians(-loc.getYaw() + 90);
Vector rotate = new Vector(x, y, 0);
rotate.rotateAroundZ(rotateZ);
rotate.rotateAroundY(rotateY);```
man 
This is ununderstandable ๐๐ quick draw?
spigot resource :DD
you can adjust the + on Yaw to do the rotation aournd origin, vertically
link?
This is really useful to solve many equations;) (and they're only a named representation)
Hey, ive been trying to figure out how to use permission and add them correctly into the plugin.yml. Can anyone send an example of how they do it?
You dont need to add permissions to plugin.yml
Simply use Player#hasPermission
Or use the vault permissions checker
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thanks all working now
Please do
adding perms to the plugin.yml is the correct way to handle permissions
under each command just add a line permission: your.command.permission
This rather large tutorial aims at getting you started with plugin development in Bukkit. It is in no way a complete tutorial of all possibilities in Bukkit, but rather a general overview of the basics. It starts with making sure you understand Java, sets up your workspace in an IDE, and introduces the essentials of most Bukkit plugins. These tu...
Yeah what you said isn't registering it with code
Spigots never handled permissions before? Whenever ive added permissions to plugin.yml it never did anything, simply found it a waste to add it IMO
Always had to handle permissions myself with vault/Player#hasPermission
If permissions are not correctly added to the plugin.yml permission plugins can;t detect them
do you think bukkit devs will accept this in a pr?
Fair enough then, i never really noticed anything about it when setting that, plus i normally don't use bukkit's command handler so havent touched that file in a while
anyone knows what's the spigot-api (player times joined) class
Statistic
yes
?jd-s
Use the statistic class
declaration: package: org.bukkit, interface: OfflinePlayer
yes but where the player times joined exact class
I actually dont think times joined is a statistic but time played it
I dont see the keyword "joined" in the docs page when ctrl + f
any idea
how is this named?
I would like to make a resource on it but idk the name
x-files
aaand this?
x-files intro plays
last image wont load for me sad, i hope its another x files pattern
Ah sounds better
i would rather interact with my own api methods with strictly reflection than deal with any of that math
for (int degree = 0; degree < 360; degree++) {
double radians = Math.toRadians(degree);
double x = Math.cos(radians);
double y = Math.sin(radians);
double z = Math.tan(radians);
Location loc = at.clone();
loc.add(x,y,z);
World w = loc.getWorld();
w.spawnParticle(particle,loc.getX(),loc.getY(),loc.getZ(),0,0,0,0,1);
}
``` for 1. one
Eh had to learn it in school anyways so ๐คทโโ๏ธ
i can do basic maths but that stuff no thank you
emm how do I create resource on spigotmc?
Should be a button in your resources page
public List<Location> spiral(Location start, Vector direction, double spiralRadius, double deltaForward, double deltaAngle, double distance) {
List<Location> list = new ArrayList<>();
Vector normal = new Vector(direction.getY(), -direction.getX(), direction.getZ());
normal = normal.normalize().multiply(spiralRadius);
Vector dir = direction.clone().multiply(deltaForward);
int iterations = (int) (distance / deltaForward);
for(int i = 0; i < iterations; i++) {
start.add(dir);
Location pos = start.clone().add(normal);
normal = normal.rotateAroundAxis(direction, deltaAngle);
list.add(pos);
}
return list;
}
Big blue button that says add resource
tysm
Or smth like that
ye but thats for completed plugins
I would like a post
Ah its in forums named create thread then
You need to go into the right category first
then buttons there, its around same position for every catagory
oh right got it
avatar state
i feel like this man could rewrite the entirety of minecraft in between discord messages
Btw just discovered a bug with this method. You might need to play around with the normal vector...
Just try to calculate a perpendicular vector to "direction" and save it in "normal"
Im using Maple. But there are some others that are good. WolframAlpha. And Geogebra is decent.
how about a link to Maple
?bing
maple is paid
Bing your question before asking it:
https://www.bing.com/
would like to check it out
lol...
okay but why doesnt it actually link to bing lmao
?quora
Google your question before asking it:
https://www.google.com/
?ecosia
?duckduckgo
oh geogebra is what I was hoping for thx
?yahoo
?yahoo
dang
only bing and google thats gotta be racist
Its kinda meh
Alternate solution: Shove numbers in until it works
sorry, I only use WolframSigma
wasnt there also a minecraft cheat called wolfram
a lot of things are named wolfram ngl
wolves
A metal for example
its "tungsten" but in german
just realised im a press piece of poop at mathematical functions..
Yeah tungsten is wolfram in german
Wha isnt tungsten a metal?
yes
So then how do you say tungsten in german?
the german word is "wolfram"
wolfram
Wolfram in periodic table is also metal
wtf
wolfram = tungsten
my first message may have been confusing
It was i see now its reversable
wolfram is the german word for "tungsten"
what the fuck is a fireball fireball
oh I forgot I remembered Czechian "mapping" of periodic table
what the fuck is that syntax
a mini fireball. the child of another fireball
The symbol for tungsten is "W"
No idea why english needed to be extra and call it tungsten.
Wolfram sounds so much cooler
and what nms entity is a CraftSizedFireball
I still find tungsten quite funny. Tung means heavy and sten means rock in Swedish
So heavy rock
is that the fireball fireball
"hehe heavy rock"
Very nice
Isnt Craft ketword reserves for ItemStack
or similar
?
So it would be the fireball you right click with?
nah
fireball can be sizeable. Ghast fireball is way bigger than the craftable fireball
yeah that makes sense
how do i use a library with a broken maven repo
but is that the fireball fireball nms entity
Craft is often used to define CraftBukkit classes
Ahhh that makes sense so there must be GhastSizedFireball then
so this might be Bukkit implementation of NMS class designed to hook into Bukkit API
EnderDragonSizedFireball
Should be able to checks it hierarchy no?
Would assume it would extend the smaller fireball if so
or a method in that class that creates fireball fireballs
ScoreboardLib
you use gradle and have jar?
i use maven
i know how to do it in gradle ez asf
and i dont have jar
You can install the jar to your local maven
yo i'm having a trouble a bit with sqlite and i can't insert data's.
here's what i wrote at all.
CREATE TABLE IF NOT EXISTS kbffa(uuid CHAR(36) PRIMARY KEY NOT NULL,kills INT(20) NOT NULL DEFAULT 0,deaths INT(20) NOT NULL DEFAULT 0,elo INT NOT NULL DEFAULT 0,maxkillstreak INT(20) NOT NULL DEFAULT 0,balance INT(20) NOT NULL DEFAULT 0,selectedCosmetic VARCHAR(30) NOT NULL,selectedTrail VARCHAR(30) NOT NULL,selectedKit VARCHAR(30) NOT NULL,ownedKits MEDIUMTEXT NOT NULL,ownedCosmetics MEDIUMTEXT NOT NULL);
INSERT OR IGNORE INTO kbffa(uuid,kills,deaths,elo,maxkillstreak,balance,selectedCosmetic,selectedTrail,selectedKit,ownedKits,ownedCosmetics) VALUES(?,?,?,?,?,?,?,?,?,?,?);
oaf finally
i dont have the jar doe
Build it?
that's a longass query
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
After installing it you can import it normally without a repo, just put it in dependency tags
Use first command on top
its 2 i think
Dpackaging value is jar if you dont know value for that (if your using jars tbh)
oof
you add it locall then import
i dont think u need to add it locally tho
same with gradle but its super easy in gradle
surely i didn't execute those all in once
to ur maven repo
yes
CREATE TABLE
IF NOT EXISTS kbffa(
uuid CHAR(36) PRIMARY KEY NOT NULL,
kills INT(20) NOT NULL DEFAULT 0,
deaths INT(20) NOT NULL DEFAULT 0,
elo INT NOT NULL DEFAULT 0,
maxkillstreak INT(20) NOT NULL DEFAULT 0,
balance INT(20) NOT NULL DEFAULT 0,
selectedCosmetic VARCHAR(30) NOT NULL,
selectedTrail VARCHAR(30) NOT NULL,
selectedKit VARCHAR(30) NOT NULL,
ownedKits MEDIUMTEXT NOT NULL,
ownedCosmetics MEDIUMTEXT NOT NULL
);
INSERT
OR IGNORE INTO kbffa(
uuid,
kills,
deaths,
elo,
maxkillstreak,
balance,
selectedCosmetic,
selectedTrail,
selectedKit,
ownedKits,
ownedCosmetics
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
It's one quick command
better
Or if it's a project install that
indeed, but will still work if you edit it slightly but like said its horribly non-reccomended
They keep saying its gonna be removed
i wonder when
Honestly i can't find anything that could break the insert code
is a CraftPigZombie (nms EntityPigZombie) a zombified piglin
.
primary key not null is redundant
Should be nothing else is named that
ill try
Any reason why you didnt specify a WHERE uuid=?
Also INSERT OR IGNORE seems odd
oh that actually exists
right
But the "OR" throws me off
i see some of my mistakes
hello everyone, is this the right channel to get help with code developpement ?
yes
thx omg
why
isnt ON DUPLICATE KEY IGNORE a thing?
^
jezus this is a pain
never realized how many entities minecraft has
gotta paste this in every class
wdym WHERE for insert?
or INSERT INTO IF NOT EXISTS lol
You can also do INSERT IGNORE INTO tablename
But why?
oh
to replace the if else mess used for getEntity
with a hashmap
which i think will be faster
IGNORE is much more short btw
because instanceof is pretty expensive and repeated if else too
The comment said that the order was very important
can I please see your usage?
since mine doesn't work at all
so my issue is ;
I have a plugin.yml file,
And in my main java class for my plugin, I have an int data, wich I want to store, and read from the yml, how can I do it ?
Instanceof is very cheap
yes because of the if else structure
You store data in external yml files no plugin.yml
if you check HumanEntity first it will always return human entity for players too
yea ok, but I just can't do it
https://www.spigotmc.org/wiki/config-files/
Use this guide for working with YAML files, you need to either use default config.yml or create a new one
I'll search more forums
oops
oh didnt know that
does it cache everything
every subclass
or superclass
INSERT IGNORE INTO users (PlayerID, Kills, Deaths) VALUES (?, ?, ?);
This will only insert for non-existent entries.
i mean
However do note
doesnt it check some stuff on low level?
Storing data in YML is normally frowned upon in here
ig
Better to use Json or SQLLite as a flate file storage
yeah but you still have to traverse superclasses unless its cached
But i would much rather do an UPSERT. Aka Insert + Update
mhhh
alright gonna try this oen
one*
Keep in mind that you cant update entries with this
im not
im using update for that
UPSERT is INSERT + UPDATE ?
thats nice
so inserting and if its exists updating?
Basically insert on duplicate key update
lemme check docs
