#help-development
1 messages · Page 1918 of 1
the code I sent is part from my NMS library. In my "normal" code I can now just do stuff like this:
Object fakeEntity = createFakeEntity(EntityType.CREEPER);
showEntityToPlayer(fakeEntity,player);
@young knoll
otherwise i'd have to import net.minecraft....Entity
and that would make my NMS library unncessary
I guess
A long time ago then
2nd post
hm, actually J8 uses char[]
check out my blog post:
Strings are built on top of char array, but are not the same
Chekx out compact strings
I always though string was just a fancy char[] wrapper
not really, a few hours ago I looked at the String class of JDK8
it's complicated but it's not just a fancy char[] wrapper
isnt it?
Unicode and Charsets are one of the reasons it isn't a simple wrapper
on modern versions of java (Java 9+) that is
oh right, I accidently opened java 17
TIL @stable is a thing
TIL?
yes in 1.8 it's indeed a char[]
anyway a String is way more than just a wrapper
I always love the til til moments
Today I learned
byte[] is used for compact strings - sometimes, you dont need 2 bytes for a char
what did we learn today?
That the people developing java aren’t stupid
To be honest it would be so much nicer if string would be an interface
why?
to allow mutliple implementations and avoid horriby stupid stuff like this:
https://i.imgur.com/eRnMvqw.png
instead, we would just have UTF16String and Latin1String
Problem:
String is a ctpool type
Or a constable type
The JVM automatically converts constant pool entries of type String to an instance of String
Which is how ldc "string constant here" works
That gets much harder when you add interfaces
Big fancy words
Nope, just stating it as it is
So yeah the problem boils down to all strings automatically being UTF-8 by default
And the fact that the JVM classfile spec can't really handle inheritance in the constant pool
e.g. how does the compiler know what format you mean by "Hello, World!"?
(❀˘꒳˘)♡(˘꒳˘❀)
oh I have an awesome idea
allatori lets you define custom names for obfuscated field, method and class names
I'll just create a file full of those uwu utf8 emojis
decompiled classes will look like this
if((❀˘꒳˘)♡(˘꒳˘❀).( ͡o ꒳ ͡o ).equals(( ˶˘ ³˘(ᵕ꒳ᵕ)*₊˚♡)) ⋆⛧*﹤ಇ( ᵕ꒳ᵕ)ಇ﹥*⛧⋆();
I’m sure spigot would love that
yeah haha I'll try it tomorrow
Depends on what Spigot does that would make it not love it
well iirc it's allowed
I think using this is allowed for premium resources, right?
i think so too
Iirc it has to be readable when decompiled
currently I use keywords for fields and methods
e.g.
if(if.else().equals(done)) { for(); }
Java is beautiful
😂

Obfuscation / DRM
You are allowed to obfuscate your resources, however the decompiled code must be somewhat legible by staff.
noone has complained yet 😄
optic mocked me already for my obfuscation twice
so I guess it's fine as it is right now
I mean, it is rather straightfoward to rename all unreadable names
I just switched from the jar library to maven and noticed this, i already asked this question and then found a solution for myself, but this one didn't work in my other project, which is weird.
Do i have to use ChatColor.COLOR instead of §?
I heard that you should do that but i never changed my old code
(once for a free plugin though, I forgot that string encryption wasn't allowed in free plugins)
I used <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
or
<encoding>UTF-8</encoding>
are your source files in UTF8 too?
if your sources are in some weird CP12345 format it will probably break
How do i check if they are?
I don't even see that
I guess it has to be enabled manually -> https://www.jetbrains.com/help/idea/encoding.html#single-file
oh
Sounds like Gradle
Yeah but that ones default
hi all
i have a question
how do i onEnable launch a cmd on server? thorugh console when plugin starts
like gamerule
thank you ❤️
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule")
idk if there has to be a slash before the gamerule
thank you
Whenever I execute this (its part of command) i get internal error occured while attempting to perform this command
World world = p.getWorld();
ItemStack bow = new ItemStack(Material.BOW, 1);
ItemMeta bowmeta = bow.getItemMeta();
bowmeta.setDisplayName(ChatColor.RED + "Bow Of Dumbness");
ArrayList<String> lore = new ArrayList();
lore.add("Useless Bow...");
bowmeta.setLore(lore);
bow.setItemMeta(bowmeta);
bow.addEnchantment(Enchantment.ARROW_DAMAGE, 5);
bow.addEnchantment(Enchantment.ARROW_KNOCKBACK,5);
p.updateInventory();
p.getInventory().addItem(bow);```
what's the error in the console?
addUnsafeEnchant
you think its better to use gamerule daylight cycle on enable rather than like some other code to set daylight always? is gamerule more optimized
Punch 5 is unsafe
Yeah they are 🤔
Yes
But set the gamerule with the API, not by running a command from code
there is some function for adding unsafe enchants
^
Oh one more qustion everyone. i was thinking of using an api to establish a connection to the database then using my mc game server to talk to api to get db stuff, would it drastically ruin performance and cause lag to players or would it be okay to talk to an api for db stuff rather than direct connection to db ?
hello
i want to create a potion with a custom level
what i have so far is this:
private ItemStack createPotion(){
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta pm = (PotionMeta) potion.getItemMeta();
assert pm != null;
PotionEffect potionEffect = new PotionEffect(PotionEffectType.JUMP, 30, 2);
pm.setBasePotionData(new PotionData(PotionType.JUMP));
pm.setColor(Color.WHITE);
potion.setItemMeta(pm);
return potion;
}
do it async
So whats your question
can you elaborate please? so async api would be ok?
i can add a potion effect to a player with the level 2 or 5 so i can jump 6 block high or something like that
now i want this kind of effect in a potion
See PotionMeta
run your code to do database stuff async (not on the main thread, or it will lag the server)
?scheduling
okay i guess i found it now XD maybe its addCustomEffect() in PotionMeta what i need thanks
i didn't saw this method earlier^^
Seems like I had the plugin before (https://pastebin.com/6DDvQSmq)/
But I still get this error: #help-development message
technically no
Wym no?
i've installed maven plugin which translates mojang's mappings to spigot mapping's whenever the maven project gets built
Ah like hosting it on git
well you can use the mappings, but you can't use the mappings for anything else but reference purposes
and im thinking if using the same field and method names is legal
console says Unknown command. Type "/help" for help. for some reason. but when i write in chat, it works.
Yes
what is the license now?
"/gamerule <rule> <value>"
try with slash
because this is brigadier command, which doesn't have proper command object internally
I used it. I tried it with slash too
that wouldnt work
pretty sure it still has restrictions in regards to using them in projects lol
Yep, so what should I do ?
did you use the command correctly?
“According to the License, such decompiled source code can only be distributed in a modified version or part of a larger project. This was changed from being available only for internal purposes before August 14th, 2020.”
Yes
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "/gamerule doMobLoot false")
Unknown command. Type "/help" for help.
Please use the API to set gamerules
how do ig et the world on Enable
Use the WorldLoadEvent
im pretty sure its due to how brigadier commands have its own implementation of Command Interface
and server's .getcommand() returns PluginCommand objects only
oh right
You may copy and use the mappings for development purposes, but you may not redistribute the mappings complete and unmodified.
Unresolved reference: setGameruleValue
So that means you can't just use the mappings in source and distribute which in other words means reference purposes only
unless you modify the mappings or only use partial I guess?
not sure what partial would mean in this case since it doesn't clarify
fun onWorldLoadEvent(world: World) {
world.setGameruleValue("naturalRegeneration", "true");
}
help
however what people choose to do is up to them
Unresolved reference: setGameruleValue
PotterPerson dumble = new Dumbledore();
the problem is, paper stopped using maven as their build tool for the project
install locally via install-file or smth goal?
Is this a valid event listener?
whats the point of returning false in CommandExecutor#onCommand when no usage message in plugin.yml is defined?
I don’t know Kotlin
Just use gradle lol
Default one exists
That wouldnt work anymore
ah and what is it?
defaults to saying they do not have permissions for the command if I recall
i can install it via going into cache folder
or it could be what Coll said
Idk
i did it like this, before i realised there are proper ways to do this
Honestly I never return false and provide my own usage message
Maybe I should make use of the option in the plugin.yml
I return false if the command doesn't hit any of the if statements
Everyone uses command frameworks anyw2
Not really
I don't
Parameter is not a subclass of org.bukkit.event.Event Compiling and running this listener may result in a runtime exception
what does this mean
class WorldLoadEvent: Listener {
@EventHandler
fun onWorldLoadEvent(e: WorldLoadEvent) {
print("Loaded world.")
}
}
Pretty sure WorldLoadEvent is a subclass of event
nah not everyone
or something custom designed
ok but what can i change then
kind of late to the party on that one 🙂
fun?
Kotlin
yea lets make some fun
so fun is void?
fun is function
Idk
event methods need to be void type if I recalled?
so if fun doesn't equal void that could be the issue then
damn im smart
Maybe void is an implied default
how do i use gamerule api again?
I guess, but I don't like it
i dont like many other languages either
Fun fact
but if you wanna grow up
lol
i like languages which dont have a null value
how do i select world
Check the javadocs
Bukkit.getWorlds().get(index) // 0 is overworld, 1 is nether 2 is end
I bet that event has a getWorld
There can be more worlds than the vanilla ones. Use the event
Any idea for setting the velocity of an armorstand (1.17)? I have tried with/out gravity, creating custom armor stand with nms and nothing seems to works. ArmorStand#setVelocity was working in 1.8 without problems.
¯_(ツ)_/¯
midday
is kotlin that fun to code with
Yeah but where does it come from
oh right lol
You get "funny" methods
When does WorldLoadEvent even happn? i set up listener but my code does not work......
When a world loads
worldload happens when you startup the server
Did you register the event
Yeah
So you’ve registered it and have @EventHandler
yes
class WorldLoadEventListener: Listener {
@EventHandler
fun onWorldLoadEventListener(e: WorldLoadEvent) {
e.world.setGameRuleValue("doDaylightCycle", "false");
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW.toString() + "test> " + ChatColor.WHITE + "Enabled")
}
}
Bukkit.getServer().pluginManager.registerEvents(WorldLoadEventListener() as Listener, this as Plugin)
I have DataBasePlugin and i wish to interact with it in another plugin. I tried use bukkit services but it not working(i did that same but on 1.12.2 and it working success)
I think a service has to be an interface
Guys
I don't think it's strictly required, but it most certainly should be an interface
why is my world listener not working 😂
i just used getWorlds get index
shity listener doesnt work lmao
I can confirm they do work
on 1.8?
weird, for me, it didnt, also no errors
im using a lot of listeners just fine
world listener didnt work though
on server startup
thats the only one
we don’t support 1.8 ¯_(ツ)_/¯
i remake it to interface but unsuccessfully
Strange things. In 1.12.2 i just registering JavaPlugin class and it working
hm... okay
Did you make sure your other plugin loads after the provider
Actually I guess it must for it to show in the loop
I don’t see either of the lower 2 messages in your log though
Make it so the service manager loads on start up
Or are the services not loaded yet
No idea
if it can get it in the loop, then it sees it
lol
the error in the at screenshot doesn't point to the method you displayed
getDatabase(String) is the method it is referring to
but you are showing loadManager() instead
the error is due to the fact that the method outputs a null value
if you are not going to show the relevant method and show what you think is correct
then not sure why you are asking for help
obviously you know the answer 🙂
If I knew the answer I wouldn't be here
my point exactly
how about show the method the error points to?
you mean it?
well that is a new error, but still points to a method you didn't display either
is that class the DatabaseInstance class?
in that class you have a method called getDatabase()
if you are able to get it eventually in a loop
then it might be wise to then wait a few ticks after loadup
also, best to not return null either when you don't need to
well you are using paper too, not sure if they change anything between 1.12 and 1.16 in regards to services
[21:20:32 INFO]: Star_WorK[/72.229.5.4:55633] logged in with entity id 266 at ([world]152.16049468859876, 64.0, 178.9883024604661)
[21:20:32 INFO]: Star_WorK lost connection: Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: Bad packet id 868
but, anyways if it is solved now then cool, but next time it helps to show all relevant areas that the error points to and not what you think is is correct. Because what you think is correct in showing us might actually not be the problem and is actually elsewhere
Java doesn't always know the actual correct area all the time when an error is thrown
so anyways glad it is fixed now lol
I’m confused how it knows the line in general
Are lines somehow preserved in bytecode
Probably
it can be like getting a file stream. it also receives the file line by line
Yeah but bytecode lines don’t correspond to code lines
sometimes it depends if whitespace is removed during compile time or not
frostalf
Bytecode is generally much longer
Have patience
how much u guys think itll take to finish this todolist
What are we learning about bits and bytes
idk
prob how bytecode works
IDK i just wrote shit on my head
that i feel unclear when i think about
rn im learning Data structures and algorithms
im not doing them in order btw
ill try to spend 15 days on each task
So basically how do I turn a T generic parameter on a method into Class<T>
Black magic is ok, Im familiar with it
and ill finish on 1st january of 2023
learn rust
^ rust is really nice
I use it for every web API i write now
concurrency/parallelism to the max
actix ftw
learn it now
forces you to become a better developer
how is it any more useful than what is in that todolist
i spent 3 days learning rsut seriously and i made a reverse tcp shell with encryption
its so easy but very powerful
fine but like
Rust forces you to become a better developer. Its heavily opinionated and will take some time getting used to but its worth it
Like literally it wont let you write bad code
whenever i look at any of the stuff in that todolist
i feel like i suck
because i actually fucking suck
Rust is amazing put simply 😌
Is this a challenge?
the worst part about rust imo is abstractation
doesnt rust look absolutely horrifying
oh wait
let a=if true
{
1
}
else
{
2
};
thats basically kotlin
EW what
idk it looks like it
I mean yeah it has the match branching but let me give you an example
or maybe im just blind
Prerequisite
Before learning Rust, you must have the basic knowledge of C++.
ok guess i cant
i dont know single shit bout c++
Nah not really
#[get("/info/{file_id}")]
async fn info(
state: web::Data<State>,
file_id: web::Path<String>,
auth: Auth<auth_role::User, true, true>,
) -> impl Responder {
match state.database.get_file(&file_id).await {
Ok(mut v) => {
if v.uploader != auth.user.id {
MessageResponse::new(
StatusCode::FORBIDDEN,
"You are not allowed to access this file",
)
.http_response()
} else {
let mut file_url = PathBuf::from(&state.storage_url);
file_url.push(&v.name);
v.url = Some(file_url.as_path().display().to_string());
HttpResponse::Ok().json(v)
}
}
Err(_) => {
MessageResponse::new(StatusCode::NOT_FOUND, "That file was not found").http_response()
}
}
}
Also heres a web example
what the motherfucking
this looks like garbage im gonna be honest
Right but then you need to notice how it actually works
the match is an enum Result variant
use magic_crypt::{MagicCrypt256, new_magic_crypt};
use uuid::Uuid;
pub fn generate_key() -> MagicCrypt256 {
new_magic_crypt!(Uuid::new_v4().to_string(), 256)
}
use std::fs::File;
use std::io::Read;
use magic_crypt::{MagicCrypt256, MagicCryptTrait};
pub fn encrypt_bytes(bytes: Vec<u8>, key: &MagicCrypt256) -> Vec<u8> {
key.encrypt_bytes_to_bytes(&bytes)
}
🦐 I mean you could also keep dying in singlethreaded languages
false
You dont even know what anything is yet and your forming an opinion on a programming language you dont know even basic details about
if u find this "very easy" then go see a doctor pls
if you know java you can learn rust easily
Not really. its medium level
idk ill try it
std::cout << "Hello world" << std::endl;
I need to keep writing my game engine honestly. Thats my main use for C++
Stopped a while ago
To be fair I can understand most of this syntax
Idk what the & is though
reference
reference
in C++ that's a reference
in rust its also a reference
its like a memory pointer
because if you use the actual value in some cases it moves the value to make sure no more memory is needed
Ah
rust is different, if you pass a value it doesnt copy. It moves the value
Pass by value
let y = 5;
let x = y;
println!("{}", y) // y was moved to x
because v was moved into pass_here
Interesting
its very cool
so passing a reference is a new variable
and extremley usefil
which refers to another variable, so you can move the reference
the reason as to why is that rust automatically cleans stuff up when the scope ends
Its really weird to do in compiled langs like rust but it uses move semantics
prevents unnecessary copies and removes memory the moment its done being used
So if you pass into pass_here then v is actually deleted if you do nothing with it in pass_here
that's a revolutionary idea called the stack
Im explaining it in simple terms
I could go on and explain how functions are actually subroutines with stacks but nobody knows what that means
i love C++, but it feels like a C with some extension libraries pretending to be a separate language
It is a separate language when you go past C++17
C code is still valid but thats the point. the stuff C++ adds is huge though
C++ is C on steroids
cmon when that sore throat will be gone... I've grabbed anything that suppose to heal it, yet it still feels like i've drank couple cups of citric acid
See I’m a smooth brain that only really knows non-memory managed languages
rust doesnt make you mess with that stuff
it does it for you while still being super low level
its literally a better c and c++
Oh
That’s cool
I can’t manage my own memory you expect me to manage that of a computer too? Smh
Ehh it still forces you to be aware of memory
Like if you write code that doesnt follow the rules it wont compile
and will tell you why you fucked up
the error messages are great
but sometimes the messages make you debug the code yourself
which is normal for most languages
Also
Whats to stop some dumbass from looking on stackoverflow and wrapping whatever unsafe shit he is doing in a RefCell
I mean I try to be smart about memory
Thats literally willingly loading the gun to shoot yourself with
i clear my hashsets when my plugin is disabled
Atm trying to make my plugin fabric/forge/spigot compatible
having fun rewriting command systems
Copying from Stack Overflow is a Classic, and Obviously Dangerous, that must be what Happened to the FNAF Security Breach Developers
Woah big moves here
Hello someone know something about PacketPlayOutGameStateChange I want to hide and show the recipebook to player
I have found this https://wiki.vg/Protocol#Set_Recipe_Book_State which points to this packet
Am I missing a meme about fnaf security breach
SB isnt even a stackoverflow problem
bad performance
they just abused the fuck out of blueprints in UE
Ah
and now their stuff doesnt work
It’s like $40
Never liked the blueprint system in UE honestly
oh, didn't know
Really?
Yeah
xD
Is at least more content than the originals for $40
The game size is just uncompressed assets
we need a fully developed rust game engine with raytracing
it will be the fastest game engine
and memory efficient
I write my own game engines
In C++ because rust doesnt get others support
but yes regardless, i write my own engines
For like huge game projects i just use unity or some shit though
Is this the correct way to read a Itemstack array (inv) from a config?
ItemStack[] kit = ((ArrayList<ItemStack>) KitFile.get().getList("kit")).toArray(new ItemStack[0]);
If i use UE it will run at 15 fps lol
no
Isnt C or C++ more low level and using -O2 faster
If you dont write shit code
How else am I supposed to do it? Sometimes this works, but sometimes it returns a null pointer
nope
unsafe rust is the same levels as C and C++
unsafe
is this the channel for JAVA coding ?
Then its down to compile time optimization and library performance
is there a event in 1.18.1 for closing a GUI?
compile time is incredible in rust
InventoryCloseEvent
You mean an inventory
you will have to check if its yours though
thanks
I cant cancel that event, is there a way to do so or do I have to just re-open the GUI
Alright, thanks
when do MapRenderers runs their render their method?
If you know, please be more specific than "when player renders a map"/"views a map"
I need more context on when this is triggered cuz I want to change its behaviour
through packets or whatever
preferably a different solution than adding the extra checks/implementations within maprender.render function, cuz my goal is to make this function trigger less
does projectilehitevent call before entitydamagebyentityevent?
tryandsee
well add a debug to the render method and
tryandsee
no
@spiral light well what's the support channels if it's to get answers "try and see", obviously we could find out everything by self with a lot of patience and involvement, but it's to gain time and have benefit of others experience
that's the whole concept of sharing^^
:)
i totally agree
🙂
if someone would know it and is online he maybe would tell you ... but i just can say that you should try and see ^^ thats mostly faster then asking here for a guess on what happens first
or maybe...
instead of responding to questions with the basic equivalent of "i dont know"
just dont answer?
but then you wouldnt know that your msg was sended and recived >:)
it's fine, the dude's not toxic no need to extend this conv 🙂
How do I run buildtools with a specific java version?
*** The version you have requested to build requires Java versions between [Java 7, Java 8], but you are using Java 11
*** Please rerun BuildTools using an appropriate Java version. For obvious reasons outdated MC versions do not support Java versions that did not exist at their release.
you need to install the java version and set it in the system environmental keys i guess
ugh
no i think you just need to use java 8 for that version
it would be easier to startup a vm and build it inside of that
i downloaded java 8
but cmd still says that
You can also install older java and use path/to/java instead of java in your command
Specify the full path to the java install
in the buildtools command?
(i got low java skills) where can I store the class / money for each player ?
jdk or jre?
Either
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Surround with ""
Woo spaces
you will need to use configuration files
'"C:\Program Files\Java\jdk1.8.0_321\bin"' is not recognized as an internal or external command,
operable program or batch file.
"C:\Program Files\Java\jdk1.8.0_321\bin" -jar BuildTools.jar --rev 1.12.2
Add \java.exe
Thanks
I can call those infos and use them while the server is running ?
if you want them to be saved permanent you should use config files for each player seperated ... or PDC (but you cant read PDC when player is not online)
wetf
wtf
Starting clone of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git to CraftBukkit
Exception in thread "main" org.eclipse.jgit.api.errors.TransportException: Unexpected end of file from server
}
Starting clone of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git to CraftBukkit
Exception in thread "main" org.eclipse.jgit.api.errors.TransportException: Unexpected end of file from server
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:224)
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:311)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:182)
at org.spigotmc.builder.Builder.clone(Builder.java:1051)
at org.spigotmc.builder.Builder.main(Builder.java:333)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: org.eclipse.jgit.errors.TransportException: Unexpected end of file from server
at org.eclipse.jgit.transport.BasePackConnection.lsRefs(BasePackConnection.java:308)
at org.eclipse.jgit.transport.TransportHttp$SmartHttpFetchConnection.<init>(TransportHttp.java:1538)
at org.eclipse.jgit.transport.TransportHttp.getConnection(TransportHttp.java:366)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:467)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:142)
Attempting to build version: '1.8.8' use --rev <version> to override
Found version
{
"name": "582a",
"description": "Jenkins build 582a (hotfix 2)",
"refs": {
"BuildData": "838b40587fa7a68a130b75252959bc8a3481d94f",
"Bukkit": "01d1820664a5f881665b84b28871dadd132deaef",
"CraftBukkit": "741a1bdf3db8c4d5237407df2872d9857427bfaf",
"Spigot": "21fe7077d9140e0f9db01587a39c2ffec29e3ec8"
}
}
it doesnt work
api error?
how would i go about checking if an arrow is stuck in a block?
isInGround iirc?
doesnt work
if the spigot 1.8 jar already constains log4j xml
then do i have to do anything? and i dont have to use any jvm args?
Correct
coool
more like, no "java skills"
lmao
true.
how to verify if a block has tile entity data?
Eh you can pass my schools Java course without knowing things like this
getState instanceof TileState
thank you very much that is what I was looking for ! 😄
Yeah my college java class had no file io
I finished my course early and personally I think it teaches things in the wrong order
Oh and it doesn't teach you about how to read stack traces
lol
reading stack traces is essential imo
Yeah I'm glad I could finish the course early..
We spent the first week on sysout
The pacing is way to slow for me
Look sysout is a very complicated part of java
Have you seen how many methods there are?!
We only learned about the string one
We got a bunch of things to make it print. 2h 30 min not so well spent
Honestly I don’t even think about the overloads, they just exist and java knows the one I want
Yeah true
What is the exact difference between Player and OfflinePlayer?
WAT
Player has a ton more methods
^^ PR
Because they are online
Player also means all their data is loaded
Ooh block damage end event PR? Sounds nice
Is there any way to detect whether someone is left clicking on a map canvas?
I'd check for damage to the item frame
It's just that the title of your PR implied that you were adding a start event, Soccer 😛
Though I guess that's the fault of the issue linked
But does the end event distinguish between cancel and finish
Actually I guess we have the break event for finish
Yeah ;p
This one specifically is for cancelling a break
i will never link something again
BlockBreakEvent and BlockDamageEvent just 2 of 3 states what can happen
But MD encourages that
No, including the issue at the start of the PR is fine
It's just misleading is all
Yep, your PR is fine. It's just the title that's wrong because it matches an ill-informed issue
BlockDamageEvent is a strange name
thats why i added the text xD
i was writing with lol (who created the feature request) about the missing api and just realised there is an "start"-event ... just no "stop"-event
i would also think its getting called for the specific block multiple times and not just for the first time hitting it ...
Can someone with a decent amount of experience that knows how to copmile plugins help me? Im trying to make a edited version of Slimefun and i can't figure out how to code it. If you can help me pls msg me i would really really appreciate it
Who is Parker H. ?
Parker Hockey
Yes ... But here in dc
Didn't want to write complete name since maybe not Wanne Show it idk
It’s Choco
Chocolate 😋
i know now who has to write my not existing future pr ideas ^^
Believe Player also represents the world entity of a player whilst offline player does not
Although now people do that to me... I guess I deserve it
Is there any other cause for the " the return value of org.bukkit.Server.getPluginCommand(String)" is null" error APART from the command not being listed on plugin.yml? A person is having this error on their server and I don't get it on my two servers with the exact same jar
Is possible to create a custom player that implements Player class
And add it to player Collection?
Cuz im thinking
Cuz im its possible to add a custom player to Player Collection. And try to see if plugin message works
Without having a physic player
😂
im trying to make a tablist in kotlin https://ibb.co/4Srd5FC
converted from java,but im getting a couiple errors for the packet and Craftplayer and it just tellsm e to create a class but idk what to do
Why using packets?
I dont use packets for tab api
its a way to make tablist
Lol
@sterile token https://www.youtube.com/watch?v=MYOM5uZOtf8&t=183s
Yeah a unnecessary way
so that yter bad?
You should do it vía normal way
who
You really should strive to use the api whenever possible
Do it without nms and reflections. Cuz that consumes more resources
And easier way of having errors
This is 4 years old
Check a already build tab api from github
Im using Kotlin.
guess you’re stuck with packets, but I’m sure there are at least half a dozen maintained 1.8 tablist libraries you could use
From Kotlin you can use Java library?
I never used Kotlin that why
I only know that Kotlin code its executed on JVM
By design it’s fully interoperable with Java
kotlin is... kotin
Based take
Kotlin is extremely Kotlin
I hate unredeable sintaxis thst are not typed
So only love programming on Java and C#
CraftBukkit stuff you have to import spigot-api instead of spigot
or other way around
cant remember
also why use packets for header/footer theres a spigot implementation for that
Not in 1.8
Poor 1.8
1.8 Died a Long time Ago
huh
i need to use IChatBaseComponent and PacketPlayOutPlayerListHeaderFooter and CraftPlayer but they are all red in Kotlin
whats the proper event listener that I should be utilizing to detect when Endermen pickup/place a block, EntityInteractEvent?
declaration: package: org.bukkit.event.entity, class: EntityChangeBlockEvent
thanks
it says it cant find main class any idea why?
Decompiled would be .class
Though unrelated to the actual issue, there is no Main class there unless it's cropped out
yep you are right, I switched the two lol
You have your folders in src/<yourpackage>, not src/main/java/<yourpackage>
i didnt make plugin 💀
Your classes aren't getting exported
Which would also explain why it's not a source dir
Basically shift your com folder over into src/main/java
Should look like src/main/java/com/...
But yes, Rack's link there is also relevant
should all these be in resources
src/main/resources/
will i have to recode plugin so it can find the files
Nope, you should be fine
Maven just uses src/main/java and src/main/resources as source dirs
ok tysm
;p You might just now have some compile errors that your IDE otherwise didn't pick up on because it's in a source dir now
Always the simple mistakes that take us the longest to figure out. I was racking my brain for a day or so trying to figure out why my plugin message wouldn't send only for me to realize that I had to delay it a tick so that the player's connection completed
are these not part of spigot?
they are part of spigot's jar
https://paste.md-5.net/mitehacemo.xml its from paper but thats fork of spigot so it shouldnt matter
if it is paper you are better off approaching paper's discord
cuz it matters
what you are depending on is an api
at least that's what i gather from the artifact
you can find out whether papermc provides some artifact that includes nms packages
Hello! So I am currently using custom config files and everytime I load my plugin it makes the files in the config folder, like it should. But when I use a command that needs to use one of the config files, it makes a duplicate config file in the main folder and uses that one instead of the one in the config folder
any ideas what I am doing wrong?
a duplicate file of a same name?
its better if I show you
Well, your config instance is pointing the wrong path so it creates it again bc it doesn't exists I guess
im making a report system, where it uses configs and such
and when I load my plugin it makes these
files
Check again how you create and acces your config instance
YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File("C:Users\\tanja\\OneDrive\\Desktop\\Spigot Plugin Server\\plugins\\ReportSystem\\reports.yml"));
YamlConfiguration statsConfig = YamlConfiguration.loadConfiguration(new File("C:Users\\tanja\\OneDrive\\Desktop\\Spigot Plugin Server\\plugins\\ReportSystem\\stats.yml"));
I get that you are just trying to test, but apart from relative paths
use File.separator
That's not spigot coding ^^'
well new to java in general
Basically, a relative path is a path relative to the execution file
So you don't have to specify the absolute path like you do
check a simple tutorial on spigot to make custom configs
I did already
It explain it pretty well
in the tutorial they didnt mention the whole path like I did
however it didnt work for me like it did for them
Cause they do relatively
so I thought putting the whole path would work
idk why it makes a whole new yml file in the main class tho
Imagine you place your plugin in a different folder or on an other computer, your plugin is broken immediately ^^'
To get the relative path you can just do JavaPlugin#getDataFolder
And you'll be on the right folder right away
do I put the getDataFolder in whichever command file I use the config in?
You may want check out java's File
so YamlConfigblah blah reportsConfig = ReportsSyste.getDataFolder("reports.yml")?
You should access your yamlconfiguration by a singleton pattern
Don't create multiple instance of the same config
Unless you save it directly
Im trying to cancel jumping in my server, https://paste.md-5.net/cakuluhimu.java for some reason players can still jump
@mint mesa File file = new File(this.getDataFolder().getAbsolutePath() + System.getProperty("file.separator") + "data.data");
You're cancelling the update of the jump statistic, not a jump itself
Wrong event
System.getProperty("file.separator") is equivalent to File.separator so use the latter instead
The string before "data.data" is the folder path of ur plugin's path
oh oops, I cant find anything on the actual event
You could simply add a negative jump boost, it will prevent jumping, or on move event, if the previous y is less than the new, then cancel the move event
would this be in the main folder?
Plugin folder
You know the folder that is created when you have a config.yml file and you run this.saveDefaultConfig(); its that folder
ur plugin's folder
ah
sorry not folder
im dumb
I meant do I put that code
in the main class
or in each of the command classes
yea
send it
@Override
public void onEnable() {
// Discord Webhook
// Setup Configs
StatsCustomConfig.setup();
reportsCustomConfig.setup();
StatsCustomConfig.get().options().copyDefaults(true);
StatsCustomConfig.save();
reportsCustomConfig.get().options().copyDefaults(true);
reportsCustomConfig.save();``` main class
reportCommand
I have a couple more commands but im just gonna use the report command as an example
also I deleted the toggled config but forgot to remove it
ok so replace
wait u need to pass in ur plugin instance into the constructor of ur command class
@mint mesa do u know how to do that?
do that and then replace static YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File("C:Users\\tanja\\OneDrive\\Desktop\\Spigot Plugin Server\\plugins\\ReportSystem\\reports.yml")); with
static YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File(<plugin-instance-variable>.getDataFolder().getAbsolutePath() + File.separator + "reports.yml"));
either pass in the plugin instance or create a public static String and set it to this.getDataFolder().getAbsolutePath();
new File(this.getDataFolder(), "reports.yml"); also works, don't need to set a path
Plugin plugin = ReportsSystem.getPlugin(ReportsSystem.class);```
If that gets ur plugin instance then use that
static YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "reports.yml"));
static YamlConfiguration toggledConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "toggled.yml"));
static YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "reports.yml"));
static YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), "toggled.yml"));
a bit cleaner
and this would be in every class which uses the config
does this also get the seperator?
correct?
any class that uses those variables
great
rather than setting it to a specific path its generic
you don't need to specify a path fully, this tells java to look into the folder for that file
it's the same thing as what you are doing but cleaner
right, i thought you needed to get then absolute path
hello how do i make using a placeholders with {prefix} will get the value from the config like below ?
Prefix: "(&7Inter&9Legacy&f)"
message: "{prefix} &7Check out a new &aNews &7from our &9Discord" # {prefix} will get the value on Prefix config
right but can you add a string to a data object?
get the prefix and save it, use replace("{prefix}", prefix)when you want to replace it
but how can i use with Placeholders API ?
oh, didn't read that fully
you will have to look into creating custom placeholders
they probably have a wiki somewhere
so then when I save the configs when I run the command, this should work then
or should I do reportsConfig.save(reprtsConfig)
it still makes the file in the main folder
oh i know why nevermind
nope still doesnt work
the file isnt created anymore but it doesnt save the reports made
static Plugin plugin = ReportSystem.getPlugin(ReportSystem.class);
static YamlConfiguration reportsConfig = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "reports.yml"));
``` the instance and stuff of the reportsConfig
```java
reportsConfig.set(reportID + ".name", suspect.getName());
reportsConfig.set(reportID + ".reason", text);
reportsConfig.set(reportID + ".author", player.getName());
reportsConfig.set(reportID + ".time", dtf.format(now));
reportsConfig.set(reportID + ".id", reportID);
reportsConfig.set(reportID + ".server", suspect.getServer().getServerName());``` making the report itself
```java
reportsCustomConfig.save();``` and saving it
shouldn't this work?
whats reportsCustomConfig
might not be getting the instance properly
yeah that's def not getting the instance correctly
maybe try no static and see if that works
gotta make an instance of the class and pass it around to other ones
How do i explode a firework but not launch a firework entity w/ a trail + its launchin sound?
thank you
https://www.spigotmc.org/threads/firework-on-join.164406/
using this and it works but i dont want to launch an entity with a launch sound and also want it to explode much closer to the player but the firework launches up
you would have to use the firework builder thing (idk what it's called) and set to not have a trail
Is there a way I can get the location of an npcs head?
trail(false). It does not work.
I think it's getEyeLocation()?
holy crap I finally did it
that was so annoying
reportsConfig.save(plugin.getDataFolder().getAbsolutePath() + File.separator + "reports.yml");```
How to give named item to player when they join
when they join give them an itemstack
:/
ye
to specific slot
getInventory().setItem(slot, item)
how do you give a named item?
do you know how to use item stacks?
item should be the itemstack
Spigot doesn't understand just STONE, it would be Material.STONE
java*
^ that
Type mismatch.
Required:
ItemStack!
Found:
Material
watch this it talks about how to make a custom item:
https://www.youtube.com/watch?v=5npPUMrYaYE
Learn to code your own Minecraft Spigot plugin in this complete tutorial series! In this episode, we create a custom item that has some custom text, lore, and effects.
--- Important Links ---
● GitHub: https://github.com/TechnoVisionDev/Spigot-Tutorial
● Discord: https://discord.gg/m5fjByfrKP
--- Music ---
● Chill Out Records - Minute Mix
-...
yeah you need to put an item stack not a material
I am using Kotlin.
That doesn't make it magically work
You need to create an ItemStack
In kotlin, ItemStack(Material.STONE)
what is the event for using a totem of undying
If I had to guess, it might be PlayerConsumeItemEvent?
PlayerResurrectEvent
Oh, never knew that existed
or Entity idk
declaration: package: org.bukkit.event.entity, class: EntityResurrectEvent
ok so i managed to give stone
e.player.inventory.setItem(2, ItemStack(Material.STONE))
Entity
how do i name it
thank you verymuch
this video should teach you all you need to know its how I learned it
