#help-development
1 messages · Page 756 of 1
in your opinion
and also using final should make JIT/GC an easier job
I disagree. Inferred types can be obstructive.
i like seeing the Type right away
yeah but intellij already shows the type so uh
var is inferred and written out during compilation
so it doesnt really changes anything at the end right?
You cant use features of a specific IDE to argue for code quality
and i think what i wrote looks better becuz everything is on the same line lol
Wat if youw coconspiwatow doesn't uwse intewwij doe
Since
var x = new Object(){
Object y;
};
x.y is valid here
yep
What is this?
Ah wait, its adelemphii...
also what the hell is this syntax
🐦
banned
It's mwy hawwoween costume
you can do this???
myews
Deceiving name
yes
var allows
intersection types
variable types
anonymous types
Look how var confused you there
But rejects null types
so all along js object were java objects
This guy is trolling
lol well I guess you could say that
In js nothing matters and everything is an illusion.
They dont do anything.
I use it in multithreading all the time to control weak, soft and phantom references mostly else there is little reason to use (unless you want like an effectively final variable)
thats cool
i dont really do multi threading however i seen horrors of low level multi threading in rust
except throwing Stream.parallelStream
yeah, well java is kinda nice at it, but once you wanna optimize things to get a higher throughput it becomes a mess
how to require permissions for commands? Is there any guide?
Explain pls
Easiest way is to give them a permission in your plugin.yml
Throw it in your plugin.yml
weak means that the value stops existing after becoming null i think
hi, I've asked earlier about custom heads in 1.20.2, as base64 method seems to no longer work. Now I'm using setOwnerProfile, but it's not loading any textures - I'm seeing only cached heads from earlier versions, other players see all heads as steve/alex. Am I doing something wrong? :?
Where?
I know what those references are you onion. I was asking how he is using anonymous objects like that to control those references in a multithreaded environment
Under the command
):<
yes there
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
i got it
permission: plugin.fart
yeaaah i understood sorry
im not an onion
onion types do not exist in java https://cdn.discordapp.com/emojis/1143967193038589992.webp?size=48&name=DelGatinho&quality=lossless

