#help-development
1 messages Β· Page 1951 of 1
1.8 :(
well it's not about mc 1.8, it's about using java15+
no instance fields in records allowed hmm i already starting to hate it π
LOL
code gone lol
public record Pair<A, B>(A a, B b) {}
vs
public class Pair<A, B> {
private final A a;
private final B b;
public Pair(A a, B b) {
this.a = a;
this.b = b;
}
public A getA() {
return this.a;
}
public B getB() {
return this.b;
}
}
i could place all thos classes in one file lol
Utils.Pair<String, Object> = new Utils.Pair("Hello", randomObject);
how would i string manipulate it so that i can use the string in PotionEffectType.(mystring)
so it would add the effect frm the config
lol ye π€£
ur on here all the time lol
im everywhere
erm ofc it has instance fields
in your case, k and v
use PotionEffectType.getByName() or even better use namespaced keys instead
i mean yo cant have fields which arent included in the constructor
that way you could use minecraft's potion names
String.valueOf(arr[0]) meh
doesnt this method use spigot named potion effects for checking
if you use getByKey() you can specify potion effects how mojang intended to.
Mmm guess not
is there anything that uses the ingame names
it has namespaces included
ohk
this should work right
it should
I mean, just write a new record got specific use case
More readable
and you dont need annotations
for example to flag that this value returned is not null
since IDE would know that the field is immutable
great for multithreaded tasks
although this is just syntactic sugar
lambda is language sugar
lambdas are salt
and pattern matching is pepper
records are thyme
throw that all together and you have a tasty baba ganoush called java
π₯²
unfortunately you cant do this
and cant add it to method signature because its overridden
because of throws IOException
i cant add throws because the method is overridden from its superclass
use SneakyThrows if you really have to throw it
or wrap it inside your own exception that extends RuntimeException
lemme just add it to the method signature of the base class π₯²
yeah that's what I said π
you can always throw RuntimeExceptions
(in theory you can always always throw any throwable without declaring it)
smh
yeah what did you expect
of course now you have to wrap all calls into try/catch
isn't it the default windows 11 taskbar?
its huge af
im wrapping them in a try catch by default
that's modified windows 10 taskbar
and this things says its always false, why?
is SQLException your own class?
wait you dont need to try/catch or throws ... if its a runtime exception?
exactly
that's why you don't need try/catch for stuff like Integer.parseInt
why did i not know that
no
or ArrayIndexOutOfBoundException
i thought they were hard coded into the compiler
Or NPE
is it a runtimeexception?
to not have to be try/caught
that's an error
show Core line 28
this.getCommand("minecoins").setExecutor(new minecoins());
you didnt register minecoins as command in plugin.yml
np
well
the checked ones
Any class that derives RuntimeException, either explicitly or implicitly can be thrown arbitrarily in principle
anything that extends RuntimeException you dont have to declare or catch
you gotta declare or catch everything else
Yes, sneaky throws is a thing if you wanna throw non-derivatives of RuntimeException, but you should really dissuade yourself from a sneaky throw
stupid sql exception lol
Yeah, well checked exceptions are a bit meh
or just print stack trace and return if that's applicable to your context
but they do enforce you to handle exceptional cases, which is good
im trying to handle exception in wrapper
mhm
why tho
Because it makes checked exceptions just as unpredictable as unchecked ones
and then im doing something like this but i dont want to do a try catch in the method itself
where the createKingdom method can throw an sql exception
Usually, you just javadoc the unchecked exceptions, whilst you should declare throws for any checked exception, at least that's what is usually the case. I would be very annoyed if a random checked exception yields from a method that does not tell me anything about it, especially if its an exception such as IOException.
In some contexts you just cannot take an advantage of checked exceptions
make ::makeFuture take a supplier/runnable that throws Exception perhaps?
I think rethrowing exceptions would be better rather than whining in logger or printing stack trace
such as?
Any form to get when a projectile "hit" water? i wanna cancel the bouncing arrow in water.. and dont wanna use a runable for track all the travel of the arrow for this... (because many arrows)
Well, it would be caught somewhere higher up or kill the program usually anyways
so the stacktrace, will most likely be printed regardless
When you implement some interface, for examples
ye i want to catch the exceptions of that runnable or supplier
Well, then you're technically breaking the contract of the interface
?paste
ERROR = https://paste.md-5.net/ulerilaber.sql
CODE = https://pastebin.com/GercCJm4 (Sorry md5 wouldnt work)
anyone know how to fix
or you could just have the interface throws Exception, or sth, or perhaps make it a RuntimeException.
INSERT IGNORE INFO? not sure but maybe is INTO and not INFO?
if i add throws SQLException if my NewStorage, i would need to add a try/catch in every method of the DelegatingStorage instead of handling it in the makeFuture method
https://paste.helpch.at/totitebatu.java
lmfao this is what i get for coding at 3 am last night
ty
idk if arrows have air/ is drownable, if thats the case EntityAirChangeEvent perhaps?
so rn im just throwing a runtime ex
hmm can try this... i hope arrows breathe xd
I'm having some trouble getting NMS to work for 1.181 (Dependency 'org.spigotmc
1.18-R0.1-SNAPSHOT' not found ) even after adding the plugin in and running package ._.
Did you run buildtools
Yes
yeah i use ProjectileHitEvent but not work with water... only when player touch the arrow and they put many arrows in one block of water then boom many trrigers xd
EntityChangeBlockEvent?
nvm EntityChangeBlockEvent is for sth else
hmm, I mean worst case you might just have to stick with a timer, im kinda baffled that there aren't any events for this
:C yeah... EntityAirChangeEvent not trigger with this...
if not can see in NMS and try a PR but dont wanna xd
ok?
saves so much time
just rainbow brackets?
yes
interesting, maybe I should give it a try then
it colors your brackets differently to distinguish scopes
yeye 
I never had problems with brackets
Even on netbeans with 0 programming skills
π
mega chad
so i made a custom tool, and i want to make a custom efficiency for it, i thought about changing the block hardness with protocol lib break animation packet and efficiency, haste but idk, any other idea?
Does anyone know if it is possible to add fake players to teams? Currently trying to organize my tablist with fake players and teams.
You cant at all
Yes, there's a method that takes strings
spigotmc.org is down ...
A method... where? In Team? That wouldn't be possible given that my fake players are client side
Why
there are Registries inside NMS
The server doesn't know about the entity
Have yohu tried? Pretty sure team just keeps those strings and everything is handled clientside
client will probably just crash
you can extend the existing class
that way the item type wouldnt change
only the server sided things could be changed
just that the Bukkit API wouldnt recognise that as an item
Thats pointless imo
And im pretty sure will crash
how to disable plugin?
plugmanX (DONT USE THIS IN MAIN SERVER)
Bukkit.getPluginManager().disablePlugin(Plugin);
This is so annoying -_- how do I get CraftBukkit to work?
Literally have the local CraftBukkit folder, but the dependency just won't resolve
how does this looks?
https://paste.helpch.at/exeyiceguz.java
does enhanced for loop uses iterator to iterate primitive arrays
lol
what do you guys return
empty collection
or null
i prefer empty collection impl whenever i need to return multiple values
since its more flexible
where possbile empty collections
works but on the client the item its just not there, null item slot in the inventory
Can I use json for configs or do I have to use yml?
π€
i can send photo if you want
any one can send some page link
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
Hey, I have a custom mob system that applies a health bar and level to my mobs, but because of this nbt they dont despawn or count to the mob cap, is there anyway i can override this feature?
MiniMappingViewer
I am looking what is PlayerTeam called in 1.16
empty
ddl
so you can iterate
i have mcpets download link from https://plugins.multicraft.org/api/v1/spigot/download/mcpets.jar?id=437300 normaly its ojly used from servers for direckt download
nop
InventoryOpenEvent may only be triggered synchronously. Help?
not sure then
but what i would do
is to open intellij
and go to Scoreboard packet class
there's usually PacketDataSerializer method there
by getting that method you can see what its used in there
ok thanks
What was the forumula for the offline mode UUID again?
UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)
thanks
Hi guys how can i play the dragon defeat rays at an entity? If it is possible
it very much depends on the contract of the method
if the method always return immutable objects, then stick with the empty coll
if its mutable tho, I'd yield null
imo
thx
Yes, always avoid null pointers
Can anyone play minigame for test in my server?
I'm trying to make a video but can not play with alone..
(It takes for a few minutes)
got big problemsssss
uh
spigot is down
any one knows what to put here
data.set(new DataWatcherObject<>(17, DataWatcherSerializer.), (byte)( 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40));
so DataWatcherSerializer.
I am not sure how method works
and can't google it of spigot page
in 1.17.1 is just EntityDataSerializers.BYTE
nms moment
why isnt this working? create table is normal sql
Isn't "if not exists" a mysql thing?
even without
Try with MySql; it should work
Is this java error?
its the intellij sql verifier or something
Honestly it might be yelling at you because of the semi-colon, yeah
nope
That's literally the only thing that would be weird about that, and even a semi-colon is a statement terminator so idk why it would yell at you lol
it doesnt recognize table or something
tbf, \users`` is weird
wow, can't escape in there
'users'
but I guess that's a matter of preference
Unless IJ is super picky about "NO! NO BACK TICKS!"
https://paste.md-5.net/aqajoheyey.bash
anyone know a fix?
if you need my code i can send
Yeah but in SQL you can use backticks
cant find table i guess
Really? o.O Does IJ actually do that?
but I also don't know why it would tell you that it can't find the table when you're writing a CREATE TABLE statement

