#help-development
1 messages Β· Page 1138 of 1
thanks
Is there an equivalent of the gradle plugin 'run-task' for a Spigot server?
I asked for ages and I believe u can set the jar file to a custom spigot jar
its so frustrating though and I couldn't get it to work properly with plugins so I gave up and moved to maven and just wrote my own little script
I just have a gradle task that copies the jar to my server folder
Ahh ok, I'll try do this in that case
does anyone else have this problem? i can't code anymore in IntellIj after 2024 updates duo to a memory leak which crashes the IDE
is any process running in terminal?
a spigot server? its on other terminal, not running by IntelliJ
Are you using the Minecraft development plugin
idk i'm running it on 2GB and it works fine
which version?
thats like downgrading to windows xp
i've no other choice, keeps crashing each 2-5 mins
Anyone knows a community/developer that's trustworthy and is willing to create simple custom plugins for any price?
?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/
π
does anyone know of a way to set a player's reputation towards a villager
im aware that papermc allows it but i'd rather not use it, and ive looked through nms to see if it offers a solution but it doesn't seem very clear
I can do any price so long as $10000/hour is a part of that "any" price
it seems like you have to get the GossipContainer (seems to be called Reputation in Spigot) from the nms Villager instance (getHandle on a CraftVillager should do)
im doing that but theres no way to change the reputation it looks like
maybe if you use reflection to make certain variables accessible but i dont know how to do that with these types of variables
like GossipContainer has a field called gossips and it's a Map<UUID, EntityGossips>
but EntityGossips is a private static class
even if you make it accessible your ide is gonna complain
and its getGossipEntries() method only returns a copy of that map and not the map itself, so you cant edit it
hmmm might be room to add API there
there is add() which seems to have all the parameters needed to change reputation, but it doesn't seem to actually change that
this is what Paper does:
getHandle().getGossips().gossips.computeIfAbsent(
uniqueId,
key -> new net.minecraft.world.entity.ai.gossip.GossipContainer.EntityGossips()
);
but they do have these access transformers so, yeah you gotta use reflection it seems:
== AT ==
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips <init>()V
public net.minecraft.world.entity.ai.gossip.GossipContainer gossips
wo wo wo my man
trying to prevent me from making a PR like that
clearly help-dev is scary place
wdym? Because it is Paper's code?
I don't think that matters really lol
CLA moment
you'd have reached to the same type of code had you not seen this anyway
does the CLA state you can't use borrowed code though? Or is it just some sort of secret rules spigot contributors live with?
I didn't see it I averted my eyes before it was too late
you have to own all code you write
basically it has to be your organic work
that doesn't make sense to me, kind of defeats the purpose of open source
it has to be your code because you sign it away to spigot, and for obvious reasons you can't give rights away for code you do not own
how can you modify a map when you can't access one of the classes used in said map?
sure, blatantly contributing a patch from the paper repo would totally be out of line but just being influenced by the structure of the API wouldn't necessarily count as borrowing even
tbh I think that much is even frowned upon
you just have to call the constructor reflectively
treat it as a regular object
as Javier said tho fr
I just try to stay away from paper everything xD I just turn my head and pretend its not there type deal.
I mean, for someone that contributes regularly, that makes sense considering all the drama around the different platforms
last thing one would want is paper users thinking Spigot is stealing code from it
It's literally technically the opposite
Huh?
the Spigot-Paper relationship isn't symbiotic but a one way street
otherwise Paper wouldn't actually exist to begin with
unless your me #1 LynxPlayzMCW simp
I even run spigot servers instead of paper I'm fully committed πͺ
Paper exists because it is on top of spigot's code
I need to fix some issue with PlayerCommandPreProcessEvent, but I legit haven't a clue chat signing is so confusing man, I miss the good old days
It's like taking a premade cake and modifying it
Remove chat signing
ahh yes remove chat signing from spigot π― what a great PR
I'm sure it'll get accepted
this guy should be contributing instead of me
Chat signing is an anti-player feature
Yeah keep your ideology regarding chat signing out of my bug fixes please
It literally only is there for more control for micro$

