#dev-general
1 messages · Page 161 of 1
đ
wait would it be a good idea to have EVERY custom plugin in one single plugin xd?
Uh sure
If you approach it properly yes
I mean Iâd still use them plugins like luckperms
And if you get 50mb of code you're doing something wrong lol
I mean
Yeah my enchant plugin is fat :6
not exactly
if it's rlly lots of things
ye I am doing a custom enchant plugin rn too
welp I mean
currently my Core plugin
is 51kb
oof
Mine is 600kb, and it has 9 plugins condensed
you gotta compact that sh@
The fuck is you doing :kek:
bruh
For now I just shade packages like com, net and org etc
my core plugin has like 10 custom enchants rn
Will probably organize it later
Ah yes the, help my Hello World ploogin is 1GB 
lol
I have like 100 but my goal is 500 on release
Show one of the classes for it Conclure
.-.
Well my main focus is making an incredible api
where tf do you have 500 custom enchants ideas?
Well I shade in like a lot of stuff
I will have in total like 40
Idk, skyvlock, factions and other enchants
Like tokenenchant?
ye^^
Idk I don't follow that shit
Maybe I should
Well I have stuff like custom enchant currency, xp, enchtable, blacksmith and all that stuff
and you click on the enchants you want to enable
and it installs those modules
and voila
Yeah I could make an enchant cloud
Yeah well very much is still wip and it wonât be 10mb by the end
Itâs just for simplicity
Libraries like guava is already in spigot for instance