IJ's high as fuck
imma leave the annotation behind i guess π₯²
Testing it now, it doesn't seem to work. However, I am using an empty string for the fake player's name and I'm using its UUID to add it to the scoreboard team as an entry. I need an empty string for the name to not appear in chat when a player tab completes
You cant use uuids in teams for players especially
Names only
Hmm... and other entities wouldn't appear in the playerlist
what is a sequence in mysql?
hmm no its not a table
i was thinking it was create sequence instead of create table cause t gave no errors
oh works with this language
@Language("MYSQL-PSQL")```
what plugin is that
I don't think it's a plugin
I'm pretty sure @Language comes from JetBrains Annotations
https://paste.md-5.net/aqajoheyey.bash anyone know the issue here?
ye
org.intellij.lang.annotations.Language @glossy venture
minecoins.java:41 nullpointer
Ayy! Lewi :D
wassup man
oh how do i include intellij into my project
p.sendMessage(ChatColor.AQUA + target.getName() + ChatColor.GRAY + " has " + ChatColor.AQUA + "" + ChatColor.BOLD + minecoins + ChatColor.GRAY + " minecoins"); this is my like 41 im confussed lol
wasnt it in buildtools or something?
That also contains @Nullable, @NotNull, @MagicConstant, and other fun goodies.
it had it when i added the spigot dependency in some 1.16 version
could be something else too
is p null?
what is @MagicConstant? π
(Btw @MagicConstant is used by IDEA for autocompletion - It shows you constants that are intended for a parameter)
Oh and Kotlin actually uses the nullable/not-null annotations
nah p is
Player p = (Player) sender;
Its compiler can infer nullability from them in non-Kotlin projects
but it also compiles with said annotations
Hm you should still be able to cast null
Yeah but instanceof also supposedly performs null-checking
is he using instanceof π
So null isn't an instanceof String, but it can still be cast to String
null in Java has some of the weirdest fuckin' semantics
I imagine it only works this way because of how null pointers work in low-level langs like C and C++
(e.g. you can cast a null pointer since it contains 0 information anyway - but good luck trying to use it)
ERROR = https://paste.md-5.net/aqajoheyey.bash
minecoins.java = https://paste.md-5.net/emifewiqak.java
command ran = /mc <player name>
wew can use var now on java 16
Yeah that's been a thing since Java 12 iirc
excited
using var is such a mess O.o why should i use var when i could use Object already (and thats messy too) `?
Because Object and var have different semantics
Object constrains the type of the value
var is like const in js but without the final
When you make a variable an Object, you have to cast to the proper type to use its members.
it needs direct initialisation right
MEANWHILE
var matches the type of the right-hand of the variable.
e.g.
var s = ""
is not Object s, it's String s
That is type inference.
Anyway it exists because people don't like typing long class names twice
e.g.
MySuperLongClassName n = new MySuperLongClassName();
Like, you can reasonably understand the type of that variable, right?
It doesn't need to be repeated for ceremony.
var a = 1; var b = a;
var n = new MySuperLongClassName();
Oh yeah btw it solves the issue of uhh
Always declaring interface types on the left
Which is primarily if you-
okay then
π³
Which is primarily if you switch out the types on the right
I wish Java just had a val tho :p
final var is still pretty gross
const is short, but is easy to different from var, so +++++++++++++++
Meh I like val more
it's easy to misinterpret it as var and vice versa
I disagree
I've been coding in Kotlin for a long time
I have never once misread it as var
i call my variables val all the time
so that would be a certified bruh moment
no shit
In the land of the JVM, there is no such thing as a restricted identifier.
yeah because variable names dont exist at runtime
or do they
idk
i dont think so
they're replaced with var1 var2 and so on
oh
They're not replaced with var1
when you decompile them
if you decompile
but it depends on the decompiler
yeah
But variables are essentially just instructions
do argument name exist?
You have stack variables and local variables (essentially registers)
the same name as the type
Also no
You must compile with -parameters to keep parameter names.
but when i use reflection and retrive them they're repleced with arg1 arg2, why?
Because that's what the reflection lib will return in place of them
You can check with Parameter::isNamePresent()
Anyway, back to tax brackets, these types of values don't have names.
They are just represented as values that are used in operations.
You have a string, that's just an LDC (load constant) instruction
LDC will push a constant value to the stack (e.g. a class literal like String.class or a string "")
And then further instructions will use the values on the stack
You also have the ILOAD, FLOAD, ALOAD, ISTORE, etc. instructions
Which will store values into locals
Which also don't have names and are differentiated by index
e.g. ILOAD_0 will store the value at the topmost stack index at the local index 0
Sorry no
I meant ISTORE_0
ILOAD_0 retrieves that value from local index 0, and pushes it to the top of the stack.
wtf is internal in itemstack tostring?
idk lol
But yeah there are some ways to keep local variable names and type information
There's the method attributes LocalVariableTable and LocalVariableTypeTable
Uhh it looks like Base64
It's probably used to store like
properties and shit
Bc if you notice, it's actually part of the ItemMeta
how can i get rid of that shit?
idfk lol
How are you comparing them?
stack.equals(single(event.getCurrentItem()))
single just clones the item stack and set's the amount to 1
can nbt be the reason?
Possibly
via nms not pdc?
I don't know enough about stack comparisons :/ sorry
have you tried the simple test? stack.isSimilar(event.getCurrentItem())
I'm using ShockByte as server host and it has built in "startup" paremeters, but what if I wanted to add my own.
java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar paperclip.jar nogui
a record generates hashcode and equals method too right?
Unless you can edit them, that is
Okay
(You should also be in #help-server, rather than development)
yes, toString as well
the change...
https://paste.helpch.at/penurinapi.java
my file became just one line...
(if you'd use lobmok you file could be 6 lines even without record, just note)
right
i could put all my records in one class lol
new Utils.Home()
it sucks ye but having 20 files with one line..
just put them in package, close and forget for life
already saw people doin this
hi, how i can send arraylist in player#sendMessage()?
iterate over the list and send every string
assuming its a string list
list.forEach(player::sendMessage) fancy kekw
thanks!
i hope that helped yo
player.sendMessage(String.join("\n", list))
mine
player.sendMessage(list.toArray(String[]::new));
still part of an "Object" class, which all class extend, so yes. Like usual, you can override them as well.
That's... sending less packets..
i wanna know what the default impl of equals and ahshcode is
hashcode
ohh of the record?
ye
why would you need to know what anyway?
because implementing hashCode and equals is necessary?
i believe the equals just compares if the object is that class, then it just compares all the fields in it
The default implementation of hashCode()
The record will use the hash code of all attributes inside the record
The default implementation equals()
The record will use all attributes to decide if tow records are equals or not
https://stackoverflow.com/questions/61719589/do-you-need-to-override-hashcode-and-equals-for-records
alr
hey, how do you get the 1.18.1 remapped spigot jar? Buildtools just gives me the bootstrap thing, am I missing something obvious?
--remapped flag on buildtools AFAIK
yeah, that just gave me the bootstrap files in a jar though
well, no clue then
it is installed in your local maven repo
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
why d fuk
yes, thank you, I did that. It's not the remapped jar, and it doesn't work with any NMS functions as far as I could tell
private int type;
public Pet(String name, int type) {
this.name = name;
this.type = type;
}
public String getName(Pet pet) {
return pet.name;
}```
run buildtools with the --remapped switch
?1.18
You can build 1.18.1 using BuildTools https://www.spigotmc.org/wiki/buildtools/
java -jar BuildTools.jar --rev 1.18.1
yes @eternal oxide
saw that lol
try this?
nah
why did u delete that lmao
because it didn't answer the question
exactly
yeah it returns null
why not creating a normal getter?
whats not normal about that getter
that is takes another pet as parameter
either make it static or make a normal getter
yes, but if you use a function to get a field from an argument, it's not a getter
python moment
im wondering what he is doing
I create a pet object
what
I am trying to get its name
yes
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
do you know how classes look like in python
public String getName() {
return name
}```
return this.name;
}
lol
that's a getter
this isn't a python forum if I am not mistaken
Stop spamming then
Stop playing a moderator
stop telling me what to do
Seriosly? I just wanted to say he did the classes simillar how it's done in python..
Woo another #help-development shitshow.
going from making mc plugins trying to follow best code practices to trying to do unity with best code practices feels like I'm suddenly committing some sort of war crime
Exactly how I feel when I try to get away from Java
like wtf is [SerializeField] private int People { get; set; } = 0; even
Going from c++ to java feels like constantly committing warcrimes to be honest
that field is private in one way but public in two ways
it's also sort of static but not really
and a singleton but not really
and thus the race begins, can I make a game before unity gives me an aneurysm
oh of course a public field with a getter is actually private...
anyone know how to get my main file's options from another file?
huh?
how can i access things from another file
oh
either use the public modifier and get it from an instance of that class, or, if applicable, use a static modifier
can you translate to an existing language?
learn java
I'm with Gepron1x here
I suggest you look up a youtube tutorial for basic java
not that I don't want to help, but they will explain it much better than I ever could
its a property but i dunno where there is a = 0
i just did this and worked xd
private property wait
i see
i just extended my main file xd
[Annotation] accessmod type propertyname {properties} = value;
is = value the init value?
Yes its the initial value of that property
why a private property tho? for the serialisation?
Convention
No idea... Dont think a private property makes much sense unless you have to follow some sort of convention where fields are always to be replaced by properties.
weird π€‘
if i wanted to grab someones rank (prefix) through vault, would i use their chat module or permissions module
sorry
permissions duhh
brain fart
xd
Global warming is causing earth to be 2 degrees hotter than you, baby girl. Sorry
yus
.
using luckperms?
yes
ah i used the luckperms api
hm alr
anyone know why is the problem?
err:
https://srcb.in/HqEYRmyhJ3
this is my main file:
https://srcb.in/zY9DQNYVwG
this is my plugin.yml:
https://srcb.in/nOfdPIfHKC
my back command:
https://srcb.in/SMqq2OQPnE
the plugin doesn't start
what error does it throw
its in my message
err:
isnt it already started?
yessir
have you tried stropping and starting your server again?
my plugins folder only includes my plugin's jar and plugin metrics
Im planning to make a library for spigot, it will contains many features. For example Chat, File, etc would do you recommend me to do it as multi module project?
Library - Main project
-> Chat - Chat related things
-> File - File related things
-> Api - Each module shaded inside
there is the same err
maybe try changing the plugin name?
How do I check if the player has the server's resource pack or not?
What error or problem having?
.
Why use that pages? its better to use
?paste
The command for getting the paste md5 link
?paste
If you wanna send code i recommend using that link
epic fail
Shhhh
Im wrong or the bot sometimes doesnt work or have delay?
i always used srcbin
might be your internet connection π€·
Try to use paste md5 its better cuz its have syntax format
So what your opinion?
wait is modules a java16 thing?
ooh
Yeah you know. I wanna be like you when i get older
I really like your kidness and you know a lot
My kindness?
Yeah, how kind you are
I beg to differ :p

it was just me messing around, turns out the editor can't handle properties anyways which is actually a massive pain in the ass
oh rip
is something like this possible?
record SomeRecord(UUID id, int playtime, long lastUpdate) {
public SomeRecord(UUID id) { this(id, 0, 0L) }
}```
doesnt seem to work but maybe there is another way
nah i dont think so
static methods tho
I need to figure out what records are
Immutable data carriers
always those difficult words 
what will happen if i damage a player with a negative amount like player.damage(-5)? will it throw exception. don't do anything or heal player with 5?
afaik it is possible, it don't compile?
try and see
it doesnt compile
well according to this https://www.baeldung.com/java-record-keyword
hmm
What compile error are you getting
Because that looks valid off the top of my head
that's perfectly valid
wait when i havent written this() call yet it showed an error and now its gone
yeah, you are forced to call this() inside custom constructor
right.. record fields are final..
Yup
having alot of oneliners now
becuase immutability is a good tone
new Utils.MyRecord() kekw
You dont. Editing an already compiled jar is really difficulty and will not work in many cases.
honestly it looks just awful Utils.MyRecord
decompiling it will not restore any variable names either so the code would be rather hard to read anyway
i know
I mean youβll get class level variable names and method parameters/names, just not local variables
i just added a whole new feature to my plugin and it worked first try
again
second time this has happened this weekend
im blessed
4 tables maybe
recaf go brr
Not 4 databases lol, Iβd imagine itβs just tables or collections within one database?
Otherwise you may be doing something wrong
I made my own command but if i dont use argument 1 it will say java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 in console. how do i check if its null so it wont throw the error
thanks
Java is 0 indexed
huh
?paste your code
the first element of a list, array, etc starts with index 0
no
check the length, so if (args.length > 1) {}
Why do you have 4 databases?
Unresolved reference: length
kotlin i guess
size
well, trace ones are just error logs
whats the easiest way to count the amount of capitals in a string?
You mean of capital letters?
You should always take a look at the ASCII table first
hm
thought it would be easier than just looping through each char
they have this in kotlin val uppercase = message.content().count(Char::isUpperCase)
A is 65 DEC and Z is 90 DEC
So you go over each char c and check if c >= 65 && c <= 90
public long countUpperCaseLetter(String str) {
return str.chars().filter(c -> c >= 65 && c <= 90).count();
}
public long countUpperCaseLetter(String str) {
return str.chars().filter(Character::isUpperCase).count();
}
count() seems to be returning a long
If you are certain that there is no edge case with more than 2.1 billion upper case letters then you are free to just cast to an int.
a string with more than 2.1 billion characters isnt even allowed
the jvm prevents arrays of MAX_INT or longer i think
^
count is essentially a long mapper (so you could use the mapToInt instead) and then it uses a reduce operation
create a class which derives Event
well
?event-api
?event
hmm
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
cheers
:p
its just a class which stores the listeners
is ignoreCancelled used in the sense that you only want your event to be run if other plugins/classes haven't cancelled it already?
mhm
Is there a way to set data to a placed block?
elaborate
If its a TileState block then its quite easy. Otherwise its quite hard.
Sorry I donβt know what do you mean, whatβs a TileState?
Furnace, Hopper, Dispenser etc
No
Unless its a TileState
?eventapi
Conclure ^
Many have build APIs for that. Redempt for example also has one that stores the data in a sqlite db
I wrote one with MongoDB and one that use the PDC of the chunk containing the Block.
val playeruid = Bukkit.getPlayer(args[1]).getUniqueId()
'getPlayer(String!): Player!' is deprecated. Deprecated in Java
This is depreciated in java, i want to use string name to player's uuid
Thanks
check the javadocs
Actually it checks the version
If it's 1.14+, it uses PDC
Oooh I found it https://github.com/JEFF-Media-GbR/CustomBlockData
Lets see. Ive read some abysmal implementations for that problem.
you could have just asked alex lol
π
its one class .... how
Itβs not deprecated in latest, which version are you using?
think efficient
Ask to @tender shard
oh its just a PDC
Hm. The data could be structured a bit more efficiently but this looks alright to me.
wdym?
You can use the relative x, y and z coordinate of a Block within a chunk
final int relX = (block.getX() % 16 + 16) % 16;
final int relZ = (block.getZ() % 16 + 16) % 16;
final int relY = block.getY();
return (relY & 0xFFFF) | ((relX & 0xFF) << 16) | ((relZ & 0xFF) << 24);
I am using the relative coordinates
I also didn't see a reason to turn the coordinates into a single number since namespacedkeys use strings anyway
Ah nice
it's just this
/**
* Gets a String-based NamespacedKey that consists of the block's relative coordinates within its chunk
*
* @param block block
* @return NamespacedKey consisting of the block's relative coordinates within its chunk
*/
@NotNull
private static String getOldKey(@NotNull final Block block) {
final int x = block.getX() & 0x000F;
final int y = block.getY();
final int z = block.getZ() & 0x000F;
return String.format("x%dy%dz%d", x, y, z);
}
yeah could be done a bit more efficient but that would break existing plugins. e.g. oraxen is using it since months
they wouldn't like it being changed now
Bukkit.getPluginManager().registerEvents
?eventapi
Implements Listener, in the main class on OnEnable. Bukkit.getPluginManager().registerEvents(this, new ClassName());
Im doing an multi module project on maven. I wonder some recommendations about doing the api.
Api-Module
File-Module - Require Api-Module
How would need to be the api, for accessing the getPlugin() method from my api interface
mhh, .format for that?
what would you use? concat? stringbuilder?
Np
Thats what i wanted to tell you earlier. A multi module project wouldnt make much sense if you have a lot of cross dependencies
stringbuilder probably. format is kinda expensive
alrighty
Doesnt it use a StringBuilder internally?
1.8.8
I have read that libraries should be modularizable. Like dont need to import all library, for using only the FileHandler understand?
Format is very powerful
elaborate please
even if String.format uses a stringbuilder, it still has to parse the format string
Iβd probably just ignore the warning then
Itβs deprecated as a warning, it doesnβt break anything
A Formatter which uses a BufferedWriter. Looks like it actually creates quite a bit of objects internally.
I bet this is the fastest π
return "x" + x + "y" + y + "z" + z;
- Dont use versions this old
- It deprecated because you should never refer to a player using his name. Only by his UUID.
Has anyone found a way to disable dolphin despawning? Giving them the persistence required tag does not work
This concatenation will just be compiled to a StringBuilder iirc
well anyone feel free to PR if anyone doesn't like String.format π
why is there no "x" * 5 in java π₯Ί
You are missing an argument
learn the api
look at the docs
learn java
?eventapi
?jd-s
yeah so just check the docs, it tells you what parameters a method expects
or just hover over the error, it prob tells you exactly what you need to do
in this case, a plugin and a listener
I believe there should be a more efficient way of storing block data in chunk pdc
not requiring you to use strings
Its for the namespacedkey
PDC always uses namespacedkeys which in turn use strings
ikr
String.valueOf((relY & 0xFFFF) | ((relX & 0xFF) << 16) | ((relZ & 0xFF) << 24));
;D
NamespacedKeys werent meant to hold any sort of information - thats jusr an identifier
as said, that breaks existing data
Is there any good tutorial that talks about practices when designing Jar apis with examples??
fkem
also it might break if some time we can build up to Integer.MAX_VALUE height π
even right now we have more than 256 height
"guys look at my skybase"
I'd love it π
thats gonna be way too laggy
And a Short2ObjectMap<PersistentDataContianer>
it was ajoke. I just wanted to say, bitmasks will break if the max height will change sometime
so I didnt use them
lol imagine they do that tho
It uses 16 bits for the height. Should be plenty. 65k
best way to destroy game
there's probably some 1.8 mod that allows it lol
what about negative height?
fine. Add a sign bit and be happy with +/- 32k
Whats the world max height now?
yeah I could have done that, true, but I don't wanna break oraxen now π
and as said, it uses strings anyway, so doesn't really matter imho
I think the theoretical limit that can be stored in the new chunk format is 2k
I think it's -64 to 384 or sth
but
individual worlds can have individual worldheights
so check WorldInfo#getMinHeight and WorldInfo#getMaxHeight
196 kb per chunk tho
send pic
send pussy pic
I can send some cock picks next time I visit my chickens
thats a cute couch
he is nearly sleeping
and a weird pillow
cute cat
Anyone?
ye π₯²
jar apis?
what
gnoogle
he was sitting on my keyboard first and now hes there π₯²
it would be way funnier if google would be called gnoogle
GNOODLE
googel
gnoodle sounds like gradle lol
gnoogel
Yeah, like a jar that act as an api.
goodle
gnoogel it
dont make an extra jar for it
no no, just gnoogel it
snorkel
bong it
I would be inside the application jar
Usually you'd combine impl and api
actually that could be bad lmao
i dont understand bongs. everytime i take a sip of it at a party everyone is looking weird at me
I have read the api class should be an Interface
I still love we have this command
You'd probably only need the Classloader
?bing
Bing your question before asking it:
https://www.bing.com/
wtf
lmao
API classes can be anything, it depends on what the API is
but fr why didnt they name bing "bong"
JUST BONG'IN IT
If API and impl is strictly the same, no need for useless abstraction, it is isn't then interfaces can be good but needn't be
hah and his little dark net brother bang
JUST BANG'IN IT
Please stop countinuing that unfunny joke
what the fuck
Please can you send a jar api example with api provider and consumer?
Spigot
if I recall I asked for that command lol
Maven project content hiding
ecosia
Not really minecraft-specific but https://github.com/Starloader-project/Starloader-API/tree/master/src/main/java/de/geolykt/starloader is probably one of the more extreme examples that isn't cb/bukkit
Allright thanks
Is it possible to make Emotes in minecraft using like ArmorStands? If yes, how can I interpolate between two different poses?
While the API package mostly contains interfaces, it also contains classes (mostly to hold the values of the interfaces, similar the Bukkit class in Bukkit) and the same applies to the impl package which contains a few interfaces (while still having mostly classes)
But it really depends on what you want to achieve
It is always good to separate contract from implementation
i mean, sure it is. but what would you want to interpolate
Sometimes it is just unnecessary
I have a done module called Api which is need on File module. In my api package i have 2 class Api (interface) and api provider the implementation
See fabric and forge, they don't have anything remotely similar to bukkit
Sorry for my bad English, I want to make an animation from pose A to pose B in a certain time
