#help-development
1 messages Β· Page 1177 of 1
I mean, system design isn't easy to get on the first go, I can ultimately tell you what to do on a high level but that won't help you with the implementation details and all the gotchas around this
the goal is clear though, have a system which you can easily retrieve and store data across a network
depending on the amount of information you're planning to share, the ways to go about it will vary
if it is simple information like you're trying to do right now, maybe a database and a redis cache is overkill, using sockets would do
however if you plan to share a lot of information across the network, you'll ultimately stumble upon all of this anyway so may as well suffer now
fair enoughj
I'm having such an annoying issue
I have this class used to check names from my velocity plugin
this.getServer().getMessenger()
.registerIncomingPluginChannel(this, "xincraft:getname", nameChecker);```
its initialised like this
yet this never prints
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
System.out.println("Received message on channel: " + channel + ": " + Arrays.toString(message));```
however velocity literally says it prints
boolean successful = sendPluginMessageToBackendUsingPlayer(player, MinecraftChannelIdentifier.create("xincraft", "getname"), byteArray.toByteArray());
System.out.println("Sent player name to backend: " + successful);```
[22:30:29 INFO]: Sent player name to backend: true
wait I think im sending to the wrong server
I'm sending it to the player who was found not the one who requested
you need to send it to the player's server, not the player client
I thought thats what I did
public boolean sendPluginMessageToBackendUsingPlayer(Player player, ChannelIdentifier identifier, byte[] data) {
Optional<ServerConnection> connection = player.getCurrentServer();
// On success, returns true
return connection.map(serverConnection -> serverConnection.sendPluginMessage(identifier, data)).orElse(false);
}```
I think I'm just sending to the wrong server
holy shit I am
whoopsie
true
how do you get the weight of a player's luckperms group?
Get their user instance, get primary group, then use that to get the group object and use getWeight
what is the user instance?
How can I delete a new scoreboard registered on the server?
you mean ones created by ScoreboardManager#newScoreboard?
getNewScoreboard()
yeah, those aren't really registered to the server, if you want to remove it then just set the player's scoreboard back to the main scoreboard or to some other scoreboard
that also means you'll have to store them on your own
okey thanks!
Is sending message to players and all chat stuff async?
iirc yes?
Thanks
There is a better way to test my plugins instead compile it everytime and insert into plugin folder of my server?
Hotswapping but uh not really recommended
Sadly no :/
Hm, okay. Also if I will create a configuration file I can use File.createNewFile()? Or must I use saveResource()?
Better than /reload kek
well yeah kek
Lol
you can create it however you want
personally I recommend Files.createDirectories then Files.createFile
Yeah, I don't see much difference between the functions. Only the "overwrite" parameter
hotswapping
How is it not recommended?
I mean, I am talking about the File object it self
Oh I can't send images
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
K one sec
It's not as stable or safe... I never got into the hotswapping I still restart my server every time I recompile kek
wdym
you can just create a FileConfiguration afterwards
Ah
It's pretty safe and somewhat stable using HSA and/or JBR
JavaPlugin provides you with a File object so you're probably best using it instead of NIO
I need a spigot account
Or just use an image hosting site
Idk ig I'm just a rebel
File#toPath and Path#toFile Β―_(γ)_/Β―
Ima create it later but this the code line:
final File configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name)
if (configFile.createNewFile()) {
return configFile;
}
You've always been
Damn straight
but I agree, I just personally prefer the NIO APIs where possible
you need to create the data folder too
So, like, instead repeat or creating a variable for MAIN_PLUGIN to call saveResource I just use configFile.createNewFile()
(Sorry if I take to long to give a response slow connection)
var configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);
if (configFile.exists() || (configFile.getParentFile().mkdirs() && configFile.createNewFile()))
return configFile;
I hate that tbh
var configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);
if (configFile.exists())
return configFile;
var parent = configFile.getParentFile();
if (!parent.exists())
parent.mkdirs();
if (configFile.createNewFile())
return configFile;
@rough drift how tf can i use ur lifesteal plugin
it automaticly delets from the plugin folder
me?
This is what I did, I think I can improve is btw
private YamlConfiguration createNewConfigFile(String name) throws FailedToCreateSettingsFile {
final File configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);
try {
if (configFile.getParentFile().mkdirs() && configFile.createNewFile())
return YamlConfiguration.loadConfiguration(configFile);
} catch (IOException exception) {
throw new FailedToCreateSettingsFile();
}
return null;
}
public YamlConfiguration getConfigFile(String name) throws FailedToCreateSettingsFile {
final File configFile = new File(JokingHouse.MAIN_PLUGIN.getDataFolder(), name);
if (configFile.exists())
return YamlConfiguration.loadConfiguration(configFile);
return createNewConfigFile(name);
}
nope it's by design, it moves itself to the right folder if it notices it is in the wrong one
does it work with paper too?
it goes inside of Helix/plugins, you should really use my support discord for this
couldnt find it
Try it, if it works, great! If not, don't come crying to me
for me it dont works i uploaded helix and lifesteal plugin but id dont wors
well, then it doesn't work
you should at least use #help-server
I'd go to his support server kekw
invite me to ur support server please
hey can i promote my plugin in a thread by making something as why should u use / compariosn / wiki / showcase
any smort ones here?
you cant put like 60 * 60 in yml right? as int
No
You could but you'd then have to parse the string into an integer
import it as string use split and then make it int
You can do so by making a math parser
okay no, i was just asking if it can be int
No it cant
thanks
Easiest type to make is recursive descent
what
recursive descent
if i am not supposted to do static methods then i should do DI always?
@tardy delta cmhere
enlighten us with your funny parser
anyone could guide me here
dont wanna get myself banned
hehe
if it's cool enough sure, you can also just ask for feedback on it in #1100941063058894868 or for feature-related feedback (make a thread in #general), should be fine
just don't spam it and take it more as "look at this cool thing I made, what do you think about it" instead of "I made xyz plugin for just β¬9.99 buy now!1!!!"
i meant in spigot website
idk about that Β―_(γ)_/Β―
idk whats that
google it bud
okay
its eaz stuff
oh seemscool
google searches are even producing code snippets now
google doesn't wanna lose the programmers
Google interview:
Question 1:
"How do you fix xyz"
googles it and shows them code snippet produced by said search
proceed to say, "I thought google had all the answers"
I found the piece of code not checking for the correct interfaces
based on the naming, it seems very user error prone
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
it's probably an int somewhere above
java library has the same issue in some places
what was the name of that command api/framework everybody uses
nah so you could do @SubCommand("addPlayer") etc
acf
yeah thats it thanks
if i have a class only with methods that can be static, (but you say that static is bad), should i make instance of it everytime or what?
if its stateless then static is fine
okay
Static variable that doesn't change
so like im having methods to do something to a player, or turn amount of seconds as int to a timer as string , like 140 would be 00:02:20
and then its static
utility methods
its stateless
static is fine
so its ok
do you know a good way to manage cooldowns?
like a map with UUID and Long which is milliseconds
That's a fine way of doing it
i always do it my way but its messy when its more cooldowns
but if you want it to stay in sync with the rest of the server you can store the time in ticks
depends on the usecase really
i make a class, which has the map of <UUID, Long>, it has methods like hasCooldown(Player player), getCooldown(Player player), addCooldown(Player player),
when i add coldown i just put the uuid and system.currenttimemillis + cooldown, in the getCooldown method i check if the difference between the value from map and system.currenttimemillis is <= 0, then i remove and return 0, and hasCooldown just returns getCooldown() == 0
but if i want to make the cooldown time configurable i would probably need to do it like that: to map i add time when the cooldown was added, not time when cooldown will end, and then in getCooldown() method i would check if System.currentTimeMillis() >= value from map + cooldown
umm sorry for message that long
but
generally unless you have a good reason not to store time in ticks
the entire server operates on that model
okay so just replace system.currenttime with ticks etc
but will it work when plugin restarts?
best way to approach this is to use a BukkitTask that runs every tick
because then if its a long cooldown like 4h, i store it in config
and ticks down over time
or you could store it in PDC or even better a proper database
but then user has to connect databse?
I'd opt for PDC here, but considering bukkit does a deep copy on ItemMeta that'd be performance suicide
SQLite
it is good for up to millions of entries theres no reason to avoid it
its a flat file
SQLite is a flat file database
the connection is just your plugin maintaining a lock file with the database
lock file?
perhaps this is a good opprotunity to learn about databases
use SQLite and have some fun, I would reccomend not coming here for help with SQLite and trying to give it a go on your own
if you're absolutely desperate you can always come here for help, but there's so much joy in figuring it out yourself
pretty much everything above is juts technical jargan, but put simply SQLite is stored in a file you don't need to worry about having a server for it
a database for a cooldown is crazy
I mean true, but you have to persist it somehow and ItemMeta is way to expensive to store it in
just store it in a file
I mean, depends on the length of the cooldown
depends the type of cooldown
π΅βπ«
I suppose you could use JSON, but I wouldn't use YAML
it really doesn't matter
i dont get it
.csv π
does it matter or not
it all depends how many cooldowns you are storing, how often you are changing them.
there are plenty of options, personally I'd go with SQLite or Json depending on what we're dealing with 
do i have to acces the database or the file every time i want to do something with cooldowns, or can i store it in my plugin and on disable save it to file or database, or something like that
just use bukkit's configuration api if you don't want to overcomplicate it
either way is fine
isnt it like
Not enough details to tell if you shoudl read directly
bad to acces a cooldown every time, it can be really often, player can spam something or idk
it depends on how critical you think the data is, i.e., if you want it to persist through crashes
you dont read it every time
if its an item with cooldown, you have to check it every time player tries to use it
databases are really fast
well that and you'd want to cache anyways otherwise you'll crash your server lmao
use a map for local data and then save it to a file if something changes
either way you'll have a cache
Use the cooldown item component
oh that exists too
Never access a db on the main thread. so If your code requires the data in the same tick you need to cache it
that ^
yeah in 1.21.3+
I forgot its on ItemStacks now
that's what I was saying lol
I mean instead of a database you could also just use pdc
PDC is far too heavy
i feell like everyone is saying different things
ItemMeta is a deep copy
hashmap frf
wdym it is far too heavy
What version are you
For API
too heavy for what
but im not talking about only items
You know paper has ItemStack#getPersistentDataContainer which doesn't clone IM-
Hey everyone, I don't really wanna interrupt y'all, but I need help with something, that might be considered basic by some, so it should be quick, I've looked for a solution but couldn't find any. I can create a thread if you're willing to help.
They are becausew you have given almost zero info, so everyone is just guessing what you are doing
you mean version of plugin
API version
sorry ;c
well they also have a proper copmonent API now
then maybe just explain what you do want?
that's because there are multiple different ways to go about it, you should go with the one you find the simplest
all projects go wrong because of wrong requirements
i have more examples, lets say there is cooldown for using an item, and every time player clicks you have to check if they have cooldown or not
If you are using items, Iβd recommend the item cooldown component because it also adds a nice animation for the client, but itβs only 1.21.3+
personally that'd be either the item cooldown component or PDC, I am unsure why Miles believes it is too heavy but you can just change it up when your server scales enough for that to become a problem anyway
thats still an item
what else would have this cooldown
maybe typing in chat, or something not related to items
5 seconds
okay but then you dont have to save this
Sent it when the chat went a bit crazy, sorry, I'm replying to it in case you've missed it.
PDC performance depends on what item you are checking that on
make the right tool for the right job
if its a stick with nothing on it, w/e
if its a shulker box with a shit ton of items in it, ehh
i had a plugin with opening chests, i was storing players, and every player has a map of <ChestLocation, Cooldown>
i mean cooldown to open chests
it was actually playerinteractevent not opening chests but yes
so are you trying to find a solution for all cooldowns or like what are you trying to do right now
Yeah we have no idea
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
im lost π
Your chests have a cooldown for opening?
find what you are trying to ask in the first place
yes, but its actually player interact event and you open a custom inventory for a player
then the Chest itself shoudl have a map of player uuid and coldown
and then think about the edge cases and situations you need this system for
and then come up with a question to ask how something like that could be done
it shoudl be on each chest not on the player
where to store it ?
pdc
Chest has PDC
what if you destroy it and place again
then you can open it again...
then its a different chest
if you destroy a chest all contents will spill out
you can always copy the PDC to the Item too
if you want to
PersistentDatacontainer#copyTo
thats bad, because i wanted to like store the locations more, not the chests
then store it per player
location shoudl be irrelevant
there are no contents because i said its actually playerinteractevent which opens custom inventory, for each player its different and chest is empty
Still pdc on the chest
why
but still chests can be destroyed and placed again, i think that my entire approach is bad, so doing the cooldown is harder
HashMap communication.
If its location specific and not chest specific you sould store it in teh chunk pdc
oh there is such thing
if you are allowing the chest to be broken, why are you doing a cooldown?
sounds like the cooldown should be on the inventory
I've created a thread. #1308481617454436414
How do you get a player's connection with NMS in version 1.21, for some reason the playerConnection variable is not showing up
there is one created every time you open, if i understood
then dont
keep it
and reopen it
I mean this is all depending on everything else you already have
so clear it every time?
ServerPlayer#connection
why would it be cleared every time
var craft = (CraftPlayer) player;
var nms = craft.getHandle();
nms.connection // or .c or some shit if you're using obf
however an inventory is not persistent so you are now back to the opriginal issue of saving data
thx
because i need that, thats why i create new inventory, put there some items, and if player closes it its GONE
and so using a file is the best
jees
what about this?
yes thats optional
i think file is just the best
IF your chests are always in teh same place
Truly an NMS moment of all time
That's a spigot name
what they done renamed it to now

