#help-development
1 messages ยท Page 1963 of 1
hardcoded ๐
it uses strategy design pattern
and has few handling impl available
you can make it simulate vanilla actions, excluding gui elements
I hate that menus system you have to create extra classes
and make GUI elements which are not even in itemstack form
But can it change the display name of open inventories without opening a new one? ๐
Animated inventory names ftw
packets?
that's not possible, you need to open new inventory in order to do that
or use packets to open one
This is why i work with Intellij. Its consuming 4gb of ram. But i have 64gb so no problems
64 gb of ram
dude you're ready
for windows 20
where 32 gb of ram would be a min requirement
8gb was so laggy for me
so i bought cheap 20 euro ddr4 one
i mixed the ram
but i researched everything
to make it compatible
and it worked
i saved 80 euros
I buy 64gb of ram. Cuz when i went to store they have 4 rams (4-16gb) that where chargeback by the buyer. So the shop have to resell it at a lower price. And i ask then to test it and see if they were working. And they worked so i bought them
I think i paid 90 dollars, when they should be more than 100 dollars
I got my 64gigs for minecraft renders...
And its freaking amazing having 64gb cuz you can open more than 1000k google pages
*Chunky
you mean a bit more than 6
on chrome
actually my gui system can support more than gui inventories
it can support holograms as ui elements too
due to extensive interface architecture
holograms inside gui?
no
lol
holograms are iselft armor stand on air?
its packet based
But holograms are simple armor stands entities on air right?
you register UI objects in the same registry
and the handlers would take care of it
you only need to implement action method
Enough already stop humiliating me, I've only been in this for 1 year
kinda
i'm not humiliating, sorry. I didn't meant to hurt you
Damn, don't believe it
Haha
i'm highly sensitive person
Oh sorry
lmao been modifying my code four two hours now and still cant find the bug
๐
Have you try Mock Bukkit?
no dunno what that is
its a lib for unit testing of plugins
creating home and when the user leaves the home is gone while the data is saved :/
Mock Bukkit, its a library used to make test and debugs
Wait describe your inssue
uhh
Today im not stressed because i went to a bowling alley so i wil ltry to help you
the player is making a home and that gets immediately uploaded to the database
when they leave that data is cleared from the cache
when they join back the homes dont load but the rest does
:/
i dont see any implementation fault
Can i get connected to your ide?
futures
no >_>
can show the github code
forget that message
Yeah the same
I just wanna see your implementation
I thought you where working directly over databases. But then i see that you mentioned you where using cache
In these times, for multi server sync its highly recommend using cache system
Upload all plugin please
uwu
owo
Conversions not allowed for -12 people, just 12+
conclure thinking no no no
idk what u guys r talking 'bout but whenever multithreading comes into play it gets interesting
Conclure
Verano123
well this is the starting point where the user creates the home
https://github.com/FourteenBrush/MagmaBuildNetworkReloaded/blob/c55fd80edb88d642ecb262a7475ce4cff14c253f/src/main/java/me/fourteendoggo/MagmaBuildNetworkReloaded/commands/HomeCommand.java#L47
For data catching (a cache) you would use async?
I would use async cache and databases query async
you probably want to see the impl of the database
thats just that some code executed linearly in correlation to some other code depending on how it was declared
I mean
you don't need an "async" cache, but rather just a thread safe cache
What should be thread safe chache?
for instance lets say you're fetching your persistence database and then want to store the result in some data structure
then its to your benefit if that data structure of yours is thread safe
such that you dont have to sync back to another thread
since that'd just be a waste of resources and complicate design
A ConcurrentHashMap or ConcurrentSkipListMap or ConcurrentHashMap.newKeyView() or guavas Caffeine's caches or guava's caches, theres a lot of them
even reddisson got their own thread safe collections
I mean
only getting and no setting kekw
ConcurrentHashMap.newKeyView() uses boolean values as dummy values
(might bew newKeySet idr)
you're never changing the the structure?
at some point you must?
nvm
I think he only updates the cache, and on server join or quit he load/save the cache (May be not, that what i understand)
:/
its not very smart to just have two points during an entire session in which you save/load
can I get more serious?
I want to ask if it recommendable to have bukkit runnables inside custom data object?
depends on the situation
but data objects generally only tansfer data between its dependencies
I ask because Fourteen has one inside his user object (Not for criticing just to know )
its not supposed to manage itself, then you violate single responsibility principle to some degree
its an actionbar
didnt know you were actually looking at it
g
fourten your problem it was when saving or loading data?
And was on cache or database?
seems like the homes arent loaded
i think the issue is in the #loadHomes method so im debugging that now
I can't find setCape block
the Home record?
A record its a new class type?
its newer java stuff
unfortunately
I just remeber a friend told that was the same as an Enum and it can be initialized. Its correct?
well thats the entire point I believe
immutable data carrier
no
its quite different from enums
Records are good
they make my class one liners ._.
Make entity rotate to player direction
org.bukkit.plugin.InvalidPluginException: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled wdym disabed i was starting a runnable in a constructor
indeed
owo
you should start unit testing ๐
while (!plugin.isEnabled)
Agree
how can i start a repeating runnable on enable?
wait im instantiating this class before constructor
A JavaPlugin is only enabled BEFORE onEnable was invoked AND AFTER onLoaded was invoked
So by definition, it can never happen in the constructor
nvm im confusing some things
?jUnit
i dont get anything about that
?junittestings
hey @ivory sleet i saw you in the geckolib discord, can i dm u for some help if that's okay?
unit testing is the procedure of testing single functions of a class by writing test cases in code for it
any ideas why sometimes the number has a ton of decimal places?
String s = configFile.getFireballDamageRange();
String[] parr = s.split(":");
int lowerquart = Integer.parseInt(parr[0]);
int higherquart = Integer.parseInt(parr[1]);
double rand = Math.random() * higherquart + lowerquart;
double truncatedrand = new BigDecimal(rand).setScale(1, RoundingMode.HALF_UP).doubleValue();
its a way to make sure none of your functions are working incorrectly
whats that
ur using a big decimal
how
whys hat bad
junit is a java library that aims to make testing in java easy
hmm yeah
how does the thing work
doubles behave weird when rounding them
JUnit.makeItWork(method());? how would it happen
tho should be said it was quite some time since I was in touch with the gecko lib and its devs @maiden thicket
aka whats the logic behind it
ahh xD all good
wow u have paldiu added i had no idea
ignore what i said here
๐
so uh
What?
basically when i add a command to plugin.yml it registers by itself. But i only want to make the command exist if the config says true
how can i do this
hmm intresting how do i do this
I have a custom api for commands do you wanna take a look?
Look at what verano got, will probably suffice for you
if(!XPlugin.getStorage().get("commandName")){
return true;
}
where XPlugin is ur main class
getStorage is a getter for ur storage hashmap, that has each command name and its boolean, that u set on enable by reading the config
thats the simplest and probably a bad way to do it
but it works
since it prob breaks SRP, ur main class isnt supposed to have random fields on it, or is it ok?
you're doing new BigDecimal(rand).doubleValue()
Well generally single respond principle states a class must only change for one major reason
Thatโs it
so it is ok?
Well the entire thing of what one major reason is defined as, is hella subjective
So itโs up to you to decide
IC
anyways i still do not understand JUnit
and unit testing
and anything related to that
Once I get home I might be able to give you a Ted talk
A con talk
now 4
5
hmmm i am trying to implement a way of checking if i could "walk" a certain path given 3 locations, the current one to eval and then the 2 previous but im not really sure how to impl it tbh. like uh i was thinking about the changes in Y value but what i have made doesnt work
i dont want to not allow changes in Y tho
and just glue the path to the floor
anyone got any pseudocode ideas
like a pathfinder?
myeah thats what im doing
around blocks or
yes, but it also has to be "walkable"
How I get a invisible itemframe in spigot 1.18.1?
Hi how would i put many materials in a shaded recipe?
Like i wanna put 10 items in one slot
Something like that
Thanks
maybe try each direction and move forward 1 block. if there is a dead end then turn, repeat
id
k
im sorta thinking like a maze, is yours for terrain?
help
why does it not think its a string
not sure if it still works with a namespacedkey
walk in straight line to location
if block is higher y level than block standing on then jump
if 2 blocks in the way of player, turn, walk and turn back to previous vector in relation to the location
it doesnt want a string
it wants a component
oh yea
howd you get the =/= thing
is that just your ide displaying !=
yea
hmm looks nice
ooh i did just find a bit on a bug where i wasnt cloning my custom location wrappers lemme check
Anyone?
the brackets are in the wrong place on that if statement
ye
and yea- it takes a component not a string
new TextComponent(getConfig....)
you would probably need to listen to events and something like this, but you can't do that with plain crafting mechanics
Damn
Is there documentation or a resource to this?
idk try looking at this https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/PrepareItemCraftEvent.html, but for those things you usually would want to create custom crafting gui
Alright thanks ๐๐ผ
np
how did you make that screenshot
Is there an event for projectile deflection or redirection
in my case, ghast fireball deflection
what does deflection mean?
as in
you know the return to sender achievement
when you hit the ghast fireball back to it
is there an event for when the player hits that fireball
Guys how does the persistent data holder for the players work? Does it save on quit and join? Cause I tried to set a value but when I rejoin something weird happensโฆ I donโt even know how to explain
ProjectileHitEvent i think
thats when the projectile hits something
not when something hits the projectile
public class ProjectileHitEvent
extends org.bukkit.event.entity.EntityEvent
Called when a projectile hits an object
if its hit back it doesnt explode just changes trajectory i
conclure you know this owo
owo
thats the spiwit
on reddit they say that you cant detect it
damnit
is there anything that even changes on the fireball
like nms metadata nbt etc
the velocity when you hit it
nms handler or something
woudltn work for e
me *
im trying to send a message like
"You deflected player's Fireball!"
something like that
HOW DO YOU HAVE EACH BRACKET WITH ITS COLOR
OMFG IT MAKES IT WAY COOLER HOW
n00b
owo
makes readablity nicer
lmao rainbow code
declaration: package: org.bukkit.event.player, class: PlayerInteractEntityEvent
how do i put each event in its own file
do i need to make my own event manager
?
you mean listeners or events
listeners
oh nah you just need to register multiple listeners
oh yea i was using registerEvents but i will use registerEvent
registerEvents is fine
Use registerEvents
registerEvent is the old way of registering events. You can still use it, but it really only has certain use cases nowadays.
Okay @grim ice ,
To begin with, programming software, whilst constantly trying to make things work can be synonymous to how science and physics works. In software it is difficult to prove that your code is correct. It might work to the extent of how you want it to behave, therefore it might not be incorrect, but that does not imply it is correct. In physics we can demonstrate that something is not incorrect by experiments, but it is really hard to prove something to be correct, for instance the quantum field theory. We have simply enclosed the set of formulas, principles and laws with counter arguments that we've collected such that there is no meaning in trying to further disprove them.
Conversely to mathematics where things can be proven correctly due it its abstractness mainly. For instance it is quite easy to prove 1 + 1 = 2 by using set theory, category theory and for instance group theory including normal calculus. This can be done by defining a binary operation of the sets the terms are contained in, and then define some other properties. Of course, it is possible to prove software mathematically, its just that the proofs get insanely colossal quickly, as an example it's possible to prove state by lining up a set of predicates using predicate calculus and category theory.
So instead of laying focus down to write mathematical proofs that justifies our code is correct, we can surround the production code with test code that demonstrates our code is not incorrect, yes double negation but that is the only way to phrase it.
Another reason why we unit test apart from proving our code to not be incorrect, is because it skips manual testing as that becomes incredibly error prone in professionalism. It is very easy to test just the smallest parts of our code, whereas when you test by manually following a set of instructions you often test a lot of irrelevant things also which may affect the output.
There is even a third argument that can be made, testing explains the production code you write, and over and above all unit testing (if used correctly) can lead to better design, as you have to write fine apis to make sure the unit is working.
Should be mentioned, unit testing and tdd are not the same, tdd (test driven development) always implies unit testing, but unit testing does not necessarily point towards tdd. Also, some of the arguments I made here are not specific to just unit tests, but also functional tests and other tests you may exercise in software.
here we go again ๐ฅบ ๐
tried to structure it into paragraphs to make it a little bit more pleasing to read
myes
there are some unresolved issues concerning quantum theory and relativity theory iirc which goes under the quantum field theory
but how does it prove that it's not incorrect
class Person {
int age;
boolean hasBaby;
void setAge(int i) {
age = i
}
int age() {
return age
}
boolean hasBaby() {
return age > 12 && hasBaby
}
}```
here we can for instance test that the setAge function works
having a baby when 12 ๐ค
lets say we want to test that the person's age actually gets changed (just a dummy test to explain)
void doesAgeReturnSameNumber_givenSetAgeInvocation() {
Person person = new Person();
person.setAge(13);
assert person.age() == 13
}```
In junit we would use Assertions.isEqual(person.age(),13) iirc
no?
and for stuff like spigot where u have to open up a server how can you even do it
we have to emulate the entire server essentially
been reading along and wondering the same thing
also in ur example its supposed to be boolean not void, right?
what does that have to do with testing?
when you test, you want to know if the test works, right?
dont you need to return the value so u can later access it
it will throw an exception if its not equal
if you get more into unit testing you will come across one technique called mocking which MockBukkit uses to make unit testing possible in a server emulation
no 2hex
we just throw if the test fails
(essentially)
so what do i do if i want to test
which i dont see how will it even benefit mee
its just more lines of code
yes you write a lot of code to test your actual code because you're testing your code against different cases and make sure the way your actual code handles all of those cases are according to your intentions
it benefits you because it avoids manual testing
it makes it very accessible to test single functions of yours
and makes it extremely easy if you just want to test something again
Is it a bad idea to use pdc to store player-specific config
lets say you wanna test that a bedwars victory function goes accordingly
manually testing that everytime would be a pain
moreover, how do you know that the bedwars victory function still works when some other code gets changed somewhere else?
with automated tests you can simply click a button to run that test again
but yes
depends on what you're storing
let me talk about the disadvantages
Not with Q
so u can literally skip to the point where u win, and just throw an error if something goes wrong with ur checks
i guess thats quantum?
and just run the test
dammmmmmm
i have a problem
players are able to bypass my event.cancel thing for inventory clicking by using number keys
i already semi-fixed it, but they can still do it by putting their mouse over an empty slot and then clicking the key where the item is
here is my entire onInventoryClick: https://paste.srnyx.xyz/ilaqagowez.java
and here's video with debug msgs: https://media.srnyx.xyz/java_9zzwig9z50.mp4
No, it's the set of all rational numbers
How do you make those little autocorrect option things in commands
Like in essentials, for example
They have those options that pop up
Since the proof that 1 == 2 requires a division by 0, it is not possible in Q and all subsets
implement tabcompleter
tabnine
good plugin
anyone know an event that can detect left clicking of entities? (hitting)
or a way to detect it
EntityDamageByEntityEvent?
can projectiles be damaged?
ill give it a go ig
I think R doesn't allow for division by 0 either, so yeah 1 == 2 is also invalid in R
how would someone hit a projectile?
Oke
Disadvantages of testing:
- You have to write a lot of test code
- Additionally, you have to maintain all the test code, and fix it if you break it
- It takes long time to get into the unit test exercise, especially to master it
- Unit tests can also lead to rigid designs where when you refactor normal code, test code breaks easily (known as the fragile test problem)
- Certain refactors will always break test code like extracting another class from a given class
- Sometimes its hard to decide whether a unit should be tested or not, and which unit is the right one to test
@grim ice
ah yea that should work as its an entity
o
oh right
but can they be damaged when punched?
Like everything, it comes with pros and cons
not necessarily "damaged" but its the same idea (like when u destroy an item frame)
that sounds like a pain
yeah but will it detect a left click
It does
hm
ok
it should yeah, just try
ill try it
where u can make a command to just automate the win
but even so its the best way for your stakeholders at the company to know that you are not shipping shit
yes but that still requires you to manually test it
unit testing isnt really necessary, is it
yes but its fast
anyone know how to fix this?
faster than writing all that code to do it
manual tests are more time consuming than what you think
- You have to write a lot of test code
This is good, the more you use the software the better the software API becomes, thus reducing semver breakages- Additionally, you have to maintain all the test code, and fix it if you break it
This results in the developer more caring about ABI, which is also good- It takes long time to get into the unit test exercise, especially to master it
Valid- Unit tests can also lead to rigid designs where when you refactor normal code, test code breaks easily (known as the fragile test problem)
This is the result of bad design and is likely to no be an issue if you have more experience with avoiding these problems- Certain refactors will always break test code like extracting another class from a given class
Not sure- Sometimes its hard to decide whether a unit should be tested or not, and which unit is the right one to test
Very Valid
What a lovely shity. The dependency its not being relocated
especially when code bases grow beyond 1 million lines of code
me with my buggy as 64 lines of code
geol its not always good to write a lot of test code, because your entire team has to maintain that (to some extent), given a deadline also which if you get a three months project is like committing suicide from my experience
and it does not always result in devs caring
because in reality devs get afraid of touching and refactoring code
because you are bound to break the code
So?
unit testing seems like pain
thus youll have to go and clean it up which takes time
awesome!
and regards to those refactors that always break test code, for instance if you're breaking out a delegate
imagine if u can do something like exec() in py
or is it called eval
either way run a method on fly
so like
u can code inside of minecraft
/run Bukkit.getPlayer("2Hex").sendMessage("ur mom");
that would be cool
Right, when you do it paid things change
can you inject code using a mc player input tho
or run code whatever the word is
yeah ๐ not saying ur wrong
I think too much with the mind of an open source person
i doubt its possible, but some sweat could probably do it
becase what u said is the true intention
but sometimes everything doesnt play out fair and square
Itโs a pain but itโs worth it
Yes, you just need to make an interpreter to interpret and execute whatever their code is
i should try unit testing.. already three hours trying to fix something
Yeah, when having issues dont fuck/lost your time and go ahead to unit testings
I started doing unit testing and found multiple bugs thanks to it, one which I couldn't even reproduce in production and I had no idea how it didn't occur in production because it should by all accounts happen in production and not just during unit tests
Is this the best thing to use to write unit tests, or is there another good alternative to get started with?
Also unittests can act as a primitive benchmark
How its possible that a premium Anticheat that cost 60 dollars, you can disable checks with a simple Sping-Poof
Its fucked amazing
Sping-poof?
Isnt call like that?
You mean ping-spoof?
Yeah that
I have disabled some checks from the anticheat doing ping-spoof
Just wanted to be safe, it could've been some form of mechanism I have never heard about
lol
i have finally completed
a plugin
:D
But yeah, anticheats are a bit sus in our days
I will probably make a scam report on mc-market because i want my money back
With that money and an extra, i would pay for a good anticheat and custom
I doubt that it is worth buying an anticheat
worst resolution ever
Normal?
How do you send the component?
And from what framework does the component come from? Bungee or Adventure (or something else entirely?)
TextComponent component = new TextComponent();
player.spigot().sendMessage(component);
Yeah
its a spigot plugin
No message to string
Read my message
thats not how it works with components
VERANO gave you the exact code
Or just use paper and have the wonderful ingenuity of adventure who's implementation sucks a bit less.
Didnt catch it
flatfile is best
it doesnt make sense why it isnt working
what about when i do it on a command.
i get CommandSender do i need to get the player
cast it
Cast it to player after an instanceof
this is basic spigot
i updated all the stuff to the tables and now it can find everything except the stuff i need
FlatFile best = one server instance
Database bast = multi server instance
eh
What isnโt working, and what are you trying to do
or better: if (sender instanceof Player player) {/* you now can use player as a player */}
id still not run flatfile if it was just one server
im saving stuff to a table and it wont save idk
so my ResultSet#next is returning false ._.
Show me how
i dont think you will understand it but ye
Iโll take a look
the records arrive at the database im 100% sure about that
but loading them fails or something
im loading them in the #loadUser method
while (ResultSet#next) doesnt seem to work in #loadHomes
debugged it
cant find why
ResultSet result = connection.preparedStatement(query).executeQuery();
while (resut.next()) {
parse staff here
}
i know
if you're looking for the table setup, its in the constants class
no errors, only when i leave and i join back (so the user cache is cleared) and i create a new home, i get an error on the database that the record with that primary key pair does already exists
my man is gone i think lol
im looking
hehe
ok sorry had to help my girlfriend with something
now
i found the issue
lol
your LOAD_HOMES query is wrong
you have SELECT * FROM homes WHERE user=?, name=?;
when you want SELECT * FROM homes WHERE user=?;
And to combine conditionals you use the keyword AND, not a comma
yeah
So it would be SELECT * FROM homes WHERE user=? AND name=?;
not in this case
If you wanted the and
they want to load all the homes
if they want to load a specific home then yes, it would need an AND
@tardy delta ^
oh it seems that i already changed that
@Language("SQL") String LOAD_HOMES = "SELECT * FROM homes WHERE user=?;";
every commit has "local changes" as message lol
hmmmm
i almost wonder if it's due to you trying to loadHomes inside the result set of a different query
please stop using semicolon in sql statements
not sure if that would matter
it looks ugly and not necessary
the semicolon is fine
:(
lmfao
I usually put semicolons
do me a favor and try loadHomes separately from loadUser
and see what happens
ye
wait nvm
i figured it out
lmfao
@tardy delta
look at the fields of "homes"
then look at your queries to delete and load from that table
see the problem?
you even can do multi queries with jdbc?
yes
wait lemme see
if you can figure it out yourself that'd be preferable but if you need i will still tell you
wdym the fields of "homes"
the columns
CREATE TABLE IF NOT EXISTS homes(name varchar(40), owner varchar(40), location_x DOUBLE, location_y DOUBLE, location_z DOUBLE, location_pitch FLOAT, location_yaw FLOAT, location_world VARCHAR(40), PRIMARY KEY(name, owner));
SELECT * FROM homes WHERE user=?;
what's missing
lmao
๐
junit + mockito I'd say
@fervent gate
(sometimes powermocks is necessary)
So wait why do you need Mockito?
to mock dependencies?
But what is mocking
"In object-oriented programming, mock objects are simulated objects that mimic the behavior of real objects in controlled ways, most often as part of a software testing initiative"
LMGTFY
well essentially you're isolating actual dependencies to make sure you're just testing the unit itself, mocking is when you have an implementation of a dependency where you can make sure they are not affecting the test negatively
without mockito you'd need to create a new class for every dependency you want to mock
for example, you don't want to have to spin up a real spigot server every time you test your plugin
which can become quite tedious, and at some point might even have to test your mocks which is a pain
so mockito is to big help sometimes
What about running an emulated server? Is using mock bukkit a good idea?
currently doing that ๐
then its not a good idea but the only idea thats decent
wait you dont have to do this?
no
lets say one of your classes depends on Plugin
you could just create an impl of Plugin and pass that
no clue what that means so I should probably ?learnjava
perhaps, unit testing is considered an advanced topic apparently
How can I detect Entity / Player collision with other entity?
Understandably so to be fair
AABB
public class Haha implements Plugin
maybe
usually you'd do extends JavaPlugin
You...
player.spigot().sendMessage(message);
It appears I have found my adversary
I mean I know that's what he meant but I don't know how I would begin testing so I'm doing my googling and stack overflowing rn
Well JavaPlugin cannot be mocked entirely with a mock of your own, with mockito you can
Did you do ChatColor.translateColorCodes?
yes
Some Error I dont know how it happened
MockBukkit ๐
so I'll get mockito for sure then
Show me your code
MockBukkitPaper 
this exists?
Cats sometimes have wild things to do
Youโre only translating the color codes in the hover
tbh any java topics i can learn
ffs im so dumb
i wanna progress
ill learn a bit more about unit testing but not a ton since i dont need it atm
im open for any other use(ful/less) topics i can learn tho
Reflection, MethodHandle, java.nio.channels and the concurrency classes, the executor api, java's module system, ClassLoaders (they are awful but extremely useful) and annotation processing api
Bitwise operators are fun and not too hard to learn
i have a shit ton to learn oh wow
thats epic
Does anyone need help? I see someone tag me but i cannot find it
yea
they explained those to me before
Did they explain why HashMap uses bitwise rather than modulo in Java?
like generally learning concurrency classes in java is extremely useful
Java is one of the better languages for concurrency
indeed
only XOR, ANDing and those stuff
"The member type PacketReader cannot be declared static; static types can only be declared in static or top level types" what is this error?
Code
ill start with reflection
yeah
?paste
master it
You canโt make it a static class if it isnโt nested
Itโs just protected class PacketReader
i was able to fix this by doing:
if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null) {
boolean skeletonBow = event.getCurrentItem().isSimilar(MorphManager.skeletonBow());
boolean skeletonArrow = event.getCurrentItem().isSimilar(MorphManager.skeletonArrow());
if ((skeletonBow && slot == 0) || (skeletonArrow && (slot == 27 || event.getClick() == ClickType.NUMBER_KEY))) {
event.setCancelled(true);
}
}
if (event.getHotbarButton() == 0) {
event.setCancelled(true);
}```focusing on this part:
```java
if (event.getHotbarButton() == 0) {
event.setCancelled(true);
}```
365 kb for 3 and a half minute video lol
thats a third of my screenshot size
Class cls = Class.forName("A");
will return the class named A in my project, but
Class cls = Class.forName("java.lang.Integer");
will return the integer class
how does it know that im specifying a package
or a classname
โ.โ
Because a class canโt be a package
it should just force u to specify a package
What is reflection actually used for? Watching a vid on it rn, but I don't really see the point.
ig
internally reflections will do a name.replace('.', '/')
class scanning generally
can be used to dynamically invoke methods and fetch values from fields etc
Nowadays methodhandles and varhandles might be better, but they haven't fully caught on and most of the basics of reflections still stand
This reflection Java tutorial describes using reflection for accessing and manipulating classes, fields, methods, and constructors
very true, much faster
โI'd group uses of reflection into three groups:
Instantiating arbitrary classes. For example, in a dependency injection framework, you probably declare that interface ThingDoer is implemented by the class NetworkThingDoer. The framework would then find the constructor of NetworkThingDoer and instantiate it.
Marshalling and unmarshalling to some other format. For example, mapping an object with getters and settings that follow the bean convention to JSON and back again. The code doesn't actually know the names of the fields or the methods, it just examines the class.
Wrapping a class in a layer of redirection (perhaps that List isn't actually loaded, but just a pointer to something that knows how to fetch it from the database) or faking a class entirely (jMock will create a synthetic class that implements an interface for testing purposes).โ
Any idea, i have look many times the code
imagine getting NPEs in your plugins
But idk why, cuz i executed: "faction create test"
And no errors appears
So im like okay?
jetbrains annotations <3
wait

Technically yes, that is how skript works more or less
SHIT
Problem identifier
if i get better at reflection
ill make a new ide
in minecraft! !!!111
lmao imagine writing code in mc that would be so cool
Eh. I'd rather want an IRC client than an IDE in minecraft
lol
IRC?
Though, perhaps I should create an IRC client for eclipse. AAAAAAAA, why can you turn everything into an IRC client?
Most people use doom as a proof-of-concept for portability. I use IRC Clients for that
Internet relay chat. It was THE way to chat before discord came
/eval C{System}->out->println(C{java.lang.Integer}(1)->intValue())
You are talking too OP and i dont understand you
C{} used to declare that its a class
that will run System.out.println(new Integer(1).intValue());
imagine if u can do that
Well, it is a chatting protocol. That is just about it
anyone know why im getting a null exception when doing WorldChangeGui.gui.show(player)
https://paste.md-5.net/tifadokapo.java
the library is https://github.com/Phoenix616/InventoryGui
discord for boomers
example of an IRC client
Could you translate what "OP" means? I am from Russia and do not understand it. Please, tell me what do you mean
I am interested, because already saw that ๐
Only meaning i know is Original Poster
Isnt OP used on Programming?
You mean OOP?
Object Programming
That thing
Lel
But that is something else entirely
Minecraft op means admin access
isnt a minecraft ide easy to make tho @ivory sleet
Well, i am interested what he mean here
what us the stacktrace?
not really
minecraft ide?
is minecraft a programming language or what
Not really a Object Programming or Minecarft op i think
coding in mc
There aren't even many build tools outside of maven or gradle
reflection
At best you'd have a raw text editor like VIM
yeah ik
And you don't really need any reflections for that
Since System.exec() is a thing
Yeah, i devleop on version 1.8 i can i use it
Yay i fixed the inssue
I was that yeath
weird question but is it possible to make a user highlight an item in their task bar? im thinking about having it in the middle slot when they log in for my server selector
I think you can do Player.setSelectedSlot or something
sweet ty ill look it up
how do i check if a it is first time joining on join event
do i just check player.getFirstPlayed() against time now
can you rephrase the question
like the first time the player has joined the server?
on PlayerJoinEvent how do i check if its first time joining server
that is how
Player#hasPlayedBefore exists im pretty sure
yeah
cheers
yea me neither
hey im looking for a plugin wich allows me to add custom items into crates for example
Diamond Sword
Of The Dragon```
but all the crates plugin i try remove the lore. I dont mind paying for a plugin aswell as long as its good
and for some backstory it is for a factions 1.12.2 paper server
Then wait for a response.
Patience
Outdated and fork 
i could
i need to finnsh my network by easter i have a $3000 server network soo yhe
cool
its factions
whats the name
I'm guessing you'll get a response before Easter ๐
havoc-network
yhe well me and my staff have a lot more to do to
so do that first
Then do that while you're waiting for a reply.
untill you get an answer?
Both are equally wrong
Ye lol
I assume the person who used the word has issues spelling the usually less used words such as OOP or ping spoofing
Well, fork isnt that bad
System is a bit wrapper around Runtime anyways
In non-paper minecraft world, it is bad
At least, the people think so. It is a small wonder that paper even has so many forks. Though at the height of bukkit bukkit also had a ton of forks
Hell, Spigot used to be a fork
java.io.IOException: Cannot run program "System.out.println("Hello,": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at java.base/java.lang.Runtime.exec(Runtime.java:592)
at java.base/java.lang.Runtime.exec(Runtime.java:416)
at java.base/java.lang.Runtime.exec(Runtime.java:313)
at HelloWorld.main(HelloWorld.java:7)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
... 5 more```
Runtime.getRunTime().exec(input));
Input var is the simple print hello world thing
Well it could be
Oh heck yeah time for java based scripting
Java is not an interpreted language
Process process = Runtime.getRuntime().exec("jshell");
process.getOutputStream().write("System.out.println(\"Hello World!\");".toBytes(StandardCharsets.UTF_8));
process.getOutputStream().write('\n');
But it can be
I didn't test that code however, but in the core it should work
Hi guys, i dont know if you can help me, but i'm using this api https://www.spigotmc.org/resources/โ -api-playernpc-โ -1-17-1-18-1.93625/ and i'm 100% sure that i followed every step but when i try to move the npc it says that i didn't create it! And i'm sure i did because i have called the method npc.create();
Anything is interpreted if youโre brave enough
well, the idea stands you might need to destroy the process and whatnot
how do you make it so portals in another world go to the nether/end in that world
You might also want to look into https://beanshell.github.io/intro.html which is pretty much java but interpreted
At least that is what I have heard
Isnโt there a MultiverseNetherPortals
like if u have a world2, world2_nether, and world2_the_end how would u make them link instead of just going to the default
ยฏ_(ใ)_/ยฏ
assign host,port all that stuff in your constructor instead
So i am trying to create a temp restart script (if not found) to make the server restart, however i wanted to use the actual command used to launch the server in the first place, so far i have almost the entire cmd, tho i wanted to know if there was a way to check if the serer was launched with nogui or not
anyone know what is the problem?
https://srcb.in/yphjWY8BlA
Code reusability! You can easily test your database code without setuping a config
because it will try to initialize your variables before the constructor iirc
so it will result in a nullpointer because plugin is still null at that point
How can I get NMS block from Bukkit Block
how do i do this then
i need to pass the variables in
you dont have to if you dont want to
but it errors lol
public class MySQL {
DiscordPlaceholder plugin;
private String host;
private String port;
private String database;
private String username;
private String password;
public MySQL(DiscordPlaceholder plugin) {
this.plugin = plugin;
this.host = plugin.getConfig().getString("sql.db_host");
this.port = "3306";
this.database = plugin.getConfig().getString("sql.db_name");
this.username = plugin.getConfig().getString("sql.db_username");
this.password = plugin.getConfig().getString("sql.db_password");
}
}
like this
im quite lucky ngl ive only had it once
only had to isolate from school once
others in my year had been isolated like 5 times
question, can you restart a server from within the api?
getServer().shutdown(); might restart it
It does if you have the kind of start script
yeah the problem is some servers might not have it
Not much you can do about that
Iโm listening
Hello, would anyone like to help me set up just the pom.xml for plugin development? I'm using MS VS Code and this guide https://www.spigotmc.org/wiki/creating-a-blank-spigot-plugin-in-vs-code/ but I don't know if I'm doing things right. The reason why I'm using MS VS Code is that my 170 euro second-hand laptop gets its disk usage to 100% when an IDE is launched.
made an auto restart script generator
yeah that is normal for IDE's especially if you don't close projects in the IDE.
Plugin support
it wasnt for me
I had installed NetBeans like yesterday or something and immediately had my disk usage go up to 100%
Would you help me with the pom.xml?
you could try execute /restart command as console
yeah some don't have the restart script tho
which is why i am making a restart.sh generator
smart
that is because netbeans and related IDE's index maven central which you can disable it doing in the settings
but you won't stop the disk usage when it is launched and it is re-opening projects you never closed as well
not entirely sure why you are worried about this disk usage
everything you open uses 100% of the disk for a short period until the OS tells it can't
But it was always 100% and it was very laggy. The experience was unpleasant. With VS MS Code the Disk usage stays at just 15% at max
There you have a sample for doing it on linux
The script should be called start.sh
yeah ik how to do it on linux
So, then just run on your server /stop
I just opened Eclipse and my Disk usage is very low on it. Why is that?
Low pc components