@hot hull perhaps the Location is being modified elsewhere? Maybe return a clone
I'll try, but I'm legit printing it out 1 line after so there's no way it could be
:bruh:
Location{world=CraftWorld{name=world},x=-259.0,y=68.0,z=41.0,pitch=0.0,yaw=0.0}
Location{world=CraftWorld{name=world},x=-259.0,y=68.0,z=41.0,pitch=0.0,yaw=0.0}
[18:06:14 INFO]: Spawner not present
@heady birch why isn't it?
@pastel imp
They tell me decouple it!
Your choice really
I'd personally do it separately
Ok i kinda see this now ```JAVA
private final LitTestPlugin main;
public ConfigValues(LitTestPlugin main) {
this.main = main;
}
When object is created in the main, it will always run the constructor
But my question is
private final LitTestPlugin main;
public ConfigValues(LitTestPlugin main) {
this.main = main;
}```
CAN we do something like this without having any parameters in the constructor brackets?
Nope
Thatâs why I donât use di of main if I donât have guice or something.
I just use final Plugin plugin = JavaPlugin.getPlugin(Main.class);
decouple is like seperating parts
I've made a number of spigot plugins but i'm looking to get into making some mods and I was wondering if anyone was aware of a client side block break event for forge? Or at least a way to prevent players from breaking blocks on the client side.
The official forge ones are limited and there are unofficial ones but I cant find anything about client side block break events or something similar. I've seen it done in mods like SkyBlockAddons so I know its possible to prevent a player from breaking certain types o blocks...
There is
You should probably ask in the Forge discord
Thatâs where all Forge pros hangout
Hmm thx I'll look into joining it
What would be the difference in using server instead of client block break?
(other than the fact it would be only visible to the one user)
Idk, making not everything based on the server side 
Smh
hms
Some events require the mod to be on the server
a remote server?
Single player world or a server itself
Aight
Well when running your mod youâll always have a server running whether itâs internal or a remote one
iirc
Is this possible to do without having any parameters for Hello() constructor?
public class TestCode {
public void show() {
System.out.println("Okay!");
}
public static void main(String args[]) {
TestCode a = new TestCode();
Hello obj = new Hello();
obj.hello();
}
}
class Hello {
private TestCode classname;
public Hello() {
TestCode classhello = classname;
}
public void hello() {
classname.show();
}
}```
I am just having harder time seeing stuff with parameters in methods
Yeah same
You donât have to pass your main through all classes
Just use JavaPlugin.getPlugin(Main.class)
uh
I am trying to know like all the ways to communicate with TestCode in Hello without creating objects directly into Hello class
Worst case scenario it would be some nano seconds slower
Pretty sure you shouldn't use that?
Why not?
getplugin(class) is kinda bad
Say that we have an object that requires your main and you invoke its constructor very often would make it annoying to pass main every time.
How is it bad
whos constructor do you invokE?
how is it bad just sending main into all classes that need it ?
the object's?
i cant do testing
Yo can you explain what you meant by invoke it's constructor? Did you mean the object's constructor?
Only thing is that it breaks oop
if you get class its not always allow you to use all its functions.
since its just gonna send you javaplugin main
It returns the same instance ?
Wouldn't a singleton pattern be better if we suggest not using dependency injection?
yes but you have to convert it.
what is singleton pattern or singletons
WHAT would singleton pattern or singletons BE IN THIS piece of code?
public class TestCode {
public void show() {
System.out.println("Okay!");
}
public static void main(String args[]) {
TestCode a = new TestCode();
Hello obj = new Hello();
obj.hello();
}
}
class Hello {
private TestCode classname;
public Hello() {
TestCode classhello = classname;
}
public void hello() {
classname.show();
}
}```
even supporters at spigotmc say its way better to use dependency injections.
class MyObj {
private final Main main = JavaPlugin.getPlugin(Main.class);
public MyObj() {
}
}```
since with JavaPlugin.getplugin you can get NPE
I mean, it is, but I am still going along with your heretical ideas @dusky drum
How do I use what u guys said
Youâd make a static singleton then
A singleton, basically put, is a static method that returns your plugin instance
and if you use injections youre more likely to have more readable and easier to use code,
In this case
public class TestCode {
public void show() {
System.out.println("Okay!");
}
public static void main(String args[]) {
TestCode a = new TestCode();
Hello obj = new Hello();
obj.hello();
}
}
class Hello {
private TestCode classname;
public Hello() {
TestCode classhello = classname;
}
public void hello() {
classname.show();
}
}```
How do you implement SIngleton in this ^?
Gasper yes I can agree you itâs good for structure and oop principles but I wouldnât say itâs faster (worst case scenario just some nanos). In fact theyâre not real static singletons and it only reduces boilerplate.
I generally use dep injection cuz it's good practice, but I also use the singleton pattern when I am given no other choice
its just better to use injections, example what if you're not on spigot and you dont have JavaPlugin.getPlugin ??
Then you cant use singletons?
its just bad pratice to use javaplugin.getplugin if you ask me.
class Main {
private static Main instance = null;
public static void main(String... args) {
instance = this;
}
public static Main getInstance() {
return instance;
}
}
class Other {
{
Main.getInstance();
}
}```
If youâre going with dependency injection use guice then
^^
In a purely object oriented language, static doesn't exist
Depends on what you define as better
in what way would it not be better
Itâs less boilerplate to use the JavaPlugin.getPlugin
It's better having as little instantiated objects as you can, that's what dep injection helps reduce
^ i was told that
Initiated?
bukkitrunnable lets say bukkit/spigot drops that function?
@steel heart neglible difference
Well I donât like having hundreds of this in my main
not an excuse
Doomful youâre really not initiating anything
You're using an object oriented language
Just creating a reference
So write object oriented code
Yes thatâs true alex I said that youâd use di for oop and structure
Although I use JavaPlugin.getPlugin because it takes away this spam
look 2000 this
http://images.virtusdevelops.eu/shareX/y3bnsl22.png
what is guice tho?
I might be wrong, but using static to have the main class stored will cause that object to get stuck in the garbage collection process
only where you could have spam is in registering listeners.
Alex thatâs true
Doomful true but JavaPlugin.getPlugin is not a real static singleton
it's kind of an exception
But not really
The principle still applies
It's a bad practice
Yep
Yes it isnât oop although you donât have to pass your javaplugin main class explicitly in every class constructor almost
idk why you have to pass it to almost every class?
And for very big projects itâs a negligible difference if you use di or JavaPlugin.getPlugin to obtain main
Atleast noone suggested lombok yet sheesh
In terms of what?
Gasper
neglible difference in what?
imagine what LuckPerms main class only has like 100 this and you're saying thats spam?
and tahts mostly due to this.blablba
is LuckPerms bad or good?
God
The project as an entirety. Itâs not like itâs going to affect performance and doing an exception for main wouldnât suddenly make your entire plugin break oop and unstructured
best Perms plugin out there..
W#hy is that?
It has a good structure
OH its just best in terms of PERMission plugins
Well anyways alex big projects should use guice which would defeat my point anyways
Almost clean
https://paste.helpch.at/akerifaqir.java
The project as an entirety. Itâs not like itâs going to affect performance and doing an exception for main wouldnât suddenly make your entire plugin break oop and unstructured
@steel heart
It would though. Like I said, it creates implicit tight coupling which is usually a bad idea
Well if you feel like one line of that fake static singleton JavaPlugin.getPlugin then youâre very pedantic. And why is it a bad idea?
because it destroys any form of clear code structure
Lol
text is disappearing hmmmm
Well oopwise yes thatâs totally true. And I fully agree that static should be avoided 99% of the time as well as not using di
Tight coupling is usually a bad idea anyway
Well oopwise yes thatâs totally true. And I fully agree that static should be avoided 99% of the time as well as not using di
Then what's your point?
Already told you?
I mean if you only want to work with oop and avoid static totally then you shouldnât code java anyways
There exist better language for pure oop
How
Java is very much an object oriented language
Everything has to be in a class
Static is a small exception
Thatâs true
yo how to make static value in kotlin like
in java where you have all cap styled variables?
I just say that if you want to code in pure oop then you should find some language which doesnât allow static then if that is the importance
like atm i have it private val TABLENAME = "CropStorage"
Think there is something like top class functions idk Alex knows better
well i dont like this:
http://images.virtusdevelops.eu/shareX/y820cycz.png
I just say that if you want to code in pure oop then you should find some language which doesnât allow static then if that is the importance
That doesn't mean you should violate Java's key principle
@dusky drum send code
private val TABLENAME : String = "CropStorage"
Well that depends, youâd use static for things like constants anyways
Yes if youâre going pure oop sure. But I donât see the big problem with using getPlugin consider itâs not slower, and only using that one isnât going to affect your entire project to totally violate oop and destroy your project structure
@dusky drum because it's not "static"
This is an endless discussion anyways
Put constants in a companion object
thats what im asking how can i make it static?
@steel heart you're going in circles here. I told you why it does violate OOP and could make your code structure difficult to maintain
@dusky drum companion object
Well youâre not differing your answers either. I donât see how just using getPlugin would make my code structure difficult to maintain
i love how this conversation is still going on :3

i remember how i used to say kotlin is bad like less than week ago, now i code in kotlin HMMMMMMM
@steel heart because it creates implicit tight coupling
Tight coupling is bad enough, but when there's no clear links it can turn into spaghetti easily
By using getPlugin you instantly tightly couple your code to the main class without making it clear from the constructors' signatures
Yeah kotlin is superior
Yes it is tight coupling but I donât see how that would suddenly make your entire code structure difficult to maintain.
It could end up being more spaghetti yes true
i remember how i used to say kotlin is bad like less than week ago, now i code in kotlin HMMMMMMM
@dusky drum literally said by everyone đ
Lol I donât use static unless itâs convenient
XD
You want to see my first plugin?
I always use static itâs fun

đ
I donât see how that would suddenly make your entire code structure difficult to maintain.
It could end up being more spaghetti
welcome the forst of y
Goodbye
xd
The kids in the playground think heâs cute
đł
đ
Didn't know about google guice until I've read the rants here, now I will revamp my huge ass plugin, thanks
@prisma wave rarely then well, I donât have a spaghetti with my 70 classes
Oh well I did use guice there but anyways
But anyways I did use getPlugin as well
Spaghetti is fun
Well I mean static singleton is used for explicitly guarantee that only one instance will be given during runtime I guess
Or I mean thatâs kinda what it is for but JavaPlugin.getPlugin isnât too bad 
Static bad
Yeah I agree
Wonât stop using getPlugin in exchange for explicit di and ioc pattern

Yaa
Very exceptionally true
This part specifically hurts so much to see new > ArrayList<>(Collections.singletonList("discord"));
From earlier
hahah
Iâm going to pr that
Also have you looked into that authors other repos? Itâs all masterpieces
Send link. I want to cringe
Wait do you mean the rest are masterpeices as in good quality?
Obviously top class highest quality
S.java
I think this person got an anvil dropped onto him/her
Lol yeah and his bio is đđ
looks like someone should learn kotlin
Actually
No
The kotlin gang doesn't want code like that
lmao
The java gang doesn't want it either. The js gang can have it
Objectively true
And in rust
Rust is good
lol
remove the laughing face immediatley
and teh doubting person
and the closure emoji
A s s h o l e

Imagine
That you wrote what we should imagine about
neeed help pls i buy plug and dont have dowload need buy again WTF i payment
Get scammed bitch 
please tell me why rust :)
oxi gen + water đŠ
Lol I cant remember đ
Rust is the chemical reaction between iron and oxygen. 4Fe + 3O(2) -> 2Fe(2)O(3)
Close đ
No i mean I was close
10 on both sides so probably
Its exothermic right
It releases energy as heay
Endothermic is opposite
You can also release energy as light or sound or even electrical
Electriciy*
A level Chemistry is fun
Is there a complete list of spigotAPI versions?
talking about the "1.16.2-R0.1-SNAPSHOT" and such. Not every version has the R0.1-SNAPSHOT suffix, I'd like to know which
That where it gives off more energy or something
@heady birch Exothermic means it releases energy, in whichever form suitable but most often as heat or light. Endothermic means the reaction requires the absorption of energy, ~~exclusively ~~ usually heat energy. Meaning the thing gets colder because it sucks energy from the environment and stores it in the bonds of the atoms of the resulting chemicals.
Bruh why are we talking about chemical reactions
Dev general (::
I think only 1.16.1 has 0.4
@steel heart I know there are other ones as well. I just need the whole list and which spigot version has which spigot-api version
Kinda glad my exams got cancelled because exothermic and endothermic still confuse me
Actually that explanation is pretty good
I always thought exothermic would get colder since it's losing energy
But yeah that makes sense now
Kinda glad my exams got cancelled because exothermic and endothermic still confuse me
@prisma wave Exo just means outward (think exoskeleton) and Endo means inwards. Both words describe the direction the energy goes...
yeah, I got that bit
It was the link between that and temperature and stuff
Pretty much the only part of chemistry that I found difficult
found something in case anybody is interested: https://www.spigotmc.org/wiki/spigot-nms-and-minecraft-versions-1-10-1-15/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
How come there was no Spigot 1.16 version though?
it started with 1.16.1
Just look at the maven repo
Anyone willing to give me a crash course to (Bukkit?) packets, or provide me the resulting code for this:
@ me
Just look at the maven repo
@analog crater which one? where?
whoa nice
bruh
this brazilian dev
is making "Bukkript"
a kotlin api for minecraft
and he made this plugin for intellij
like it previews the GUIs
he's making
sadly only works with bukkript
lol
someone knows something similar for javabukkit?
Is bukkript compatible with the spigotapi or is that its own thing?
the issue with that is you probably have to wait quite a while longer for newer versions
it's like a skript plugin
you make scripts
for it
and it runs them
but like 2000X better
some tests he did
What is so good about it? Explain
it's like a skript plugin
@pastel imp I don't quite get it tbh, it's for skripting but in kotlin instead of java or what?
What is it fast asf at?
and how does it relate to spigot?
oh
he just explained
Can it make super speady database transactions
no I don't know that plugin :/
that it exists bukkript
and bukkript-api
the api is to work with spigot and bukkit
no I don't know that plugin :/
@empty flint welp search a little bit
honestly don't know
ask the questions to the dev
he's streaming rn
Whats his twitch or a link
K
send his twitch
twitch is DevSrSouza
You said its like skript.. it just looks like a framework for plugins
it kinda is
welp
not sure
ask the dev
the questions
xd
he's speaking english now lol
sooooo
ask whatever you want
oof okay
after speaking some things with the dev above
I am gonna for sure make my server in 1.8
lol
is that plugin only for 1.8?
Anybody experienced with Bungee/Waterfall and have any idea why players who login via Bungee are invisible?
If I VPN in and connect directly to the server, players are visible, but through Bungee nobody is visible. Other entities (e.g. items) are visible when I throw them, but players not
is that plugin only for 1.8?
@empty flint no
but he's using 1.8 to test it
and he explained why 1.8
is sooo good
for servers
etc
and why hypixel still uses 1.8
and he explained why 1.8
@pastel imp Could you relay that info? I'm curious
welp in general 1.8 has some big fat long time
means most of the bugs in it already got fixed
- it's a lot better to have 1.8.8
and support newer versions
than have for ex. 1.12.2 and support both newer and older versions
cause support older versions is a big risk
also performance is a lot better in 1.8
he gave an example of a brazilian server that only uses 1 server for their factions server
and has/had 1k players
playing at the same time
with 20 tps
But aren't you missing all the 1.9+ features and blocks then?
idk if that's a tradeoff I'd make
yes you are
BUT if you even want to use 1.9+ blocks
then you can't support 1.8
and 1.8 has a big player base
sooo yes.. it's your choice
but it's always better to support the max amount of versions
ye ye I know
I don't care tho, I don't make my plugins for the playerbase, I make them for myself and whoever else wants to use it can update or cry themselves to sleep, their choice.
you literally kill your server by half
oh if you are speaking about public plugins
then that's another thing
Eh, the way I see it you kill your server by half the features or half the players. I'd rather kill half the players.
but ye
if you support lots of versions
you are gud
if not
don't expect people to download a lot
Eh, the way I see it you kill your server by half the features or half the players. I'd rather kill half the players.
@empty flint not exactly
cause
PACKETS
but anyways
@pastel imp Ah I see you're a fellow Brazilian as well
Oh wait i think i already knew that
Ignore it xD
Ah yeah, well I am both so it works xD
I have dual nationality
brazilian and portuguese?
Yeah
welp I have also double nactionality
luxembourgish and portuguese
xd
welp that's like "wtf"
Portugal and Portugal 2 xD
Not many do ;p
makes sense xd
welp now I think I am going to 1.12.2 again
cause of the issues I am having in 1.8.8
with GameProfile
lol
welp actually.. wouldn't a 1.12.2 plugin work in 1.8 too?
It should
If you use features above 1.8 then no
ye
ik that
sooo
ok
gonna make my plugins in 1.12.2
I mean.. it's a legacy version
should work
Just don't support 4 year old versions.
If you wanna publish the plugin then i think it'd be better to make it in 1.16 and do support for 1.8
Yeah it is me
nha it's for private server
soo
also
@ocean quartz you could maybe do an intellij plugin like this for java bukkit
xd
would help making GUIs using your api with thins plugin
I mean it's from the dev above
and it's only for his project
it's like a preview of the gui
would be cool
just an idea
Sounds fun actually, prolly hard but fun
ye
he said it's kinda hard
but if you are gonna do it
gl
also only noticed now that you actually have a command framework too
xd
an idea for that would be also adding listeners
etc?
You can already add all necessary listeners?
what would listener supprt change about default bukkit listeners?
nha not exactly speaking about that
this for listeners
would help clean out the code
a lot
xd
yea
i lowkey though i had it set up for multiple
and just realized i didn't after i sent that
I use a framework allowing you to do this Events.subscribe(Event.class).handler(e -> {
});
oof
If you want to try it out I have custom version which fixes the dependencies and relocation
DM?
DeluxeMenus
Ah
why's bukkitrunnable bad?
because coroutines exist 
iirc conclure only thinks theyre bad because he nitpicks on something small about them
Theyâre useless in newer versions
Yo u guys think its good to have 2 Methods like this?
public String getStringColor(String s) {
return ChatColor.translateAlternateColorCodes('&', s);
}
public String getStringColorConfig(String s) {
return ChatColor.translateAlternateColorCodes('&', main.getConfig().getString(s));
}
Why no to second one?
First one can be used in more scenarios
I am saying to have both or have first
Yes
SO ia m saying should I have both or just 1st one only?
And it defeat the point of having the second one
getStringColorConfig(s) {
return getStringColor(main.getConfig().getString(s))
}```
doens't it make it shorter?
The second wonât defeat the point of having the first one
It wonât be that much shorter
if you have to make 2 methods, define the second one through the first
Wow fking genius maan
that way if you change the behavior
why didnt i think of that
you don't have to change it twice
secondly
you don't need 2 methods
main.getConfig().getString(s) is not a long ass method parameter
so just do getStringColor(main.getConfig().getString(s))
I know but i am like learning new and stuff so i am trying to create utils and stuff
for sure, do it then if you want to.
Generally avoid too much utils
Oh y?
Static
cus I dont mind using ChatColor.translate
Wait this is not static tho
no he means boilerplate
Utils classes should contain static methods mostly ?
o i didnt konw that
well yeah but why are static methods a problem?
Oh i am also avoiding static methods btw
cus i am new and Static methods seem a lot easier
Oh i am also avoiding static methods btw
@viscid charm When using Util classes, don't
use static for Utils, they shouldn't be parts of any instance
I mean the thing is that any method should in principle of oop take an instance
But things like factory and utils methods doesnât take an instance
And therefore can be static
And static methods doesnât really work with inheritance
Man its tough :/
Guys what would be the fastest way to learn more about creating plugins and stuff? Would it be to look at other peoples code on github? Or follow some plugin making series?
both
doing little bit of everything and find what you learn the most from
I'd suggest to ask many questions though, it usually gives you a good perspective on your question
rather than googling