let’s say you wanna avoid ReentrantLock or synchronized (since they’re by implementation equivalent almost, except ReentrantLock has fairness and is a bit more object oriented) then the other option is to go with StampedLock, and perhaps use optimistic locking for reads as an example, this is much more bug prone and needs a lot more testing, let’s say you wanna go without locking, yet you don’t wanna use volatile since it enforces cache flushes and memory order effects that greatly impact performance, that your only option is VarHandle, where you use weaker types of memory ordering effects, but at the cost of being much more bug prone
I was just asking bc i would rather use an atomic ref than sharing objects through an array or anonymous object
Problem with atomic ref is that it uses volatile
And volatile enforces cache/registry flushes
And it enforces memory order effects by the semantics of volatile
too many magic words
Doesnt it prevent caching in the first place?
Ugh, well sorta, it makes sure the value is always up-to-date
Because of the aforementioned 2 things it guarantees
Well, ok you loose some CPU optimizations either way.
There should be something cooler for creating a shared scope other than anonymous classes tho...
so doing a compare and swap implementation becomes possible with it (assuming you wanna update a variable based on its previous value concurrently)
yeah def lol
I mean we had MutableObject from apache
But apache is gone now right?
i think so
Anyway for a spigot plugin, one can prob use volatile just fine lol
In spigot anything goes. lol
Reminds me to read a few of the newly released plugins again 🙂
Anything
No one had this issue? I saw a lot of plugins having issues with skull textures also :/
Just sort by submission date, look for one without a picture and you often get a bonus read if they use a foreign language.
Preferably with an angry one start review.
huh
Spigot has an API for GameProfiles and textures now
I think they are using it
Block block = ...;
Skull skull = (Skull) block.getState();
PlayerProfile owningProfile = Bukkit.createPlayerProfile(UUID.randomUUID());
URL yourSkinUrl = ...;
PlayerTextures textures = owningProfile.getTextures();
textures.setSkin(yourSkinUrl);
owningProfile.setTextures(textures);
skull.setOwnerProfile(owningProfile);
skull.update(true); // Not sure if needed
No idea what he means by base64
base64 of the url
Well its just this weird nbt string {{"textures": { "url" : "some urls" ... or whatever.
No need for that
It's http://textures.minecraft.net/texture/<base64>
wolf head
This... is the ID of the texture. What should be base64 encoded in this URL?
It is base64
Alright. Whats encoded there.
Ah wait no, the entire url can be base64 encoded
Which looks like this
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjhkNDA4ODQyZTc2YTVhNDU0ZGMxYzdlOWFjNWMxYThhYzNmNGFkMzRkNjk3M2I1Mjc1NDkxZGZmOGM1YzI1MSJ9fX0=
The base64 String which are usually shared look like this decoded:
{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/ef13b7b3d50e072c5d1b3c5121ea2e59e21fddfa5386cc0cf6ee131983a25e45"}}}
All good
Ok, so with a bit modified code to get it as itemstack instead of block, it's still showing me only cached skins :/
public ItemStack generateSkullWithURLTexture(String URLTexture) {
ItemStack item = new ItemStack(Material.PLAYER_HEAD);
SkullMeta skull = (SkullMeta) item.getItemMeta();
PlayerProfile owningProfile = Bukkit.createPlayerProfile(UUID.randomUUID());
URL yourSkinUrl = null;
try {
yourSkinUrl = new URL("http://textures.minecraft.net/texture/" + URLTexture);
} catch (MalformedURLException e) {
e.printStackTrace();
}
PlayerTextures textures = owningProfile.getTextures();
textures.setSkin(yourSkinUrl);
owningProfile.setTextures(textures);
skull.setOwnerProfile(owningProfile);
item.setItemMeta(skull);
return item;
}```
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof LivingEntity) {
Player player = (Player) event.getDamager();
LivingEntity entity = (LivingEntity) event.getEntity;
if (event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
//do things
}
}
}``` is this gonna work to see when a player shoots someone?
then how should I do it?
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Arrow a && event.getEntity() instanceof LivingEntity && a.getShooter() instanceof Player player) {
Entity entity = event.getEntity();
if (event.getCause() == EntityDamageEvent.DamageCause.PROJECTILE) {
//do things
}
}
}``` so I dont need event.getCause then?
Don't think so
thx
This would be the naive approach
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
Entity defender = event.getEntity();
Entity attacker = event.getDamager();
Player defendingPlayer;
Player attackingPlayer;
if(!(defender instanceof Player)) {
return;
}
defendingPlayer = (Player) defender;
if(attacker instanceof Projectile projectile) {
ProjectileSource source = projectile.getShooter();
if(!(source instanceof Player)) {
return;
}
attackingPlayer = (Player) source;
} else if(attacker instanceof Player) {
attackingPlayer = (Player) attacker;
} else {
return;
}
attackingPlayer.sendMessage("You attacked " + defendingPlayer.getName());
defendingPlayer.sendMessage("You got attacked by " + attackingPlayer.getName());
}
I just assumed they only cared about arrows and not melee
hey i am using nms on minecraft 1.20.1 with spigot using mojang-remapped maven but i only can use it in my server using SpecialSource and that make the shaded with remapped special jar so how can i make plugin can be shaded with dependcies and remapped by SpecialSource?
Mappings are just a thing for you to use locally.
Make sure you include the maven plugin that md provided so that the mappings can be turned back into the obfuscated values once compiled.
Maven should produce a demapped jar with all dependencies
*If you use the SpecialSources plugin
how to do that i've used but it look like be the orginal not shaded
Just compile using one of the maven lifecycles
Make sure you include the plugin. https://paste.md-5.net/uleqazexug.xml
Replace the values with the mc version you are using. Then just clean package. It should produce a jar file that the server can use.
why is there such a delay
i think his server tps or ping is low
Ah okay
I put the open in a 2 second runnable delay
I was worried the code was actually that slow :p
lol That'd be scary
yes, I did😹
and just defending entities, not players
just to calm you down
final InventoryView createdView = menu.create(player, menu.getKey().getKey());
TestPlugin.thenLater(() -> {
player.openInventory(createdView);
}, 2);
lol
That probably is a runnable
it's not an actual method
ohhh
public static void thenLater(Runnable runnable, long multiplier) {
Bukkit.getScheduler().runTaskLater(instance, runnable, 20L * multiplier);
}```
Just a custom static method they made
i suck ,sorry
Yeah
Coll this new Container API is awesome
creating InventoryViews and not having to open them is lit asf
kind of but you can view the containers
also Virtual Containers are non functional
because Containers themselves don't tick
e.g. things that aren't possible are working furnaces, brewing etc
because that would require a block in the world to tick
Yeah
Or manually ticking the ui somehow
Wait, could I make a furance ui and tick it via a scheduler
Or is that not possible
yeah it'd be weird
essentially you'd need to create its tile entity
then tick it manually
ah
wait, does this mean that Bukkit#createInventory ticks?
Bukkit#createInventory doesn't work for furnaces
the furnaces don't work
it does create a FurnaceInventory though
I tested it, I mean I haven't changed that API and the furnaces don't work
hmm what about using chest and glass_pane to make the furnaces UI?
and use 1 glass_pane to make like how long it burn
it'd be better off for you to use the actual FurnaceInventory though and tick it manually
^
something like that just isn't ideal for actual API though
oh so the containers actually tick but not bound to world
the Container doesn't tick the TileEntity does
the container is simply what it looks like
and if you have one that isn't bound to a tile entity
hmm
It no tick
so doesn't that mean both container and createinventory are the same then?
no
createInventory is ambiguous for what is and isn't a container
it is a meshing of Inventories and Containers and it should be phased out
lets think of an example. For example AnvilInventory
CraftAnvilInventory actually has ContainerAnvil as a parameter. Which is a no no, because Inventories shouldn't have a clue about the data the Container has. Think of a Container as what happens when you're viewing the Inventory. The Inventory is as simple as the contents the Container has
Is there a way to check if a instanced class had run a function and then run a function in the class where it was instanced?
Hello , anyone good with gson , json?
i have a bit of a problem , so each time i add something new to the plugin inside the settings.json , i must delete the version on the server and let it recreate the new one , how i can make it so it auto-update?
go through the jar's settings json and add to the file what the jar has and it doesnt
iam doing something like this to load it
you can get one of your jar's files with
InputStream defaultStream = plugin.getClass().getResourceAsStream("/settings.json");
youw awe a wiar
json is better in some cases only imo
i just liked the design of the file that's all
in most cases :3
that's why i went with json
json is better at storing data and yml is better for configuration files imo
Ya
You mean mojang-json
ur a snbt
hello, with protocolelib, PacketType.Play.Server.TAB_COMPLETE also works for PlayerCommandSendEvent?
uhh , so what i can do i liked the converstion you guys did but i still don't know what to do?
Load the config check if there are new values that need to be added, add them and save the file
No need to write to the file if there are no changes
yay my script finally decodes something into readable form, now what's left is to handle tcp exceptions
is that powershell script
yes

i've made a cmdlet for powershell to get the minecraft server status
i was forced to do it in powershell dont blame me
What IDE is that
ah

?nms
what was that page where u can see difference between spigot and mojang mappings after using mapper
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
toml is superior
toml screeching in confusion when you ask for that nested block
i never felt like yaml was missing anything really
I love 0 visual feedback of data relation in my config lang
command.no.permission=%red%You do not have permission to execute this command
command.player.required=&red&You must be a player sender to execute this command
command.no.group=&red&You are not in a group that can be valued please join one in order to calculate worth
scan.current=&red&You are already scanning you must wait until your current scan finished until you scan again
scan.start.self=&gold&Started a scan this could take a while
scan.start.all=&red&The server has begun recalculating all town values, you won't be-able to calculate your worth until this has finished
scan.complete.self=&green&Finished scanning your group, your worth is now {worth}
scan.complete.other=&green&Finished scanning {group} their worth is now {worth}
menu.top.title=[Group Top](dark_gray)
menu.top.background.name=
menu.top.skulls.filled.name=[{group}](gold !italic)
menu.top.skulls.filled.lore=[Worth: {worth}](green !italic)
menu.top.skulls.empty.name=[Not Filled](red !italic)
menu.overview.title=[Group Worth Overview](dark_gray)
menu.overview.background.name=
blocks.iron_block.name=[Iron Block](white !italic)
blocks.iron_block.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.gold_block.name=[Gold Block](yellow !italic)
blocks.gold_block.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.diamond_block.name=[Diamond Block](aqua !italic)
blocks.diamond_block.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.emerald_block.name=[Emerald Block](green !italic)
blocks.emerald_block.lore=<[Amount: {amount}](!italic)<[Total Value: {value}](!italic)>
blocks.spawner_pig.name=[Pig Spawner](light_purple !italic)
blocks.spawner_pig.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
blocks.spawner_blaze.name=[Blaze Spawner](gold !italic)
blocks.spawner_blaze.lore=<[Amount: {amount}](!italic)><[Total Value: {value}](!italic)>
I use json for everything and everywhere
basically .properties 😛
:basically lol
sept hte lists are <item1><item2>
I'm too lazy to include proper lists into my parser
hi , so after further reaserch about the topic , i couldn't find any links or anythink that can help me out with it [auto set missing values in old json file!]
i only found yaml , and that would not help .
iterate through new json object entries and !if oldJson has propertyName add property
idk if there is anything built in into gson
How to check if player is in the group of luckperms?
tried that , but it still not adding the values ..
that whole instanceof and cast is redudant i think
also i assume you never saved new json object into file ?
Oh how nice switch expression pattern matching would be here 
switch (defaultValue) {
case JsonElement element -> data.add(fieldName, element);
case String string -> data.addProperty(fieldName, string);
case Number number -> data.addProperty(fieldName, number);
case Boolean value -> data.addProperty(fieldName, value);
default -> throw new UnsupportedOperationException("Unexpected value type.");
}```
We love J21
is that in java 21 xD?
well is it backwards complatable?
No :p 21+
😦
world if minecraft updated to java 21 so we can use this feature
maybe next update they wil
Seems like an annoying hurdle for some
they are able to install java 17 and 8 why cant they install java 21
also if you are running server at least know how to install java right?
I use same java MC requires
no more no less
if a plugin required me to change java versions I'd just throw it to the road its not worth the seconds to switch my sdk
sdk install java 21-graal https://cdn.discordapp.com/emojis/1045365302516518962.webp?size=48&name=Peblo&quality=lossless
then why r u using sdk if you dont want to switch tools, thats the whole point of sdkman
Hi, I have an Inventory of Type Crafting but for some reason I cant use the recipe book (when clicking the recipes are not shown)
but for example with my Furnace inventory it works...
Any ideas?
I only go back as far as java 10 now
and all the plugins will work with java 21
Java 10?
no one uses java 10 nor java 9
soo , any idea on how i can fix it ,-,
People still use that?
idk
well 11 really, but will work on 10
Fun fact still using java 8 xD
java 8 shouldnt be used
Crafting = Player Inventory
WorkBench = Crafting Bench
WorkBench
Im dumb Im using WorkBench sry
But the book still doenst work
what are you doing with teh bgook
yeah :( I'm dealing with that mess right now don't remind me InventoryType exists please
I just want something so people can look up recipes but in the inventory when clicking on the book and then on a recipe the recipe doesnt show up
InventoryType exists
(:<
unsure tbh RecipeBook is weird
still struggling ..
Hi guys, do any of you know how I can get around this accepting only Bukkkit ChatColor? Or does anyone know another way to change the color from player name to RGB colors? 😄 admin.setColor(ChatColor.of("#634125"));
spam ping choco to bring component support into the rest of the API
until then, well
there is spigot's RGB syntax, which is great for bleaching your eyes out
§x§6§3§4§1§2§5
How do I apply this then with setColor? 😮
😐
so teams don't support anything but the inbuilt colours iirc
so that method actually makes sense 
hm okay 🥲
guys don't get rid of legacy it still makes sense
I hate the enchantment table
this.creator.put(MenuType.ENCHANTMENT, custom((i, playerinventory) -> new TileInventory((syncId, pi, entityhuman) -> construct(ContainerAnvil::new).apply(syncId, pi), IChatBaseComponent.empty())));
so much code just so it works

I am a wizzard
not that many exceptions with MenuType though surprisingly
I am sure the PR graveyard will be happy 
it will be
well my main goal is to get this stuff to work with the old API so hopefully MD spares me from the graveyard
and yk what I will merge with master every update :P
Ping me once you open the PR, I am sure paper peeps are interested in it as well
ahh okay
tryna get feedback tbh
wanna make sure I'm not doing some fucked up shit without knowing
let me tell you
trying to fix teh AnvilInventory
almost killed me
Yeaaa
o:O

yeah not my proudest moment but the only other solution is to just
remove the other AnvilInventory and make a new one
Lets just say I prevented the same mistake with EnchantInventory luckily
nah not getting this one I got it on lock
paper is going to do it better 😭 but its okay
I'm doing it for upstream
We don't wanna steal the PR xD But with larger rewrites we obviously have an intrest that it lands well on upstream too
yeah lots of stuff to iron out
maybe move around some things. The hardest part of this is to figure out Virtual Inventories
I didn't realize CraftBukkit had other API for seeing container data. too bad it is not very good. Just threw Deprecated tag on that
- public abstract class InventoryView {
+ public interface InventoryView {
I wonder how many plugins are gonna get fucked
not your fault, they are not allowed to implement API types xD
but like
I am sure some fucker out there is
I remember when I added a non default method to InventoryView we actually got a PR about it
that surprised me
like who TF extends InventoryView and why
whenever I have these questions of "who the fuck woul do something so increadibly hacky and dumb"
I generally ping @covert valve
maybe above and beyond
hey hye hey
whats up lynx how can i curse things
LMAO xD
give us exploits
can you come up with fun reasons on the spot to extend InventoryView
no
I wonder if MD will even approve of this change if he doesn't I gotta do like a generic getData for InventoryView
it'll be cursed
okay nice
that is a good sign xD
if auxilior cannot come up with something cursed on the spot
whenever I do weird things with the API its not for the sake of being cursed, it's to make things have a clean developer / user experienced
💀
so like, you know he is crazy
me when i extend OfflinePlayer
i've never extended block
You implemented it 
i was considering extending block and then promptly realised it was a bad idea
the consideration is enough
yeah i threw that idea out of the window when i realized it wouldn't even work
you will forever be my goto curse guy
thanks lynx x

I accidently made a change to the ContainerSmithing patch now I can't undo it 😭
try harder
btw I think Preconditions.checkNotNull was a trap
🤷♂️
not too sure
but iirc it throw NPE
not IllegalArgument
which, kinda defeats the point
ill preconditions you

guh why would it do that
its annoying because checkArgument is longer

if I wanted to throw an NPE I'd use Objects#requireNonNull
a bunch of materials basically
the tags are backed by the internal registries 
mhm
Which can be modified by datapacks
Would it be stupid for a datapack to assign the wool tag to an egg? yes
I mean yea but wouldn't you want to recognize datapack changed stuff

How can I iterate through every child node of a BasicConfigurationNode in Configurate ? I tried using node.childrenList() but that does not appear to be the correct solution. What I'm trying to accomplish:
{
"messages": {
"message1": "value",
"message2": "value"
}
}
I've got the messages node and I now want to iterate through every message and get both the key and the value of it. I'm using this code which, according to debug, does not iterate through anything (probably because I misunderstand childrenList):
for (message in primaryNode.childrenList()) {
// i debugged values of message.key() & message.string before I null-checked them and I got
// nothing from that debug, so i'm sure that childrenList is just not what I'm looking for
val termName = message.key()?.toString() ?: continue
val termValue = message.string ?: continue
}
Please please please ping me if you answer because I'm going to bed. Thx ^^
you'd be looking for childrenMap instead of childrenList
hello, I have a question, with protocol lib i try to use PlayerCommandSendEvent with packet (this event got called when the player join the server) is that?
https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/PacketType.Play.Server.html#TAB_COMPLETE
i am not sure because PlayerCommandSendEvent is not really tabcomplete because tabcomplete is sended 1 once only but i don't find other packet type
thanks
Why do you want to use ProtocolLib in this event, and what do you want to achieve?
the equivalent of PlayerCommandSendEvent (edit the commandslist sended at player join) firstly for starting with ProtocolLib and also because (unless I'm mistaken) when using the event, commands (even deleted ones) are still sent to the client, so using packets would avoid this
Are you sure that commands removed from the command list are still sent to the client?
Double check that part and send your code. If this doesnt work then you need a packet listener
to intercept the packet. Listening to the PlayerCommandSendEvent would be useless.
they aren't
you just need to resend the list
Player#updateCommands() should resent the command list
Update the list of commands sent to the client.
yes i am not sur but I knwo that exist client to get plugin list without query /plugin command and here
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandSendEvent.html
"Commands may be removed from display using this event, but implementations are not required to securely remove all traces of the command. If secure removal of commands is required, then the command should be assigned a permission which is not granted to the player."
I deduce that this is what provides the list of plugins but I am not sure
my questions Is what packet i have to listen? tab complete? (i am not sur)
Not really useful if he needs only specific commands to be sent
hi, anybody of you guys knowing what Transformation I have to do to apply a constant velocity to my ItemDisplay?
I could do rotation, I do know how that works too, but I actually want it to move
I tried to just set the Translation to move it, but it is more of a teleportation and not moving
(I also set the Interpolation properly)
ItemDisplay bulletDisplay = player.getWorld().spawn(projectionPoints.get(1), ItemDisplay.class);
ItemStack is = new ItemStack(Material.ARROW, 1);
ItemMeta meta = is.getItemMeta();
meta.setCustomModelData(1);
is.setItemMeta(meta);
bulletDisplay.setItemStack(is);
bulletDisplay.setInterpolationDelay(-1);
bulletDisplay.setInterpolationDuration(40);
Transformation transformation = bulletDisplay.getTransformation();
transformation.getTranslation().x = 3;
bulletDisplay.setTransformation(transformation);
This is my code, all that happens is it spawning 3 blocks more to the X
im trying to set the meta's display name with components but it says it needs a string and not components, how can i fix this?
SPRAYCAN = new ItemStack(Material.IRON_HOE);
ItemMeta meta = SPRAYCAN.getItemMeta();
meta.setDisplayName(Component.text("Spraycan", NamedTextColor.GRAY, TextDecoration.BOLD));
You don't
There is no API for that yet
And I don't think there is api to decompontify a component
use a better API or you are stuck with jank legacy 🙂
I'm surprised MD hasn't kicked you more
? wdym?
his bio say it all
isn't that literally normal bukkit api?
ahhh ok
It sucks that adventure's bukkit bridge doesn't support that
I just use the legacy serializer
But eh, that bridge is useless and I really wonder which moron decided it would be a great idea to work with it
bro the fuck he sounds disrespectful asf
To be honest that is true though
lol what? who is disrespectful?
you sound kind of "aggressive" by literally having "paper > spigot" in your bio and then saying "use a better API or you are stuck with jank legacy 🙂"
Using bungee-chat isn't that much of a great idea, and if you stumble on one of it's shortfalls you should not be suprised
I can be a bit snarky for sure, but that's hardly disrespectful to any individual.
yeah, idk who tf that is
y'all should ban them
cause they took a name close to my username and their nickname is my real name
and they didnt have a similar name pre-discord username change
@worldly ingot do the ban or something
guys this is hardly the channel to discuss these matters
Which matters?
you can dm me epic if u feel like a user is breaking a rule
why tf is Interpolation not working
you are fucking supposed to do it SLOWLY and not teleport yourself 3 blocks ahead
its pretty much right there, some guy just decides seem like paper staff
That is an oddly specific question to which I wouldn't even know there is a clean answer. You could just get and set the NBT (however that works), but carrying it over directly may not be possible unless you preserve the tile entity along with it
So you mean like changing an oak to a spruce fence unsafely?
Pretty much
?stash
Yeah it does
the block type is part of the BlockState
nms BlockState has a final field for the blocktype. You'd have to copy stuff over
I was expecting there to be something like BlockData#copyFrom(BlockData)
you can use the string methods to do that probably
Anybody having an idea why the Transformation is happening INSANTLY instead of slowly with 40 ticks?
ItemDisplay bulletDisplay = player.getWorld().spawn(projectionPoints.get(1), ItemDisplay.class);
ItemStack is = new ItemStack(Material.ARROW, 1);
ItemMeta meta = is.getItemMeta();
meta.setCustomModelData(1);
is.setItemMeta(meta);
bulletDisplay.setItemStack(is);
bulletDisplay.setInterpolationDuration(40);
bulletDisplay.setInterpolationDelay(-1);
Transformation transformation = bulletDisplay.getTransformation();
transformation.getTranslation().set(3, 1, 0);
bulletDisplay.setTransformation(transformation);
mmm I'll try the string methods
uh, is this 1.19+ stuff again?
yes
Yeah then sorry I have no clue what this is.
where you cannot find a single dip-shit of documentation ANYWHERE
Are you sure you can use -1 as a delay?
I tried all different amounts of delays lol
You could substring the string and append the original data to the old data? But at that point it is performance adieu
that's not the string method? getAsString, remove the type, then try to parse it
You may want to set a teleport duration @orchid gazelle though idk if that really works
No, I mean teleport
You know, this is mojang code
oh lol
God knows if there is some dumb prerequisite you need to apply
I thought this was some Spigot stuff on Server-Side
Why would spigot integrate such a feature by default?
tried, didn't work sadly
private BlockData changeType(Block from, Material to) {
String data = from.getBlockData().getAsString(true);
data = data.replace(from.getType().getKey().toString(), to.getKey().toString());
return Bukkit.createBlockData(data);
}
Janky hack mate
But it works
Yeah then I am out of ideas sadly
hmmm
How do i add reflections as a dependency to eclipse? i dont have a pom.xml and i cant find a jar download so i can add it as a lib
create a maven project guys?
Isnt there a jar download for it? i cant find anything and i just want to add it as a lib
Reflections as in
But i am getting a error
org.reflections:reflections?
yea thats what they mean
mvnrepository.org is your friend
Alternatively, https://repo1.maven.org/maven2/org/reflections/reflections/0.10.2/ has everything you'd need.
Though beware that you also need javassist, jsr305 (although that one is more optional than not) and slf4j (if you aren't already using it)
I believe you need to wait a tick after it spawns
I really need to follow up on my resolver-as-a-service idea one day...
Does anyone know why Vector4f is giving a error?
what do you mean with waiting a tick?
You do not have JOMF I believe
Or was it JOML?
Proberly not, is it a lib?
Yes. I really recommend you to not use Eclipse JDT as build tool though. The Maven integration is godsend already.
Change the transformation a tick later
Anyways, the joml download is over at https://repo1.maven.org/maven2/org/joml/joml/1.10.5/
Joml is part of spigot
misread it
Unless you are on old api
how can i translate spigot blockdata to nms blockdata
Or they are not using the shaded jar...
rather whats the best way because i assume just doing new BlockData() is not great
getState -> cast to CraftBlockState -> getHandle
oh you can just cast? cool
Mhm
epic thanks
didn't work :(
YOU GENIUS I LOVE YOU COLL
YOU LEGEN D
COLL IS THE BEST
So wait did it work or didn’t it
first it didn't work
you gotta set Transformation AND the Interpolation-Duration and Delay a tick later
Bukkit.getScheduler().runTaskLater(LoopCityScript.plugin, new Runnable() {
@Override
public void run() {
bulletDisplay.setInterpolationDuration(40);
bulletDisplay.setInterpolationDelay(-1);
Transformation transformation = bulletDisplay.getTransformation();
transformation.getTranslation().set(3, 1, 0);
bulletDisplay.setTransformation(transformation);
}
}, 1);
so it looks like this
Yes that was what I meant :p
The game just skips interpolation if you change it on the same tick the entity is spawned
well but actually, that's pretty bad
because 50ms (=1 Tick) is literally the entire time the Displayentity will even exist
Have you tried setting the interpolation in the spawn callback?
That’s what they did originally
yes
I need some way to do it on the same tick
ah no i should be more specific, im trying to get a tool's destroy speed on a specific material and not block and nms ItemStack requires a blockstate for that method. can i get a block state from a material?
I dont see the code for that...
here
Ah they didn’t use the consumer at first mb
I doubt it changes anything but you could try it
Well I somehow need to set the Translation at the same tick...
Did you try the callback
No what how?
i gotta ask again because my first question was just wrong, but how can i get a blockstate from a material? or is there another way to get the destroy speed of a tool on a block material
wait you set the delay to -1 because you delayed this task by 1 and hoped this would schedule it back a tick?
you cant go back in time lol
why not use lambdas
Material.createBlockData()
And then BlockData has createState
it does not
could do just got it this way to test it out quickly
It does in the latest api
how and where?
World#spawn(location, class, consumer)
nope, doesn't work with Callback
Wut
What?
you need 2 ticks min
p.openWorkbench(null, true) works so I guess you should open Workbenches that are not existent like that vs custom Workbench Inventory 🙂
wait
are you using Bukkit#createInventory
Yeah I was
its literally just a chest inventory with 10 slots
it doesn't work for the furnace either
pretty sure that furnace doesn't work
Ok but I dont need it to work only for the recipe book but thx I'll keep it in mind for the future
ye
okay basically in Minecraft their are things called MenuType's if you look at NMS you will know its pretty different from InventoryType. What Bukkit#createInventory does is attempt to just get you a MenuType (which is only how the container looks). It does this well, as you know. However, Some things bukkit calls an Inventory aren't really an inventory. For example the Workbench. It isn't actually an Inventory only a container. Under the hood the conversion map converterMap.put(InventoryType.FURNACE, new CraftTileInventoryConverter.Furnace()); creates a NMS inventory furnace so it has its recipe book properties. However, the workbench only creates a generic inventory with 10 slots
if you need the recipe book from a custom inventory you can do it but its wacky
you essentially need to create the Container from NMS and then grab the BukkitView
then you can open it for the player
Is this why openWorkbench exists
yes
Ok I see thx for the good explanation 🙂
Probably the case because the furnace is also usable by multiple people and a storage option
its the most bandaid fix on earth
Instead of just create inventory
Glad i found it
that's exactly the main distinction
Inventories have Storage
but not every Container has an Inventory
still though not every container has an Inventory, so createInventory isn't fully enough
I see
what really needs to happen is InventoryType needs to go die in a pit
oh
sorry idk what happened my fingers just went out on their own
also another fun fact, not every container has a MenuType
for example the Horse and LLama chest, as well as the Player
why is this happening
are you shading some dependency you're not supposed bte shading
or
not shading a dependency you are supposed to be shading
what
aare you compiling correctly?
yes
You can just copy paste the bstats class into your plugin and create an instance. Shouldnt be an issue.
I would say you just recompile and try again
i tried 4 other times
Alright. Open your compiled jar (its essentially just a zip file) and check if the class is there
lol/aabss/eventcore/commands/MainCommand
yeah its there
Do you hava a static block in your class or eager initialized fields?
in main command?
Ok i dont see an issue in that regard.
Mind showing your onEnable?
Do you use EventCore as a dependency in other projects which are also loaded?
Hm. Could you post the exception in a readable format again?
Update your paper version. They had a ton of problems with their new classloader in tha past few weeks.
ok
do they still have issues with plugin's jars being closed?
im on latest paper but it still dont work
also dk if it matters but im using api version 1.13
How do you compile. Show your pom pls.
This is really really unusual.
i use gradle
Show your build file then i guess
Why do you have SkriptLang as an implementation dependency? Doesnt Skript come with that?
idk, thats what the tutorial said to do
It should be compileOnlyApi, if anything...
o
I mean they dont use the shadow plugin so...
they have spigot api as an implementation 
💀
average skript moment
(compileOnlyApi is from the java-library plugin, won't work with just the base one you have applied)
so what do i do
Using anything else is not ideal anyways.
the java plugin works just fine for most things
Most, but not all. As you evidently demonstrated
May i ask here doughts about javascript? Or is only related to java and/or spigot
no reason to use the api configurations for their seemingly non-multi-module plugin anyways
how does item syntax looks like in this case? as in, how I should write to give a specific item, amount with a specific name?
If nothing is going on in the channel then i guess its fine
right, really thanks
cuz im a little confused by ItemStack data type
Wait i dont see a proper guide for that.
just an example would be enough ;<;
Material material = Material.DIAMOND;
int stackSize = 32;
ItemStack itemStack = new ItemStack(material, stackSize);
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName("Some cool item name");
meta.setLore(List.of(
"Line no 1",
"Line no 2",
"etc"
));
itemStack.setItemMeta(meta); // Dont forget to set the meta back on the ItemStack
player.getInventory().addItem(itemStack);
Its essentially just this
one more problem
I defined "Object[][] dict = new Object[4][2];"
in onEnable
but I cant access it anywhere
You can only access it inside onEnable
oh
Because it’s a local variable
Uh oh... im seeing a certain command emerging
?
I didnt but thats besides the point
I think that is the only point to be honest
bc an Object[][] should pretty much never occur when writing java.
Oh, you should absolutely never have different data types in an array
You probably don't have e a default
This means that there is a branch in which your variable has no value.
Make sure to add a default statement in your switch-case to cover
all occasions which are not covered otherwise.
there are none
its either 0 or 1
Show your code pls
But what if it's not 0 or 1
?paste
You need a default statement there.
Even if it only throws a random exception.
The compiler cant ensure that the nextInt method only returns 0 or 1
Uh don't detect items by their name
great its my 2nd time doing a plugin
dont expect me to automatically know the best answer
Its fine for now. Just remember that there are better ways for the next plugin.
?pdc is generally that way
No worries we've all done that at least once
why is this happening
?paste
Send your jar pls. There has to be something wrong with it.
How the hell did you manage to get upper case packages in your project?
Hi i havent touched making plugins in a while i was wondering how to save data of how many times a player entered and if it reaches a certain amount provided in the config do smth an set the value of how many times it entered to 0
Change your packages to lower case
like to run some code after a player enters the sv a certain amount of times
Yeah sry. My decompiler made that up.
Wait nvm. The packages are upper case in actuality
Old jar?
Hi, does anyone know what the initial velocity of an arrow fired at full charge is? I've been searching online for one of my projects but can't seem to find anything other than an experiment that a dude ran. No official sources
Just write 3 lines and check it
Tried but the program im working with is rly strange on my os version so it wont export properly and doesnt apply in game
Some Java + listening to the PlayerJoinEvent
What part specifically bothers you?
how to save like how many times the player entered the server or how to get that info
if like i have that ik how to do the rest
well now I am constantly getting "default" item
but case code is running cuz server does print Dam 1 or Dam 0
You need break; at the end of each case
You need to break in each case
wow
Yay fall through
You can add this data to the PersistentDataContainer of the Player.
Alternatively you can just write this into a file, in which case you need to load/save it yourself.
In case you wanna use files
Or a database if you want to be real fancy
turns out the packages in my build folder were capital
Hmm idk whats PersistentDataContainer but ik how to use like a file to save that so yeah il prob do a file with the times that the player entered
oh thanks allot altho i will use a file cause i am dumb
also item's name isnt being changed
for some reason
This guide is also meant for files
no you didnt say anything about it when I posted the case problem so I thought its alright
xd
ohh didnt know thanks
Also idk why i imported my old plugin from github and it says it has errors in every code, i formated my pc and only installed intellij does someone know what i am missing?
java
Yeah there is a dw button there as well
what would be a better way for it
i have 3 javas in my path that i switch order as needed
pdc?
ItemStacks have a data container where you can store a bunch of hidden data and read later
Ohh thanks allot to both
well okay but if I were to add like 50 items with custom tags how am I supposed to do it, I doubt that making "set tag" line 50 times everytime event is handled is a proper way
Try to never repeat yourself. Group code into statements or methods.
last time I tried grouping it turned out to be impossible
hey, can someone help and view my code intelji
If its just to id it pass in a string if it needs to be different tor each, if not just make a class var
I dont get any of it
Instead of calling getpdc.set() every 4 lines make a method with either item stack or item meta as a param and do it there
cant I just make a database with such special tags
and just check on event if item has this special tag
and then do code
otherwise just return
thats assuming I know how to work with databse
I dont
but I could learn it that way
Pretty much
it says i need java 17-21 to run a spigot so i can make a local server it says i have java 8 where can i update
thx
?java17
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
Aye we do have it
anyone know how I can disable AI for an entity without NMS? I figured I could just edit the NBT data but I've looked everywhere and couldn't figure it out. My best guess is that it has something to do with .setMetadata() but again I don't really know
setAware(false)
Or setNoAi
Depends if you still want them to have gravity and collision
the Entity class doesn't have either of those
I'm still pretty new to this stuff so this is the first time I've heard of that. thanks for pointing me in the right direction lol
gotcha
so what's the difference anyway? is LivingEntity just a more specific type that doesn't include stuff like item frames and falling sand?
actually that's probably exactly what it is lmao
how does conversation factory work
i want to do somethinf where you click an item on a gui, it closes the gui, takes what you typed and then uses that later
Yeah that’s doable
Create a conversation with a single input prompt and then add a cancellation listener that calls back to the gui
i have no idea how to do that lol 😭
Anyone knows how can i saved the last conexion in specific world?
like, when i disconected in a specific place and i conected again, spawn in the same place
isnt there a better way to do this?
public void putOrReplace(UUID uuid, CombatLogData data) {
if (combatLogData.containsKey(uuid)) {
combatLogData.replace(uuid, data);
}else {
combatLogData.put(uuid, data);
}
}```
and its gonna replace it?
Yeah you might be thinking of how arraylist's works, allowing duplicate keys/objects. With hashmaps, since the Key is encoded with the hashCode of the object, there is no duplicates possible. So, it would just overwrite the value with the new value.
ohhh that makes much more sense i never even knew that
Well there are hash collisions at times, but that’s resolved with K#equals(obj) which is why you never wanna use hashCode() in an equals() implementation in principle
They’re cool
also this, shouldnt i do Collections.singletonList?
AbilityLog log = new AbilityLog(ability);
if (!logs.containsKey(uuid)) {
logs.put(uuid, Lists.newArrayList(log));
}else {```
Also, depending on what's in the else, you could use Map#compute or Map#computeIfAbsent
yay
computeIfAbsent is usually a very good one with these multi maps
conclube you know what happened to imajin at all?
Nope :\
damn
uhhhh this is the entire method
public void addAbility(UUID uuid, Ability ability) {
AbilityLog log = new AbilityLog(ability);
if (!logs.containsKey(uuid)) {
logs.put(uuid, Lists.newArrayList(log));
}else {
ArrayList<AbilityLog> cachedLogs = logs.get(uuid);
if (cachedLogs.size() >= 5) {
cachedLogs.remove(0);
}
cachedLogs.add(log);
logs.replace(uuid, cachedLogs);
}
}```
No1 does I think
strange
if i have one map with an image on it, how do i like spread that image onto a (number)x(number) block like a 5x5
he just up and left 😦
:(
he deleted his discord too :(
it's actually kinda sad how people can disappear like that...
without anyone here able to get to him
well its not like they just went inactive, they removed their discord
and I don't recall them saying anything either
it was just after a bit of time people noticed they hadn't been around and they didn't even say bye 😦
Code mining I believe
mining? xD
I don't remember the name you called this, where it kept tracked of usages through out your code
I do know its under code refactoring
In Visual Studio it's code lens or something
or the related
but not in JetBrains
inlay hints iirc
Preferences, Code Vision -> Show hints for:
idk why you want to disable it, their quite useful
personal preference 🙂
I find them rather annoying, personally. They push your lines down for no reason and make whitespace feel weird
yes exactly it started to piss me off XD
put them on the end then
half of the class gets filled with "1 usage 20 usages 5 usage"
like i did
If I want to know how often or where a method is used, I'll freaking search for them in the call hierarchy
that takes like tripple the effort
It's like 3 key presses D:
thats more than 0
Alt + Shift + H in Eclipse is ez
or you can CTRL + Click the methods in IntelliJ :D
I'm pretty sure!
yup
look at this
doesnt clutter my whitespace, still shows me what i need to know
gotta love prison mines plugins!
kek




