#dev-general
1 messages ยท Page 102 of 1
alright
file.readText()
You dont need to make a file reader, and you definitely dont need to make a json reader
Im pretty sure we told you this already
and you dont need to pass in the datafolder, get that from plugin
Why are your param name tooltip thing so ugly
you also dont need to pass around world container
you can get that from Server
plugin.server.worldContainer
JavaPlugin implements Plugin
Ok WHY is this not wokring
You are making an even tighter coupling by using JavaPlugin
alright
private void checkAnimationListenerAlreadyRegistered() {
Listener previousListener = null;
for (final RegisteredListener registeredListener : PlayerQuitEvent.getHandlerList().getRegisteredListeners()) {
System.out.println(registeredListener.getListener().toString());
if (AnimationListener.class.isAssignableFrom(registeredListener.getListener().getClass())) {
System.out.println("MATCHED");
previousListener = registeredListener.getListener();
}
}
if (previousListener != null) {
System.out.println("UNREGISTEREING " + previousListener.toString());
HandlerList.unregisterAll(previousListener);
}
}
what am i doing
stupid
@heady birch ummm
What are you even trying to do here?
Why would you just not keep track of your registrations?
Still dont F ing work
I ant
Papi expansion
I cant store it anyway if you see what I mean
I dont
Go on then
if (registeredListener.getListener() instanceof AnimationListener) {
This dont even work
net.kitesoftware.animations.expansion.AnimationListener@548c98e5
Clearly the same type
@topaz bay what do you suggest
tracking your listeners properly
I cant store an instance of it
why?
Probably because its not the same class
๐
.... Exactly
So I cant track my listeners properly?
You know what
Ill just keep creating listeners
Server owners can F off
youre probably over complicating this
// register new listener
}```
Yes it does
?
Nothing new
Ceo of memory leaks
But esp of memory leaks
I dont wanna use cacheloader
Cache
I will need my own BukkitPlayerAnimationServiceProvidingCacheLoader
ThatsALongWord
CALLABLE
@topaz bay You know you shouldnt store Player in a map?
What about in a Guava cache
Also using a weak reference for a player wouldnt work would it?
Looks decent
Bit outdated
net.kitesoftware.animations.expansion.AnimationListenerIs not an instance of: net.kitesoftware.animations.expansion.AnimationListener
.....
im done
done
Looks like it is to me
if (registeredListener.getListener() instanceof AnimationListener) {
previousListener = registeredListener.getListener();
} else { System.out.println(registeredListener.getListener().getClass().getName() + "" + "Is not an instance of: " + AnimationListener.class.getName());
}
Tell me thats wrong
Try Class#isAssignableFrom
or print out Class#toString rather than getName
Uh
like AnimationListener.class
yeah
I was thinking that
toString should show a hashCode or something
๐ฆ
Cos papi reloads the expansion
He kept telling me to "keep track of my listeners"
Lol..
who else is gonna register an AnimationListener?
hopefully no one.. I'll just unregister anything that contains that in its name
PAPI 3 better have an unregister() method
the event is deprecated
papi 3 will never happen ๐ข
soonโข๏ธ

Lol
Might just replace the HandlerList with my own one telling other plugins to go away
eh what
proper fully functioning string interpolation
yea but where are you getting the 15 from?
add(number, 5)
CEO of script njection
oh I didn't even see that
Enter your username: "${db.deleteAllUsers()}"
=paste
Please use a paste service to share configs, errors, code and long logs.
โข HelpChat Paste
Not really
Thats the size of tabs youre seeing on the paste
The only thing that can really be inverted is the break on check in the while loop
@topaz bay very nice
smh
imagine
ugh
i was about to flex on having escapes working but i can't even run it https://img.bristermitten.me/13-37-25-11-06-20.png
why does intellij do this
Its a sign
https://img.bristermitten.me/13-38-55-11-06-20.png nope, this class doesn't exist
not there
oh dear
I can draw 100mb worth of shapefile in that time ๐
that sounds evil
Render time for: UK Water = 3
Render time for: UK Roads = 8
Render time for: World = 7
Render time for: UK Counties = 11
Total Render time: 29
Do you want to know the secret
good job
LOL
they're like interfaces kind of
could actually contain the logic behind setCancelled
did you press the "run" button
yes
ok press it again
hello its me microsoft support
before we start, your bank detail so i can confirm it is indeed you
๐ฌ
praise the lord
it started working again
thank you microsoft support!
i will pay $80193
as I was saying
๐ฎ๐ณ
@topaz bay slow https://img.bristermitten.me/14-02-31-11-06-20.png
print = value::Any -> _ {
stdout.println(value)
}
print("Hello World")
4 lines
frigga is very speedy
She's an old woman who needs time to warm up
I'm deadass tempted to build my own Redis server implementation
Why tho
Ive done that
I was reading a technical spec and its from 1998
I worked it out but if you wanna answer it, it was how do i put like "defau;t" values in a mpa
Who tf does he think he is
@obtuse gale kotlin actually has Map.withDefault or something
but it's a questionable implementation
Please use a paste service to share configs, errors, code and long logs.
โข HelpChat Paste
for (int i = 10; i > 0; i--) {
final int i2 = i;
}
[] is the current stack
its the final countdown hahahaha
NiallLib has this really cool concept
What?
Every object is wrapped in N
?
N is very useful
new N("Hello");
N can be anything
you make all your N's public
They have their own getters and setters
Imagine having to use new
new MyClass().propertyOne.set()
N.of()
N is powerful
add propertly lsiteners and stuff
What
Bindings to another N
n.bind(otherN)
Can someone check #development ๐
N<String> myN = N.of("String 1");
myN.set("New value!");
myN.friend(N.of(":)"));
What does friend do
makes them friends
....
Pair<> alternative
What does pair do
Neat am I right?
What does that do
nice
Lets see it then
I don't think it's on this pc to be honest
Does it start with a P
it has a p that says enough
Oh dear
I called the lang Jaquar though
but eh
y'all flexing with that language
I'm flexing with the kernel
@prisma wave
You ever just...
๐
I have 0 idea how I want to resolve this
Cause like... yeah... thats working right
It is handling it correctly
xD
I would have to somehow unravel this expression
Oh you know what
I have an idea
Currently, when used in an expression, the look prepends a head marker command
and then appends a tail marker command
when the tail is hit, it walks up the stack until it hits the head
And adds all the values in between to a list, and then pushes that onto the stack
which is why its concatenating as a list
I think
I THINK
This is an opportunity for me
to add a 3rd pass
Imagine not knowing how your code works
No...
The I think was a new sentence
I know exactly how the head and tail walker works
I think I can add a 3rd pass that will detect that head and tail, and then modify the loop expression to include the left side of the operand inside the expression
to change this
bar += loop (cur++ <= barLength) {
=> "="
}
into this
loop (cur++ <= barLength) {
bar += "="
}
Surely that second example would work anyway?
?
Ofc it does, that was the original code
Im attempting to add the first thing
Since a loop statement is the only construct that cannot be resolved as an expression
Thank you
I appreciate it
On a somewhat related note... Could function multiplication replace a for loop?
I guess the lack of an exit condition could make it problematic
That would probably be nutty
Yikes
so inspiring
ty
what happens if it's without a =>
It wont compile
The final statement on an expression loop has to be a stack push
(which is a reused return statement)
not a very pretty exception, but yeah
no
๐ฆ
It can though
direct access to the stack sounds kinda dangerous
if a function just pulled something it could disrupt a lot of things
hm
it would kinda be like a memory leak
but not exactly
say if a function pushed 10 things but didn't remove them
unless you've got scoping
Who doesnt love a good gimmick!??!!
that's not entirely a gimmick
It is VERY gimmicky
it's like reduce but declarative
Its syntax sugar
ooo just found a bug in the string interpolation
tell me more
unacceptable
Very much so my diamond
๐ค
Ha
I guess it's parsing as a property reference or something
Well that part where its trying to find hello, obviously yeah
Although kinda stating the obvious...
But the interpolation resolution is completely separate from parsing
Apparently not
It literally is
Its basically a string utility
fixed it
This check was inside the wrong scope
It was only breaking if there were more matches of the interpolation marker
interesting
Whose lang is dat
sxt
Sicc
Ew kotlin
Get out
alright you've crossed the line
Lmao
yeah wtf bro ๐
Ew kotlin
@signal tinsel
tbh id use kotlin only for some of it spicy functions, such as Extensions and string interpolation ๐
?
๐
what did you said b1tch
Extensions?
U HEARD ME
add methods to classes that aren't yours, Maffie (might be more than that)
does kotlin compile to java?
fun String.color() : String {
return ChatColor.translateAlternateColorCodes('&', this)
}
"&cHello".color()``` is a simple example
sometimes
it can compile to .class files, or javascript, or native code
I wonder how extensions looks in java
disgusting?
Also, do you have to register it somewhere or just write it?
Shit thats real nice
extensions compile to static methods
I thought it's more than that Sx
and no you don't have to register it, but you have to import it sometimes
it's kinda magic
let me dream
it feels like magic
I still use java for the complicated because im a little more confident
gross
i should learn kotlin
Good idea
Ori
I know your a n00b and all
But it's been doing that for as long as I can remember
:feelsbad:
i think its an intelliJ ultimate thing
and its only now in community 
but not sure
i'm dumb
It was there for me on community edition iirc
enable final on local variable detection
That's kinda disturbing
ยฏ_(ใ)_/ยฏ
Maybe I should add specific operators for stack manipulation
lol
I love ligatures
That's really disturbing
honestly
this collapse api is so fucking useful
not having to change implementation code is fire
lmfao
too much power
You know whats kinda funky
The pull operator technically doesn't need an implementation
Since the pull from the stack is executed by the target
I just have this command that will optionally pull from the stack
When the type goes to parse an expression, it just adds the command and tells it to do nothing
(except for making sure the stack isn't empty ofc)
pretty error
Kinda cute
Oh damn coroutines is huge, 1MB
I would appreciate some feedback on a plugin that I've been updating.
In particular some suggestions for simplifying/improving cross version support of different MC versions.
https://github.com/frost-byte/QuickBoardX
That spacing makes me oof
its not even the allman
Also this man be doing everything there is in the main class jeez
no
I guess you could use main as a descriptor
but it is not the main class
it is the main class
explain plugin.yml then ๐ค main: com.my.myshitplugin.Whatever
Niall
the dude seems to have basic java knowledge
You're a 4head
but everything is just a mess
I've seen plenty of examples that apply a defined api to the main plugin class; if you have an alternative suggestion or example I can review that'd be great.
As far as having all of that functionality within the main plugin class, if you can suggest another approach that works with a multi-module that handles different versions for compatibility,
that'd be great. Which is why I asked for some feedback.
Ori, I've just refactored that part to use an additional method, because it I also felt that it was pretty ugly.
oh yeah btw
we dont give actual constructive criticism
we just bully the code and ruin your self esteem
:)
Yeah I figured that out a while ago, which is probably why I'm generally inclined to help when I can ๐ Just to be 'that guy'
tongue emoji 
I do a lot of refactoring as I learn better approaches; most of the time getting something relatively functional doesn't necessarily mean it's clean.
90% of popular plugins on spigot
are coded like pure garbage
so its not just you, dw
wrong
bit more
102%
I'd say around 99.95% of plugins are badly made

