#help-development
1 messages ยท Page 356 of 1
No sounds like a dumb idea too
Usually if you want to extend player your doing something wrong with your data structure
not really
Yes really
I am doing something wrong with my structure? No
I was going to do it? Yes
Spigot doesn't allow you to natively associate any other data with Player so wanting to extend it shows something wrong is up
okok ill make it in another awy
If you want to associate more data with the player use PDC
I just liked the idea of doing player.mymethod
Or make a uuid wrapper and use a database
that was one of my ideas
That's your best option
You could have an internal getBukkitPlayer method or something along those lines
Just snack some crack cocaine
Alex back to being unhinged
@tender shard
hi
i am using ur JeffLib
but it good an error
for entity player
?paste it
you need to define the method
do you know how to make EntityPlayer have pathfindergoal?
can an EntityPlayer even have a path finder goal
that why i asked here
i want to make my EntityPlayer or humanEntity have pathfinder
if an EntityPlayer represents a player, that can move them self i doubt they can have a path finder goal
i'm try to make it attack nearest entity
do you know anymethods?
no sorry
oh
EntityPlayers have their own goals you might need to extend the nms entity
And add them yourself
let me tell you what I want to do before I do a bad decision
I want to store a selected kit
by name
should I use a .yml or a db
Whatever your scale is tbh yml is fine for tiny amounts of data. Otherwise the next step up would be JSON, than Sqlite than, something like MongoDB or MySQL
I would like to implement info in Discord
I should not use Sqlite right?
Sqlite is fine
but
didn't sqlite have only 1 connection?
like could only take a single connection
Oh if you want other stuff to beable to open connections use MySQL
okok
Yea go with MySQL or Mongo
mingo
Mingo?
Shut
oh okok
Brit
xdd
how could you
I'm wondering how to make the chat visible to all players when I type a command I've created.
how i can get block data(block id:block data) without getData() cuz it deprecated
val type = object : TypeToken<Map<UUID, Killstreak>>() {}.type
why is "object" needed here?
Kotlin :(
thanks for your answer, anybody else wanna try?
lmao kotlin
Most people here don't use that
it defines the type
thats the reason
does it?..
iirc if you use var you shouldnt need object:
nah typetoken is just a goofy ass thing
it's weird in both java and kotlin
gson is goofy in general it seems
this line looks like this in java
final Type type = new TypeToken<Map<UUID, Killstreak>>() {}.getType();
TypeToken Is like a hack lol
like, those curly brackets threw me off the first time i saw it
It's so scuff
gson is hacky asf
in a EntityDamageEvent, if the cause is FALL can I get the player that caused the fall damage? (eg attacked by player a and then took fall damage, like A was doomed to fall by B)
only if you track all damage
you can manually track it maybe, track the last damager in a map like Map<UUID, UUID> and do something with it
can't be obtained via events
well I was able to get the killer (such as various player-triggered entities) using damage cause
figured I could use it for fall
yes but FALL has no cause
oh
FALL is the cause
alr thanks
you could track last damager and then lookup if the cause is fall
but timestamp it so you know it's not from an hour ago
Oh alright
Best way to fill an area?
?workdistro
this helps alot too ^
they sound they were for heavy work
I need it for less than 1k blocks
well then ur fine
how should I do it for that?
because you create anonymous object which implements TypeToken interface or abstract class
3 nested loops?
yea
okok
its same as new TokenType<T>() {} in java
should I check if the block is not air to set it to air and then set it
or just set it?
ig so
maybe seting a block uses more resources than an if
so if I if it
I would save some resources
ohu mean check if its already the block ur changing it to
yeah
u could do that, it'l probably be a little bit more performant yea
editing the region file
this is soo smart
ngl. I've never had thought you can just predefine a queue that uses special amount of tick time for each work task, without lowering the tps
@tall dragon thanks
i really really like this
@lost matrix
I thought 7smile is dead
nah he was on last week
yeah
nah
who is sachin
oh
and all the other plugins that end with -n
nah i give up
anyway
did anybode here text sachin in the last weeks?
I suspect he's actually dead
ty
plugg
yeah?
have you heard anything from sachin in the last months?
I remember he went to the hospital and after that I never heard fron him again D:
nvm
i think i recall seeing him online a week ago or so unless i've gone mad
wait no
oh ok thats good

that said he was available
don't you have some of his contact info
like i remember he had a gofundme for a surgery
i thought he had some there
no
that's an incredible article, is there a shortcut in cafebabe for this?
@icy beacon
oh ty
@tawdry scroll
you still alive?
pls answer
I already got DMs of people asking whether yo uare fine
his last github contribution is on october 19
yeah that's like 5 months ago
wait
4 months*
oh
lol
.mf
?paste
that plugin is shit, doesnt properly work on multi-module maven projects
looks so jank tbh
are there better ones
none that I know
yeah same ๐ฆ
there's a good CLI app though
xDD
but I dont remember how it's called
i want everything to be gui so that my eyes can be pleased
code in vim
Code in sed and echo
most of my code is so bad, nobody would worry if I'd just pipe it to /dev/null anyway

Hey,
Could someone please help and/or explain me these Error Messages and what I have to change?
https://paste.md-5.net/dugokafori.pl
This is my codestarting from line 127:
for (Entity en : p.getWorld().getEntities()) {
if(en instanceof ArmorStand) {
ArmorStand as = (ArmorStand) en;
if(as.getScoreboardTags().contains("Holotable")) {
Location locE = p.getLocation().add(25, 25, 25);
Location locF = p.getLocation().subtract(25, 25, 25);
if(isNear(as.getLocation(), locE, locF)) {
coms.sendMessage(as, p, msg, false, false);
}
} if(as.getScoreboardTags().contains("nightsister")) {
}
}
}
people who claim their code sucks > people who claim their code is god-like
which is line 127?
the first one
what is this indentation :wheeze:
2 tabs
for (Entity en : p.getWorld().getEntities()) {
the world got unloaded
i bet world is null
nvm i didn't read the error
is this inside an async runnable?
how? I was in the world
?
when do you execute the code you sent?
Inside an async Chat event
oh
the world got unloaded
i think you should run a non async task inside it
because bukkit api can't be used async
^
do your stuff in a synced task
But how does it get unloaded if I'm right in the world?
how can I do that?
make a synced task inside the event and run your stuff there
public void onSomeAsyncEvent(AsyncWhatEverEvent event) {
Bukkit.getScheduler().runTasklater(() -> {
// do your stuff here
sth like that
it's ?scheduling
?scheduling
Do I do that just for the for-loop or for the whole event?
the for loop must be inside the task
for everything that you need "world access"
btw i'm not sure but for the sake of avoiding ambigious naming you could change the method to scheduleSyncDelayedTask or whatever it is
you are not allowed to do any "world"-related things in any async context
probably not necessary
IIRC, "scheduleSyncDelayedTask" with a delay of 1 is the same as runTaskLater
not sure though
just in case runTask runs on the same thread as whatever it was declared in
correct, same as runtask.
oh ok then
alex
what's your attitude to kotlin
i recall you wanted to code a plugin with it some time ago
I do not like kotlin for a few reasons
I did many things in kotlin because I wanted to learn it, but I didnt like it
for example for the following reason:
What do I need to put inside the brackets of .runTasklater?
public class MyClass
public String name;
public void setName(String newName) { ... }
your code
in kotlin you do not know whether you call the setter, or set the field manually, when doing myClass.name = "asd";
no in these brackets: .runTasklater**()** <--
ah
it should be your plugin instance i think
are you not using an IDE?
interesting
if something throws an exception on your classloader if halts the execution right
but what something bad happens on separate classloader?
wdym?
it doesnt halt the main classes?
i'll try smth with the kotlin thing rq
what is an IDE?
sth you gotta pay for if you're not a student ๐ฅฒ
I'm using IntelliJ IDEA community edition
lets say i have classes which throws unhandled exception on application classloader
that halts the flow of code right
are you talking about a spigot plugin?
are you loading these classes in onEnable() or somewhere else
yes im loading them using URLClassLoader
what im asking if the badly written jar file can interrupt plugin's work
if their classloaders are separate
if you do it in onEnable() and do not the catch the exception yourself, then the plugin will get disabled
yes
you're givin me chat gpt vibes
how so lol
ok alex so it seems that you're calling the setter
all my messages are written by a real drunk german human
yeah I know, isn't that weird?
to me it is weird
i mean lets say I load classes using different classloader, Spigot plugin uses PluginClassLoader to load plugin's classes and i load plugin's subplugin jar file using URLClassLoader class
I also dislike kotlin for their weird funny idea of getting rid of knowing variable types
it's just conciseness to the point
oh you can know them though
does that halt the execution
like i did in var a: String = "A"
of the parent
or do you mean smth else
if child is dum dum and had a bug
imho kotlin doesn't do anything useful besides adding stuff to java that wasn't added to java in the first place for good reasons
the three reasons i enjoy kotlin are 1) syntax sugar 2) conciseness 3) extensions to classes omg omg
e.g. var/val
haha "consiness" is exaxctly what I hate about in kotlin
๐
some people call it "conciseness", I call it "inaccuracy"
myNullObject.doSomething() yeah just don't do this ^
tbh I love that java throws an NPE instead of just returning null
yeah in kotlin if it's null it just won't do the thingy
if you wanna be able to debug stuff being null all the time, go use LUA
might be useful, might be nefarious asf
depends on the context of the usage
I agree that kotlin is nice for allowing you to decide whether you want an NPE or just getting null
however I never saw ANY reason in using it
๐
if "myObject" is null, I WANT to get an NPE
How do I do this with regex? |
e.getMessage().replace("&0", "").replace("&2", "").replace("&4", "").replace("&6", "").replace("&8", "").replace("&a", "").replace("&c", "").replace("&e", "").replace("&m", "").replace("&o", "").replace("&1", "").replace("&3", "").replace("&5", "").replace("&7", "").replace("&9", "").replace("&b", "").replace("&d", "").replace("&f", "").replace("&l", "").replace("&n", "").replace("&r", "");
i do have some use cases where it could be better
wtf
are you drunk or sth
uhh
XD
WE DO HAVE THAT METHOD???
yeah...
stripColor
and yes, it exists
i think you just need to replace & with paragraph
yeah
even if it didnt exist char for loop would be way more clean than this
the grand wall
:D
does everyone agree?
yes
with this
ok ill use it
no
is it wrong
do you want to use regex for the sake of using it?
the & stuff will only work on "pre-ChatColor.translateAlternate...." stuff
will stripcolor work when someone is chatting using & symbols?
just replace & with paragraph and strip color
what the heck are you even trying to do
why use regex
Asking about your attempted solution rather than your actual problem
do u mean some weird default translate color symbol?
it's not weird???
ยง
if at all, then ยง is weird
its ๐ฅ
i use this symbol all the time because i am a student
your mom is fire
if it's weird, what isn't
true
ye i meant that
yeah just replace & with it..
ok
anyway i don't get what you are trying to do either
who was btw the first who translated & to ยง and set the standard?
if they are using & to chat, it shouldn't get translated to colors anyway
unless some other plugin does that
yes
and if you want to prevent other plugins from doing that, you can probably disable that in the conig
some does
config*
ah
will this work for that thing?
well then don't do replacing
Is GPL license inherited from Bukkit when I make a plugin that does not include any of the Bukkit libraries?
if you make a bukkit plugin you are using bukkit
if you aren't, then you aren't making a bukkit plugin
I am using it to access the methods, but not including it in the jar. Isn't this like emulators where "accessing methods" is completely fine?
well that's what every plugin does i think
unless you use reflection for every single method you are still kinda including it
Do that means I need to inherit the GPL license?
What license are you wanting to use?
MIT
yeah
Why is the PrepareAnvilEvent not triggered if the name of the AnvilInventory is different?
thanks btw and you too @tender shard It worked
@EventHandler
public void onAnvilInput(PrepareAnvilEvent e) {
Bukkit.broadcastMessage("bro");
if(e.getView().getTitle().equals(GUI_NAME2)) {
if(e.getView().getPlayer() instanceof Player) {
Player p = (Player) e.getView().getPlayer();
openCallInput(p, e.getInventory().getItem(2));
p.sendMessage("te");
}
}
}
it is only broadcasting "bro" when the name of the anvil Inventory is not changed
if(e.getView().getTitle().equals(GUI_NAME2))
"bro" should be broadcasted either way
it's the first thing in the method
Nice
๐
cleaner is to if (!e.getView().getTitle().equals(GUI_NAME2)) return;
yeah it's ?arrowcode
also doesn't InventoryView#getPlayer return HumanEntity?
if it does then there's no need to check for player instanceof
Yes
because the only class that is a humanentity is player for now afaik
so it can be just casted
No idea on why you don;t see bro
we haven't figured out the reason yet
Plugins might implement it
oh i guess
though isn't that a bukkit api misuse
sounds like one
Eg Citizens
oh in that case i hereby allow it
Depends, i guess
allow what?
include the gif
dont compare inventories by title, if title changes you cry
agree
Implementing bukkit interfaces
though working with inventories in general is pain
just dont change the title
InventoryHolder
i used to create custom inventoryholders
but that's a misuse too
i don't wanna do that anymore
i just use triumphgui
abusing inventory holders
misuse
okay but the problem is that the event doesn't get triggered when the title of the anvil inventory is different
lol
Lol exactly that is kinda not allowed
the whole event
uh i havent really been following
really though check it out
in that case my inventory is an inventoryholder
not allowed by who
Well inventories implement equals and hashCode. So you have plenty of utility with that.
stated as a "bad practice" from spigot, but that doesnt stop me
@tardy delta we're here trying to figure why bro isn't broadcasted
By md_5, read the javadocs
its the same as using a deprecated method
yeah no fuck that
im a proud inventoryholder user
Bukkit.getOfflinePlayer(String name) is the bane of my existence
fucking undeprecate that shit
doesnt disallow it
just advices not to
due to bugs which can occur
i used to use inventoryholders for a while
if it would be not allowed i would do it anyways
didn't have any real bugs with that
I have talked to md5 about this 3 years ago and he said โdont do itโ
sounds like a you problem to me
๐
Do whatever you want
i have asked him to add other ways to receive money from paid plugins and he sent me a link to a copypastable wall so i don't really care about his opinions anymore
And what did that link say?
Oki
but i honestly don't care, i only care about this
๐
which means that there needs to be an alternative?
this is just plain stupid
If you have only one type of custom inventory:
public class SomeInventoryManager {
private final Set<Inventory> customInventories = new HashSet<>();
public boolean isCustom(Inventory inventory) {
return customInventories.contains(inventory);
}
public void registerCustom(Inventory inventory) {
customInventories.add(inventory);
}
public void unregisterCustom(Inventory inventory) {
customInventories.remove(inventory);
}
}
Or if you have a specific functionality for each inventory:
public class SomeInventoryManager {
private final Map<Inventory, InventoryHandler> customInventories = new HashMap<>();
public boolean isCustom(Inventory inventory) {
return customInventories.containsKey(inventory);
}
public void registerCustom(Inventory inventory, InventoryHandler handler) {
customInventories.put(inventory, handler);
}
public void unregisterCustom(Inventory inventory) {
customInventories.remove(inventory);
}
public void propagate(InventoryClickEvent event) {
Optional.ofNullable(customInventories.get(event.getClickedInventory())).ifPresent(handler -> handler.handleClick(event));
}
// ... do other events
}
yeah they are weirdos
I could do everything without a verified card, now I need a verified card ;-;
But i also do understand md5 not wanting to deal with stripe etc because tvh stripe is even worse
there are like 2 ways for international transfers in russia, and i only call recall one
Spain and another country were the only ones to not need a card
what's tvh?
Tbh* typo
Go home plugg
how does that solve my problem?
YOU MISSED A G
Maybe it doesnt
following good code standards may sometimes solve your future problems that you are not aware of yet
such as not using an arrow code anti-pattern
^
It proposes a more robust approach to your inventory situation so you dont
have to rely on names. Didnt read your full problem dbh
good alex
why
void
do you not like 1 liners
bad practise
it's not a constructor
If you think that adding a ton of code blocks for a one line statement is needed: okay
it should be done with || right?
also why is your class in lowercase
Many people think otherwise
no
The problem was that the PrepareAnvilEvent only gets triggered in the anvil doesn't have a different name
What should I do?
how should it be done then
No i always add bodies to every statement and it has been a code standard at every company i worked so far
like alex does it
?
public scoreboard(Main plugin)
also don't name your main classes Main
?main
yep
?help
was looking that up
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
thx
if you do ?cc list in #bot-commands you can see all of them,
is there a list of all this commands?
Thats a weird reasoning though. I could also say โkilling jews was a standard at every company hitler worked forโ.
Just because sth is standard somewhere doesnt mean its good
oh the timing
this
The event always gets fired when you click on any anvil. My suggestion simply removes
the need of checking for names all together because its a very brittle approach.
ik
i was looking up the thread
didn't know that it was a command too haha
lol
in my company its a standard that oneliners doesnt have a body
well your company is quite goofy
In my company its standard that people do whatever is appropriate
not really
how old are you guys?
27
Its not the reason why i use them, its simply affirmation
you go first
no problem, I am 16
wtf i thought you were like 22
it's in my ab me xd
you cant work with 50 people without the code being messy without conventions and standards
ah
damn
?reminder
Oh
and i'll be 15 haha
My best friend has birthdax on feb 21 lol
Haha
Why is this event:
public void onAnvilInput(PrepareAnvilEvent e) {
Bukkit.broadcastMessage("test");
}```
Working when the name of the anvil inventory is "Repair & Name" but not if the name is "ยงbEnter your name here"?
february is the new meta month
wait
did you check for the exact name?
Because those are two different strings
I didn't check for any name

I didn't check for any name but the first one is the default name of anvil inventories and the second one is custom
https://github.com/WesJD/AnvilGUI for fetching input from anvils
it'll really make your life easier
Anyway, using a block for a single return statement is kinda useless imho
Imagine someone writes code like this:
if(condition) return;
And later on you need to add functionality to that.
if(condition) {
someLoggerCall();
somethingElse();
return;
}
Thats just a hustle and now if we remove the two lines again
we would also have to remove the body to get standardised code again.
Also clearly separating your scopes is very important. Its not clear
that everything after a conditional statement is a new scope if you just
skim over some code.
did you ever set the scoreboard to a player?
Modify default loot table for a block
I'm not sure
well then start there
what should i do
There is literally nothing preventing your listener from firing regarding the name of your inventory. So this is not possible.
player.setscoreboard
Keep track of the inventories you create
Instead of merely comparing them by their name
wrong person xD
Oh
๐
Thats the almost 30 brain kicking in
Yeah anyway lol
where to put
where you want to set the scoreboard to the player
I assume you have some class that determines what the scoreboard should look like
thatd be the first place I would look for applying the board to the player as well
I confused
hmm
i looked at your code and im confused too since I never worked with fastboard
so idk what it does and doesnt do on its own
because you create a new board in join using the player as an argument
for all I know that should already set the board
thank you for the advice
Hello confused im flo
lamo
imma have dinner now cya
not lamo.. flo!
what happened
Your scoreboard class is extending javaPlugin
Which it isn't allowed to do as you can only have one java plugin type and instance
thx u bro
What should I do if I have a business out of Bukkit plugins but most of the people is getting the jars for free by compiling the source code? Am I forced to publish the source code by the GPL license?
I want to try to comply the licenses without the business getting bankrupt
usually people dont post the source of their premium resource
but yeah otherwise you would probably need to update the license on it
@pseudo hazelBy the GPL license of Bukkit, I am forced to use GPL on all my plugins.
Does that comply with GPL?
no
You should contact a lawyer about that
Don;t comply with GPL
not really
No one here has any opinion that is worth anything to you
Nothing anyone here says is useful
In terms of "oh fuck I am about to get sued"
keep private your source and anyone who trys to force you to give it ignore
I think I can redistribute it for a price
As long as I don't deny it
The source code
are you talking about yoru own plugins? or other peoples?
My own
I think I can distribute source code with a fee
And that would comply with GPL
And prevents people from getting the plugin for free
then you have no responsibility to expose your source, so long as you are not packaging any OS libs
I think I do because my projects use the bukkit api
why it doesn't connect
Bukkit/Spigot is not going to sue you for keeping your plugin source private
I have people menacing me
Thats why I want to make sure I comply
Your choice, I'd use the block button
They only want things for free but have no way to force you
Its a group of developers
Only license holders can sue
sounds like a bunch of babies
Doesn't it like... not even matter? Bukkit/Spigot may use GPL but since we're not compiling their code only relying on it as an external dependency, you can put whatever license you want on your own plugin?
Or am I misunderstanding how GPL works
Not quite
When you compile you actually include some of the API
So IF Spigot wanted to enforce it's license THEY and they alone could demand your source
I finally solved the problem myself.
Ah, gotcha.
and everyone who helped
Hey guys, I notice when I open an ender chest programmatically with player.openInventory(player.getEnderChest()), the name displayed at the top is always "Ender Chest", regardless of what the players language setting is set to. However when opening an ender chest normally, the language is displayed correctly. Is there something more I need to do to get this localization working? I notice openInventory() returns an InventoryView, which has a setProperty() method. But I feel like it should be using the localized string automatically. Any help would be appreciated =]
Hmm set property does not appear to be what I need
theres even a getTitle() method, but no setTitle() =[
i've noticed this myself
problem is that spigot always sends hardcoded name for some reason. Container names are hardcoded into OBC classes
That is unfortunate =[ I was looking at the relevant code here to see if I could figure out why it was happening
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java#277
you can send localized name, but it involves probs some packets or setting localized chat component as the container name
its just a dumb thing tbh that spigot has
Oh interesting, that is a bit above what I have worked with so far. Could you suggest some reading for packets?
I also was unable to find a way to "set container name" at all. There doesn't seem to be a setTitle method
on paper there's an easy fix for this
but it involves using Adventure API's TranslatableComponent
Hmm, I looked up adventure API. I would prefer to keep the plugin with zero dependencies. However if that is the only way, what can ya do haha
yea but its built into paper rn
Inventory enderChestInventory = player.getEnderChest();
InventoryView enderChestView = Bukkit.createInventory(null, enderChestInventory.getSize(), "Ender Chest");
enderChestView.setContents(enderChestInventory.getContents());
player.openInventory(enderChestView);
Maby something like this could work?
and when they close the inventory you would set the echest contents.
Bukkit.createInventory(InventoryType.ENDER_CHEST, Component.translatable("container.enderchest"))
would create enderchest type of inventory with translated text on paper
but this would be separate from player's ender chest
Oh that is an interesting approach, creating a temporary inventory. I am slightly worried doing that as it might cause some duplication issues if there were packet drops or something. But that is a total guess haha
i think sending a packet would be cleaner approach
but this would involve some NMS
or protocollib
"Resending this packet with already existing window id, will update the window title and window type without closing the window."
eureka, thats it baby THATS IT
now I just gotta figure out how to send packets haha
Are you looking to just rename the open inventory once?
Yup thats right, I want to rename the inventory with the correct localized name
And you have that localized name as what?
Yeah but does that not translate to other languages or whats the problem?
Yeah, when opening the ender chest programmatically. No matter what the language setting is set to the title is "Ender Chest".
Oh okay perfect
it would translate if the sent title is TranslatableComponent
server just sends the json key to the client
I've just got the shortest Error in my life:
java.lang.ArrayIndexOutOfBoundsException: null```
Does anyone know how to fix something like that?
Check out this package
https://github.com/AKUS-Studio/nature/tree/master/nMauris/src/main/java/works/akus/mauris/objects/menu/title
and client translate it to normal lang
It uses protocollib
To read the windowId and containertype
when a player opens any inventory
Then uses that info to resend an open packet
with the same id
which in turn just renames
if it does duplicate i think it would just set the values again to the same number since you'd be using setContents() but smth like addItems() would do that.
the open inventory
Excellent, I would prefer to avoid using any external libs, but this looks like a very good resource to look at for renaming a window title with packet sending
Yeah you could write some NMS I think as well
Since minecraft IS capable of renaming windows
(inventories)
Hmmm, protocol lib DOES look nice though
but I doubt the implementation of this specific packet will change much since I'm not planning anything advanced
you can do this without protocollib, but you would need to setup your maven or gradle project in a way to support NMS
and add abstraction classes
to each minecraft version you wish to support
Just use protocollib
Honestly yeah, sounds like its protocollib time
There are more slaves to update that plugin than your nerves and braincells watching the minecraft server's netcode
how would you call plugin which get loaded by the spigot plugin
addon?
extension?
subplugin?
This does of course raise the question..... Why doesn't spigot just use the localized name when opening an inventory lol. But thats just me bitchin ๐
probs due to backwards compatibility
or due to many people relying on names rather than inventory types
in order to detect ender chests
idk
OH you know what. I bet I could make protocollib a softdepend couldn't I. So its not REQUIRED but if they do have it then it will do the thing.
it just seems weird indeed
good idea. that's what you should do
its a minor feature
I have my plan =]
thanks a bunch guys you all rock
specifically you dovidas you helped a bunch =]
you're welcome
hol up
at least on my paper
nms
its translatable component
what version of paper do you use
if you use it at all
im guaranteed that 1.19 paper will send enderchest container names correct
unless you create them explicitly
with Bukkit.createInventory() and use string instead of component
im not sure about spigot tho, iirc spigot didnt had chat components
or they were pretty shhh... (*cough* bungee ones)
How can I get a UUID from a String?
I'm stupid, thanks!
np
sorry was eating my lunch
Ummm so hold up, lemme wrap my head around that
So I am using paper v1.19.3
and I am opening the inventory using player.openInventory(player.getEnderChest())
im running purpur, but its almost the same (Paper, Pufferfish and some other fork patches)
but it defines the translatable component
maybe you're using some kind of resource pack
that alters the locale?
Hmmm, I do have a custom resource pack enabled that skins the item. Let me turn that off and see if the problem persists.
Hm, even after disabling all resource packs it still seems the title isn't localized
Hmm nope it seems the same thing happens on purpur
ok lemme try that myself
Need me to send you any sample code to test with?
is there an BungeeCord alternative for OfflinePlayer?
Very strange right
Does anyone know how to make a player mount an entity? Im trying to make a player mount a minecart using minecart.addPassenger(player), but it wont work
ok
this is not fixed
but its translatable key exists within a code
wtf
so apparently from reverse engineering you can see that the openInventory() calls for inventoryType to retrieve the name
inventoryType serializes old legacy hardcoded strings into components
thus no translatablecomponent is being sent
to the client
you'll still need packets
Oh wow, you know this codebase pretty well ๐ฎ I would have never been able to delve that deep
Very interesting
So I have accidentally stumbled upon a bug huh haha
its probs not a bug
but a leftover
to keep broken plugins alive
who check if inventory.getType().getTitle().equals("Ender Chest")
the thing is it does correctly for ender chest blocks
it just doesnt whenever you open via the code
Right? Thats what I found peculiar haha
this would explain BlockState and other things
in this method args
that belong to the block classes
in other words, just use softdepends and protocollib to fix this
i doubt spigot would ever fix this
Working on it now =] I notice the enums in protocollib are slighly different than the ones listed on the packet site
yes
they're standardised
so that the names wont change
like in NMS they sometimes do
actually its an easy fix from spigot side
this guy must be a GOD tier developer, to create something that works across multiple versions like that
just change defaultTitle() to TranslatableComponent
and everything would be translated
but this is left purposefully if i had to guess
yeah prob what you said about compatibility is why
getting string equivalent name is even deprecated
im 99% sure that this is intentional, but its a codesmell that contributors of spigot and paper know about ;D
Ohh ya know what though, I just thought of something....
I intercept the OPEN_WINDOW packet, but theres no context there telling me whether its them opening an ender chest normally, or through my custom item
Hmmmmmm
you can just send the translatablecomponent
nvm
you would change custom titles
if you do that
what type of component does protocollib return
if its native to spigot or paper
you can do comparison
with == to detect
if the title is legacy hardcoded
hmm when you say component what do you mean? I don't see any component class in the spigot API, but I saw some in your code from before
can you retrieve WrappedChatComponent object from the intercepted packet?
it does appear that I can
ok this wont work
because WrapperChatComponent does not hold real component objects
but what you can do instead is to check the ids
of the containers
nvm
hmm
maybe you shouldnt intercept
packet
but instead send one
by wrapping the openInventory function
but you need to somehow get the menu id
Oh! I think you might be on to something!
How can I check what the item a player is attempting to pickup is
use the event?
yeah
PacketContainer container = new PacketContainer(PacketType.Play.Server.OPEN_WINDOW);
try {
manager.sendServerPacket(player, container);
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I think you sent me on the right path @mortal hare ๐
I just have to make sure to send the correct window ID
yeah, but how can I use an if statement to check if the item is a specific item?
if (event.getItem().getItemStack().isSimilar(YourItemStack) { do stuff }
yea you can get it via NMS
but im thinking of a way to bypass that
since that would break version support
How do I make a player mount a minecart? addPassenger() isnt working
i mean you can do simple check if wrappedchatcomponent is "Ender Chest" but that would make all the ender chests translatable
even if that was explicitly defined as "Ender Chest"
I think I am heading down the right route with this, lemme see if this is stupid ๐
PacketContainer container = new PacketContainer(PacketType.Play.Server.OPEN_WINDOW);
container.getIntegers().writeSafely(0, inventoryId);
container.getIntegers().writeSafely(1, 2);
the inventoryId still need to find a way to get that, but the second one is writing to index 1, with the value 2
https://wiki.vg/Protocol#Open_Screen
https://wiki.vg/Inventory
eureka
I'm not entirely sure I'm using that right. But I think I'm heading in the right direction
i know
OH SNAP
create a new variable
to store your id
int
make a map
Map<Player, int> ids = new HashMap<>();
as a global class field
outside the method
intercept a packet of open_window
check if MenuType is EnderChest if so add to map
intercept packet close_window
?paste
remove the id
from the map
now you have a map which holds windowId
without nms
of a player
Help please: https://paste.md-5.net/onufivajoh.cs
use it next to openInventory() to send packet, like you provided in the snippet above
idk if that would work but it could
Ohh that is interesting. But how would I know if its a real ender chest vs my custom item? Since the ender chest already translates correctly, I don't need to send the packet in that case
you dont need to
you wrap the method
of openinventory
since player can see only one container on the client
by executing wrapped method you're guaranteed player is opening patched one
but it would work only if you execute the wrapped method
to open the enderchest ivnentory
this should work
EVERY time a chest is opened, add its ID to that map, then ONLY when my custom open inventory is called will I send that ID
yes
the only time that ID will be sent, will be in the context of my method
thats clever
genius haha
but im not sure if packet send listener gets called instantly (single threaded execution) or its async
How can I use custom args in Aikar Command Framework?
I've created an Object class:
@Getter
@Setter
@RequiredArgsConstructor
public class Arena {
private final UUID id;
private final String name;
private final ArenaType type;
private final World world;
private final int maxPlayers;
private final Map<TeamColor, Location> spawns;
private final Map<GeneratorType, List<Location>> generators;
private final Location lobby;
private final Location[] shop, upgrade, beds;
private GameStatus status = GameStatus.WAITING;
}
And I would like to use it inside a subcommand arg
public void join(final CommandSender sender, Arena arena) {
afaik packet listeners are not thread safe