I love playing with chat signing cryptography its like the best thing ever!!!
did you see what I made last night? Its the most beautiful thing ever
I have not yet
Is it me or does it feel off-centred
tis not off center πͺ
noice
probably is by a pixel or something
looks cool xD
lol
How to center a div
considering I only ever reply to Inventory related posts on the forums
I figured it'd be fitting
imagine not using forums
Imagine having forums
how are you verified?
Imagine forums
skill
imagined
im
forums always get me subscribed to too many topics
and then I get spammed with updates
man the gossiping system is so convoluted wtf
changing someones reputation should be the easiest thing on the planet but nahhh
easy how
It's so easy to manipulate other people into thinking bad things about others and spreading rumors given that your own reputation is kinda high
oh indeed manipulating people is very easy
im talking about minecraft villager reputation tho and they're not very easy to manipulate
why of course
why else would i ask in #help-development
i need help developing a reliable system of mass manipulation so people give me money
People usually drop some general stuff here
Also, it's likely to land here without knowing you are in helpdev instead of general
i heard this dafeist is a jerk, using LinkedList everywhere. dont talk to this guy
have you tried looking at tiktok?
i dont want to manipulate children i have standards
im not a minecraft youtuber
ok but consider that children tend to be more poor than the typical adult
they have parents
so i will manipulate them
hmmmmmmm
grandparents are usually wealthy
i can use the kids to get to the parents to get to the grandparents
or double depending on how many parents they have left
and there you have your complex recursion algorithm
infinite money hacks
did you get it yet? Shouldn't be too hard
i couldnt figure it out
we need tests, in case the child is orphan
im not experienced with reflection though and it seems like you need to use it a good amount to do this
real
is it considered bad practice to use C style structs in java? so, classes acting as containers, only holding public fields and constructors to assign those fields, but no protected/private members, and no methods?
what are those? maybe ive missed em
records are the best
cheers
i see so they are exactly what structs represent but in an oop context?
They are just immutable data classes
with automatic hashcode and equals implementations
how does one do nms in Spigot nowadays
build tools add the spigot server to my maven local right? Or is that not the way anymore
yup thats still how you do it
what I mean is, do I need to use the remapped mojmap jar for development
or can I just use the reobf jar if I don't provide --remapped
well, I will just try it I guess
why would you not use mojang mappings lol
will the spigot remapper properly remap reflective lookups
if it doesn't then it is a waste of time
hahaha
indeed rather funny
it was a genuine question lol, if I want to do the villager thing it will mostly be reflective lookups so the remapping won't do me any service
it does not
alright
it is been forever since I used maven, takes me back
and it will also take forever π₯²
- Paper
- You can't just assume the sender is going to be a player. You've proven this yourself by running the command in the console
You made a cast to Player on line 28. You should move it below your instanceof check (around line 41)
Even your IDE was telling you "this can't possibly be true, you already cast it above" lol
In essence you've done this:
String example = null;
example.length();
if (example == null) {
// do something
}
Not very smart innit
i solved
i put player variable after "is console" check
i dont get how permissions work... they are just strings right?
are they assigned to a player uuid or what
I mean yeah pretty much
what does pretty much mean?
It means you answered your own question
For all it matters yes
They are linked with uuid
Although not assigned on-top of it
Permissions are only useful in cases where you'd want to allow someone to do something
Or vice versa
how to add them to player?
Player.setPermission if I had to guess
Agreed
Use vault
if you don't use LP Vault has the next best reaching Permission API
though I'd reccomend LP first and foremost
I don't actually think that exists btw
it exists, would I use it? Well that's another question
;c
I'm assuming LP does its damn best to hook into that
Making your own could be cleaner or you could put it inside of the server jar but I personally donβt care much.
using an established API like LP or Vault makes the most sense here
LP is your best choice for not reinventing the wheel
LP pretty much has a permission monpoly
if you want to go generic just in case Vault wins
If PlayerTeleportEvent extends PlayerMoveEvent does that mean that if the first one gets called the second one gets called oto or what
e. g.
is it possible to add an element to config list or you have to get the list, add element, and override the previous one?
nope you have to override it like you describe
in this case, it means both are called for the teleport scenario, teleport event is necessary to attach the teleport cause information
oki
im wondering if its like thread safe
probably not
but atleast its not writing to disk until you tell it to
you mean saveConfig()
are player nicknames case sensitive? can there be 2 players the same nickname but different cases
what if i want them to be mutabil?
and have standard initializers
you cant
you create a new instance if you want different values
umm.. what saveConfig in main class does
https://hastebin.com/share/monokizohe.java like this?
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
oh right yeah
thats for the config.yml file
I was saying more in general
but saveConfig is what you use for config.yml
yeah im using that
well i wanted it to be directly accessible like a C struct since its supposed to only hold data, not work with them
yeah its valid
should i still wrap it in getter and setter?
people are just frowning anyways
π
I wouldnt bother
well id like to follow best practices
even tho theres different opinions on what is a best practice xD
well best practise vs common practise
common practise is to slap a setter/getter on everything
but if its just for data classes using public fields makes sense
esp if its not like lists and stuff
just make it private as soon as you want to do other stuff with it
yea its basically just a container of config info for the factory on how to create stuff
sounds like it could be a record
but i want it to be mutabil since i want the factory to be able to return the structure modified
but then you need a builder for it
If only we had the fancy thingy from C#
what
wrapping a C function that in turn wrap C#
tbh i avoid native code at all costs not because its plattform dependend that can be fixed but because of antimalwares going ham on it
if its not code signed
It's kinda like lombok but less horrible
I once worked with JNI, one time in my life and it was for an android app
why saving config deleted my comments lol
because comments arent stored by default
I forgot how to actually add comments too
because my config with comments is not saveable in game
Pretty sure they are saved bu default now
can I somehow keep the player in the joining screen for an indefinite amount of time off main thread
after using kotlin more and more I just throw in public fields where They are going to be got and set anyways
what's the point of a wrapper if exposing the field does the same exact thing
getters and setters are so pointless unless your making deep copies before you send them off. In the case of collections its always a necessity otherwise I hardly see a point
what?
yea getters and setters sucks
but what else can u do to protect urself when coding in OO langs
I think they're really only necessary in the case of collections
I'd rather not get ran through by using java's measely final fields
eh its mostly in case u wna keep compatibility w the future, allow mockability, etc
like OOP stuff :c
oh so stuff idc about xD
mock this dumby
kotlin is nieche w its property semantics, unsure how ugly the impl is tho under the hood
kotlin property semantics are awesome
true!!
I want to learn a non JVM language like C or Zig
I really want to learn C, but CMake has got me regretting life
fuck
CUnmake amirite?
dont tell them
i think you should touch prolog
prolog?
yea
what's that
Epilogue?
π
as a language C is very simple, but it's simplicity hinders the ability to make good dev UX when making a library and such
what π
yeah I noticed the lack of generics really sucks
having to make macros for that stuff is rough
macros my beloved
oh no, not these kinds of macros
well idk if its called macros in C
C macros π
whatever those # things are
that is Rust
rust macros β€οΈ
Excel macros?
#define are macros yeah
But yeah my complaint as an early user is yeah simply syntax but the need to write macros and complex header files for a simple lost implementation is rough
do you have to do something special to get values from final fields with reflection?
oh wait
I'm waiting
be more patient
yeah i was just silly, i got it from the villager instead of their gossipcontainer
but i haves another problem
forgive my possibly sloppy code as i am new to reflection, but here im trying to get the private gossips information from the villager's GossipContainer, which is a Map<UUID, EntityGossip>
EntityGossip however is a private nested class, so I can't use it in my IDE without it freaking out, and the map can often just not contain the gossip information for the player and so I need to add it to the map
but its expecting a "capture of ?" in the map
you know what scratch that i can just use Object instead of ?
i should really give this thinking thing a try
oh wow i got it to work, can edit villager reputation now
net.minecraft.server
you receive some packet and you gotta pull out from somewhere how its supposed to look
or
is it like reflection and doing some magic with your jar
AKA not normal java stuff
what
You just interact with the servers internals
Mojangs names for classes and stuff
right..
mojangs name for math class
so you basically just switch your spigot smth to mojang mappings
and everything magically works?
Mth
basically nms is the minecraft server's base code, but it's obfuscated
mojang mappings make it better readable
damn π
english class
You gotta depend on the server itself
instead of the spigot API
what
nms is really useful at times but its biggest downside is a lack of documentation
Not just that
gotta experiment a lot just figuring out if certain methods do what you think they do
fr
it's the fact that it's just shit
thats a lot to document bro
Parchment tries to do that
whos parchment
its a type of paper
Doesn't work for plugins afaik tho
It's not a type of paper It's a project on github smh
okay
nuh uh
retroopers fans trying not to glaze him
It very much could work formplugins
You'd just need to make your own tool
If you're already using PE then why do you need to use NMS
im not a retrooper fan
https://en.wikipedia.org/wiki/Parchment
well dont you just feel silly right now
Parchment is a writing material made from specially prepared untanned skins of animalsβprimarily sheep, calves, and goats. It has been used as a writing medium for over two millennia. Vellum is a finer quality parchment made from the skins of young animals such as lambs and young calves.
The generic term animal membrane is sometimes used by libr...
LynxPlayzMCW with Parchment?
and the fact Im using his custom plugin isnt related to that
Nah I just use mojmaps
anyways
rad, join back builders kingdom, we need you 
smh
like nms
okay and then why do you need nms
what
if you just wanna mess with packets then use protocollib (ew) or packet events
actually
good question
lemme ask in paper if they have one thing built in rq πββοΈ
but if you dont wanna have your plugin require dependencies then you gotta go with nms
which is a stupid reason
also, certain game manipulations aren't supported by spigot api and will also probably need nms
why is it a stupid reason
wdym
like me earlier today i tried to change villager reputation towards certain players, api doesnt support that
You could just... require users to download one more plugin, which they maybe already have installed
got it to work using nms
yeah idk why tf everyone hates procollib
protocol is also a ton of bloat
wdym by that
a ton of stuff you wont be using
what did retrooper make to deserve this fame
@alpine urchin UPDATE MY PFP IN THE README FRFR
at least from my experience it matters a lot how easy to install a plugin is and adding a dependency makes it a little harder for the chucklefucks out there
Oh he did
@river oracle
if you can't install an extra plugin you don't need to use this plugin π
and thats fair
but i already have to use nms for some game edits so i dont mind using it for packets as well
I dont use nms
and by doing packets myself i at least know i wont be adding any more bloat to my already big plugin lol
You should really avoid it
I am
yeah you should use mcprohosting instead
that's the point
they love your money
hell no
That name π
if it aint sparkedhost then it aint it
and they'll give you a nice handful of shit in return
W
lunar hosting!!
lol
lunar hosting is amazing!!
fr
the guy who was promoting it doesnt even own minecraft!
get lunar hosting!
lunar hosting is so good!
(their site got taken down)
kek
Obligatory plug of my new Inventory API hey check out MenuType and InventoryView derivatives!!
more coming soon!!
what
are they written in kotlin
Won't use them then
I will tell you every time I create a class in craftbukkit
I almost always first accidently create a kotlin class
check out MenuType and InventoryView derivatives!!
No one can save spigot from such a great person like me
didnt know there was a "tabexecutor" interface lol
Hi, does someone know how i can teleport my client side entity to a specific location, i have this but it does not work because the packet requires an Entity, but i want it to teleport to a location:
`FriendlyByteBuf byteBuf = new FriendlyByteBuf(Unpooled.buffer());
byteBuf.writeVarInt(this.entityId);
byteBuf.writeUUID(this.entityUUID);
byteBuf.writeDouble(this.location.getX());
byteBuf.writeDouble(this.location.getY());
byteBuf.writeDouble(this.location.getZ());
byteBuf.writeByte((byte) (location.getPitch() * 256.0F / 360.0F));
byteBuf.writeByte((byte) (location.getPitch() * 256.0F / 360.0F));
byteBuf.writeBoolean(false);
packets[0] = new ClientboundTeleportEntityPacket(byteBuf);`
What is your packets array about
The best approach tbh is to just create an entity and not spawn it
having more packets in one void, i think it is easier to read. because i'm returning the array to a different class
Sounds icky
Yeah
tbf I'm kinda thinking of making a client-sided entity system that works based off routines and operations
Where a routine is a list of operations π€
So you'd have a "display to new player" routine that's just a compiled list of operations or whatever
and operations could just prepare packets or update some value hm
I'm abstracting away methods smh
Sounds like you need a record or a class
bros speaking to himself
how to write it in config?
Map<String, List<String>>
so every element has list of strings
like that? or that.. idk
confusing to me
viprewards:
examplevip:
- "give %player% diamond 5"
- "give %player% gold 10"
examplevip2:
- "give %player% diamond 15"
- "give %player% netherite 5"
guys how to get keys
getKeys(false) on the viprewards config section
First image
The second image is a list of map lists
whats map list
yeah
package org.xfurkanadenia.creusa.Commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.xfurkanadenia.creusa.Creusa;
import java.util.Set;
public class Hediye implements CommandExecutor {
private final Creusa plugin;
public Hediye(Creusa plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
ConfigurationSection vipRewardsSection = plugin.getConfig().getConfigurationSection("viprewards");
sender.sendMessage("BaΕlΔ±yo");
if (vipRewardsSection != null) {
sender.sendMessage("BaΕladΔ±");
// AnahtarlarΔ± al
Set<String> rewardKeys = vipRewardsSection.getKeys(false);
sender.sendMessage(rewardKeys.toString());
// AnahtarlarΔ± yazdΔ±r
for (String key : rewardKeys) {
sender.sendMessage("VIP Reward Key: " + key);
}
} else {
sender.sendMessage("viprewards section is missing!");
}
return true;
}
}
{
"idk2": [
{
"a": [
"b",
"c"
]
},
{
"b": [
"c",
"d"
]
}
],
"idk": {
"a": [
"b",
"c"
],
"b": [
"c",
"d"
]
}
}
Here's the json version
Maybe it'll help you understand the difference
thanks imma see that
how can i solve
are you sure its correct?
yeah but just try it lol
ok so in this example you cant type something like config.get("idk.a") right? because a is like an element, it has duplicates. or can you?
That's a list
nou, im trying to understand these colons and dahses
So it won't work
is that even valid yaml
dash means (element of) list/array
colon is object
yes
you mean dash means element?
of a list
still kinda confusing
Never found it that confusing
are you sure? How would you reference that
Just don't go nesting lists and you should be fine
With the Spigot API? No idea
I use Configurate 
You'd probably have to getList and then get an entry
umm.. it really is to me
this is just a Map<String, String>
yes
Good night :)
:)
guys how can i solve that
dude i restart the server every modifying config / plugin
And is that the entire config you sent
what the hell
You have a problem somewhere else
i load
and i reload server 3 times
whatever problem is solved
βΊοΈ
thanks dude
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
I see it as more of an attitude issue. Asking why your solution doesn't work is one thing, asking "how to fix" and expecting an immediate answer is another
i dont expect any quick answers
It's unethical to criticise someone without knowing.
not really an ethics thing
I think they aren't native speakers so it might just have been a mistranslation
my native language is turkish
im not good at english
i think illisusions words not ethical
asking is normal thing
Alright, minor rephrasing from my side: I don't believe the issue is asking, but rather what you're getting out of it. Coming here all the time and getting an answer to a beginner's question is a pretty big waste of time for us, comparing to just sitting down and learning the basics (either through the wiki or user guides)
Pro tip: google spigot <my question's topic> before asking here, for example spigot file configuration. This will skip the whole asking for help process, and get you answers a lot faster
If you do have a question about a problem, make sure to list out the problem, what you've tried and any errors you've faced. Simple asking "how fix?" hints that you're looking for a pattern, not an explanation
The same way that a kid can figure out the addition of basic numbers by just memorizing them instead of actually summing up the numbers together. That kid will have issues down the road because they memorized basic math, not learned it.
Debugging is a tedious and (sometimes) long task but does yield learning and understanding of implementations from unfamiliar libraries and APIs
^ Programming isn't a memory-oriented skill. You look things up on the fly and try to make it work to the best of your ability
A proper valid comparison is driving. Sure you can just memorize all the exam questions to pass it but you'll end up questioning yourself as to who goes first in practice. There's a lot of information around you, form relations and use it
An interesting perspective π
Constantly asking "how to fix" is like memorizing that you can overtake in the road home. You end up not paying attention to any of the signs or road design and end up not actually learning whether or not you can overtake in any given road. You just know you can overtake on that one
I completely agree but learning the techniques to efficiently work out a situation is also a skill that needs to be worked on with coding
Correct, but taking this approach won't teach you how to actually problem-solve
That ability mostly comes from figuring it out yourself or being not-spoon-fed
As in debugging and working through a problem to solution
Or coming up with a solution to begin with
Or when you get to higher levels (if that's your desire) to design a solution valid for the problem at hand using common techniques or a combination
For example at work we have custom death animations embedded deep within NMS. I've never done something like this before, but by just seeing how the class works I knew exactly where to hook into and how
I feel like the main take-away is to take things apart and learn how they work
If you don't know how configs work maybe just look at how it's implemented and fill in the blanks
unless you're using a java multithread api gl with that
yeah, no. That's a huge waste of time if you're trying to be productive. Any midly-complex task will require a library that implements a bunch of compsci concepts that are just going to be a pain in the ass to learn if you don't already know about them, the logic gets very hard to follow real fast. Luckily for beginners, Java is on the better side when it comes to documentation, specially within the JDK where pretty much everything is documented in the javadocs
so, if you're trying to understand it, just look at the javadocs and ultimately check out online guides on the specifics
yeah javadocs (if done right) are really handy
Basic usage guides work better for me. javadocs are quite hit-or-miss
try and fail it is for me
Depends on the standard imposed on the developer who created the documentation. I do find that javadocs are quite subjective on how you handle detail and what you should convey
I struggled hard to read the CompleteableFuture implementation the first time around lol, turns out multithreaded logic that takes care of data races isn't so straightforward
Spigot is quite good for that, thankfully
mfw empty items vs null items vs null arrays vs empty lists vs empty arrays
null items should die
it is memory oriented when you write spaghetti code and have to remember what interacts with what and how
gl remembering that in 2 weeks lmao
ImIllusion, are you the same dev that works on the Skyblock core etc.?
maybe yeah
haven't worked on that in a while
lot of ppl seem to know me by it
Lately it's been a lot of geyser + nms fuckery :)) and kotlin
Incredible how I get to communicate with an esteemed developer of the community haha
Surreal almost
am I esteemed?
I mean, you produce works for top end plugins so
I would consider you to be esteemed
the elite of spigot
If you produced bad work, then I doubt you would've lasted long haha π
π none of my public work is.. remarkable imo
Completely understandable, nobody offers expertise for free
I see my own code as "good" but not that much else
- whats your "good"?
Yeah precisely
like in quality or readability and structure?
Good is very subjective
Good code and a good product are two different things
my version of good is can i leave for a month and still understand the code when i come back
usually this is not the case
For example I can write some pretty crazy abstractions sometimes and using them is chill but it won't amaze the end customer because it's just.. backend
I'd say my structure is "wonky" sometimes, but any individual piece of it is easily readable
as a user my good is obviously quality
as a dev im a writer and architect
I'd say that where I shine is mostly at just reverse-engineering and managing to fully understand a system within a couple minutes
But that's no big deal in the world of "elite developers"
call me an architect cus i wrote the code and even i still find new things within it
I'm okay at writing proof-of-concept projects that can easily evolve into something fully-fledged without the need of a rewrite
What I do still need to work on is mostly just abstracting away networking and database logic
If you all had to give one tip to improve, say you understand the main OOP principles of Java etc., you have a basic/intermediate understanding of complexity associated with data structures and can impose algorithms on them to efficiently do X. next steps?
Probably try out different "niches" within the minecraft network scene
chase your needs
Always making sure to work on a project that allows you to learn something new while putting it to good use
I wanted to expand into minigame development so I took more projects around making minigames and stuff
Find something you like to do and do it a lot. I personally never sat down and learned OOP or data structures (besides the fact I had to take a class last year xD), but seriously just keep doing what you like doing and improvement should come naturally
Then I wanted to do more proxy and infrastructure stuff so I wrote some more fucky code :p
Learn patterns, read books
always ask yourself what could be better
And rewrite your old utilities
its really a warning sign if you don't
I still use some old 2018 code but it's being phased out :)
it's just placeholder stuff
I sometimes still get caught up on logically arguing with myself whether or not a protected final field within an abstract class is better than a protected/public getter. Semantics really, I've never really found an resources to give proper "rule of thumbs" to it
as I become older I swear I care less and less about what I'm doing while prototyping
so your code becomes shit because you don't give a fuck
To combine fields and methods that are common to multiple classes
Could it be a skeleton class?
If yes use a getter
If no use protected fields
ezpz
turns out I throw that shit out 80% of the time regardless because either there was a better way of doing something or I was patching a symptom and not the addressing the disease
honestly, i have never bumped into skeleton classes
though, reading up about them, how useful

i'd love better exposure to higher programming concepts
i'm currently at university and have breezed through most basic concepts within OOP and computational problems like data structures and algorithms
I'm getting old man
I feel like I do as much HR and accounting as programming these days
well
and sales and team management
and I guess pr sort of
just be richer so you can pay someone to do those jobs
bro is in the pipeline
a year from now we'll start hearing about the greatness of haskell
I'm actually super hyped because I am finally getting to do some programming-ass programming
adding a wave function collapse system to make infinite dungeons and cities in mc
I'm much more of a product manager than I've ever been a programmer tbh
I used to do a lot of programming when freelancing but that got boring real quick
Haskell looks painful π±
I like programming
you just don't get to do fun things when working for small-scale problems
i don't think that's entirely true, i still love my little tick distribution regeneration plugin
its like a little 3D printer haha
that isn't small-scale though, just limited scope for what's worth
what I mean by small-scale is a customer with a very specific demand at hand, which doesn't really care about how it is done, just that it is done fast
i suppose small scale is subjective as well then
if it is something you do yourself for fun, it might be a limited scope but you can implement it in the most complex ways if you really want, since the sky is the limit when it comes to that
i think it was the first plugin where i really achieved proper design, whenever i needed a specific addition, implementing it was so straightforward with the provided structure i created
that's true developer satisfaction
the most satisfied I've been as a dev was to see people script things on systems I made where I genuinely was not able to guess how the hell they did it at a glance
that must be nice, i rarely get to do a peer project or more
i feel as if it is where i am lacking
not peer projects, just a plugin that allows people to do scripting
it's user contnet
often enough, you can just check a bunch of open-source things that you use relatively often, and do small contributions
see which one you like the most, stick to that community for a while
become a maintainer, get burned out by peer pressure, abadon the proj - that's just me
i'm somewhat out of touch with newer minecraft versions, still learning all the new features like persistent data containers etc.
i used to do a lot of packet stuff and nbt with 1.8
the golden years imo
I'm at the making minor contributions part can't wait to get to the burned out and quit part
Are you calling all the inventory stuff minor
weird question but does anyone know of a program or website that will let me preview a schematic easily
schematic file from worldedit
(.schem)
Should i be using DI for non instanced classes?
https://beta.cubical.xyz mayhaps
hm doesn't seem to work with my files
doesn't seem to actually load anything
Well thatβs all google Iβve got
What does that mean
passing an interface?
Do you mean singleton?
Dk what is non instanced class
The only thing that comes to my mind is some kind of utility class
I have a static TasksFile instance
to get stuff from this by TasksFile.getInstance.method();
My TasksManager class is not an instance, doesn't have a contructor. should it be DI (Dependency Injection) instead?
https://gist.github.com/godcipher/493976c4fe936a7a87e2eeda32a9c1de
what y'all think
What does getInstance do then
If itβs βnot an instanceβ what is that returning
im confused
So taskmanager uses only static methods?
Also why is getInstance named like a function
No taskmanager doesn't have any static methods.
public static TasksFile getInstance() {
if (tasksFile == null) {
return new TasksFile();
}
return tasksFile;
}```
Idk thats the way i learned a long time ago π€·ββοΈ
Oh you just didnt type it out fully
If it doesnt have static methods how are you accessing it?
DI through constructors.
I thought task manager doesnt have a constructor
it doesn't. It just passes into my main class.
Im still not entirely sure by what you mean with not instanced
If it doesnt have static methods and itβs not an instance, you cant access it
But either way, if itβs not a static utility class it should be passed through DI
I really don't think you should use static for this
Im still curious on what non instanced means
surely you should instantiate the TasksFile to the field instance in a singleton?
This is singleton ways
What that method does if you have everything setup correctly is ensure only a single instance of the class exists. If it doesnt exist it will create an instance
bump
it's just a wrapper for lists
what are maximum no damage ticks
it is fine and well documented, but kinda over the top for a rather simple functionality. I would specialize the class a bit more to justify its existence
?paste
in what way specialize?
Hey,
Im trying to decrement an item in a dispenser. within the BlockDispenseEvent
and it does, but once the stack lowers to 2. it will not progress to 1.
if I only have 1 item in the dispenser, it also doesnt remove.
can anyone point me to what I might be doing wrong in this case? I feel I must be missing something simple..
well, I assume it is a paginator for ItemStacks, if so, just make it more tailored towards that
its a generic paginator
i f.e. use it for chat output
Have you tried just Inventory#removeItem
does that remove the whole stack?
so, add methods specialized to that
It removes up to the amount specified in the ItemStack
but that would destroy the generic concept
otherwise, I don't any reason to not just use something like Lists.parition(items, pageSize)
so using a stack of 1 will remove one
fair point, but not everyone is using guava
gotcha, how does it select what stack to remove from? I assume the stack it removes from must match exactly, i.e itemmeta etc?
yes
Nice, il give it a go now
I mean, that isn't quite the point, the method isn't hard to replicate either
Should my lang file be static?
what do you mean by that
so i can just call LangHandler.instance().
nobody said that, im just giving out the tool i was using for it
no
in case anyone needs it
theres no point implementing DI if you are just going to use a static instance getter on other things
that is fine, however since you asked for feedback I had assumed you wanted to improve on it. If you just shared it as a general utility class then, godspeed
sure, improvement is good, but please no change of direction :D
Hmm, Inventory#removeItem seems to exhibit the exact same behavior it seems
Delay it a tick
That did the trick, thank you very much.
I wonder why?
bizarre that without a delay, it works from max stack size down to 2.
just not 2>1>0
with a delay getting the 2>1>0 to work also
cancelling the event probably does some funny business with the inventory
I need to run something if a player gets below a certain y level. what would be the best approach
every tick check every player position (curent method)
is there a listener that plays when a player position moves or something?
playermoveevent or tickwise, doesnt really matter since its just arithmetic performancewise
with playermove you dont need to listen for player quits Β―_(γ)_/Β―
both are called alot
worth noting to keep operations to a minimum for performance reasons in those specific events
it is negligible
a simple if statement is nothing every tick
if thats all they are doing I suppose, yep
arithmetic is the very minimum
yep, thats why i said its just worth noting π
ill show code and see if its gonna be a performance issue
bet you would get more info by running it π€
I doubt it would be anything noticeable but there just might be a better way to do things if I post it here
ah so we codereview, i mean yeah, go for it
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
String worldName = player.getWorld().getName();
if (BridgeUtils.isBridgeWorld(worldName)) {
BridgeMatch match = BridgeUtils.getBridgeMatch(worldName);
if (match == null) {
throw new RuntimeException("Could not get bridge match.");
}
if (player.getLocation().getY() < VOID_LEVEL) {
match.voidDeath(player);
}
double x = player.getLocation().getX();
double z = player.getLocation().getZ();
// if player outside the bounds of a 150 and 150 space, void death
if (x < -150 || x > 150 || z < -150 || z > 150) {
player.sendMessage(ChatColor.RED + "You went too far out!");
match.voidDeath(player);
}```
public static boolean isBridgeWorld(String worldName) {
return worldName.startsWith("matches");
}
public static BridgeMatch getBridgeMatch(String worldName) {
return XinCraft.getInstance().getNewMatchManager().getMatch(worldName.substring(16));
}```
utils as well for clarity
i wouldnt substring on the playermoveevent and would rather cache the match instead of retrieving it repeatedly. other than that it looks fine. i'm not sure if you want to penalize the players chat when they go too far out, but thats your beer.
go to help development they said, learn from peoples mistakes they said 
wait... this code makes sense tho... HMMMMM
how would you personally go about caching the match?
I dont like the code either
probably mapping the matches to the worldname
in a hashmap or a seperate object in a list
whatever map you desire, but yeah a hashmap
I would use the world uuid instead
But yeah
You can also check if the move event is within the same block (compare from and to locations) and then skip the rest of the code if so)
^
hows this look
private final HashMap<String, BridgeMatch> matches = new HashMap<>();
public BridgeMatch matchMake() {
BridgeMatch match = new BridgeMatch("A");
match.setTeamCount(2);
match.setTeamSize(1);
matches.put(match.getWorldName(), match);
return match;
}
public BridgeMatch getMatch(String id) {
return matches.get(id);
}
...
public static BridgeMatch getBridgeMatch(String worldName) {
return XinCraft.getInstance().getNewMatchManager().getMatch(worldName);
}
...
@Getter private final String worldName;
public BridgeMatch(String id_) {
id = id_;
players = new ArrayList<>();
worldName = BridgeMatchManager.MATCHES_DIRECTORY + "/matches-" + id;
}
should I switch from String to UUID object?
not really necessary I wouldn't use a string ofr ID tho, I'd probably just have a global static integer you can increment on object creation
oh actually in the case where you're saving them to a file for some odd reason? I guess it'd be best to use UUID
basically every match is a different world
it kinda depends on your cleanup process
does somebody know a guide on annotation processors that process source annotations?
havent even started writing that yet
I think going with an int here is fine as long as you clean up after yourself
would it be much faster? I feel like that would just be messier code
because obviously if you have /matches-1 existing after your server restarts it'll cause issues
yeah at server start I delete the whole matches folder
an int wouldn't be faster its just a clearer intention. String id's here make little to no sense
you gain no extra insite by giving a string name versus an int name
fair enough
so instead of labelling matches with A. B I should use 1, 2?
is that what you mean?
yeah I mean alphabatized names are just harder to keep track of
fair enough I just liked the look tbh
the easiest way to track alphabatized names ends up being char codes anyways
Clearly it needs a uuid
and at that point its just an int
UUID isn't needed here
makes little to no sense
why use UUID when you only need a temporary UID
dont worlds already have a uuid
oh true though
Yes
yah he's just messing with me lol
Actually probably safer to use File.seperator
yeah thats what I do
But still, weird way to make subfolders but I guess it works
matches/match-A but now moving to matches/match-1
okay I've changed it to an int
how would I now get rid of the awful substring
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
String worldName = player.getWorld().getName();
if (BridgeUtils.isBridgeWorld(worldName)) {
BridgeMatch match = BridgeUtils.getBridgeMatch(Integer.parseInt(worldName.substring(15)));```
I think the whole point of caching the world name string was so I don't have to substring it at all and I can just directly look it up
Have a map of world uuid to BridgeMatch somewhere
// only run the code if the player's y level has actually changed
if (event.getFrom().getY() == event.getTo().getY()) {
return;
}```
like this?
Use getBlockY
ty
whats the best way of placing and removing 10x10x10 sized structures
schematic lib? write my own read/load from file system?
Anyone know off the top of their head if any enums have been converted to interfaces yet
ahhh inner enums have alr
Does anyone perhaps know how to damage an Ender Dragon? I found this bug report, but damaging the EnderDragon instance with damage(4, DamageSource.builder(DamageType.THORNS).build()) doesn't seem to work, nor does calling damage() on the EnderDragonParts directly. The dragon just takes it like a boss and idk how to get him to not do that 
I'll look at internals quick and see if I can find anything
seems like damage is just scuffedd
Yeah I literally have no idea, it's super strange
setHealth() works so I'll just use that and play the hurt animations myself I guess
When using DI does Bukkit.createInventory cancel it out? having this issue where its fine up till it gets to my create method and it says its null but doesn't anywhere else.
@Override
public Inventory createInventory() {
int invSize = this.size;
invSize = ((invSize / 9) + 1) * 9;
return Bukkit.createInventory(null, invSize, color(String.format("&aTasks &7(&c%s&7)", this.size)));
}```
Whole class
private final PlayerDataManager playerDataManager;
private final TaskManager taskManager;
private int size;
public TasksInventory(PlayerDataManager playerDataManager, TaskManager taskManager) {
this.playerDataManager = playerDataManager;
this.taskManager = taskManager;
}
@Override
public void decorate() {
int i = 0;
size = taskManager.getTasks().size();
System.out.println(size);
for (Task s : taskManager.getTasks().values()) {
Task task = taskManager.getTask(s.getName());
InventoryButton button = new InventoryButton(taskManager.getIcon(task)) {
@Override
public void onClick(InventoryClickEvent event) {
Player p = (Player) event.getWhoClicked();
playerDataManager.startTask(p.getUniqueId(), task);
}
};
this.addButton(i++, button);
}
super.decorate();
}
/**
* @return
*/
@Override
public Inventory createInventory() {
int invSize = this.size;
invSize = ((invSize / 9) + 1) * 9;
return Bukkit.createInventory(null, invSize, color(String.format("&aTasks &7(&c%s&7)", this.size)));
}```
Can you show the error?
And it seems you never define size
Looking for a web developer for a Skript code generator AI website, the pay is the Skript AI, dm me if you want more info, or ping me
?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 does spigot have to do with skript or web development
Dunno
you dont understand bro, java is dying bro
skript is gonna take over
according to this guy
i actually tried skript for like a week and that shit is worse than scratch
couldnt even figure out how to make a fuckin variable without like an hour of google
Skript devs trying to make good syntax challenge (impossible)
Skript is garbage
Player.spigot().send...
are you on paper?
oh yeah you right
im sorry
i recently changed
that's why i keep askin here
im so sorry
if something is deprecated it usually means paper wants you to do it differently
They deprecated in favor of adventure components
Here's a fun challenge. What's a good way to implement item tracking for stackable items? e.g. tracking a specific item between drop, pickup, inventory movements etc. Modifying the PDC for non-stackable items is feasible, only because they're unstackable already so it doesn't matter. Gonna use this for moderation stuff, if even possible to implement lol
it would be impossible for a stackable item as once merged it no longer exists
they would need to merge tracking numbers
Player has one item, picks up a second, it stacks so only one item exists. When he drops one which did he drop?
but then you would need an external system keeping track of it
^ That's what I'm trying to figure out atm
but yeah you lose that information
Unless I pool UUIDs and assign at random, based off player & previous UUID history
unless you keep track of all changes to an item stack in some kind of manager
The only way is to have a very comprehensive tracking systme, but you'd have to decide on discard order and always use the sme
which... isn't necessarily the worst idea
first in first out, or last in first out
it gets even more complex when the player splits a stack in their inventory
wtf
You'd likely just do
crafted - UUID
merged uuids:
list
for crafting
I'd not even attempt to write it
right, ids would be converging
I'm sure it's possible, assuming one does not try to be exact and goes off player & past history.
The issue at that point is just matching sure the UUID's history is exact, which is slightly easier than trying to get it perfect
and when you split a stack you would have several stacks with the same id, which doesnt make sense
unless you keep track of that and assign new ids
That would likely be feasible.
Stack ID & Item ID
Probably a randomized UUID or something along those lines. An identifier basically
I've seen this done before
Could omit the stack identifier, however, it would be useful to log the stacks it's been in
Yea, I'm sure it has. Can't name anything public off the top of my head though
Yeah that wasn't public
A stack would essentially be stored with a list of item ids items in it (ordered). And whenever the stack would split you'd modify the stacks to take out the ids
right but you have to arbitrarily split out the ids

