#help-development
1 messages Ā· Page 754 of 1
bro took the time to try the code š
DuskTaler, focus on learning object orientation instead, not this goofy arithmetics stella is quizzing you on lol
HAHAHAHA
goofy arithmetics
ok but heāll actually need for loops in spigot plugins (maybe)
true
Yandere dev had entered the chat
still you just throw everything at the poor man
Intelli don't come round here often no more
i threw two compilation errors at him
that may be true, but they don't need to learn these caveat exceptions quite yet
THERE WAS 2 | IN THE FOR LOOP š
Put all ur code on one line so u always know where it is
Tbh I wouldāve despawned at this point if I were him, just learnt variables and now |
despawned šš
well the or symbol isn't revolutionary in java
Don't me and my partner spent 2 weeks documenting Mythic Enchants before we started adding to it š š
Bitwise or
Yeah fair, revolutionary usage tho
You know not.of pain
| isnt even the or sumbol
wdym by that
what else is supposed to be here
at least its or in binary š„²
look at the for loop syntax more closely
tbf Iām not certain what that code would output
it sets j to 0 and adds 1 everytime
it wouldnt
Btw frost did you test gen zgc any?
it starts from i = 0 and adds 1 until i = 5 but then the loop breaks so it only prints i up to 4
I ran some iterations with it
Oh does it actually just not compile
All in favour of a pseudo compiler for the server say aye š¤£
no, my weekend started XD
š¤Ø
Its better than zgc, but prob needs a lot of manual tuning
I thought the bitwise or would cause some shenanigans
and I pretty much slept last weekend I think
ah nice, enjoy weekend then :)
I don't quite remember
I think the bitwise xor is more interesting:)
this is super handy if it really allows this
I mean sure you can tune the other gc's but its like limiting though
Yeah true
Gotta be honest, never really had a use for the bitwise operators
I really dont get what I did wrong
Apparently it is released, but they had some flags that are still in beta
most people who stick to the higher end of things probably wouldn't
it wouldnt compile
well you missed } and used | instead of ;
thats what weāve been talking about this entire time babes
but how am I supposed to know wether it was intentional or you were a lazy ass
oop
now that sounded really bratty
but when you start getting into lower level stuff of the programming hierarchy like when dealing with protocols, networking related things, or maybe some hardware api stuff you kind of need. There is other areas too, like compression or maybe you are switching between different bases
Yeah
dont get me wrong but you sound like that from the beginning
šæ
i was testing your lazy ass. quote from you 20 minutes ago. āso am i forced to perform dozens of hours of abstract java programming to then do pluginsā
smhh
Yeah
Its pretty much essential at low level
Take it from me, learn java before touching plugins
I didnt really have any problems understanding anything from like first 3 videos of Kody (the ones where he actually programs not where he says how to set up IntelliJ etc.), so am I really that lacking?
I made that mistake like 11 years ago and it was painful
In terms of object orientational knowledge yes @storm crystal
especially since youāre new to this entire programming branch
we dont know as we havent memorized kodys first three videos š¤š¼
but plugins dont even seem to take it to extreme
??
plugins ARE oop
thats their whole thing
Just the bad ones donāt take it to the extreme
I can give you a real plugin lol
why simple correlates to bad in this case
You mean you donāt use ASM in every plugin?
Not really
But you will guaranteed have trouble to fix things on ur own if u limit urself
luckperms is so bad š®āšØš
Is the code too enterprise for you
what does it do
im not in any super need to make such thing myself
wasnt there a thing called essentials or something like that
which makes it for you
I mean depends on what level you want to take things to
But programming as a whole is very good for your thinking
idc about permissions cuz ill be the only one on the server
It combines theory and practice, also helps with ur ability to think abstractly
I mean you gotta think about the future as well
Like if you find entertainment in programming, maybe thatās what u wanna do in the future
hell no programming is my least favourite IT thing out of all
š¤¢
2nd semester is gonna be script oriented programming though
no idea what about this one
good point, I can only give you the context that my course is cybersecurity, maybe that could ring some bell
and on 2nd semester we have a thing called script programming but no details yet
University?
Machine Learning
Thatās nice tho
Haha lmao
Nah
I like telecommunication though
anyway
Hottub coding stream
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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
I guess ill just continue Kody's course until I approach some big problem
his spigot course?
How did u figure out that command
Itās a classic
mhm
his spigot tutorials stop at liek episode 9
the rest are just miniprojects he makes
well then who else makes spigot tutorials that also doesnt have bad habits
public interface CharacterItemSet {
@NotNull List<@NotNull ItemStack> getItems();
@NotNull ItemStack getHelmet();
@NotNull ItemStack getChestplate();
@NotNull ItemStack getLeggings();
@NotNull ItemStack getBoots();
}
If this will also be the implementation of the item set, should I make this implement Listener or make that a seperate interface
Another separate
yk what I ended up doing
oh I cant post imgs
wtf
ok here
characterwar.character.impls.SupermanCharacter <- extends AbstractCharacter, item impls
characterwar.character.Character <- getters to get all the items and names descriptions, etc.
characterwar.AbstractCharacter <- Has impl of the character
characterwar.CharacterManager <- register character
uh sure?
Anybody know of a way to make it so you can combine enchantment books that have higher enchantment levels with items that can normally be enchanted. If I combine a sharpness 7 book with a sword it defaults to sharpness 5
does that work?
because idk I feel like this heavily violates srp
the SupermanCharacter class provides all the items for the character and the implementations for them
thats usually how you do it
not sure where you see a srp violation there
š¤
@Override
@NotNull
public CharacterVerse getVerse() {
return CharacterVerse.DC;
}
private final ItemStack chestplate = new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setName("<red>Superman's Chestplate")
.setColor(Color.BLUE)
.setUnbreakable(true)
.build();
private final ItemStack leggings = new ItemBuilder(Material.LEATHER_LEGGINGS)
.setName("<red>Superman's Leggings")
.setColor(Color.BLUE)
.setUnbreakable(true)
.build();
private final ItemStack boots = new ItemBuilder(Material.LEATHER_BOOTS)
.setName("<red>Superman's Boots")
.setColor(Color.RED)
.setUnbreakable(true)
.build();
@Override
@NotNull
public ItemStack[] getArmor() {
return new ArmorSetBuilder().setChestplate(chestplate).setLeggings(leggings).setBoots(boots).build();
}```
cause if I provide the item impls I dont wanna call getArmor() and stuff like that all the time
it will create new instance if I dont have those fields
idk what java does but I feel like it's gonna be crazy on performance
no idea what you are on about
here let me show u
if i do this instead
@Override
@NotNull
public ItemStack[] getArmor() {
return new ArmorSetBuilder()
.setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setName("<red>Superman's Chestplate")
.setColor(Color.BLUE)
.setUnbreakable(true)
.build())
.setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS)
.setName("<red>Superman's Leggings")
.setColor(Color.BLUE)
.setUnbreakable(true)
.build())
.setBoots(new ItemBuilder(Material.LEATHER_BOOTS)
.setName("<red>Superman's Boots")
.setColor(Color.RED)
.setUnbreakable(true)
.build()
)
.build();
}```
then whenever I want to lets say check the cooldown for the boot's ability
I would need to getArmor()[0] for example
and it would create a new object
i wouldnt expect to create new armor for the character everytime you get their armor
so this is already what you want probably
no you dont want to do that
for what do you have getBoots
oh I deleted that
this class extends AbstractCharacter, which extends Character, which has getArmor() and getCustomItems()
then either give it the methods back or create another interface which gives them the other methods
- getArmor for clarity
what
here's my charcter interface
public interface Character {
@NotNull
String getReferenceName();
@NotNull
String getDisplayName();
@NotNull
String getDescription();
@NotNull
CharacterVerse getVerse();
@NotNull
ItemStack[] getArmor();
@NotNull
ItemStack[] getCustomItems();
}
public interface Character {
@NotNull
String getReferenceName();
@NotNull
String getDisplayName();
@NotNull
String getDescription();
@NotNull
CharacterVerse getVerse();
@NotNull
CharacterItemSet getItemSet();
}```
@hybrid spoke
do you mean something like that
Brb 1 Question
Is mentioning my plugin on someone else review section is against the ruels ?
I would argue that it depends on the context, but if you interpret the rules literally, then it's a violation of the general forum rule of no advertising outside of the services and recruitments section
why is this happening
im using it in this
message.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, new URL(URL)));```
you are passing a URL into your URL constructor
oh
so you are doing new URL(new URL("string"))
you are not passing a string in there
yeah i figured it out
you are passing the variable URL
thanks
Bit of a shitty thing to do. Dont know about rules though
but i see ppl doing that in abanded plugin review sections
sorry
can anybody help me how to add the support of color tags like <hexcolor>string</hexcolor>
my question link
bro u will never be able to do so
??
that message makes no sense
just parse your messages with minimessage
It's what ppl do
has all the tags you want
1 option: Use minimessage
2 option: Make it yourself using random html/xml parser lib
Well I see people stabbing each other, but that doesn't mean it's fine to do it
Can I make display blocks fit together such as the glass and "wall"
hello, currently I have an event handler like this: java @EventHandler public void onPlayerMovement(PlayerMoveEvent e) { if (e.getTo().getBlockY() < tgttos.currentMapConfig.deathYlevel && e.getTo().getWorld().equals(tgttos.currentMap.getWorld())) { e.getPlayer().teleport(tgttos.currentMap.spawnPoint, PlayerTeleportEvent.TeleportCause.PLUGIN); TeamPlayer p = MCInfinite.getPlayer(e.getPlayer().getName()); Bukkit.broadcastMessage(p.getDisplayName() + ChatColor.RESET + " died."); } }
but I get this error: [10:05:16] [Server thread/ERROR]: Could not pass event PlayerMoveEvent to mc-infinite v1.0 org.bukkit.event.EventException: null at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?] ... Caused by: java.lang.IllegalArgumentException: location at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
invalid world
well its not null
if a plugin is abandoned then i think its fine for people to recommend alternatives, other than that its rather shitty
anyway i gotta ask again, but i got a multi module project and when i build it the server cant find plugin.yml and i don't know what to change to make my sort of "core" module the main module containing said plugin.yml
the other modules are shaded into it and in the project's pom.xml
?paste
Show full error then
i fixed it by using currentMapConfig instead of currentMap.. issue on my end
edit the blockdata
you can tell a wall block that it is connected on X side without another block there by editing it's blockdata
Isn't mc bedrock for phones basically mc broke edition because it costs less than all other mcs and is kinda uhh, yk, bugrock edition
unless you were one of the lucky few to get it for free š
I bought bedrock for 2 platforms and 1 I got for free
Why? Because I can
At this point it's just a useless flex
2x Java accounts 2x Free win 10 + 1x Bedrock for Ipad
I don't think the ipad is powerful enough to launch it anymore
Lol
It's an ipad 2 from 2011 so š¤·āāļø
I used to play pocket edition before getting Java edition in 2013
My iPhone 7 could run minecraft earth
It got almost unusable when updating it
That was a mistake
Should have kept the old OS
Good ol' half a gig
Back in my day we only had 512mb of storage
My wii only has 512mb of storage
Nintendo always sells weak hardware I'm aware
But they make good games
^^
i have xbox 360 edition and pe edition and java edition
Damn you shigeru
Played some a few days ago, games are running great
I only have win 10
Controllers are starting to have issues though
Tbf I donāt like bedrock edition so meh
average minecraft bugrock user when they travel too much and fall into void
Itās so predatory towards kids
Pocket Edition was great but then it turned in to Bedrock š
average minecraft bugrock when cross command calling is still possible
Micro transactions for god damn everything
(it was patched in 1.8.9)
Is it possible to just cast OfflinePlayer to Player?
Like (Player) Bukkit.getOfflinePlayer(UUID.fromString(<uuid from file>))?
(Iām trying to handle (custom) inventory stuff onEnable which generally needs an online player but i donāt have online players onEnable)
no
Only if they are online
offline player is cached player
Asking about your attempted solution rather than your actual problem
Not always
Cached? I thought Bukkit.getOfflinePlayer() gets from the API
^^ It does if you pass a name
But iām guessing itās still not possible right?
but like, you cant really do anything with offline player, just store its data
The uuid version doesnāt need to do an api call
If the player isnāt online
Ya canāt cast em to player
Still the Vault system. I tried mapping the Vault instances for handling the id of the vault but to create an instance, I need a player
Sounds like a design issue
I need help in perworldplugins
yeah
Should really only need a uuid
wait cached or local stored
like world player data
Depends
An offline player may have joined the server before
But they also may not have
If i understood offlineplayer correctly itās making a call to the api and it also knows if the player has player before (hence ā offlinePlayer.hasPlayedBefore())
Anything else wouldnāt make sense
Or ig it looks into local files first
Then calls the api
It only makes an api call if you use the string version
If you get an offline player by uuid it wonāt make an api call
Which i still donāt understand how that would work. E.g. if you have a ban system and do /ban (player) u wonāt let the staff typenout the uuid
since when o.o
*type out
Since forever
The api call is to get the uuid
If you already have a uuid then ya donāt need it
Generally youād let staff type out a name and just make the web request for it
i call the api manually
I⦠okay
I DID NOT KNOW OKAY? š
Hi guys struggling with config stuff- its probably really simple but im just starting out.
In one of my classes im getting Cannot resolve method 'getConfig' in 'ShopCommand'
however everything i try doesnt fix this... ive watched tutorials, checked other code. my config.yml is where it is supposed to be as far as im aware
Wha HUH
getConfig() is a method of JavaPlugin. You need an instance of your JavaPlugin class
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
is this in the right place?
and thanks, ill look into that
This is not a config or spigot problem. This is a basic java problem.
You need your JavaPlugin object because it has the getConfig() method in it.
Your command class doesnt have the getConfig() method so you cant just call it randomly there.
Thats all it is.
i see
is that because its not in the main class or something?
sorry if these are dumb questions im trying to wrap my head around and stuff
Your ShopCommand class doesn't have a method called getConfig
I'm trying to ge the base64 from a skull when clicked with PlayerInteractEvent, but idk how to get it. Can anyone help me? Pls
to understand why the issues happen instead of just knowing the fix
JavaPlugin does
so you need to get your "main" class which extends JavaPlugin
to access that method
What version?
1.20.2
Methods dont exist in the air. You can only call a method like this
getConfig();
if this method is in your class or the parent of your class.
Otherwise you need an object of that class and call the method on the object
JavaPlugin yourPlugin = ...; // You can find out how to get that
yourPlugin.getConfig();
Well then you need to use NMS...
wrong
API contains all you need
I see, so am i like. referencing the JavaPlugin object (main class) ?
Calm down i didnt have my coffee yet
to use the method
Ik the value is in SkullOwner.Properties.textures.[].Value
Spigot has a wrapper for GameProfiles now called PlayerProfile
Get the PlayerProfile from the skull and then the skin url. Then add the url to:
{"textures":{"SKIN":{"url":"<URL GOES HERE>"}}} and convert that to Base64
This is missing a few checks but you get the general idea
Block block = ...;
BlockState state = block.getState();
Skull skull = (Skull) state;
PlayerProfile owner = skull.getOwnerProfile();
PlayerTextures textures = owner.getTextures();
URL skinUrl = textures.getSkin();
^^
And then you can either extract the URL from your Base64 value or do it the other way around
and insert the url into what olivo sent, then Base64 encode it and check for equality.
ok.. thanks
what
Thanks for help me. The last question, How can I convert it? š„²
What does 'it' refer to?
the url
It puts the URL into the string or else it gets the hose again
If you want to encode it use the Base64 class
Meaning {"textures":{"SKIN":{"url":"<URL GOES HERE>"}}} is just a String in which you replace the <URL GOES HERE> with your URL.
After that you Base64 encode the String.
Base64.getEncoder().encodeToString(string.getBytes());
I would recommend you to do the following:
- Get your Base64 string
- Use the Base64 class to decode it into a readable String
- Print out the readable String
This should make things clear
They have one in a config, right?
I want to compare the string that I've in config with the one that i get from skull
ah
Must have missed that part
Now why do you want to do that?
If you want to detect your plugin skulls you probably want to attach a PDC tag instead
This code
results in
{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/d0daf5a346a2e805c5203540925e3984fd20e6be12a74eca355fd7bf996c09dd"}}}
Process finished with exit code 0
I want to detect if when I click on a block is a skull with my base64 in config
I would recommend you to scrap the base64 String and just let the user input a skin url...
Too hard for many users
How so? Are textures always shown in base64??
I converted it but it's not equals
my base64: eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWMyMWViYzAwMzAxMmIxMjhjNTEwYTg1OThlMTM5ZjUxZjBlYzg4YmE1Y2VhNTg1ZWYwMDdlZDc1NDgzN2ZlMyJ9fX0=
converted:
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6aHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xYzIxZWJjMDAzMDEyYjEyOGM1MTBhODU5OGUxMzlmNTFmMGVjODhiYTVjZWE1ODVlZjAwN2VkNzU0ODM3ZmUzfX19
Print out both decoded strings and check for diff
Looks easy enough to me...
Now watch them try to find that
and in this method I only need to check strings?
I mean... its right below the base64 on head database
People don't read nor scroll down
You are almost there. Just go through with your base64 then. Only missing two quotation marks
oh, where? ahaha
Yeah it's missing the " "
If I do Scoreboard.Team and then getEntries() how do I cast it back to players?
They are the player names, right?
are you trying to get the head or the skin?
yeah
There you go
Just seems a bit weird due to Name not really being a great identifier but I guess its enough
is there a wait to load a world and then on its load teleport a player to it
Yeah you should probably wait a few ticks
yeah I know but there is like no other way then to do a runnable that checks every x seconds if its loaded right?
or u could rely on WorldLoadEvent ig
yeah that makes sense thanks
This my daily reminder that spigots world management system is very outdated... I think a callback would be nice.
hidePlayer is my best bet from having multiple Player tab lists on the same server without using Packets right?
Heads use the skin texture
So there's no difference
does any of you know how to changes sources jar base name in gradle?
jar {
archivesBaseName = "your name"
}
only changes the jar file that's being built
Set archiveBaseName in the top of your gradle file
instead of only in the jar scope
Do you have the java plugin?
Isnt that a jar prop?
It defaults to project.archivesBaseName
plugins {
id("java-library")
id("maven-publish")
}
No idea what the difference is
but I assume Java is what you want since that's what it defaults to
Default with java plugin:
project.archivesBaseName
Gradle jank as usual
ok its a complimentary plugin
so basically you use java as a core, and then java-library if you want additional features
nvm
even with java plugin installed it doesnt work it throws the same
^
Try skipping the project. part š¤·āāļø
Are you using Kotlin or Groovy?
plugins {
id 'java'
}
group = 'io.github.olivoz'
version = '1.0-SNAPSHOT'
project.archivesBaseName = "abc"
This works for me
That's my entire build.gradle
Intellij can't find the archivesBaseName but it does run and work as expected
kotlin
Hello , i need help with mongodb, i have it installed on my vps , where the server is running , but for some reason it does not connect :
i created new db with a user , pass and added them
I can't even get Intellij to give me syntax completion on my kotlin gradle file
Everything is red
it does work though
(not the basename)
Kotlin is pain
Deleting .idea folder fixed it
š¤·āāļø No idea how to do it in Kotlin
and this why I use groovy with Gradle
mm can you send me an example one?
oh wait are you hosting MongoDB yourself?
Are you running the server or MongoDB in a container
what i must do to fix the issuse :p
You can't use localhost as the ip
public ip?
what i should do then :L
Try host.docker.internal as the ip
Alright
try
tasks.withType<Jar> {
archiveBaseName.set("your name")
}
(that changes it for all tasks of the Jar type; if you want only a specific one, tasks.named<Jar>("sourcesJar") { /* ... */ } should work)
How can I hide a death message from some players? IS ther something like viewers like with async chat event?
i found a better solution
tried it , but it didn't work
by encountering random google's kotlin build.gradle.kts
its just ```gradle
base {
archivesName = "${rootProject.name}-api"
}
on kotlin
works perfectly now

Do you guys know where we could learn more about the configuration section? because I'm not clear on how it works
?jd-s
what are the benefits of making spigot a debug server?(https://www.spigotmc.org/wiki/intellij-debug-your-plugin/)
Read the first section of that wiki page
anyone know what these are called, they show infront of variables in methods
hints
Show parameter name hints is the setting if you want to disable it
im changing the code and i dont see the changes in game
i was checking if there was a setting to show it for all params, inlcuding same named ones
Inlay hints
i dont see anything in it hiding same named ones which i wouldve thought is a setting
why I get null when im trying to get block that's hit by XP potion?
Javac inlines constants even in methods right? So
static final int A = 0;
static final int B = 1;
method() {
doSomething(A ^ ~B);
}
Would inline the constant?
Could also be an entity
Yes
I found that out when i used my decompiler
I thought i was a smart ass from saving my string as a constant
Just to find out that in the code it was a constant and inlined
Probably the constant was to keep reflections working
Yeah I recall bstats having to go to great lengths to prevent constant inlining working
Now that I think of it, my question was completely unnecessary... oh well.
Reminds me of CraftBukkit main
mfw they could have used String.join instead of whatever they did with a byte array lol
what
You can also smash an XP Potion against a player iirc
Yeah you can smash it against any entity
always null
?jd-s
It cannot not be null
The constructor doesn't support it
Probably a bug though. Might be worth reporting it to JIRA (I won't do it though as I have yet to sign the CLA)
That is not of relevance
It is always null
As the constructor does not support setting the block
Or the entity
And there is no setter method as far as I can see
Idk why it extends projectile hit event if it doesnāt include the hit block or entity
Thatās kinda silly
This is entirely spigot's fault and there is nothing you can do outside of hacky workarounds.
I can look into making a PR
so its been an issue for a long time
PotionSplash seems to have a similar issue
cuz it happened to Kody the same way 2 years ago
Yeah they will not simply remove some fields without replacements
But not adding fields is nothing new.
I expected more from spigot lol
I've taken a look and paper doesn't seem to support it either
Who did
ExpBottleEvent derives from ProjectileHitEvent
Show the CraftBukkit impl. Doesnt it derive the hit target from the bottles location?
Doubt it
If not then Booo
Otherwise projectile hit would do the same
why is it so hard to develop such simple thing in gradle
everything
works
now for some reason intellij doesnt detect sources.jar
inside .m2 folder
i want to have source files for comments proper argument names and .jar file for compiling against it
it exists it just doesnt detect for some reason
click that + button
And this is why I love eclipse's maven integration
can't say I've had that issue though usually refreshing intellij fixes that stuff
It automatically detects from which project individual dependencies come from and links the projects together
ok
But sadly that is not possible under gradle by design.
- button would work but then its complain that im doing work which is outside gradle, so it wouldnt be persistent
it's a warning that it might not be
not that it'll be removed the second you click ok
there has to be a better way
Is there something in the API nowadays so that you can just link a new nether and end to a new world so that it can have its own dimensions?
ok this is so weird
i clicked on to decompile
with fernflower right
when you ctrl + leftclick
and then clicked download
use vineflower
and somehow it retrieved it
and now it works
it simply found the sources in the .m2 repository instead of download and it applied it
epic intellij moment
for some reason or another it didnt automatically
the fact that i even invalidated cache and it didnt work
is really messed up
i've wasted 3 hours
to fix this
nonsense
great
Yeah it just... doesn't
wow š
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
What am I doing wrong here? I created two projects, one is a Spigot plugin and a second is supposed to an API. I installed the API through maven local repo and all worked great until I started the server with the plugin
log: https://paste.md-5.net/peniserozi.md
spigot plugin: https://paste.md-5.net/nevakujome.java
api code: https://paste.md-5.net/esojizeweb.java
The server has no idea what your api is
You need to include the code somewhere
Either have it as a separate plugin or shade it (include it) in your plugin jar
Well, how would one shade it?
could've just said to change the scope from provided to compile
I am using entity.setGravity(true); and the custom entities are still floating. Is there a method i have to call how some objects have the .update() method?
what entities
no
custom entities as in nms?
or just bukkit custom
just bukkit custom
then you should see changes as soon as you do them
im using normal entity spawning then modifiing the data contaiuner to hold info
They should have gravity by default
would ai being false have to do with it?
yes
yea
oh then how do i enable gravity without them pathing
If you still want them to have gravity use setAware instead
oh ok
that worked thanks
im glad it was something simple
hey so i have made a custom item with a right click ability when it is on offhand, it works as intended but when i have the item in offhand and i want to do other right click actions like eating food it activates. i only want to activate it when it is offhand and when player right clicks and not when he is eating food open chest etc
sorry if this is hard to understqand what im saying
First step ist checking the Action of the PlayerInteractEvent
can i show you my code?
tried with "MultipleFacing" but it doesn't seem to work for wall
https://paste.md-5.net/hepiyezesi.java here is my code i only want this to apply to ItemInteractEvent i t would be a lot of help if you could help me
im kinda new at this so it would be nice if you explain it to me..
Yoiu should use PlayerInteractEvent#getItem
public void onFish(PlayerFishEvent event){
if(! (event.getCaught() instanceof Item item)) return;
ItemStack stack = item.get...
}
this about right? i havent worked with fishing before
Im on my Phone with not enough patience to read kaioken code rn.
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
okay
I need to create a plugin for a private chunk system. I need to create entities around the perimeter of the private area and delete them when turned off. And then, when turned on, upon loading the chunk, create them.
What is the best way to store information?
Via PersistantDataContainer in chunks or MySQL?
depends how much data u need to store
if its something like 'chunk belongs to player x' just throw the players uuid into the chunk PDC
The name of the kingdom, the coordinates of this chunk on the private map.
that is, 2-3 values
Entities get saved with the chunk. Why manually save them yourself?
I donāt think itās completely correct to save 12 entities for each chunk by uuid and then restore them
so it seems like it would be easier to recreate them
If i changed persistantDataContainer should I somehow set it to old itemMeta? Or something like that would work?
ItemMeta itemMeta = item.getItemMeta();
PersistantDataContainer itemTags = itemMeta.getPersistentDataContainer();
itemTags.set(key, PersistantDataType.LONG, value);
item.setItemMeta(itemMeta);
Sick fucking speeds
Ok apparently paper's repo is down loool
Not loading
Welp
sorry that was me
What else?
my motivation
All good, please get it back up I want to have my compilations be under 3 minutes
no can do
Not them
probably cloudflare issues
Is there any way to duplicate a world without messing directly with the files?
Yep cloudflare
thats not a cloudflare issue thats a paper issue
that screen means the repo is down and cloudflare cant access it
Yeah
if that screen didnt appear it was a cloudflare issue
with the fact that loads of stuff is down theres probably some ddos proection failing somewhere and its causing issues
oof
Wouldn't happen to build tools
dropItemStack(location,contents[i] = null);
this passes the value, then sets the array entry to null, correct?

better to use spigot api
first content[i] becomes null then null gets sent to the method
create a new object
and i think it had create()?
dont think so
somethings wrong with my code it creates a file named ColdForge instead of a folder with a file in it: https://paste.md-5.net/ogatohudav.java
show ur usage
YamlConfig config = new YamlConfig("test/test.yml")
and you get a file called test/test.yml?
no i just get a file named ColdForge in the plugins directory
i know but it creates a file instead of a folder
like there is just an empty file called "ColdForge" in my plugins folder
you should use Path.of and then call extend on getDataFolder().toPath() iirc
then your configuration doesn't parse well /
whats a lightweight hologramm api
It's called resolve
@celest notch
wait i found a different file in a different one of my plugins will this work: https://paste.md-5.net/icufurikir.java
Call .toFile() on the result
File dataFodler = JavaPlugin#getDataFolder();
dataFolder.mkdirs();
File customConfig = new File(dataFolder, path);
It isn't working according to him
pfff imagine not using java nio
is there a reason why most people type # instead of .
saying JavaPlugin#getDataFolder refers to an instance of JavaPlugin, saying JavaPlugin.getDataFolder may infer that its static
^
like ideally i want to just input a string: "data/config.yml" and for the plugin to create it in the full path: ".../plugins/ColdForge/data/config.yml" how would i do that
then inside your class make it so plugins coldforge is the default
and append the string above
You get your "data" folder with new File(JavaPlugin#getDataFolder(), "data")
Then you can create dir if it doesn't exist
this is perfect ^
And get config.yml same way
JavaPlugin#getDataFolder() will return the coldforge folder in my plugin
that is exactly what you want
how do i add the additional path
Altrough idk why you want config to be inside data folder, spigot provide api for config already
I just showed
Can't read minds. You never showed your pom. Also don't forget the relocation part
new File(parent, "data")
Does player.teamDisplayName() only work with the MainScoreboard?
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
My bad I assumed it exists in both
public static boolean isLookingPlayer(Player player, LivingEntity playerToLook) {
Vector playerDirection = player.getLocation().getDirection().normalize();
Vector playerToLookDirection = playerToLook.getLocation().subtract(player.getLocation()).toVector().normalize();
double dotProduct = playerDirection.dot(playerToLookDirection);
return dotProduct > 1;
}
gecause dont go?
the dot product will be wrong if the other player is really close
not sure how you would properly fix that
Mm
because this only does the angle for 2 small points
How can I draw a String on a 2d graphic in a headless graphic environment?
and it only works if there's a bit of distance, otherwise you won't even see the point
Is there any api that helps you do these things or do I have to do everything by hand?
ImageBuffered
Graphics
wait, hge
i don't know that
Yep
Like you don't what that is or the solution?
i don't know how hge works to display stuff
But I don't display it
you can get the size of the font this way
I just create a graphic, draw on it and get it's bytes
It's for map image rendering
The font is the problem
All the other things work
Except the Font
can i do it?
i think you have to use 3 dots
lol love the drawing
1 for head, 1 for middle and 1 for feet
this way, you would cover most of the angles
but still not sure how well it would work if close enough
might wanna check the angles you're getting
5: hitbox vertices (4) player vector (1)
i don't understand exactly
you have 5 points?
4 on some hitbox verticies?
and a player vector as in where he might be?
i see
what if he is close enough so he doesn't see neither hitbox verticies nor player look?
for example when he looks down when hitting a player with a sword
are the verticies calculated so they're always aligned this way towards the viewer?
however it should see that it is inside the hitboxes, however the player is seeing the player
public static boolean isLookingPlayer(Player player, LivingEntity playerToLook) {
Vector playerDirection = player.getLocation().getDirection().normalize();
Vector playerToLookDirection = playerToLook.getLocation().subtract(player.getLocation()).toVector().normalize();
double dotProduct = playerDirection.dot(playerToLookDirection);
BoundingBox hitBox = playerToLook.getBoundingBox();
Vector playerEyeLocation = player.getLocation().toVector().add(new Vector(0, player.getEyeHeight(), 0));
return dotProduct > 1 && hitBox.contains(playerEyeLocation);
}
??? i dont know
oh
so you're trying to check if the player is inside?
the dot will fail even if not inside the bounding box
so you can't do this sadly
also, it has to be or instead of and
he looks at player or inside the hitbox
i recommend you try what i said
and try to see some dot products on a test server
so you can do it as best as you can
how do i get item meta of PlayerBucketFillEvent using getBucket()?
i need to check if bucket has customModelData and other
i need to check item before event and after
is there any VarInt calculator or implementation that I can use to test my own implementation
of minecraft varint32's?
yea, but those are pseudo code
oh
i've already written my own implementation it seems its working but im not sure
but the event should be triggered after?
and i've written it in powershell lol
getBucket is before event but i cant get data from it
No they're not?
so you can use player/getiteminmainhand @plush sluice
in the event
this one should be before any change
function Get-VariableInteger {
param([int]$integer)
$dataMask = 0x7F
$signMask = -bnot $dataMask
[byte[]]$data = @()
while ($true) {
if (($integer -band $signMask) -eq 0) {
$data += $integer
break
} else {
[byte]$fragment = $integer -band $dataMask -bor 0x80
$data += $fragment
$integer = $integer -shr 7
}
}
return $data
}
function Read-VariableInteger {
param([byte[]]$data)
[int]$integer = 0
$dataMask = 0x7F
for ($index = 0; $index -lt $data.Count; $index++) {
$integer = $integer -bor ([int]($data[$index] -band $dataMask) -shl ($index * 7))
}
return $integer
}
this is my impl of varint32 on powershell but im not sure if that's correct
Why Powershell š
im working on one mini project
so?
and i need to implement it on powershell
i have uni assignment
and im looking forward to write code to do server ping
from powershell
to retrieve the server info from powershell
is that actually power shell?
yes
that's pretty cool
Use bash š
I can't
also Powershell is not that bad
after learning it i've set it as a default in windows
Why not?
i have uni assignment
yas
You can always test your code with some values
its seems deterministic i input any value with Get-VariableInteger and use Read-VariableInteger and it seems to return the same values
wiki vg does provide that too
public boolean playerAreBeingWatchedBy(Player player, Player targetPlayer) {
Vector playerDirection = player.getLocation().getDirection();
Vector targetDirection = targetPlayer.getLocation().toVector().subtract(player.getLocation().toVector());
playerDirection.normalize();
targetDirection.normalize();
double dotProduct = playerDirection.dot(targetDirection);
double threshold = 0.8;
return dotProduct >= threshold;
}
go?
trying to get a NEXT value from a list , for example
getNextRank(String rankName); ... [this is in RankManager]
and each player have a Profile Class , with kills , deaths , CurrentRank ..
so i can just do rankManager.getNextRank(profile.getCurrentRank)
iam trying to do that , but it seems to be not working , i tried LinkedList
but i think i used it wrong
this is how iam doing it , but i think iam doing it wrong , very wrong
any ideas?
what iam trying to achive is a /rebirth command , so when player reach last rank or Prestige , he can rebirth it will give him some benift ..
dunno who gave me this idea, but setting the material of a potion to Potion doesnt do anything to the potoin itself.
also i want to make it into a thick potion, but there's no such potionEffectType
wait is it potionType
yep it is
I have a question about making health bar plugin for enemies, do I just make a listener on entity damage and check if it's a mob and then add a health bar by getting their current and max health?
or is there something that I dont really get?
What approach should I take about saving personal players' info in my plugin's folder, without the server owner being able to access the info?
I can't find a way to access players' PCD, but even if I do, how do I verify that a server owner won't be able to read the data?
I use spigot 1.8.8
It's a big problem because I want my plugin to be cross-version
any idea :p?
you'll essentially need to reimplment PDC with yourself
use NBT in old versions
but make sure to put it in the same format PDC is in
then you can begin Using PDC once you reach 1.14
?pdc
I am a bit confused, how can I get max health of entity?
or do anything in regards to their health?
getAttribute(Attribute.GENERIC_MAX_HEALTH)
You need to check if it's a living entity (or just attributable) first
So do an instanceof check and cast
I didnt do it correct, right?
do if (entity instanceof Attributable attributable) {
instanceof indicating that if true the Entity is inherits Attributable
Ah rip old java
what version you coding for
17
like mc version
1.20.2
upgrade to java 17
I have java 17
are you using maven?
yes
?paste
send your mom
kek?
what
when a shulker is broken, and you're in it, it fires the inventorycloseevent. why is the inventory obtained through the event not accepting changes when the shulker box is broken? breaking it returns what appears to be a copy, but closing it appears to return a reference
yes i checked, both instances return an inventoryType of shulkerbox
<java.version>1.8</java.version> alr so this property indicates your java version
e.g. if you want to support java 17 you need to change it to 17
oh
Probably because the inventory no longer exists anywhere in the world.
do I just change it to 17 and thats it?
any idea how to reliably manipulate it?
yes
you might need to reload your maven project
yes
click it open then press the reload icon
Not to my knowledge. Would probably need to do some other form of event checking to do whatever it is you're trying to do.
how can I get current health of entity?
Entity doesn't have getHealth()
LivingEntity does
check if entity is an instanceof a LivingEntity
then cast to LivingEntity
then you can get health
this is java 17 not java 8
instanceof can do short casting
LivingEntity also extends Attributable so you dont need to do an unsafe cast to Attributable