The choice of variable names just really makes the project
wooly, where's your guice module?
I want to obfuscate my code with meaningful variable names, just to be different. The original source should be like typical obfuscated code, amirite?
just don't obfuscate it 
ah verison manager
wooly, I can't really give specific tips regarding making the version independence stuff simpler, but I can give general feedback if you want it
That's fine, I'm happy to have whatever feedback.
there's no such thing as cyberbulling ori
in every coding discord server im in theres one guy like sx
I figure he doesn't even sleep in a bed, just falls out on the wrong side no matter what
that just comes off as a prick unless you get to know them more lol
don't take things personally and you'll find that your perspective changes
Sx is a species
I used to hate sx's lol
he's an acquired taste
wooly this project would benefit massively from some design principles
and considering you've got guice here, it's especially easy to follow them
Well there is definitely a lot of reused code
which is one of the things that is related to the question i was asking
right, don't repeat yourself
sx hates me right now 
sx hates everyone right now
I'd also recommend formatting the entire project wooly
whoever made this was definitely a c# developer
Most of those issues for this project relate to creating mulitple versions, a binding for each of the mc versions I'm supporting.
I was curious if there was a general strategy or design pattern for handling changes in Bukkit/Spigot Interfaces and classes. Like Scoreboard and Team (bukkit actually)
I basically reworked the entire project
to make it multi module
the original developer was basically letting me and anyone else who felt like it support his plugins
and was never available on his discord
There were issues with how he was managing his plugin configs; overwriting changes made to them when the server shutsdown, as an example.
that and people were asking for backwards compatibility; I thought it'd be a good project to learn how to set up maven for multi-module as well.
wooly, this is what I call clean. https://paste.helpch.at/licihulinu.java
you and me have very different concepts of clean
You're a 4head Piggy
Right, I generally follow that approach. I have a far more complicated plugin with lots of Managers and code compartmentalized into separate classes
I honestly don't know what i'm looking at
I would typically do intialization and teardown in the plugin class
and put all of the other stuff elsewhere
you're storing commands, listeners, "plugins", and also managing their registration in this class frosty
I think that's supposed to be like a skeleton of a plugin
then you're also providing getters for "CompletionHandler", "MessageLoader", etc
and then you're also extending JavaPlugin, signalling this class is your main?
like pick a task lol
is it your application's entry point, an instance provider of your "managers/loaders", or a command, listener, and blah registrar?
It's all ๐
well that's a violation of the single responsibility principle
Indeed it is, but you're also violating it, so can't really blame me
hehe
what can I say, it's hard to make your main class abide by that principle
Some times I feel like that Single Responsibility Principle would cause a lot of fragmentation.
I mean I understand the concept, and from a maintenance point of view I get it. But sometimes it's just not as practical, depending upon the context.
Would you typically split off all the responsibilities for loading, registering dependencies into individual classes?
yes
even if it's just one method with a couple of lines?
Some times I feel like that Single Responsibility Principle would cause a lot of fragmentation.
I mean I understand the concept, and from a maintenance point of view I get it. But sometimes it's just not as practical, depending upon the context.
I think all the solid principles are pretty sound, the issues come into play with oop itself, which is what solid builds upon
although I'd just like to mention, the example you provided before, is not an example of an oop/solid flaw, but rather just a lack of different perspective
Now one of the things I've done, for example, is created a bunch of Manager classes, each handles specific aspects or features on the server.
They're basically glorified event listeners, and yet there's still a lot of interdependencies between Managers, which I manage with Guice currently.
I know that SRP pretty much mirrors the philosophy of a traditional unix cli program
If you need more complex behavior you can just pipe various commands together
is that just your comparison, or was that an actual inspiration for the principle?
I think I've read that, but I'm also aware of it just from observation
Quick question
I've had a lot of exposure to it, and I know how it works from experience
I dont really understand why its better to pass the individual things like file manager to a class, when it looks neater code wise to just mass through the main class which contains getters/setters to said file manager class
So I have a frame of reference and can see how it's similar in some way
It makes the constructor look hella messy
That's why I switched to Guice
aj there's virtually no difference between the two things you've just mentioned
actually that's not true
ignore that please
I was told last night to pass through the individual things
I have like 40 commands, and I use ACF a command framework.
/**
* Register Console and Player Commands with ACF
*/
private void registerCommands()
{
getLogger().info("VanillaEssence: Registering Commands");
Set<Class<? extends BaseCommand>> commands = pluginReflections.getSubTypesOf(BaseCommand.class);
commands.forEach(c -> commandManager.registerCommand(injector.getInstance(c)));
}
by who?
I use a reflection library at startup one time, and that can be optimized further, I just haven't done it yet.
oh
pig aka the ceo of org.reflections
nah i made my own thing after I realised org.reflections was kinda shit a while back
this has suited my needs because it does the job, it runs at startup of the server. I just haven't had the time to do any further exploration, including the alternative you'd suggested.
wooly, I also do a form of classpath scanning for commands
and with your example before, my loading and registering process is separated
๐คข
I have a "request" api, which allows me to request particular things from the scanning api, and bind them via guice. I then inject the scanned items, and register them elsewhere
well I do this for a lot of things during startup/registration, not just commands
/**
* Register classes with Bukkit that implement its system for
* serializing and de-serializing their data
*/
private void registerConfigs()
{
/*
Challenges and Objectives Configuration
*/
getLogger().info("VanillaEssence: Registering Configurations");
Set<Class<? extends ConfigurationSerializable>> configs = pluginReflections.getSubTypesOf(
ConfigurationSerializable.class
);
configs.forEach(c -> {
String simpleName = c.getSimpleName();
getLogger().info("Registering " + simpleName);
ConfigurationSerialization.registerClass(c, simpleName);
});
ServerData serverData = createInstance(ServerData.class);
if (serverData != null) {
serverData.onCreate();
}
LeaderboardData lbData = createInstance(LeaderboardData.class);
if (lbData != null) {
lbData.onCreate();
}
WorldData worldData = createInstance(WorldData.class);
if (worldData != null) {
worldData.onCreate();
}
}
Custom Configurations for example; since I'm not currently using a database.
using a guice factory to do assisted injection for the last three
I've never actually used assisted injection
your overcompilcating this
it can be pretty complicated
what does it do?
basically lets you mix things that need to be injected with parameters
that are different for each instance you want to create
so let's say you have four custom serializable configs; they all share some dependencies you want to inject.
But the path where each is stored is different
ah right
or, in my case, the player data config is per player
so the file name is based upon the player uuid
Yeah, I'm sure there are probably other approaches to doing the same thing.
did I show you my scanning/guice idea?
where you could do things like @Inject @Id("69") private Person person;
You mentioned it above
is Id your own annotation or is that from Hibernate/something else similar?
it's just an example
that specific example would probably never appear in real code
it's kinda useless
but it show's the concept really well
perhaps this is a better example
@Inject @Extends(Command.class) private Set<Class<? extends Command>> commands;```
Ah I see, by scanner you mean the class path scanner
well technically it's not a classpath scanner
well, but in a sense it's finding all of your commands and registering them with guice/handling the injection; instead of explicitly registering each one.
Similar to what I was doing, but condensed, less verbose.
Did you create the @Extends annotation or is that from another lib?
or was that just an example
just an example I made up then
although that's definitely something I'm putting into my framework, now that I've thought of it
I've been trying to find a use for that concept for ages
One of the biggest challenges with guice is avoiding circular dependencies; it took me a while to figure out how to refactor some of my code to avoid it
I had issues with that when I was first working with guice
whether I use provides, or method injection; or events if I don't need a result immediately
my style of coding doesn't really allow for it though now
what if you have multiple classes listening for the same event?
then I'll have multiple classes listening to the same event
so that's not really an issue, I mean plugins collectively do that already I guess.
It's really only tricky when you need things to happen in a specific order, and you do have the priority for that, I guess.
I find my code rarely needs synchronization of that sort
maybe I just stray away from the kind of projects that need it, but I'd like to think it's my code style
You rarely need that
oh you're probably right
i never thought of that lol, that maybe it's just rare in general
I dont care unless theres a problem
Piggy, I expect the thingy you're working on to be put on spigot
Decent XML parsing library
does the jdk have an xml library?
Yeah but..
Its not exaclty fast
Not sure if jacksons extension one works with the streaming api
Actually its pretty small json anyway
@ocean quartz, do I have to close and reopen the menu to update the lores? cause rn I'm using .update and it doesn't seem to be doing anything
@hot hull You need to update the item, the item you add to the gui won't be the same you added since the nbt stuff will give you a copy of it
Also wtf is wrong with this guy?
Ah okay will try that, also, I had a kid spam my dms this morning asking if I knew someone who does web de
dev*
Also wtf is wrong with this guy?
@ocean quartz ๐ ๐ ๐
Where is that message from?
On their Discord
Not sure what he's looking for, some sort of compliments?
Matt, I'm slightly confused
Oh yeah I don't really care
Fullwall is a nice dude, this one is just an ass
What's up Frosty?
Thats one of Citizens authors, frosty

Show me your code
Anywhere I can improve from this?
Remove kt
remove java
Whats wrong with citizensCMD??
delete java
As far as I know nothing
I guess is just fun to create an API then when people use it you throw shit at them
Can you rephrase that ,-,
He is yeah
i can imagine
I use citizenscmd on my server
Nothing wrong with it
Honestly i have no idea wtf denizens even is
It's because he's upset that he tries to shove Denizen in people's face and they don't like it so they went for mine
But now Citizens have the commands built in so he has a reason to complain lol
Yeah, a more complicated way to use but it's there
Welp
Yeah
He was saying that Denizen was a better alternative, then linked me to this to prove his point https://forum.denizenscript.com/viewtopic.php?f=13&t=149
And ended up actually proving my point that it's just too complicated to use compared to mine
skript ๐คข
wait so just like remove the object declaration and just have it as a file?
yes
ah alrigh
object shouldn't be used to make util classes
it's for singletons mostly
and static methods when they're needed
anything else weird with htat code lol?
ugly spacing
code wise tho lol?
lol
How about the generator manager or store entity manager class
thats got the most in it probably
not very readable
would it kill you to format it
add a few line breaks every now and then
etc
ye
Any Git clients you guys recommend? I don't really like GHD
command line
yes or whatever other jetbrains ide I'm using
If you want to make it neat, why don't you use proper spacing and allman @obtuse gale
which
ew allman
allman?
hi
{
}
it's just some inferior shitty style
ew
https://github.com/Aj3douglas/AJ-Bedwars/blob/master/src/main/kotlin/org/aj3douglas/ajbedwars/core/GeneratorManager.kt#L32 personally I think you should only use BukkitRunnable if the task needs to cancel itself
@topaz bay this https://img.bristermitten.me/15-59-46-12-06-20.png
@quiet depot you are wrong
I literally just woke up
I feel... strange
I usually wake up between 1-5am
arent I using BukkitRunnable?
pea brain
use Runnable unless the task needs to cancel itself
oh ok
whats the difference
Sx, why would anyone use your language over any others?
wdym magical numbers lol
Same with Frigga KM
what the frig is a frigga
Its... a toy language
KM's lang
random numbers with no mention of what they actually mean @obtuse gale
It doesnt exist to solve any problem
Frigga will be the best functional language
no clue why thats 2.0 lol
it will literally REDEFINE the programming market
good day all
Fair enough Sx, just thought you were making it for people to use
its meant to be 0,0
hello
Hey BomBardy
what have I missed
you guys know what we haven't done in a while
some good old clash of code
anyone down?
classic
who got the link
ugly
functions have their own stacks
oh right
Not much. A monitor flex in #off-topic, some weird stuff here, nothing much in development @jovial warren
strange
i mean it's strange that you can do stuff like https://cdn.discordapp.com/attachments/695431668944732270/721016718561902652/unknown.png
if functions have their own stack
oh
where did that arrow come from?
ligatures
I didnt send the entire screen shot
I thought you showed some examples of that working yesterday
clash
of
code
clash is gay
don't care
hows that for storing GUI item
i'm bored
na
heard korm was broken
the name sucks
not broken
That is objectively untrue
just a not descriptive error message
actually it doesn't aj3
and dumb end users
JOIN SX
im not gonna make the chicken korma joke again
welcome to the korm fields