also make sure you know at least the basics of the language you plan to make your plugins in
just made my discord bot auto updating with github actions
now i don't have to log into my server and pull changes every time lol
Yo this stuffs pretty hard man :/ How long have u guys coding/doing java?
Ive been going since like just before the start of this year probably
o hmm
What exactly do you find hard?
idk like a lot of things like looking at methods with parameters, it takes a lot of energy. Lol, even something so basic like for loops I find difficult in terms of not knowing but, ability to utilitize it well for example. It would take me days to code just:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Or
$ $ $ $
$ $
$ $
$ $ $ $```
And like it kinda feels hard to create plugins. I looked at one guys code, the StringLore method litterally gave me headache lol.. Also wondering if programming is based on IQ or not
I mean yea you're a begginer.. it's not going to be easy at the start, and you shouldn't go around looking at other peoples code for a comparison,
Also wondering if programming is based on IQ or not
No, it requires persistency.
Also it does feel shitty to know that even despite not knowing syntax I also find the actual algorithm/programming/logic part hard/unable to do lol
kek
And I am also wanting to speed up the process :P
If you're looking for speed, sorry but this may not be for you lol
hmm dang
Something important for me when I was learning was to make sure I enjoyed what I was learning about - idk if this is for everyone, but I cant understand something if i dont enjoy it
Also yo it feels like theres so much stuff to remember and shit :/
If you actually enjoy it, it's not hard at all/you're going to want to remember all of it
And there really isn't that much
U dont think theres that much?
There isn't no, but like everything worth learning, it requires time
how mcuh do you code everyday?
too much
^
and not enough at the same time
Master procrastinator 
Worst thing to do is drop a project in between tho thinking youll do it later. Thats just the beginning of the end for that project then xD
Id suggest going through some problems from hacker rank or something if you want to get familiar with the logic part @viscid charm
Might take some time tho. Be patient
Yugi, that's why you should always work on atleast 2 projects at a time, so if you get tired of one you switch to the other, and vice versa, meaning you're procrastinating, but still productive 
That never works out for me, so I just try to focus on one till its at the very least usable
What kind of storage system would be the most efficient/safe when it comes to storing crucial information (less likely to break)?
crucial info such as?
not "crucial" as in sensitive, just like if it breaks the entire server is fucked info
I mean, any database works I assume? just depends on how often you update the db or how you would handle any loss due to crashes I guess. Not too sure
am I the only one that learnt by naming variables like shit and fuck?
imagine NPEs
alrighty frost
Aj, I reworked the entire storage system without testing so yes NPEs 
kotlin good
Yes
So I just did this exericse
public boolean monkeyTrouble(boolean aSmile, boolean bSmile) {
if ((!aSmile && !bSmile) || (aSmile && bSmile)) {
return true;
} else if ((aSmile && !bSmile) || (!aSmile && bSmile)) {
return false;
}
return false;
}
public boolean monkeyTrouble(boolean aSmile, boolean bSmile)
^ my code. Answer code V
return (aSmile == bSmile);```
:c
monkeyTrouble(true, true) â true
monkeyTrouble(false, false) â true
monkeyTrouble(true, false) â false
monkeyTrouble(false, true) -> false
Look up solutions when you can find em and try to understand the diff between your soln and theirs
if we run those values, what is the return value taht we get ^
yea i understood it
but i dont think I can think of something like that next time xD
its better to do problems then to lok at other peoples code and try to understand it??
Yes
oh
Trying something and then checking someone elses soln is better than just reading someones soln cause you understand the thought process
Need help due to shitty ass spigot still, the ones which have a type are spawners, the last location is the spawner I broke, issue is it doesn't actually recognize it's a spawner since the location doesn't match, any suggestions?
ZOMBIE, Location{world=CraftWorld{name=world},x=-252.5,y=67.8999969959259,z=41.5,pitch=0.0,yaw=0.0}
ZOMBIE, Location{world=CraftWorld{name=world},x=-254.5,y=67.8999969959259,z=41.5,pitch=0.0,yaw=0.0}
ZOMBIE, Location{world=CraftWorld{name=world},x=-256.5,y=67.8999969959259,z=41.5,pitch=0.0,yaw=0.0}
ZOMBIE, Location{world=CraftWorld{name=world},x=-250.5,y=67.8999969959259,z=41.5,pitch=0.0,yaw=0.0}
Location{world=CraftWorld{name=world},x=-257.0,y=68.0,z=41.0,pitch=0.0,yaw=0.0}
(The spawner broken being the 265.5, 67.9, 41.5 one)
What are you getting the location from?
Can you show me the snippet where you fetch the location?
Block Break
final Block broken = event.getBlock();
final Location location = broken.getLocation();
Block Place
final Block block = event.getBlockPlaced();
final Location location = block.getLocation();
Not really much to show :p
weird
Are you sure you gave the right output?, why would the Y axis be 1 integer above...
Also for storing block locations I suggest using your own class that stores them as ints rather than floating point numbers
I'll try my own class and we'll see
Alrighty
I am so confused..
[08:39:35 INFO]: Set spawner: -250, 64, 44
[08:39:40 INFO]: ZOMBIE, -250, 64, 44
[08:39:40 INFO]: ZOMBIE, -255, 68, 41
[08:39:40 INFO]: ZOMBIE, -253, 64, 44
[08:39:40 INFO]: ZOMBIE, -256, 64, 44
[08:39:40 INFO]: ZOMBIE, -251, 68, 41
[08:39:40 INFO]: ZOMBIE, -252, 64, 45
[08:39:40 INFO]: -250, 64, 44
[08:39:40 INFO]: Spawner not present
Rip i gave up on this
dont
Given an int n, return true if it is within 10 of 100 or 200. Note: Math.abs(num) computes the absolute value of a number.
nearHundred(93) â true
nearHundred(90) â true
nearHundred(89) â false```
```JAVA
public boolean nearHundred(int n) {```
I dont evne get teh solutiuon
public boolean nearHundred(int n) {
return ((Math.abs(100 - n) <= 10) ||
(Math.abs(200 - n) <= 10));
}```
nor the question
so ripperoni
You have to check if the given number is within 10 range of 100 or 200, you've got 3 examples there, what seems to be the issue?
I dont know what Math.abs(num) computes the absolute value of a number means
Ctrl + Click on the method
just type it in ur ide
public static int abs(int a) {
return (a < 0) ? -a : a;
}```
Then ya know, "What does Math#abs do" since you already have google opened
Dont know what that means
if a is less th an 0 it will return -a and if its not then it will return a
not sure why...
LOl wow you say it like taht it makes more sense
Tenary operate just a bit hardcore for me to read
it doesnt make sense to me either
O
I understand the ternary operator but idk why you would want that method
Dude you guys have any tips on like a < 0. I TAKE LON GASS TIME TO PROCESS THIS :/
variable a is less than 0
:bruh:
a < 1, a > 1
I KNOW
what does < mean?
there was a trick long time ago
taht i read but i forgot
Like just look at tail and memorize something
but cant you say that: a < 1. 1 is greater tahn A?
what?
a < 1 <-- your say a is less than 1 in that symbol?
no clue what you mean lol
Oks o
1 < 2,
you can say 1 is less than 2. but oyu can also say 2 is greater than 1
always?
in just programming or wat/
cus I remmeber having to read it both ways
from childhood
:what:
It's a language..
its english
I mean yea 2 > 1
Which would be the same
Well different output, but technically the same
Fk I am used to like swapping it and not the way you guys say it
I needa get used to the other way xD
if a is less th an 0 it will return -a and if its not then it will return a
not sure why...```
@obtuse gale
Absolute value.
if a is less than 0, it means that a is negative. negative * negative = positive and hence that negative of a
like if you did it without Math.abs
its already defined in the standard lib doesnt mean you cant do that yourself. But you probably should just be using the given function rather than redefine it
(a < 0 ? -a : a) returns the same value as Math.abs(a) would
because it does the same thing
So for some reason the spawner is always null, I'm debugging it and it's showing up correctly in the map, yet when I try to retrieve it it's null, I've no idea why tho..
final Spawner spawner = SpawnerMechanics.WRAPPER.getSpawner(location);
if (spawner == null) {
Bukkit.broadcastMessage("Spawner not present");
SpawnerMechanics.WRAPPER.removeSpawner(location);
return;
}
lel
Legit can someone tell me what the fuck is going on cause I'm so lost..
[09:43:44 INFO]: world: -259, 68, 43
[09:43:44 INFO]: CraftWorld{name=world}: -259, 68, 43 (ZOMBIE)
[09:43:44 INFO]: Spawner not present
(First location being when I place a spawner, and it get's put into a map, second location when I break the spawner it prints out the map)
the spawner is not present
No shit Niall
what u using as key
SpawnerLocation, world x y and z
what u using as key
(The printout above)
is it the same instance of object you compare
@hot hull is the location mapped to the spawner in a hashmap?
yes
Have you overrode hashcode and equals?
However Niall has a point, no I haven't
class Version {
val blocky = object {
val root = "1.0.0"
val lib = "1.0.0"
val ranks = "2.0.0"
}
}
How do I access Version.blocky.root?
when I try it like above I get Unresolved reference: blocky
class Version {
companion object {
val blocky = object {
val root = "1.0.0"
val lib = "1.0.0"
val ranks = "2.0.0"
}
}
}
I think?
object { } returns a type of Any which wont have any field of name root
Id suggest just making a class to hold that
object { } returns a type of Any which wont have any field of name root
@old wyvern Wait what's the point of objects then if I can't access the fields?
Thats used mostly to create anonymous classes for interfaces of abstract classes not for this purpose
}
Would create a anonymous class that extends BaseClass with your defenition and return a BaseClass type
You can still only call functions defined in the parent class
Which was Any since you didnt define any
a map I guess?
can't access a map with the field accessor .
yea ofc
You contradict yourself. Without defining a class you do not have a field
Ah I see
đ
Yugi, do you happen to know some gradle as well?
Ill try to answer the issue. Ask away
I'm trying to set up a root project for all my plugins and link the dependencies in the plugins to the root gradle setup. I know how to do that in maven but it doesn't seem possible in gradle. Any ideas?
I don't want to maintain versions for all dependencies in all projects. I just want them to be all in one place
You mean like with modules?
yeah
This good enough, or should I do something different for it?
public Spawner getSpawner(final SpawnerLocation input) {
Spawner spawner = null;
for (final SpawnerLocation loc : storage.getSpawners().keySet()) {
if (!loc.getWorld().equals(input.getWorld())) {
continue;
}
if (loc.getX() == input.getX() && loc.getY() == input.getY() && loc.getZ() == input.getZ()) {
spawner = storage.getSpawners().get(loc);
break;
}
}
return spawner;
}
Does it work? If so, its good. If not, its not good
How about implementing equals in SpawnerLocation?
Probably cleaner yea
@empty flint
you can just have compile project('YourModuleName') in yout dependencies. and include the modules in your settings.gradle although I think intellij does that for you
@hot hull Why are you iterating over a map to check if the key exists? xD
You dont need the instance to be equal
Just the hashcode
Have you not overridden the hashcode and equals?
elaborate on what I should be doing, because I've no clue what you mean exactly
Go to your SpawnerLocation class, right click, click "Generate..." then click hashcode and equals and tell it to match world and the 3 axis
Alternatively you can write the hashcode / equals yourself but I do not recommend it
you can then just call HashMap#get and it should return the same result as what you are doing
except its much faster
This is what I currently have
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof SpawnerLocation)) {
return false;
}
final SpawnerLocation input = (SpawnerLocation) obj;
return input.getWorld().equals(this.world) && input.getX() == this.x && input.getY() == this.y && input.getZ() == this.z;
}
That hashcode looks wrong
Yea, but what do I do with it?
do with what?
The hashcode..
Ah I see
got it
@Override
public int hashCode() {
return Objects.hash(world, x, y, z);
}
mhm
Meaning I should be able to just use get on the map now?
Yes
neat works
đ
Now to fix these hecking holograms
xD
So Yugi, now onto my storage, this is how I currently store them in a yml file (for persistency)
spawners:
world;-255;64;45: 1;BLAZE;BLAZE
world;-251;64;41: 1;BLAZE;BLAZE
world;-258;64;40: 1;SNOWMAN;FROZEN_SNOWMAN
world;-261;64;44: 1;ZOMBIE;ZOMBIE
Why not just use sqlite?
Yea
Time to google 
Can I use bootstrap studio to make a frontend and then link with a backend?
one day i'll learn how to do cooldowns 
They are literally easy
F
Baked Beans
indeed
Rookie error
its saying x depends on y which depends on z which depends on x but z doesnt depend on x REEE
Ok some sketchy shits going on here
it probably does somehow
How reliable is intellijs refactoring just to change a variable name lol
Ive got like 30 usages of a variable - and I wanna change the name by 4 letters
Or F6
Alright
netx up
how would one get the unicode from an emoji
I tried using a lib val parsed = EmojiParser.parseToUnicode(emoteId)
and that didnt do shit to the emoji
watch i've just like done all of this and then it just like doesnt work 
wack
ah yes
What is that wack color scheme sheesh
eternal reports
niall say another word and your dick is getting chopped off
nial pls
đ€Ł
A mute will stop you
đ±
biased
@heady birch some may say abusive
đ

Only use it for legit reports
is this not a legit report? 
Anyone got a better format for the animations expansion?
Something nice and compact
niall u been asking for days now đ
yeah no one answered
đŹ
??
well.....