you are (hopefully) using mojang mappings ^
Oh wait im dumb
i mean, there are values in config (locations of chests), and when player right clicks a chest, you check if the chest has the location, then check the cooldown to that location, umm idk how to do that better, i feel this is stupid
ClientboundRemoveEntitiesPacket
there we go
Do I just pass the entity id of the item to it?
i probably should start putting my code here
yes
so you can say whats wrong
if its a method wchich returns values from config, can it be static? but it needs to have an instance of Main, because it needs to get the config, is static ok or not?
Is this correct
public class CustomItemManager {
public HashMap<Integer, Player> clientSidedItems = new HashMap<>();
public Item dropClientSidedItem(Location location, Player player, ItemStack itemStack) {
Item item = location.getWorld().dropItemNaturally(location, itemStack);
Bukkit.getOnlinePlayers().stream().filter(p -> !(p == player)).forEach(p -> {
((CraftPlayer) p).getHandle().connection.sendPacket(new ClientboundRemoveEntitiesPacket(item.getEntityId()));
});
clientSidedItems.put(item.getEntityId(), player);
return item;
}
}
If you pass an instance its stateless. If you hold it in the class you need it to be a singleton so not really stateless so shoudl not be static
protected final EntityCreature a; //THE ENTITY
protected final double b; // x
protected final double c; // y
protected final double d; // z
protected final double e; // speed
protected boolean g;
public PathfinderGoalLoc(EntityCreature entityCreature, double x, double y, double z, double speed) {
this(entityCreature, x, y, z, speed, 5);
}
public PathfinderGoalLoc(EntityCreature paramEntityCreature,double x, double y, double z, double speed, int timeBetweenMovement)
{
a = paramEntityCreature;
e = speed;
b = x;
c = y;
d = z;
this.a(EnumSet.of(Type.a));
}
//RUNS EVERY SINGLE TICK (THIS IS HOW ENTITIES WORK)
//WILL START PATHFINDING GOAL IF ITS TRUE
@Override
public boolean a() {
return true; //<- runs c
}
//RUNS IF A IS TRUE
public void c() {
//runner x y z speed
this.a.getNavigation().a(this.b, this.c, this.d, this.e);
}
//RUNS AFTER C
//RUN EVERY TICK AS LONG AS ITS TRUE (AFTER C GOTS EXECUTED)
public boolean b() {
return true;
}
//RUNS WHEN B RETURNS FALSE
public void d() {
}
Hello, I'm looking for an equivalent of this following NPC path finder goal (written before nms remapping) how can I use the entity navigation component to make it follow a player for example? I can't find much information on the remapping version of NMS 1.21.1 so I'm a bit lost
and the tick method too ^^
what are those comments π
not mine code x)
an instance of Main?
thank ! which package does contains the navigation ?
use the search ba
could just
world.dropItemNaturally(loc, itemstack, i -> {
i.setVisibleByDefault(false);
player.showEntity(plugin, i);
});
wait thats a thing?
but won't the item still be able to be picked up by other players as its only hidden and not destroyed?
setOwner
Canβt other players pick up the item even if it is destroyed for their client
I assume thatβs a server side thing
It is
Interesting
would be pretty ass if your inventory is full, your get an advcancemnt and someone else grabs it
gimme your loot
Hmm, working with a ChunkSource directly doesnβt seem fun
get ur own trial key
And moonrise doesnβt help
I'm 1 year better than you at coding
spigot should integrate moonrise 
you took a break
true between 2020 and 2021 I did
still means I'm 1 year better
your much more of a nerd
says the guy who is in "cute"
i have cat ears you dont
nerd behavior
nuhuh
Blah, I need to figure out an efficient way to merge a bunch of small bounding boxes
what's he gonna do ban me???
yeah
oh :(
hes a cool1234567 guy
isn't their a tree like structure you can use
octtree or whatever
@young knoll check this one out https://en.wikipedia.org/wiki/Octree
An octree is a tree data structure in which each internal node has exactly eight children. Octrees are most often used to partition a three-dimensional space by recursively subdividing it into eight octants. Octrees are the three-dimensional analog of quadtrees. The word is derived from oct (Greek root meaning "eight") + tree. Octrees are often ...
thats how the simulation works
I need to merge them not group them
The merged boxes shouldnβt contain any space that wasnβt part of the original boxes
oh
can oyu merge them by doing like O(N) finding mins and maxes of the given boxes
or depending what you can do is if you can detect a bounding box is being made alongside another one or something 
Tbf arbitrary structures probably donβt boil down to that few bounding boxes anyway
Maybe I should just store a bitset for the entire space and flip bits that are occupied
My use case is dungeon generation (again)
If I was working with only rectangular rooms I could just use a single large bounding box, but that doesnβt work when rooms are arbitrary shapes
I either need to subdivide the rooms into multiple boxes or I need to have a way to do precise block-block collision checks fully async
finding the min and max of the space?
that would be a cuboid no?
hey how often does weather change in minecraft? random? or is it on some specific interval
specific interval
oh, weather is probably random
there's a timer for when it will change
because now that i synchronized the server time with realtime i also need to take care of the weather. probably handle it myself... i'm making a forecast for weather in minecraft after this if i succeed XD
you just need to edit the interval and you're set
i could also get some apis and change the weather based on how it is in real life
yea
Do plugins need to be open source?
No but they should be :p
if its not opensource its just weak
if plugins were open source and published one some site with high traffic.. people would judge every tiny bit of the code that isn't up to their expectations. the world is full of people who browse github just to judge code XD
the questions is a bit flawed, but what are you getting at @native nexus
people just don't like my code
How is it flawed, itβs a yes or no answer.
The answer is no�
yeah
No need to make me sound stupidβ¦ βflawedβ
Cut with the bs
its not flawed
But I like reading peoples code ππ
the answer is that you do not have to put it open source
but its highly encouraged
and there is really no reason not to
okay let me rephrase my answer then
Yeah if itβs not licensed then I guess you donβt
well you're making assumptions, calling your question flawed is not the same as "making you sound stupid". i'm highlighting that you might be referring to a different question, which would understandably be more complex.
I think you need to be able to show the source to people
spigot plugins are licensed with gpl
whether you like it or not xD
Well it felt condescending because I donβt know you and you instantly reply with my question not being a good one. Itβs just a yes or no answer, I didnβt need you to tell me how to phrase my question.
Yes, GPL does apply, however if your understanding of GPL is that it "forces you to become open source" then that's an oversimplification of the entire license, and would lead us to misunderstand the license.
so, open source necessary, no, follow the license? yes.
that's why the question could have been phrased more clear
You could have easily said, did you mean something else?
welcome to the world of anti social developers
you're arguing semantics here, a dictionary definition of "flawed" is imperfection, so being near perfect might be a complement.
lol cmon man
it's not that deep
i bet you both missunderstood each other lol
Sorry I have feelings
i think this is a very kind question im asking back
it's not that deep
i said a bit flawed
"but what are you getting at (what are you asking)"
lol
this is like asking someone.. i have an apple. is apple good? as in fruit
and then they would ask you all sort of questions about it. referring to retrooper
Please stop
have you looked at something like seidel's algorithm to decompose the polygons
that's the first thing that comes to mind when it comes to what you've described
there's other ways to go about it but eh, they're all very complex algorithms on their own lol
okay so
im making
uh
a plugin for beta 1.7.3
and im
BRO
STOP π
im making a plugin for beta 1.7.3
and im trying to detect deaths
should be fast and sufficiently moderate for something like dungeon gen so I would say it is fine
but it wont let me
some kid was reacting with like emojis
Not a single person can help you creating plugins for beta 1.7.3
everytime i sent a new message
i got some stuff working bro
only commands
i added /msg and /list
howcome you are working with 1.7.3?
trying to add funny death messages
you'd rather just use cursed legacy fabric instead of bukkit or hmod, whatever was available for that version
?
my friends hate new minecraft
lmao
The Minecraft Cursed Legacy project: bringing legacy into the modern era. Mod Beta 1.7.3 easier than ever before with the powerful and modern FabricMC modloader!
damage event probably existed
i mean like
your best shot at doing anything in that version
there is a death message plugin
i looked through its source code
but i couldnt understand
anything
learn java moment
i know java bruh π
did you use a decompiler or just open a .class file
jdec.app
then there is no way you would not be able to work out how to track a death WHIT the source of a death message plugin
ok well
i
took some code from it
and it didnt really
eh, decompiled obfuscated code is harsh
work
too
many
it forced me to use their like weird
Did people even know how to obfuscated back then
class
presses of enter
okay
sorry for being harsh it is just a pet peeve of mine
yeah bro this plugin is forcing me to use its like weird code bruh
why?
isnt
this
a
nice
way to
read messages?
I mean, MCP existed so I assume
HeroicDeathListener looks like the code you want to look at
this is like the closest thing i got to like event stuff
Looks like an older version of the event system
Seems pretty simple
WAIT
Event type, listener, priority, plugin
YES
but i put this in my code already
and it did nothing
let me try this again bruh
HeroicDeathEvent is a custom wrapper class
what better 1 bukkit task or many
JUST DONT WORRY ABOUT MY CODE
ok i mean that other script doesnt have
uhm
@EventHandler
so maybe i should remove that?
Β―_(γ)_/Β―
I have no idea how that event system determined what method is the listener
what version of spigot are you coding for?
beta 1.7.3 π₯Ά
?howold b1.7.3
Minecraft Beta b1.7.3 is 13 years, 4 months old.
Hey itβs old enough to use discord
It is lol
the hell does that mean
Idk, probably used to record the death
Youβve only shown small snippets of the code so we canβt really tell what itβs doing
link me a copy of the HD plugin you are looking at
or drop in channel
wait, elgarl?!? https://dev.bukkit.org/projects/heroicdeathplus
lol
lol I wrote it π
yea help me find out how to detect deaths on beta pls
dude this setup is so scuffed man
im using intellij and made a plugin using the 1.12.2 preset thing
oh
Minecraft 1.6.2 is 11 years, 4 months old.
I found it https://github.com/ElgarL/HeroicDeath
That appears to use the same event system we have now
found another plugin
essentials for b1.7.3
or it came with the server pack
so i assume it is
same thing
ok well it works on 1.7.3
something like that
im gonna check out the event registration
yeah its using old classes and stuff
I remember that event system with classes that were just a lot of empty methods you could override kek
its just a simple listener, registered in teh onEnable
ill just write it down anyways
PluginManager pm = this.getServer().getPluginManager();
pm.registerEvent(Type.ENTITY_DAMAGE, this.listener, Priority.Monitor, this);
pm.registerEvent(Type.ENTITY_DEATH, this.listener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_RESPAWN, this.playerListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_QUIT, this.playerListener, Priority.Monitor, this);
I had a cb jar with that from frost somewhere I think
^^ this
yes
See now thatβs some wacky old event system
private final HeroicDeathListener listener = new HeroicDeathListener(this);
then register the events
Back then there was no annotation system
in what version was fevents implemented
@lilac dagger I feel honored, but I'd appreciate if you'd be more creative on your own instead of copying feature by feature and config by config from my plugin, thanks

ok dude it doesnt even let me build the goddamn program
Hes not too good at freestylin π
what are the errors
ITS BECAUSE IM USING FUCKING 1.12.2 AS THE THING ITS READING OFF OF
why are we having this convo in #help-development
im using 1.12.2
go to dms smh
tell me what is like yours
YOU told us it was for 1.7.3 NOT 1.12.2
IT IS FOR 1.7.3
im just using 1.12.2 to make it because its the lowest version i could get to π
Well that wonβt work
just compile it yourself
The api is entirely different
You can;t build against 1.12 if you want it for 1.7
Beta 1.7 at that
@warm mica btw i've been told you've made the setup where you set using the hotbar, was i not the first to make that i wonder π
No idea. Somebody sent me a screenshot of your changelog and it gave me a good giggle
@plucky peak this project seems to port some new APIs to craftbukkit 1.7.3 beta, I'd use that
Java 8 even, that's crazy
you're just being rude for no reason then
if players want a feature, i provide the feature
bro why the ceo speak man
i thought coders were nice and friendly nerds lol
well, he went at me
sometimes
most nerds are prideful assholes, don't get it wrong
I personally covered ebic in metaphorical shit recently
honestly ill just find the api
i'd like to make my own thing
And by metaphorically I mean I just shittalked him and the thing he was doing cuz it was going off course lol
you're crazy, but go off
lol
the 1.7.3 beta codebase isn't that big anyway so it shouldn't be too hard
Gonna have to go to some shady old site
yeah
It's small I'd say
Not even an inventory API :(
that forks ports inventory API
i got it on github
Whatβs an inventory
Damn
did inventories packets exist back then tho
Did we have those back then
Not trying to be rude. Sorry, if that's what you're seeing. I had to giggle because the changes looked very familiar
That's what bukkit asked me when I did Bukkit.createInventory in b1.7.3 lol
I think they worked differently, but an inventory api should've been doable
well, i'm just trying to do my job as a developer
Display entity? Armor stand? Nah but you can have P I G
True
I really don't care about how others do things. Every feature has been designed by me in a way I think it's best
i'm sorry if some things look similar to yours
Or lava item
Hunger bar? Nope sorry
Funny thing about b1.7.3: all blocks were automatically registered as items
Frostalf has like every cb build or something
Probably
1.21 starts pretty quickly now
I mean, you can just go back on the commit history and compile it
Thanks to Mojang majorly lowering the spawn chunk radius
@wet breach Tell us, what's the oldest version you have
some beta or alpha version
takes about 20 seconds for me
I will have to go take a look
if worlds are generated that is, if not then idk, 1 minute and some?
20 seconds is what it takes for me to start a 1.19 server
I have a shitty PC
also windows
I have a laptop
My laptop is utter garbage
running a flaming celeron N4020
literally flaming, that thing doesn't explode because God is gracious
Doesn't oracle or whatever offer free servers
it isn't too shabby honestly
yeah but I wouldn't use a remote server for dev
I actually did try to use one via devcontainers, but it turned out more annoying than I thought
mostly because I don't have IJ ultimate
Me neither, but at that setup it's prob faster to just upload
wouldn't have to upload anything, just setup remote hotswapping π―
Isnβt that just uploading but fancy
am I being silly or did setHeldItemSlot get removed
declaration: package: org.bukkit.inventory, interface: PlayerInventory
thx
in rare cases a player on my server can hit another player and when I teleport them at the exact same time itβll register the hit from where the player was teleported
is there a way to cancel ongoing hits or something? before I teleport the player or even after
make them invulnerable for a few ticks
Are you using paper's async tp
is creature spawn event only blocking agresive animals or also neutral
Should be every living entity, that includes hostile mobs, animals etc.
Whats the alternative to velocity.lengthSquared() > 0.01 because that seems to only check the Y, not walking.
such as when i walk nothing happens but if i jump it activates
You have no x/z velocity when walking
Is there a way to check if moving without the player move event?
im checking every tick instead
track last against current location in that tick
yikes tho, its per player, wish it were a single method
theres getWalkSpeed(), dont know if its the actual moving value
yea nvm. darn
just use the event
if you early-return when the data you're interested in checking isn't there then it isn't a problem
e.g. check on block changes, ignore rotation only moves etc
The game actually stores the last position for living entities
Idk if that also applies to players tho
(Also we donβt expose it π)
i decided to go with storing the location to a hashmap, i have a runnable already looping. i want to avoid playermoveevent for performance
it really isn't bad
simply listening to the event doesn't really change anything
it's whatever logic you run in it that matters
hence returning if no data of interest has changed
people just give it bad rep without even trying lol
right i have returns on the ones i use but in this case i do have to read from file and map each time for all players, while it does cache it still needs to update values often
that just sounds very wrong at first sight but idk your architecture so you do you I guess
so im making cosmetics and i want to store the customized particle to a map so they can rejoin with that particle, the location checking is to adjust the particles design based on them moving or not, certain actions i want to move the particles out of their face
it works fine. dont want to add a player move event
The heck do you need to constantly read from a file for
maybe i dont mean constant read, its just with regular restarts the maps would reset so i have it save to yml when they quit, and reads on join. i suppose thats not necessary they can just re-apply.
fair. but anyways id still rather avoid unnecessary events if possible due to lots of players and decent amount of plugins.
even if the event returns, i still am checking some sort of condition which id assume might take the tinniest bit of performance but it adds up
it really is not noticeable
does this overwrite existing config with the default one?
I personally think if you don't read the file on the move events it should be okay.
no
first, dont use Β§ use & and use ChatColor.translateAlternateColorCodes('&', text)
i did that but it just blocks the first word
Try quoting the text in the yml file
You have a mistake in the config, you added β. Do what he said ^ add β text β
i see
ye that fixed it thanks
What should I do to control player list of player's tablist? I wanted to hide players if they are not on the same arena of a minigame, or hide all players that are inside minigame arena for player that's in a lobby.
where is the color code
its just eating the Y
the real config is using &, its a few pics down - the problem is solved anyways, no need to respond
is there a way to get the plugins that depend on my plugin in their plugin.yml at runtime?
well I am only interested in the number of plugins
couldnt find an easy way
I guess I could query all plugins and use the PluginDescriptionFile#getDepend
but therefore I would need to use PluginManager#getPlugins and does this return all plugins in onEnable or only the ones that got enabled previously?
long count = Arrays.stream(pluginManager.getPlugins())
.flatMap(plugin -> plugin.getDescription().getDepend().stream())
.filter(s -> s.equalsIgnoreCase(name)).count()
this fine?
is it possible to get an external jar of spigot 1.20.6 to add to my eclipse project like i could with a 1.8 jar
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
Seems fine
if a class has other class as field, and its final (maybe final list) is it stateless?
what are you asking
Class clazz1{
final List<Clazz<?>>
}
?
no, Just list of anything as a field
give an example
what the flip
No, it isn't
if it has a mutable field, it inherently becomes stateful
this is because you're depending on state that might be outside of the class's control
What's this whole statelessness thing, are we doing fp or what
I mean, it is good to know the difference
stateless is anything that depends on things outside of the current method/class's control to execute
having an immutable field doesn't make it stateful, or a deferred immutable field even. For this case though, List impl, might be mutable so that doesn't apply
yes, tons, everyone seems to like IF (inventory framework) so maybe you can try that
Yup
((CraftServer) Bukkit.getServer()).getServer();
ty
Hi,
While ramping up with plugin development, I started a very simple plugin creation template.
Do you have any idea of what can be improved to make it more useful ?
https://github.com/Jaalon/spigot_plugin_template
For the moment, thereβs two things:
- a docker image with spigot downloaded, built & deployed
- a very simple plugin with a command and a listener
I see already want to check at this improvements:
- migrate to an annotation based configuration
- use standard built tools to generate the spigot jar (instead of buildtool)
how can I prevent Items from going back into the players inv on InvClose Event
Cancel click event? wym
Its like Anvil or something like that?
Like you put something in, close -> Items back in your inventory
something like that?
I got It already but I mean like if you have a sword and lapis in an enchater inv how to prevent the lapis from going back to the player too since its put in via plugin
and it was just getting the closing inv and removing the items
Make sense ^ If theres nothing, you cant get items
buildtools is what you should use to build the jar though
Why not using directly maven by cloning each project independently ? I thought it would ease the patching of spigot or other project if needed for more advanced user
Not really, you usually just run buildtools for whatever you want to do, including editing the server code
Ok I see, so Iβ―guess I wonβt include that to the project. Maybe just explore it for personal curiosity but keep using buildtool for the template
not much to gain from that considering pretty much all buildtools does is automating that process
it also has some other features such as downloading git and maven if not present, but that's about it
one thing you could do is use that docker image and make it a devcontainer instead
then you can make it a devcontainer template: https://github.com/devcontainers/template-starter
another suggestion would be to use JetbrainsRuntime distribution instead of Corretto's and add the -XX:EnhancedClassRedefinition flag for hotswapping
you might also use patrick-choe's mojang-spigot-remapper considering you already run build tools to get the spigot jar, might be good to run it with --remapped and use the remapped sources in case they may want to use NMS
Yes, I was going to talk about hotswapping, will have a look to jetbrainsRuntime. Using it, it will make a devcontainer more usuable in practice
It shouldnt happen by default
Unless the menu is vanilla (opened by clicking on a block)
Or should it? Idk. I forgot
well, it does for stuff like anvils and crafting tables etc
since they aren't containers
upon closing the items will return to your inventory
wouldn't these be dropped
or are we talking about the case where the event is cancelled, making it like they were never placed in the inventory to begin with
inventory close isn't cancellable though, now that I'm looking at it so that shouldn't be possible
that hasn't been the case for like a few years
they used to drop, now they just return to the inventory, unless you don't have space then they'll drop
oh that's cool, since I don't really play newer versions I haven't noticed the behavior change
You should be able to remove from that list
Not entirely sure if you can add stuff to it
Give it a try
You can't add
whats the best way to check if a player is in area using the PlayerMoveEvent or somehow getting the entites in range relativ to the area
You can just get the players location on player move event, and check if they are in the area you want them to be
There is also a location.getNearbyEntities method
To get all entities in a range around a location
yeah but what of those is more performant prob the nearbyentits if I trigger it ever 0,5 sec rather then when everybody is moving no?
Hey guys, i wanted to add something to a plugin that i have on my server
Its a marriage plugin
The problem is that i only can kiss my partner using /kiss, but i wanted to used shift + right click to kiss too!
How can i do that?
I asked for help using some IA but it didn't work π
Do you already have a plugin compiling? even if it doesn't work
The .jar?
Well, given you are asking in help-development I presume you wanna add that functionality via a new plugin?
(or by editing the existing one I guess)
PlayerMoveEvent PlayerInteractEvent I think would work here
What
Yes, i'm trying to add it by editing the existing one, but idk how to do that :(
Is it open source?
if you don't know how to code and its open source you might be best asking someone on services to just add this small feature for you it'd probably be very cheap or free depending on the person you ask to do it.
?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/
Sorry, how do i know if it's a open source?
Whats the name of the plugin π
LunaticFamily π₯²
Contribute to Janschuri/LunaticFamily development by creating an account on GitHub.
A family plugin has like a full platform submodule setup xD the world is crazy
fr exactly what I was thinking lol
We are progressive like that 
lol
remember that one plugin
where is the Data Driven Gender Registry 
is it still on spigot i dont remember
Literally no clue what you're on about btw lol
the one where it had mental illness in it as something
some person that was a troll here ages ago made it
Lex?
Its starting to ring bells
That totally sounds like a Lax plugin
I can't ask for help, i'm not allowed to post anything
He has a gender plugin, if this is what you're referring to, https://www.spigotmc.org/resources/33217/
Lax?
you must ask those who have posted already
thats what i was thinking about
I miss Lax :(
Who's lax
was he banned or did he just drop off the face of the earth
i swear he was banned from here
true
I guess being a troll can get boring lol
I think he was mainly active during the time while I didn't talk here much lol
sad time I wouldn't want to be missing
He was an IRC man. Don't think he ever joined the Discord
that makes more sense then
He even made amazing plugins such as RotatR :( https://www.spigotmc.org/resources/rotator-lite.53688/
We even used it on the Spigot test server for a while!
OH WE STILL DO
lmfao
the reviews on his gender plugin are hillarious
Oh he was! Long while ago then
Oh he is banned
Yeah, I mean that makes sense
ahaha lol
been a while since we had a good troll, we just have people like Epic and he's like not even that funny 
fr
what is your gender??
True.
oh and we have neon
hes underage, so therefore needs to be banned π
I'd use an enum
okay God I was going to say enum I'm glad someone else agrees with me
cant be hard coding genders
What? You wouldn't let me invent a gender?!
ENUM because its funny
Okay, I'll use registry if you want it
nah nah ENUM
TRUE,
FALSE,
MAYBE
Lol
enum
TRUE;
"what's your gender?"
"Hmm, maybe"
getGender() { return Random...
Lol
lgbtq engineer be like
Ο = gender
That one physics teacher: hmm, about 10 Ig
"mixed"
π what the fuck is the point of this
Somebody wrote that unironically and still decided to use -1 as true
Could someone help me? I'm trying to edit a plugin, but the changes that I made are not working and i wanted to identify whats wrong with it
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
If you're not a dev editing a plugin is just dumb