#help-development
1 messages · Page 2230 of 1
the /public/ one should have the latest versions as well though
dumb gradle just doesn't grab them
try reimporting? you can look, it's there
Yep all new ones are there, just 20220615 isn't, and gradle is looking for that for some reason. What do you mean with reimporting, how to do that?
as opposed to invoke virtual
or iirc invoke interface
altho invoke static might still be faster, but you dont gain any abstraction
so not really a good comparison
or reload all gradle projects
this button in intelliJ, if you open the gradle menu on the side
smh have to present a website
have fun
you should remove the old repo too if you still have it there
oh that's actually what's causing the error to appear which is strange. Old repo is also gone already
your website is the exact reason I'm not a web developer my websites would look 3000x worse than that on a good day
we just got a book html and css and they told us to learn it :/
you poor soul
is that why your working in C sharp
nah but its for the same project
😉 alright
use libreoffice draw it supports adjustable arrows
i did something like this
in like 10 mins
first draw the shape
then use the connect button
to connect shapes
on your right there will the be the properties
in what style do you want to your shapes to appear
wheres the text thing
oh i see
does anyone know where did setCustomNameVisible go in 1.19?
was it deprecated in 1.18 or is this nms
NMS
doesnt look like a big achievement lol
it is
you need to make your own NMS class
pain
you do?
@mortal hare heeyy agaain .. 😄
This throws me this when leaving chunks or placing blocks in it :
all the items which were previously put in
will go back to your inventory
in this case it does not
im wondering why bukkit has a conversation api
I asked the same couple months ago
im sorry can't help as I said previously I haven't managed it to fully implement it
damn
theres litterally nothing on BiomeSpecialEffects out there
new BiomeSpecialEffects.builder() allows you to construct BiomeSpecialEffects
it does everything
that's color related
ok im loosing my last braincells
yeee but on implementing it into game
aka applying
yea its just an a.k.a record class
which holds data
you can apply it to the biome by constructing new biome via new Biome.builder()
but how to apply the biome to specified region im really not sure
btw where did you got that photos?
u send them very very earlier , they contained custom leafes color,water color
or you can use reflections to modify existing biome
to replace the colors of existing biomes
that seems hacky
but it would work
ye thats what I want to do
but im scared of reflections
there's nothing scary there
you just ask for a field
in runtime from JVM
instead of asking it on compile time (well you ask it on runtime, since its interpreted but still)
?
here's the plugin
which does exactly this
but its premium resource
iirc
that's where I got the photos from
frick its premium
I would have "borrowed" some code out of it
it seems it uses protocollib
so we can make presumptions that it uses packet technique
which I mentioned previously
but its hacky
and needs to be managed
everytime player enters chunks
basically the same thing what the NMS does
oh noo
is there some other way for custom fog?
https://www.spigotmc.org/threads/sky-fog-color-packet.456700/
found this but this would require me to change verything to NMS Remapped
you helped me a ton
so thx
can you mess up your IDE method suggestions if you decompile source code?
here npc should have the method setCustomNameVisible, but it isn't there https://i.imgur.com/YA802j3.png
var npc = new EntityPlayer(server, world, profile);
Hi i need some recomendations for my block protection plugin. Im trying to add multi protection per user support. And im a bit messed trying to do that. At the momment i have this structure.
-
The claim manager (holds every claim from the db and used for caching)
-
The protection manager (holds every protection from the yaml file and caching them)
-
The claim object (holds each region data, the claim uuid, owner uuid, claim type, protection block location, home location, flags list and members uuid list)
-
The protection object (holds each protection data, for example the name, item, displayname, lore and radius)
So im stucked thinking how to to implement the multi claim part. I really apreciate help. THanks
the method is in the Entity class though https://purpurmc.org/javadoc/org/bukkit/entity/Entity.html#setCustomNameVisible(boolean)
im trying to get nms to work on my server but im getting a NoSuchMethodError every time, implying the specialsource maven plugin didnt work entirely well, am i missing something? do i have to build my project a specific way?
https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ im following this guide and idk if it will create the database automatically, and if not where and how should i create it and put it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
make sure you are reobfuscating your jar
yeah i thought that was what the plugin was supposed to do
i think you should just publish your project on github
what jar are you using that its created
maven should create ~3 jars depending on your setup
do you use gradle?
no
your jars should be in your target directory
there seems to be not much of note in my target directory aside from the my own project file structure
you do have the md5 maven plugin correct?
Allright would you help me if i do it?
because your probably putting the wrong jar in your server
oddly enough for me it was my shaded jar and not the remapped jar
after thrusday noon i definitely have time
Oh
More than i expected
I will try to figure myself
I just having logic troubles
just put it on github and maybe i got some time tmrw
i dont get anywhere with random code
Allr
But what about the logic?
Cant you help me now?
do i need to do it a specific way because ive just been using build artifacts the whole time
EntityPlayer is an NMS entity, not a bukkit entity
mvn package ?
You can either use the command "mvn package" or by intellij in the part where said maven, then select your project and lifecycle. Finally blick on package
did you guys know that you can make villagers leashed
with code maybe
you can modify the canBeLeashed() method inside abstractvillager
and in villagers can be leashed with lead by default
Yall know how to send a message to discord in a bot after a spigot event is ran without having to start a new session every time the event is ran cuz ofc it kinda delays the event.
i would probably just cancel an interact event towards villagers if a leash is held and leash them
oh
what session?
Like a bot session?
just send a message to the desired channel thro the jda
im sorry but i really cant find it, using intellij and there's no "maven package" option anywhere
dunno what session but normally your bot connects when your plugins starts
can entity metadata packet be sent before the spawn entity packet?
and stays alive
My small brain doesn't know how to send a message through the bot connection that is made when the server starts when a spigot event is ran, and my current method starts a new connection every time event is ran but as you can except that causes lag quickly and so I'm trying to optimize it. (Discord4J is wrapper I am using).
oh discord4j not even jda
just get the server and the textchannel and send a message
.builder(plugin.getConfig().getString("BotToken"))
.build()
.login()
.block();
gatewayDiscordClient.getChannelById(Snowflake.of(987876078624325682L))
.ofType(MessageChannel.class)
.flatMap(channel -> channel.createMessage("``" + event.getPlayer().getName() + "``: " + event.getMessage()).withAllowedMentions(AllowedMentions.suppressAll()))
.subscribe();``` it works, but it creates a new connection each time and so it kinda delays the message and the actual action in game.
lol store the client you silly
Ik I am silly.
My brain just went brr.
Thinking of a possible solution.
Where say maven, click there and will display something
i think i found it already, i just did ctrl shift a, entered maven, and i could find the menu that way
there maven package was one of the "goals" i could create
Yeah, you can also use the maven shade plugin
taking a bit longer to compile but its to be expected
Making a static variable in the main class and then setting the variable to the client in the bot start event should work, right?
Yeah it take some time because it need to compile, test, etc
or just use a field and use dependency injection to get your plugin instance
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
thanks for helping out btw and being patient
ive been developing plugins with just spigot for too long so nms takes some getting used to
does anyone know how to make custom fog?
burn weed plants
never used that
yeah im confused, i used the plugin but im still getting nosuchmethoderrors
specifically on CraftPlayer#getHandle()
Maybe because the class you are importing doesnt contain that method
check if you have the correct import
i mean just org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer right
😐
man, intellij truly is shit as of lately for me lol
I have this error when trying executing the following line of code InputStream in = getClassLoader().getResourceAsStream("dbsetup.sql")
java.lang.IllegalAccessError: class me.vaindev.simprewards.Database (in unnamed module @0x4df62f75) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x4df62f75Anyone have any suggestions on what it could be
Im trying to use a db with my plugin
Well my method worked anyways lol.
why are you trying to access internal jdk stuff?
there is a reason why it has "internal" in the package name
in that line im not accessing internal right?
in what line? i didnt see any code you sent
its saying the error is caused by the following line: InputStream in = getClassLoader().getResourceAsStream("dbsetup.sql")
i mean there is a plugin.getResource method
^
are you trying to get "dbsetup.sql" from your jar file?
yeah
just do getResource("dbsetup.sql")
ty
if i have two zombie textures for head and body each can i say 'this zombie has head a and body b' or do i need to save all possible permutations along the lines of 'a_a.png, a_b.png, b_a.png, b_b.png'?
what kind of server? mysql?
i guess the database either doesnt exist or the credentials are wrong
for me a h2 database is the eaasiest option as its just a local file and it doesnt require login credentials
could you show code
?paste
is it connecting?
errors?
or did you forget to create the db with the mysql workbench
lets try to execute a query like SELECT 3 and check the return value
well thro code i mean
public enum ArrowType {
FISH(){
ItemStack itemStack = new ItemStack(Material.ARROW);
{
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName("Fish Arrow");
itemStack.setItemMeta(meta);
}
@Override
public ItemStack getItemStack() {
return itemStack;
}
};
ArrowType() {}
public abstract ItemStack getItemStack();
}
better way to do this?
you can declare static blocks inside enums?
enums dont like static fields but they accept static methods :/
try (Connection conn = getConn(); PreparedStatement ps =
conn.prepareStatement("SELCT 3;")) {
ResultSet rs = ps.executeQuery();
System.out.println(rs.next());
} catch (SQLException e) {
e.printStackTrace();
}```
@quaint mantle
execute that somewhere
SELCT
Let me see getConn
Let's see getConn
conn is null then
Isn’t that invalid SQL? Or does it just grab the first three from the first table in use?
It just returns 3
it return 3
The number 3
Oh. I did not know that.
3 | 3 |
What is in ur getConn method?
i guess you didnt call connect()
Did it say databse connecter or not connecter or anything likr that?
Print the stacktrace
well theres a null value someone add some sysouts to see what is null
When u cath the sql exception print it
Oh is this MySQL and not SQLite?
I do
Put e.printStackTrqce when u catch all exceptions
It's gives useful onfo
enable your database
You sometimes need to call the MySQL class directly before it can load. I forget the proper syntax, but it’s smth like Class.forName(“org.java.mysql.MySqlDriver”)
is it on localhost?
"it should be" doesnt say anything, what did you do to enable it?
in my opinion mysql workbench is just the easiest way
uhh
havent tried mysql on linux myself
imagine not using windows and just using xampp 😄
Well it’s just a daemon so it should be started and stopped with systemctl
im on windows and i do use xampp
i always use embedded databases
Guess I need to brush up on the syntax for that command.
Maybe it’s systemctl start mysql
^
idk try it
Can u connect to it from another device?
Have you tried this? #help-development message
You’ll have to look a little more into it, but this could be your issue.
i think you want to check if the name equals what you are looking for, not just starts with it
actually since when Stream#toList a thing?
Are u testing the plugin on the same device that hosts the db?
?paste
sounds like tabcompleting the player names
Do u have a username as password set in tje cinfig+
Config*
3306 is the defult
Think u can do lsof - i:3306
To see if it's mysql
if you're using it for tabcompletion, just let TabCompletor#onTabComplete return null and it will automatically do the player names stuff
also thats just default impl
how can you know the equivalent of a packet if you're using mojang mappings? i.e. what would be the equivalent of PacketPlayOutNamedEntitySpawn?
i was doing my tabcomplete light this
is there a list somewhere?
does -> do the same as parenthesis in java?
No, that’s lambda
the string from config is null
Yes but its not tho.. or maybe ive done something wrong
I believe that there is a method that can do that. Bukkit#getPlayerExact() and Bukkit#getPlayer()
No a single player
eh im asking cuz my switch looks more like 'case 1 : ... break;' so i assume the lambda works like a normal switch just with break included?
you never told us what you were trying to do
the string just isnt set in the config, so do a nullcheck first or smth
The newer switch statements use the -> but I haven’t used them enough.
public String PREFIX = getConfig().getString("global_prefix").replaceAll("&", "§");
Player with that exact name else a player who's name starts with the string
as ye that -> is the same as { something(); break; }
that is the error line
so the "global_prefix" is not set in the config
It is
Are you sure it's not global-prefix
Are you sure?
global_prefix: '&7&l[&b&lHub&7&l] '
I make that mistake alot
right here
Can we see your code
Check your config in your ide and then check what the config on your test server says.
is it set in the actual file and not in the file within the resources folder?
They may not be the same
Right now it doesnt give me any config folder since the error
Do you ever call #saveDefaultConfig()?
also you should replace & but use ChatColor.translateAlternateColors('&', text)
Okay so remove both and use saveDefaultConfig()
Remove getconfig.options…
Heidisql
#saveConfig() saves the cached version of it to disk. The cached version is also null because it gets the instance from the file written to disk.
Since you didn’t write the file to disk, your config was null.
still gives same error
at same line
even when changed to saveDefaultConfig();
Show updated code.
public void loadConfig() {
saveDefaultConfig();
}
Where do you call loadConfig()?
If u wanna save config from the jar file do saveResource("config.yml", true)
Then do reload Config
onEnable
And how often?
#saveDefaultConfig() will cover that.
Only if it doesn't exist
Ok but
just use saveDefaultConfig in onEnable
Let me see the config in ur plugins folder
That'll be the most useful in helping u rn
https://paste.md-5.net/imikedudoy.java code line 28 error
https://paste.md-5.net/icujokoxeb.coffeescript config
that is not the config in my plugins folder tho
Is this config from the plugins folder
You are calling #getConfig() in a global context.
can you set merchant recipe to slot 0
Which won’t work.
Don't get the config values outside onEnable
ok so where to put it then
Declare your classes and variables in a global context. Initialize them in a method. Or declare and initialize all inside one method.
for the merchant
@ocean lion
In onEnable
public String PREFIX;
then in onEnable after saveDefualtConfig PREFIX=getConfig().getString("global_prefix").replaceAll("&", "§");
Im looking into a plugin api, but im wondering to know how the heck it works, because all the methods throw exception. Looks weird
OHh ok
in intellij you can right click and find which class extends particular class
Thank because i was looking and i was like shit how does that work
but im not sure about eclipse
Eclipe sucks
Thats fking stupid and should be an interface
It's also possible that they do that to hide the internals of their plugin
And the actual plugin has methods that work
that's why interfaces exist
Also the plugin itself its obfuscated only their api its not obfuscated*
Im not trying to steal nothing just trying to find a good example of external api for a design
that's not really good example
Allright, a good example would be with an api with interfaces right?
and the core, having the api integrations right?
you should have an interface which should be implemented
by your code
which gets provided either by static getter
Allright really thanks
And how do i protect people using my methods from the main class?
Like, i just want them to access to api getter
Nothing else
just return an interface
Registered servive provider?
instead of class
yes
that's how bukkit hides their implementation classes (Player interface <- CraftPlayer implementation class, etc.)
Even using private methods, i go another class that uses DI ith main class and do: plugin.getBla() and appear everything
Instead of just public methods
Thank you it works, but the reloadConfig command still doesnt...
Because you save config values to variables
You need to update them when u reload config
Reload only works if you make changes manually.
the GUI is scrollable
so any example about an api?
so List instead of primitive array then?
I would even use a Map<Integer, ItemStack>
why map?
same thing as an arraylist lol
no, because in map you declare the exact postion
you have never used a list?
you're saying you never done this list.get(i)?
There is only a single use for array lists... access by indicies
key - value is different from index - value
if the key is an incremental integer, then just use a list
ur thniking about c++ arrays
if it's a task id or something, use a map
There are multiple types of maps in java
Or dictionaries as programming teachers call them
In java, the most common variant is HashMap
lol really?
I use Map<> bla = new HashMap<>()
Yeah
you're defining it as a hashmap
I really aprreciate
i wonder why #Inventory.all(#ItemStack) returns Map<Integer, ItemStack> instead of List<Map.Entry<Integer, ItemStack>>. Wouldnt a LinkedList better suite for this job?
I use that, but instead of inventory i use Map<Integer, MenuButton>
well depending on what you use it for that might be applicable
probably due to the hashing
maybe because of O(1) .get()
only inventory i ever saved was extra ender chests tho
internally it uses primitive array
what the fuck
A linkedlist is utter garbage.
Pages but not all exist at once
Honestly the list would mostly be empty or null
how would that be better?
inventories are small so linkedlist would be a waste of memory
in memory space
hashmap internal arrays are a waste of space too
not really. I recommend looking up PDC - i stored it in pdc then loaded it into a <uuid, inventory> map while the player was online
?
hash load factor matters
initializes two hundred and point seven five
once a map reaches seventy five percent capacity
if you wanna be that petty just use arrays for everything
those extra 20 clock cycles are really gonna hurt us
Do you have any plugin with an api where i can base on it?
Sorry wron person was for govidas
dovidas*
😛
Hashmaps use loading coefficient to determine array size, and im pretty sure its memory footprint would be bigger
but i bet its because the .get() is O(1)
and linked list is O(n)
yes, that's soooo important when using inventories which can never be bigger than 54 anyway
pretty sure iteration speeds are still the same as it ends up getting converted to an entryset
You should not worry about a few megabytes more or less when using the jvm.
yea but that three bytes more space eaten by a hash map in this day and age really isnt important
that's was just the question, chill
the jvm itself will take those extra mb for fun, no need to specifically call for it
yeah 7smile7, CHILL! DONT SHOUT AT HIM
sets have a slightly slower raw iteration speed that arraylists
Im not complaining i was just thinking
we're talking about linkedlists not arraylists
class overhead and calling getters might end up slightly slower at an assembly level
run JMH and test
Linkedlists are really bad. If you would use a list for this, then it would be an arraylist.
I started to regret that I asked this. I was just curious, that's all.
its the two way pointer thing isnt it
don't worry
you aren't the only one spending hours doing meaningless optimization
yes, the only advantage
this is getting into StackOverflow vibe
people who worry about whether a List<Entry<Integer,ItemStack>> is "better" because it uses 62 bytes less then a HashMap should also put all their code into one class, and call their methods "a", "b" etc. Because proper class names will take up sooooo many bytes too
I've rewritten Math.abs to not use any if statements and just return the value with the flag bit set to 0
¯_(ツ)_/¯
something the jvm probably does by itself
oh right i remember something like that
if you can replace an if with math
its almost always faster
fuck those 62 bytes are really gonna fill my floppy drive
but that's JVM implementation dependant!
javac likely optimizes it
¯_(ツ)_/¯
I remember the times when people on spigot were upset when a plugin was 400kb in size lol
the three element spaghetti code i write cant be optimized further
idc I'm the only person that's ever gonna use it
and they left 1 star reviews because of that
I rate my plugin update prices based on kb size
if it's above 100kb I double the rate lol
yeah totally fair
two times zero is still zero
then I decompile that shit and they shaded commonlangs3 or something
but 0² is 1
:DDdd
Hey, so is there any api good example or not??
but what is 0 ^ 0
he said double not square
ah yes, 3MB of libs
important difference
is there any api good example or not?
Just shade in every single db driver. Boom. 50mb file = 20$ project
those 17MB plugins that have 53kb of actual content
25$/hr
compiled on that pentium 1 just to be sure
42
i once found a plugin on spigot that was around 60mb. they shaded the entire spigot server into it lol
Smile also why shade plugin shade every shit, not only what you told to shade?
classic
but what is 0/0
bleugh
you only ask this question because you didnt properly tell it what to shade
you guys managed to make me think of four dimensional numbers now
I've downloaded more spigot jars bundled in plugins than actual spigot jars
you can download spigot?
i told him with using <relocations> thing. Is it wrong?
i thought you have to build it
yes
that's wrong
you use filters and/or the scope to tell it what to shade
I once uploaded a plugin on an alt that only removed join messages. It was 1.7mb because it contained a txt of the bible and some cat images.
Bstats showed a bit over 100 concurrent installations before it got shut down.
lol
i mean that isnt against the rules isnt it?
I once made a website for my work
stay back satan
I once went to the supermarket and bought butter
took a month before someone sent the history of fishing wikipedia page translated to chinese
idk. But it was taken down after some time 🤷
rip your hard work ;<
is there any library someones made to get the end result of an inventory event? right now the only real ways of doing it is with bukkitrunnables, which can cause a lot of issues and bugs, or manually doing checking the data of the event and and doing things yourself, which can get very long and tedious
cant you just chain all inventory events into the same class
java is the language with too many method parameters anyways
Whats your use case?
just get the result yourself
with some fancy if statements
getting what the items in an inventory after a click event takes place
yea ik, thats what ive been doing usually but i was just wondering if there was a simpler library or something someones made
if it's a shiftleft, oppositeInventory.firstEmpty
unless the oppositeInventory already contains a similar stack
I present you: a simple C++ function i wrote an hour ago. Talking about too many parameters and keywords
looks like normal gui code
you havent seen java yet unless you saw someone overload the same method twelve times
:)
or my shitty minigame code
that's true java
just pulling numbers out of my ass and doing bitshifts
Too many arguments is a code smell anyways. Just bad design.
now write every variant without template
do it in C form
Funny thing is, this template is not there to generify the function but to allow the passing of an multidimensional array of an arbitrary size.
Because that needs to be known on compile time.
reminds me of Map.of
wrong quote
why do I always quote the wrong people
I know why
wait so
because people write a new message at the same time when I click on reply
and then it moves up
idiots made that with copilot most likely
map of has a limit of sixteen?
that's builtin to java
I know but still
*ten
java.util.Map#of
those early copilot builds that would just make a christmas tree
Im using JDK 17, but i cannot do that tho :/
iseven copilot is an abonimation too
I got kicked out of copilot
suggesting stuff like
numberOne
numberTwo
numberOneOne
numberOneTwo
numberTwoOne
numberTwoTwo
numberOneOneOne
...
me too
why not? who prohibited it?
hello darkness my old friend
Why?
Anything but the builder pattern 😱
It helped me so much tho
They are going to do it paid, from august 22
Wtf so i teach it how to work then they make money off me
Its a lot if you dont work it
yeah
It really shity
😂
im not sure how i feel of github making money from the work of other devs bassically
since it learns from github
if I saw this as an example when I started programming i would have quit right away
I achieve part-time hours with copilot
it's more of a therapy type thing
avoids mental breakdowns
one thing that almost made me stop coding was understanding delta time
same lol
Hey guys quick question.
So I want to do the following:
-
when a player dies, I want his body to fall down (like the sleep animation)
-
I would do this with nms right?
-
Basically making an npc with the same skin and name and putting him to bed somehow?
that nonsense is a result of not using kotlin
yes
yes, packets
alright, thanks guys
yeah this calls for DHL or UPS
np
or FedEx
If only kotlin was a bit more mature and standardised...
MyEx
its fun until you realize it breaks even on minor version updates
wait someone send a link for doing that
then you realize that using remapped is a very good idea
could be rewritten as fun mapOf(vararg Pair<K, V> values): Map<K, V> and mapOf("test" to 23, "hello" to 54, "no weay man" to 12);
😏
In this episode of the Spigot MC Plugin series, I start a new plugin called Bodied. This plugin makes it so when a player dies, an NPC is spawned using NMS and is made to lay down and have no nametag. In the next parts of this plugin's development, I will show you how to put items in the body once the player dies, and if no one claims it after a...
There you have sir, have a lovely day
well that's perfect, thank you very much sir
prettys ure
Your welcome
java also has it as varargs
pretty
No, I mean that we have infix functions allowing us to use to in the language for Pair's
I know Java has vararg xd
Having methods with a fixed amount of params is quite a bit faster during runtime.
And after 12 args or so they also use varargs
no more static blocks for me i guess
why do they use:
List<CustomObj> getCustomObjs() {
return new ArrayList<>(this.objects);
}```
Strong encapsulation of fields. Very good practice
Is there a reason?
to not exposing access to the internal list?
how the hell do you have methods with an unknown number of arguments???
^
allr
varargs
you don't
i didnt know
varargs is basically just an implicit array creation
well in truth varargs is just an array
ah ok
isnt that the same as Collections.unmodifiableList(list)?
just in the language, it's unknown the number
varargs in Java are ok
dovidas so do you have a good eample for an api or not? you never anwered me tho :/
wait till you see C varlists
with a "varargs" flag in bytecode
they pretty hit
those dont even have implicit type
or size
you need to specify the type and the size
of var list
?
didn't even know it was flagged
by yourself
in C
what attribute is that in? the field map table?
yes, it has some reason but i dont remember what it was for
oh wait of course I know what the varargs flag is for
it's there so you can pass as many parameters as you want lol instead of having to create an array yourself lmao
so yeah the flag is there to make it work lmao
yes lol
nah that doesn't make sense
so a third weird flag urgh... ? and T was confusing enough lol
Java compiles varargs to creating an array, the bytecode is dealing with arrays directly, no?
I don't think that the JVM implements varargs, that's a bit silly
the bytecode yes, but javac also has to know that the method supports varargs because otherwise you couldnt pass a "list of parameters"
javac can know, because that's part of the Java language
the JVM bytecode spec is abstracted from Java
it couldnt know it without the flag
the hell are you talking about
if you have a dependency that declares a varargs method and the bytecode only sees the array, then how would javac supposed to know that it's avarargs method
maybe I'm explaining it badly
I had thought about that as well but I thought you meant javac with just one source, because then it wouldn't need a flag as it already knows that it is varargs
nah I get you now, just needed you to specify for dependencies
well I guess even with one source it wouldn't know
as the class is turned into bytecode first and then actual Java sourcecode is completely ignored kekw
imagine you have two methods
public void stuff(String... args);
public void stuff2(String[]args);
both have String[] as parameter in their signature. If stuff wouldnt have the varargs flag, then javac wouldn't let you use this
stuff("asd","asd2");
because there is obviously no method called stuff(String,String)
And that's why the varargs flag is needed. That's what I wanted to say
yeah exactly
nope I get you alex
yep okay
you're right
it's considered an access flag by the JVM
oh yeah I tried to find that link but somehow I was too stupid to google it properly lmao
lol, I just went through the document directly
I had gone through this document a few times because I was trying to write a custom JVM language
it's true that it's not very well SEO'd
It also looks like the site was made in the early 90‘s 😄
😏 that's because it was
Yeah lol
Are online players included in Bukkit.getOfflinePlayers();?
yes
it's every player that has ever joined
Dang. I would have expected it to just be people who have joined the server before but aren't on.
yes
if a player is online then it will be an instance of Player
you can use isOnline
Ik.
In conclusion, apis are a set of interfaces and abstract methods right? And the core contains the impl of that api right?
Hello
I need to check if a player is in the air or on a block.
Player#isOnGround is deprecated, and is based off the on-ground flag set by the player.
Is there a way to get the height of a block type without creating a manual mapping? (Since not all blocks are a full block tall)
If anyone has any ideas, feel free to ping me. Thanks!
Block#getBoundingBox
Hello! I am quite stumped as I'm trying to set the block data given a string. I store an entire map in a text file with the block's state as a string (via block.getData().toString()), but now I'm trying to set that data. An example of the text data is this:
{ x: -3.0, y: -3.0, z: -3.0, type: STAINED_CLAY, world: Urban, state: STAINED_CLAY(9) }
{ x: -3.0, y: 1.0, z: -1.0, type: BRICK_STAIRS, world: Urban, state: BRICK_STAIRS(5) facing EAST inverted }
However, the function for setting the data of the block is deprecated and doesn't set the data properly (ex. clay isn't set to the correct color, stairs aren't updated properly, etc.). Is there a better way to do this?
Location newLoc = blockLoc.add(loc);
world.getBlockAt(newLoc).setType(block.getType());
MaterialData data = new MaterialData(block.getType());
for (byte byt : block.getBlockDataAsString().getBytes()) {
data.setData(byt);
}
world.getBlockAt(newLoc).getState().setData(data);
I have a library that does that
It also compresses the data
Would you like to use it?
Sure. I'm using 1.8 however which is why this sort of problem is a bit more difficult since I think 1.13+ is better for this sort of thing
1.13 is better
But my library still works on 1.8
It just loses the ability to rotate block data
Oh awesome. Yea that's fine
Thank you! i'll try it out
Feel free to DM or @ me if you need help
👍
Installation instructions are in the readme
is it possible for me to make a block have a blockphysics event fire
elaborate?
The library uses structures though. Is it possible to just utilize the block data part? I only want to load block data that I store initially. Removing a lot of the code for creating/saving maps would be annoying haha
I made a block array and want all the blocks in the array to run blockphysics event
what do you mean, utilize the block data part?
you want to perform block updates?
ye
I guess you might be able to with block.getState().update(true, true);
Not sure though
I did that and it didnt look like it worked
sorry i worded that question terribly. basically i have all the code for saving a cube of blocks and can load it fine. now i just want to save the block data and load it
If you can already save the cube of blocks then what's the problem?
the blocks have the type correctly, but for example stairs, stained clay, etc. dont store the data since i save everything to a text file.
https://i.imgur.com/M4MNFS8.png
i created a bukkit post with more detail on the issue.
https://bukkit.org/threads/setting-block-data-1-8.496994/
sorry im pretty terrible at explaining things but hopefully that makes sense
you can convert it to a string and back
Any idea why this isnt working? They have values in config, no error in console but does not do anyhting
o okay. thank you.
have registered the event too
MultiBlockStructure.stringify
MultiBlockStructure.create
Those are the methods to convert to a string and load from a string respectively
okay. tysm for the help
Add a print statement
Some debug output
To ensure that your event handler is actually being run
it does print "1" when I join
but the title still wont work
Print out each individual value
The values loaded from config
Make sure they are what you think they are
👌
it does print every value as I've put it
What do you use it for?
Can I see those values?
could i utilize this and pass in a block as the location? ex. MultiBlockStructure.create(block.getLocation(), block.getLocation()
It returns a MultiBlockStructure
Hold onto that return value
I am aware of this, and for my application that would not work. I ended up using Block#getBoundingBox as suggested by Redempt. Thank you though.
fadeIn: 1 stay: 2 fadeout: 1
And you can call .build on it
allowing high configurability, for example defining your own math of some "genspeed" depending on level & other stuff
You do realize that that's ticks, right?
Not seconds
That's gonna fade in for 1/20th of a second
Stay for 1/10th of a second
And fade out for 1/20th of a second
Good shit
yea its also really awesome i can define my own funtions
i love that
and the speed ofc
ok so I changed it to 10, 20, 10 so 0.5s 1s 0.5s. Still prints the values in console and does nothing
...
What about the strings
ah. so i could do String struct = MultiBlockStructure.stringify(block.getLocation(), block.getLocation(), block.getType());, then store that and convert it to a block?
I dunno then
if you're using titles you might be better of using a library. i messed around with titles and its a pain
I don't know what you mean by "convert it to a block"
You can save the string returned by that
Load it later, create the structure from it, and build it somewhere
oh okay. i think i understand now. ty
nah all good I fixed it
what was it?
the world uses some time to load on my pc, so I had to increase the values to ensure that I was there in time to get the actual message
;D
Sorry for asking so many questions. What parameters does MultiBlockStructure#create take? I stored the stringified version of it (1x1x1;STAINED_CLAY:9 for example), and now want to load the data. If I already have the location and block type, how could I create a block at the location specified with the data?
Like I said
You just pass in the string
It returns a MultiBlockStructure object
You hold onto that return value
And then you can call build on it to build the structure at a given location
MultiBlockStructure#create takes two string parameters though. Would it just be 1x1x1 and STAINED_CLAY:9?
no
one is a name
it can be literally anything
it's only there to make comparison easier
you can even set it null if you want
Prevent the PlayerInteractEvent all together when they leftclick blocks
Hm might not work like that
Send bqck the stacktraces
This has been a long standing issue with servers. I doubt there is an easy way to fix it since it depends on the game tick.
The simplest solution is to prevent them from breaking blocks, but I can understand how that wouldn't be a perfect solution.
Yes
What
LOL
U updated in ide but not plugins folder
Happens
Print everything when ur confused
That's what i do
Pretty much solves everything
Are you using an old jdbc driver?
What's your solution though?
Its pretty much the same you do to detect flying players
*Or wall glitching
Well I haven't had a need to check for that yet. Could you give some more details?
I'm assuming Player#isOnGround() isn't enough?
I have a /relore command which takes the item in players hand and relores it! However it is only one long line.. how would I do /relore 1 <lore>
by. only editing the lore of the index the player passes in?
Several ways of doing this.
- create a param
/relore 2 This should be the second line - Split the text
/relore This is the first##And this is the seconds line##And the third
woulnt \n actually work?
You will have to at some point.
He would still have to split the text at '\n'
I dont think the components of minecraft support newline chars
Cuz it's much better than conventional artifact building
Because if you want to use other dependencies then maven will save you huge amount of time and headaches.
unless ur name is 2hex aperantly 
😂
Don't think he sorted that as yet
I'd have already reintalled intellij
rumor goes his resources still dont get included
oh my pc would be outside
So I'm in a situation where I need to remove final on a field, however, for some reason java 17, the "Field" class seems to have 0 fields, which includes the one that needs to be changed to remove final. On java 8 however, all the fields are still there. Tested this on a brand new project and got this as well:
getDeclaredFields
using that
show code
field.setAccessible(true);
done
:p
i cant right now since its someone else working with me and they went afk a few minutes ago lol
thats the solution
no
what you sent above
says you're tying to assign "java.lang.Reflect" to that field
so one of your variables are mixed up or you're passing the wrong one
ok lmao i think they might have just used the wrong parameter
ill check once theyre back
still confused as to why the field class doesnt have any fields on it at runtime but doesnt really matter
its purely intrinsic
probably
java weird
no ur weird
is there a way to get the entity that hit a entity, but didnt use there fist
as EntityDamageByEntityEvent i can use getDamager but that only does fist
so what else will they use?
How can I change item durability, I don't want to add more than the max, I want to set it to 50% and 100%???
can someone convert that lambda to a java 7 level
i dont understand what's going on there
return new Consumer<>() {
@Override
public void accept(T value) {
this.accept(value);
after.accept(value);
}
};```
Basically returns a new Consumer that calls this consumer and the consumer that was passed as an argument
that's what i thought but this refers to the scope ourside of the consume that is being returned?
final This instance = this;
/*lambda
PlayerConfig.getPlayerFileConfiguration(player).set("Deaths", PlayerConfig.getPlayerFileConfiguration(player).getInt("Deaths") + 1);
PlayerConfig.savePlayerDataFile(player);
``` Anyone know why player deaths wont increase?
holy static abuse
:( dont talk about it
god no
I am going to fix all the code up after it works
you dont even have public or private or any other modifier on your global VARIABLES
YES IT IS
okay it really wont change anything but like