#off-topic
1 messages · Page 519 of 1
imma obf a waterbottle
do it
yall aint getting the secret code
if water*
First time when I have seen an obfuscated code I was like "wtf code like that?" 😂👌

noob*
What does Something<?> means?
is that even obfuscated?
ye
? is a wildcard generic gaby
a
im not sure what setting its on
when he wants to obf leveling tools 

Why do I have / want to do a lot of stuff but have no time omg
I need to finish a commission, to study for school, to learn C & I want to watch a serial smh
what u need c for

do what? xD
Between Pascal and Phyton, which is easier?
py
python
Isnt Pascal too old?
python is pretty old too
But never too old to be used to study..
In our school still learns about Pascal
ay at least you guys have programming courses in your schools
Well.. we had the recent test about Pascal, but the friend and/or someone behinds me keeps asking me about the code (obviously they aren't expert or intermediate in English)
Got me in a hell life enough to miss a single semicolon in the code line ._.
Why dont you move to a school where you have programming classes @eternal apex ?
It was only 15min test, and knowing my friend next to me doesn't have much time, so he snatch my test paper to copy it, and my teacher didnt even notice..
I wanted to but comparative to me you know everything
Not sure if it’s different in Romania, but I can’t simply switch school, nor would I want to. I’ve got friends, don’t want to try make new ones. Also, sorry if this makes me sound egotistical, but try to see it as a problem of the school system and not my ego, but I doubt any high schools in the area could improve upon my current knowledge. I’ll just have to wait for uni
I can agree with the last sentence haha
And isnt like you can switch the schoom at any time you want but there's a way
😮
well to expand on the last point, I actually have had a java teacher once. The school brought him in as an experiment. Unsurprisingly, none of the students were engaged, I finished the work far before anyone, and my skills far exceeded that of the teacher.
Too smart for his age, I have to say that
I need to find a way to focus on learning stuff, I get bored & distracted pretty easy kms
I find the best way is to have someyhing you’re developing for. Back when I first started on java, my reason was I wanted custom plugins on my server.
SAME
it’s very hard to learn a language without goals
I started when I was little because I wanted a cool server, but couldn't afford to hire dudes
so I turned to learning
and here I am like 6 years later 😂
if you don’t have goals, you need some, so go onto the languages relative forum, or a community around the language, and ask for someone to give you some goals.
piggy how old r u
117
11,7?
not yet
what i will do there
one or the other
neither
more than likely 17
It sucks that I dont have irl friends involved into programming
I'm 12
can vouch on the above statement
They are all into alcohool and such
gian is indeed 12
banned for being under 13 on discord
Kek
lel
has been 12 for as long as I’ve known him
=multi spin
oo
Wew
=multi
Smh fc
nice
Im eating rn
eZ
poggers
Oh
see
Yea
Shame I'm in school tho lmao
ShitShat?
dchat
shit shack
o
Gonna hopefully finish this whole eco today and start on the enchants
It'll be private so </3
Ye
Pig why dont you make premium plugins
I'll let u see it on mah test server
kinky
💦
i don’t have any premium plugin ideas
well i do, but I don’t care enough to implement them
also, I try to avoid paypal at all costs, and that’s the only gateway spigot offers
Piggypiglet.store ez
my new PayPal is even set so I can withdraw money to my bank, but I can't pull money from them
In future, I might actually have a thing on my website like that gaby
so I can accept stripe
im looking rn for xenforo stripe actually
Cant wait for my mother to come home and yell at me cuz I didnt went to school :))
won’t be selling resources, it’d be a place clients can pay for commissions
even if I did sell premium plugins, they’d still be open source
perhaps I’d even have a link to jenkins on the gh page
makes no sense
they have a resource manager addon
so surely that addon should let people sell..?
Docs > Word
google docs?
Ye
smart mf
Paint > Docs > Word
ofc
etch a sketch > paint > docs > word
I'm cryting after seeing the project plan 😐
HAHA
I got told a method on how to verify my paypal
without bank etc
and it worked, mcpf is working now
its out
o 
So pricey xD
Seems that way
eh its in a suitable figure for what it does
Papi3 has that planned iirc
Just seems odd to charge $5 for something when papi does all the hard work 😉
lol
I'll reshuffle my pricing a little, as this is what I want
most expensive to least
HQ Bundle: $12.99
Tools: $9.99
SkyBlock Setup: $6.99
Tags: $4.99
Piggys: $2.99
Globalholders: $1.99```
seems fair
@sterile parrot Yes it's very specific because I can't find any plugin that does this...
Plugins like BungeeSignsUltimate don't have any option to display text depending on the MOTD of a server....
And none of the minigame plugins I want to use has any bungee feature except:
- Change MOTD based on current state
- Auto-join players to game on join
- Send them to a specific server on leave/end of game
prob something you'd need custom
Thought about making a plugin
Which would use plugin messaging channel to send updates
?
plugin messaging
it always needs real players on each side
for it to be able to send
I don't think so
it does
Or how else would LP work then?
only way around is sockets
Give me a valid proof (from spigot staff) that it requires players
I mean you can search spigot yourself, but I know from testing my spoofer
and other plugin messaging ones
even maxim himself 😉
only way around is via sockets
BTW: I don't want to rely on having players online
The global multiplier has ran out and has been reset!
whats that?
=multi
that x9
ranking stuff? lol
ye
lol




# Vouchers v4.0 Configuration
# Configure your 'example' voucher here.
item:
name: "&bExample Voucher"
lore:
- "&7Go into the plugin folder"
- "&7to edit this voucher."
- "&7"
- "&7plugins/Vouchers/voucher/example.yml"
glow: true
rewards:
test:
chance: 100
actions:
- "[broadcast] Example Action!"
settings:
permission: true
blacklist:
region:
- "bad_region"
world:
- "bad_world"```
opinion?
on config layout
you should use the correct codeblock language
oh ye
oops
Vouchers will be per file, so cleaner
Just not sure whether I should move everything out
U cant set the material?
mat and data pls
item:
name: "&bExample Voucher"
lore:
- "&7Go into the plugin folder"
- "&7to edit this voucher."
- "&7"
- "&7plugins/Vouchers/voucher/example.yml"
glow: true
material: PAPER
data: 0```
ye
It looks good
Not needed, but maybe add a custom permission?
may be confusing and I was gonna but people would get confused
up to u..
Oh yea
I've got a fast NBT lib I can use for this, may even use mysql/sqlite
for storing limits
so u can use it server wide
noice
Wow and now that I'm home there's no more multi -.-
@fallow crow what were some of the remote dev job requirements you stated for yourself, as iirc you have searched for one but did not find any right?
You guys perhaps know what mysql command I have to use to create a user (with password of course) and a database with same name where the user has full rights on?
I don't have phpmyadmin setup and imo is it not really worth to be setup for this....
CREATE USER 'user'@'hostname';
GRANT ALL PRIVILEGES ON dbTest.* To 'user'@'hostname' IDENTIFIED BY 'password';
don't forget to flush privileges afterwards
u forgot to create the db
Anyone else know the feeling when you accidentally blast your volume instead of your screen brightness
CREATE DATABASE dbTest;
oh thought he had one already
he said create a user and database ¯_(ツ)_/¯
I'm not 100% sure about the hostname... Should I just use 127.0.0.1 when it is on same machine?
yep
It's been 9 days since I published my resource.. Still not accepted
on what?
mcm
I still wonder how you guys have so much time
@velvet crescent you’ll be waiting 2-3 weeks
I mean I got messaged day 1 to confirm it was me (since the resource is also on spigot)
so kek
Togo
It's vlang new, Pig?
Rofl
go
And how could I check if everything was successful?
It says Query OK, 0 rows affected (0.001 sec)
& python
snippet? xD
fn main() {
println("Hello")
}```
ah
that compiles into c++
All I know it's that py it's ugly
M# is a new lang too
link?
lemon lang when?
I made a tiny language in python once
but M# is for a new operating system from ms
another snippet gaby
fn main() {
go loop()
go loop()
mut keep := 0
for {
keep++
}
}
fn loop() {
for i := 0; i < 10; i++ {
println(i)
}
}```
just messing with it's multithreading
anyone know what markdown library discord uses?
why cant ppl use the same format for all languages p.p
aight, thanks
https://github.com/Vankka/SimpleAST this is without android and using java
what does it use for syntax highlighting implementations? textmate, or some other type?
no clue
I'm literally going to kill myself if I have to work with frontend once more
yea i avoid that shit at all costs
only thing I really use from bootstrap is the grid
the rest I end up remaking eventually
grid is the only component I ever actually need
this is built in laravel so bootstrap is available
hopefully I can get my framework's http library good enough so I never have to venture into that territory
short of storing some cookies
why did you make a http library though
there's enough great open source projects
my library is just a wrapper around nanohttpd to handle configuration and boilerplate
ah okay
also authorization and ssl generation, but that's a wip
how can i code
once you turn 13 you'll be allowed to gian
thing is this should've been finished already yet I lose all motivation due to frontend
what u making?
can't disclose that
another question, what's with the proguard? https://github.com/discordapp/SimpleAST/tree/master/app
what's with proguard in general
I've seen it quite a few times recently, in places I can't understand
like on okhttp
why would okhttp be proguard obfuscated?
is not only for obfuscation
charlie, that obfuscation you showed earlier was basically proguard level
it is used for optimization and shrinking too.
oh
i think it wasnt on a high setting, all my configs are diff
o lemmo
u be trolling me
half trolling me
this is only the simple markdown
do you know what it uses for code blocks?
is it good practice to store your objects inside your object as a static?
Lemmo the memer
E.g. have a Voucher object, with a static hashmap inside with your vouchers
public class Voucher {
private static Map<String, Voucher> vouchers;
public static Map<String, Voucher> getVouchers() {
return vouchers;
}```
no
never do that
i'm sure there's a good explanation for why, but i'm not the person to give it to you
I read somewhere thats why
thought it made sense
then you can do Voucher.getVouchers()
it's an object though, it's designed to be initialized
ahh seems fine
from what people say
ill make a manager anyway as may be cleaner
but eh
it might be ok to declare the list as a constant, however the getter shouldn't be static
even then, the list should be constant, so you need to initialize it with an empty arraylist
if I went with a VoucherManager, what would be the best approach to let others access it?
well, I use guice
a static getter insied there insyead?
so I chuck @Singleton on top, and do @Inject private VoucherManager voucherManager;
oh wow
typically though, I'd say flat out avoid static in objects
it's simply redundant
and could have unintended side effects, so actually potentially dangerous
I want to build this plugin where devs can hook
Gosh i even forgot that what plugins discord is this 😖
@fallow crow btw did you see my question
LemmoTrestoToday at 2:58 PM @Charlie what were some of the remote dev job requirements you stated for yourself, as iirc you have searched for one but did not find any right?
yeah
well you searched for a remote dev job right
ye
what was the criteria you searched for
Java development / web dev
nothing specific you searched from in the company?
Web dev is most of the time a remote job, isnt it?
and @eternal apex if you were to look for a developer job, what would be your criteria?
not collecting just trying to draw a picture out of asking a few people
it's for private use.
honestly, I'm starting to think developing for people isn't necessarily for me, I'm going to consider teaching
Damn
tbh I'm thinking of dropping dev
teaching computer science just to be specific
oof
I've thought about that too, since teaching computer science would be fun
plus it wouldn't be too complex
but I think that might be something I'd rather do at a later age
because you'd teach from basics
means u can teach the right way too
E.g. liskov principle
you don't start on liskov lol
if I were going to teach liskov, I'd start at the actual beginning, srp
then go through it in the proper order
if I were to look for a job as a developer though, it'd be strictly backend. Extremely lenient deadlines, if any at all. Preferably have to work in an office, not open office though. don't care about the money. java only right now.
I don't know if this is extremely unreasonable, as I've never looked for a professional job.
it's hard to just have someone work from home
I'll only work from home when I've got enough experience. I'll get distracted too easily
a workplace is the only place where I'll be able to focus
I work from home sometimes if necessary
the thing I find it embarrassing myself if I was at somewhere
It's such a distraction honestly
home work or workplace work?
Home
but yes you get distracted very easily
and you miss out on talking with the others, helping each other out etc
sitting on a problem with multiple
I was listening last night to a podcast about distractions actually
and the idea of saying no to picking up your phone
in uncomfortable situtations
that's not my issue
my issue is all the shit I've got going on in the background
i'm working for 10 mins on a project, then I get bored and open up csgo
get bored 10 mins later, open up rainbow
then I go onto my email
ye I do that
oh, a new email from quora
oh, look at that idiot, he's asking about some idiotic stuff
hahaha
lol
one idea I've had is to not have discord on my pc
but only on my phone
so I check less often
like the quora too just gaming is replaced with discord or some other stuff
from 10pm I have my phone set to silence notifications
so if I use it, I don't start clicking and staying up
I do good work at night
same
not because of the lack of distractions though
my brain gets so tired, it can't process distractions, the only thing I can do is code
the distractions are most certainly still there
Honestly I work better at night merely because I'm sitting on my own, no family around me
and my eyes are focused on the screen
nothing around me
I sit in the dark
I think most devs are better in the night lol
I hit my prime of brain dead at around 12, which coincidentally is also when these sort of cluster fucks form https://github.com/PiggyPiglet/Framework/blob/master/core/src/main/java/me/piggypiglet/framework/managers/objects/KeyTypeInfo.java
I don't even consider myself a dev anymore, welp
One big issue I have, and @woven prairie can so relate because we discuss this often - we both start projects and never / rarely finish them.
You get a bold idea, and jump to it
I think I may put all my other projects on backburn and work on my primary project, which in my case is Spoof
Well I read some common sense the other day
I used to think that motivation was the only factor behind why someone could make something
so when motivation runs out, the project dies
this simply isn't true
you need to force yourself to work on something
motivation only lasts for the tiniest time, to get the project started
that's it's job, it's job isn't to keep you working
I have some motivation to spoof merely because its reoccurring money
if you can get past that barrier, then you'll be able to work on it, and experience the illusion of joy, at least sometimes
@sterile parrot can I be your first student? 
anyway, at least that's the logic I've read, and can understand. While it's not particularly relevant to personal projects, as there's really no downside if you choose to give up on those, hopefully the barrier is significantly easier to cross when actually working for a living. If not, i'm screwed, and will need to look for another career
I hope so
That happens all the time for me
All I need besides motivation it's a partner to work with
oh god working with others can be really difficult
Yeaaaa
if you get a partner, make sure they're either of the same skill, if not higher than you
I hate working with someone
Yeah I work alone
I might have to setup affiliates for spoof
just found out about a cool feature
never knew this existed on this platform
what platform?
gumroad
ah cool
o
o
xd
So if you think you can get sales hmu
25% cut per person
@eternal apex how would you optimise this? https://paste.mcplugins.io/amageqemoy.cpp
File.separator basically redundant, / automatically gets converted
how
bukkit has a scheduler, use it
don't even need to do + '/' can even just use a comma (as in 2nd argument)
you're registering files in the same class as your main, that breaks srp
cough #development cough
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}```
don't blindly print stack traces, handle it properly
just log a warning?
call it something appropriate for what the class will achieve
VoucherManager ig
no, shut down the plugin with a nice message
vouchermanager is quite ambiguous, it sounds like a memory manager for voucher objects
but we're talking about configs
so no, vouchermanager wouldn't be appropriate
what would you call it
that's complicated
my file system is spread out over a lot of different classes
technically, the storing happens in a class called FileManager though
@sterile parrot What did you mean by putting my packages inside packages?
So I'd call FileManager which would add vouchers to VoucherManager I'm guessing?
no, that breaks the dependency inversion principle charlie
maybe interface segregation aswell
FileManager handles files, why would it need to interact with VoucherManager?
to create the objects
that's what vouchermanager should be doing
To load into memory
not filemanager
I'm confused..
wy tf does your tree looks like that
@velvet crescent do you see the difference between my tree and yours
hmm lemme fiddle around
it's me.frosty.lenchants as main folder then everything else it's inside that
Piggy please guide me, what classes would I have setup
charlie, filemanager shouldn't have any references to vouchermanager, and vise versa. You should have another point where the data is extracted from your filemanager, and parsed into the vouchermanager
Because my guess was that FileManager would loop, load the yaml data and then push it to somewhere to store into memory
i.e, you have a storage interface, with an implementation for your filemanager
when populating the vouchermanager, it uses said storage interface to get the data
Confused honestly
look into the solid principles
i and d are what we're looking at here
interface segregation principle & dependency inversion principle
especially the latter
Ahh, but this is why I asked for you to explain how you would do it
I then have an abstract class in my mysql library, called MySQLManager, which is an implementation of my Manager api, which supports auto population from the configured table
basically, it starts off with a simple object mapper
converting db rows to objects, and objects to db rows
on app startup, it will find mysql managers, and populate them with the tables they configured
the key principle is, when I implement mysqlmanager, I don't actually touch any mysql code
if I can't interact with other classes to add my data
it all happens at a higher level
the concepts are the same for your situation
you have an object mapper, which maps your fileconfigurations to Voucher
at a higher level, something gets the data from your configs, feeds it to the mapper, and populates the manager
in my case, my Table class handles object mapping, and provides the ability to fetch everything from the table
ah
my MySQLManager then grabs the stuff and populates the underlying data structures
Ahh I see, so in simple terms with me, if I have a FileManager I call on enable
what should my filemanager do to build these vouchers
and load into memory
nothing
but then they won't ever be loaded
that's not the job of filemanager
but filemanager still needs to store the data it fetches
unless when I create Voucher object
that auto adds to storage
you store the raw FileConfigurations in a list, or map, or whatever
my filemanager uses a map with string ids
the object mapper converts the FileConfiguration into a Voucher
then, you feed the manager the mapped objects
yep, except you won't be initializing VoucherManager from that code
that once again, breaks srp
Manager is ambiguous, it allows you to assign several different responsibilities to a class when there's only meant to be one. It's hacky, but it is what it is. Even though you can do that though, it still has it's limits, and initializing a seemingly irrelevant class in that code hits the limit.
So what should I do in simple terms now I have this data
have a static vouchermanager method?
VoucherManager.setup(List<YamlConfiguration>)
you need to follow liskov
FileConfiguration, not YamlConfiguration
I believe at least
ahh didn't realise fileconfiguration was the main class
I'm pretty sure it is, you'd have to double check
also don't use assert in production
ye ive never used assert before just did it for now, but is it that bad?
List<FileConfiguration> fileData = new ArrayList<>();
for (File file : files) {
try {
config.load(file);
fileData.add(config);
// config.get(get)
} catch (IOException | InvalidConfigurationException e) {
vouchers.getLogger().warning("Failed to load voucher '" + file.getName() + "'. Reason: " + e.getMessage());
vouchers.getServer().getPluginManager().disablePlugin(vouchers);
}
}
VoucherManager.setup(fileData);```
ontop of that, a static setup method would suffice principally wise, but it's still a code smell imo. Object mapping & manager population should really be happening elsewhere, at least with the way you're doing it.
no errors shown (with fileconfig object)
boi
in your filemanager
you have no reference to VoucherManager
it's that simple
its not
because you explain oddly
Its a learning curve to me
I'm here to learn just like anyone else, and I'm showing my code as I go to understand this SRP stuff
first step is: do you know what srp stands for
ye u explained it before
srp is relatively simple, you're in for a treat when you hit isp and dip
single responsibility, that each class should do its own thing
so I'd have another class which mapped each file to its fileconfig
and returned the list
ill have a shot before looking at yours
you have a Common class!?
you should name it a lot better
should be called MessageUtils instead
yea
Gotta say tho, I like how the Founder Cape looks
ye
that gold is butiful
is that for minecon attendees?
nah
for the new realms capes
they release exclusive capes on there
public class FileConfigurationFactory {
public FileConfigurationFactory() {
}
public List<FileConfiguration> map(File[] files) {
YamlConfiguration config = new YamlConfiguration();
List<FileConfiguration> fileData = new ArrayList<>();
for (File file : files) {
try {
config.load(file);
fileData.add(config);
} catch (IOException | InvalidConfigurationException e) {
// TODO: Sort this shit.
}
}
return fileData;
}
}```
this?
liskov tho
redundant constructor
i can just get rid of it?
public class FileConfigurationFactory {
public List<FileConfiguration> map(File[] files) {
FileConfiguration config = new YamlConfiguration();
List<FileConfiguration> fileData = new ArrayList<>();
for (File file : files) {
try {
config.load(file);
fileData.add(config);
} catch (IOException | InvalidConfigurationException e) {
// TODO: Sort this shit.
}
}
return fileData;
}
}```
java generators an empty constructor automatically if none found
you can make that method static
but this class will only have one method which does not need to be instantiated
so I see no reason to have this
yeah one of the solutions is to make it static
also, I assume you're going to be getting an instance of your main in the catch block
so, assign a constant, use JavaPlugin#getProvidingPlugin to get an instance
oh dope
private static final Vouchers VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);```
public class FileConfigurationFactory {
private static Vouchers vouchers = JavaPlugin.getPlugin(Vouchers.class);
public static List<FileConfiguration> map(File[] files) {
FileConfiguration config = new YamlConfiguration();
List<FileConfiguration> fileData = new ArrayList<>();
for (File file : files) {
try {
config.load(file);
fileData.add(config);
} catch (IOException | InvalidConfigurationException e) {
vouchers.getLogger().warning("Failed to create voucher '" + file.getName() + "', reason: " + e.getMessage() + ".");
vouchers.getServer().getPluginManager().disablePlugin(vouchers);
}
}
return fileData;
}
}```
oh getproviding
1s then
needs to be final, vouchers should also be all caps as it's a constant
does Vouchers not extend JavaPlugin?
it does
doesn't matter, just change Vouchers to JavaPlugin
public class FileConfigurationFactory {
private static final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
public static List<FileConfiguration> map(File[] files) {
FileConfiguration config = new YamlConfiguration();
List<FileConfiguration> fileData = new ArrayList<>();
for (File file : files) {
try {
config.load(file);
fileData.add(config);
} catch (IOException | InvalidConfigurationException e) {
VOUCHERS.getLogger().warning("Failed to create voucher '" + file.getName() + "', reason: " + e.getMessage() + ".");
VOUCHERS.getServer().getPluginManager().disablePlugin(VOUCHERS);
}
}
return fileData;
}
}```
hows this?
Also ty for guidance
why
^
he's overriding the same object every iteration
I thought I only create it once
unless load returns a new instance
it does
what the fuck
iirc
use that then
#off-topic does anybody know how to solve Integrals? xD
but yea current code wont work
public static List<FileConfiguration> map(File[] files) {
List<FileConfiguration> fileData = new ArrayList<>();
for (File file : files) {
fileData.add(YamlConfiguration.loadConfiguration(file));
}
return fileData;
}```
back onto my OK rating, only way it could be better at this point is with a proper filemanager, which I assume you've gotten rid of, due to the fact that you're reading files in the factory, which should also be async btw. A dependency injection framework would also help ofc 😉
otherwise, looks good
i'll make an exception for dagger and springs di thing
i gotta write docs for my framework
it should be async, no?
public class FileManager {
public FileManager(Vouchers vouchers) {
new BukkitRunnable() {
@Override
public void run() {
YamlConfiguration config = new YamlConfiguration();
File voucherFolder = new File(vouchers.getDataFolder(), "vouchers");
File[] files;
if (!voucherFolder.exists()) {
try {
voucherFolder.createNewFile();
files = voucherFolder.listFiles();
} catch (IOException e) {
e.printStackTrace();
}
}
files = voucherFolder.listFiles();
if (files != null) {
VoucherManager.setup(FileConfigurationFactory.map(files));
}
}
}.runTaskAsynchronously(vouchers);
}
}```
cuz its being done in there
o so u do still have that
ty boss
😮
how should 1 transform
o couple issues actually
never good
so
in your filemanager, you'll want to save the fileconfigurations to the class itself
like a list of FileConfigurations stored in it's instance
yeah
rename FileConfigurationFactory to FileConfigurationMapper
and here's where u gotta make a choice
you can either make a nice little expandable framework, or hardcode logic into the mapper class
in that case, it's gonna look something like this
Voucher voucherMap(FileConfiguration data) {
return new Voucher(data.getString("name"));
}```
so that goes into FileConfigMapper?
ye
integrate what's currently in FileConfigurationFactory to FileManager
and store the stuff u need in the FileManager instance
then, if you've done it correctly, you could do something like this to get a list of Vouchers
like this? https://paste.mcplugins.io/butelukaja.java
vouchermap is in it's own class
FileConfigurationMapper
if done correctly, you should be able to do something like this
List<Voucher> vouchers = fileManager.getVoucherConfigs().stream().map(FileConfigurationMapper::voucherMap).collect(Collectors.toList());```
public class FileConfigurationMapper {
public Voucher voucherMap(FileConfiguration data) {
return new Voucher(data.getString("name"));
}
}
and wow
where would what u wrote go? in filemanager?
not in filemanager
VoucherManager?
no
I guess whatever point which should logically have access to both
unfortunately, that's probably your main
ideally it'd be a manager for managers
ye was gonna say main but i thought you'd be like
SRP!!
unless I create a PluginManager
but wrong name prob
could be confusing
I'm not sure what would be a good spot tbh, since this isn't as abstracted as it should be
yeah no
😂
Im wondering if anyone knows what this error that always crashes my server is? https://pastebin.com/RsTJ1zAg
@eternal apex https://i.imgur.com/oWJWLaY.png so this is so far
that's a nice theme
next step is to make your main look like this https://github.com/PiggyPiglet/Framework/blob/master/core/src/main/java/me/piggypiglet/framework/bootstrap/FrameworkBootstrap.java
what theme is that 😏
it's material theme
ye your thing is confusing lmao
so far
ik i'd specify outside etc
So from my thoughts I guess I would store those vouchers somewhere
in a manager or w/e
w/e?
whatever
yeah, a manager
yes
for my fileconfigmapper would I pull everything from the config to store in a voucher object?
yes
because I have like 5/6 things from that config, but dope
just pass the relevant config section then
public class FileConfigurationMapper {
public static Voucher voucherMap(FileConfiguration data) {
return new Voucher(data.getString("id", "unknown"), new ItemStack(Material.PAPER), data.getBoolean("settings.permission"), data.getStringList("settings.blacklist.regions"), data.getStringList("settings.blacklist.worlds"));
}
}```
this basically
is it
and yes ik material is hard coded rn, will sort at a later date
public class Vouchers extends JavaPlugin {
private FileManager fileManager;
private VoucherManager voucherManager;
@Override
public void onEnable() {
fileManager = new FileManager(this);
voucherManager = new VoucherManager(fileManager.getVoucherConfigs().stream().map(FileConfigurationMapper::voucherMap).collect(Collectors.toList()));
// voucherManager.getVouchers();
}
}```
is that following everything correctly?
it's acceptable
this is as far as most developers will go, and it's good enough
but it can be better
I guess next step you'd mean inject stuff?
no, but I don't really want to explain this any further
the logic just gets more and more complicated, I can't easily explain it
ahh I see yeah
Thanks for your help so far with everything, slowly will grasp it
At least now I can pull the vouchermanager object from my other classes
and handle as needed
for my listeners, how should I do that?
Not sure what you're asking
sorry didn't explain, for registering my listeners
how should I do that, a separate class?
I use a separate class, but in terms of bukkit development, it's fine to use main
simply because you're not expected to follow the principles to such a high standard
Eh I may as well go full board if I'm gonna do it
and use a separate class
ListenerManager or EventManager ?
1st imo
@/piggy would u use a manager for it? perhaps take a list of classes
and for each one it registers or w/e
I don't have a manager for listeners, since I don't wrap them with any other apis
oh
yeah but you wouldn't be doing it like that
you'd just be registering them manually
oh
public class EventManager {
private static final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
public EventManager(List<Class> events) {
for (Class event : events) {
VOUCHERS.getServer().getPluginManager().registerEvents((Listener) events, VOUCHERS);
}
}
}```
but i realised
prob not good
make a varargs method
oo oke
logic shouldn't be handled in the constructor
public class EventManager {
private static final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
private Class[] events;
public EventManager(Class... events) {
this.events = events;
}
public void register() {
for (Class event : events) {
VOUCHERS.getServer().getPluginManager().registerEvents((Listener) event, VOUCHERS);
}
}
}```
the cast ofc wont work
but u get my point
there's no reason not to directly initialize the listeners in that class
private static final Listener[] LISTENERS = {
new Listener1(),
new Listener2()
};```
be careful though
ahh I c
you're getting into semi static abuse territory
up 2 u
is that a good move?
a good move would be using guice
it won’t get that huge
public class EventManager {
private static final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
private static final Listener[] LISTENERS = {
new InteractListener()
};
public EventManager() {
for (Listener listener : LISTENERS) {
VOUCHERS.getServer().getPluginManager().registerEvents(listener, VOUCHERS);
}
}
}```
this gucci?
PiggyPigletToday at 11:44 PM
logic shouldn't be handled in the constructor```
I did say above
public class EventManager {
private static final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
private static final Listener[] LISTENERS = {
new InteractListener()
};
public void register() {
for (Listener listener : LISTENERS) {
VOUCHERS.getServer().getPluginManager().registerEvents(listener, VOUCHERS);
}
}
}```
cough Head over to #development cough
good
now, talk to someone slightly more experienced than me and double check if that's not static abuse
because I couldn't tell you
ye ima remove the static
@velvet crescent don't minimod
@pale grotto don't minimod
lol
tbh i dont need static
public class EventManager {
private final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
private final Listener[] LISTENERS = {
new InteractListener()
};
public void register() {
for (Listener listener : LISTENERS) {
VOUCHERS.getServer().getPluginManager().registerEvents(listener, VOUCHERS);
}
}
}```
that was a chain reaction
@eternal apex dont megamod
Fair enough
that was fun
vouchers should be static
although I think piggy is angry at me
it's a singleton throughout bukkit
oh
Just as usually CoLe
just as usually
@Override
public void onEnable() {
fileManager = new FileManager(this);
voucherManager = new VoucherManager(fileManager.getVoucherConfigs().stream().map(FileConfigurationMapper::voucherMap).collect(Collectors.toList()));
new EventManager().register();
}```
```java
public class EventManager {
private static final JavaPlugin VOUCHERS = JavaPlugin.getProvidingPlugin(Vouchers.class);
private final Listener[] LISTENERS = {
new InteractListener()
};
public void register() {
for (Listener listener : LISTENERS) {
VOUCHERS.getServer().getPluginManager().registerEvents(listener, VOUCHERS);
}
}
}```
bang tidy amirite piggy
p.p
yeah, that's fine
than*
though, time for another cliff hanger
thanks for your help, I think ima take this plugin slowly
you'd be initializing that class via new, so might aswell pass the vouchers instance via dependency injection
I wonder how spoof looks like internally
how would one do that pig
xd
lol




