#help-development
1 messages ยท Page 337 of 1
my main class would be in the mycoolplugin folder
so by "same main Class directory" they mean "main class directory with the same name"?
well the wording is a bit weird in this part of the article
it's basically just showing the traditional way to name your packages
well if i had a plugin called mycoolplugin i would call my main class MyCoolPlugin
and my package would be me/epic/mycoolplugin
pretty sure it means to avoid conflicts with different plugins with the same name
tyvm guys
yeah
There's no problem if the FQN of your main class is unique, so just call it Main. FQN = <containing package>.<class name> A package is a directory, in essence.
out of curiosity, is it somehow possible to change the quote-unquote default tab completer? i'm talking about the fact that when a tabcompleter returns null, it provides the list of online players, but can I modify that list for all commands? i'm thinking of TabCompleteEvent -> getCompletions(), but i'm not sure if i can know whether it's returing a list of all players' names
it'd be trivial to do this for the commands in my plugin but i want to do it for all commands
ok this seems to be something cool
public void onPing(final TabCompleteEvent ev) {
final List<String> allPlayerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).toList();
if (new HashSet<>(ev.getCompletions()).containsAll(allPlayerNames)) {
// ...
}
}
the only thing bothering me is that there might be a delay between a tab completion and the event being called?
hashset for performance
i think you should try it out to see if there is a big delay
sure i'll do it
it seems slow but who knows, it might be unnoticeable
now that i think of it, it should be fine if a couple tabcompletions fail every minute
the chance of a player leaving/joining during that very delay is so small that it'll probably have no impact
yea and even if a player joins, the list will still contain all the player names of the other players
it would be true nonetheless
yep
only possible problem is a player leaving during the delay but the chances of that are small as you said
ugh and thats a reason for it to not compile ๐
should see whats its gonna be replaced with
you might have deprecation set to an error level in the ide
just wondering what are you using it for?
i used it in the past (cause of some code i used online) and i just deleted it and it worked ig ๐
Preferences -> Editor -> Inspections
uh just testing some stuff
there's a search bar so look for deprecat there
yeah that makes sense
deprecat looks to me like an abbreviation of "depressed cat"
i think it's Java -> Code maturity -> Deprecated API usage
Uhm, maybe I'm missing something, but how does it make something more performant when you have to allocate a new hashset which then has to go through all items and calculate a hash for them anyways? I don't see the advantage there at all.
ah
stolen!!!!!1!!!!!
i think the reason why it works cause of some elevated permission usage... i forgot tbh
my ide suggested it to me and i listened ๐
either way securitymanager is a mess lmao
i'm not experienced with performance
shrug
so i just did
How to use "translate" object with spigot? Is this a thing?
i.e I have the command /tellraw @p [{"translate": "advancements.adventure.kill_a_mob.title"}]is there a way to make this a code, without using dispatchCommand?
i think it is a translatable key or smth
racism???? calling me a thief just because i'm albanian???????? i am reporting!!!!
noooooooooooooo!!!!!!!
use adventure ๐ฅฒ
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
just make a tell command that uses color codes
i want to get a mac for funny outlines and rounded corners
me being bored and looking at how NativeMethodAccessorImpl works
native code is always fun
that name is almost as long as my pinky
shrt
you have a long pinky then
they don't call me long pinky joe for nothin
my name isn't joe, my pinky is just long
his gf is shivering
if he even has one
that's the thing, my pinky is so long that moving it flings anyone near me miles away
pinky telekinesis
i have longpinkyitis
as magic as this accessor impl
poor gf
hehe DelegatingMethodAccessorImpl
also fun thing about translatable components: you can have custom keys and use a resource pack to have translations for them
that's more or less how forge does translations iirc
your pinky so long, you threw your girlfriend so far that she flew through all of the infinite space and came back
oh that's really cool
i single-pinky-dly proved that the universe clamps back around
and that flying higher than the speed of light is possible
that is as long as my thumb
there was a site that would create overindustrialized java class names
i wanna find it
and pointer finger
no way
dang
not even my pinky is that long
oop
danke schon
I have a problem with gradle, basically I have a library that includes certain dependency and shades it.
However when I add that library to my project gradle still looks for the dependency that's already in the library
me on my way to throw an instance of IdentifierContainerMapperCallbackListDefinitionFacadeMethodInterceptorMethodManagerResolverPrototypeSchemaExceptionAdvisorManagerException
undefinedCandidateIteratorMessageModelFilterDispatcherConfigurationManagerMapInfoAdvisorInterceptorPrinterDescriptorWorkerImporterProxyExpressionEventContextInterceptorRequestAuthenticationPrinterThreadInvocationPool
undefined ๐
don't forget to make an overly verbose error message
ParameterTagTemplateAnnotationListenerFilterPoolListenerCallbackInterpreterCloneWorkerThreadFacadeFacadeTaskProxyListenerDescriptorFilterProccesorContextMappingMapperBroadcasterVisitorFacadeAdvisorSerializerIdentifierAbstractLiteralTemplate```
give me a few minutes
a literal template, to differentiate it from a metaphorical template
PublisherListParameterProxyDescriptorIteratorSerializerWatcherExpressionReponseDatabaseMapMappingServiceConsumerProducerInfoCandidateExceptionConnectionCallbackTemplateInstanceVisitorStubOrderConsumerDescriptorInfoWatcherDefinitionPublisherObserverPropertyErrorRequestFacadeMapIdentifierAttributeDecoratorExporterMockComparatorTaskContainerMockInterpreterExporterSerializerMessageParameterConfigurationInterceptorValueExceptionSchemaPrinterWatcherComparatorConsumerMapperHelperAuthenticationPoolMappingFilterTestsContextVisitorThreadIdentifierWatcherMockRepositoryParameterHelperThreadIdentifierProxyExceptionResolverUtilsInterceptorRequestClientIdentifierServiceGetterMethodFacadeMockProducerProccesorExporterStubFacadeDecoratorMapFacadeMethodExceptionListenerDispatcherImporterundefinedCandidateIteratorMessageModelFilterDispatcherConfigurationManagerMapInfoAdvisorInterceptorPrinterDescriptorWorkerImporterProxyExpressionEventContextInterceptorRequestAuthenticationPrinterThreadInvocationPool
beautiful
do we go longer
i'm using that as a class name in my next plugin
this is still help-development i'm pretty sure
oh i'll use it in my CURRENT plugin
definitely do so
what have I started
a mastapiece
oh alr then
that's what you've started
DefinitionDefinitionComparatorStateValueAttributePropertyPrinterMapperFilterAuthenticationStateInterceptorTagInvocationInterceptorTagStrategyProxyConfigurationUtilsReponseQueueTemplatePolicyImporterProducerSingletonTaskTemplateDecoratorBroadcasterFacadeListMapEventMapperSetterMessageInfoPrinterPolicyMockClientPoolBeanUtilsListenerManagerAuthenticationOrderPropertyMethodDescriptorAdapterRepositoryStrategyConsumerPrototypeMockInstanceGetterResolverIteratorUtilsSingletonGetterEventFilterDescriptorDefinitionVisitorConsumerMapUtilsResolverContextPropertyPropertyDefinitionDefinitionCandidateStrategyProxyContainerProxyConfigurationGetterHelperAttributeInfoObserverSingletonStrategyGetterCandidateSchemaObserverErrorHelperDecoratorDecoratorParameterReponseDefinitionCloneQueueQueueValueMappingSingletonContextAttributeCollectionCallbackStrategyMappingPrototypeInvocationResolverAnnotationPrototypeContextContainerStrategyIdentifierAdvisorServerReponseInfoMockComparatorCallbackComparatorParameterDispatcherSerializerTagCallbackComposerFilterTaskMapStubHelperWrapperAttributeInvocationImporterServiceListenerPublisherValueOrderFilterClientMockMapperBroadcasterMockImporterAttributeModelAttributePropertyMessagePropertyFilterProccesorGetterSetterDispatcherTagTaskBeanAttributeProccesorProxyFactoryPredicateAdapterMappingDatabaseFilterPublisherIdentifierConfigurationPublisherSetterMapperTemplateTestsBridgeMapperProxySingletonServerCandidateAdapterConnectionAdapterBroadcasterConnectionServerStubStateMapPredicateServiceTestsPublisherListParameterProxyDescriptorIteratorSerializerWatcherExpressionReponseDatabaseMapMappingServiceConsumerProducerInfoCandidateExceptionConnectionCallbackTemplateInstanceVisitorStubOrderConsumerDescriptorInfoWatcherDefinitionPublisherObserverPropertyErrorRequestFacadeMapIdentifierAttributeDecoratorExporterMockComparatorTaskContainerMockInterpreterExporterSerializerMessageParameterConfigurationInterceptorValueExceptionSchemaPrinterWatcherComparatorConsumerMapperHelperAuthenticationPoolMappingFilterTestsContextVisitorThreadIdentifierWatcherMockRepositoryParameterHelperThreadIdentifierProxyExceptionResolverUtilsInterceptorRequestClientIdentifierServiceGetterMethodFacadeMockProducerProccesorExporterStubFacadeDecoratorMapFacadeMethodExceptionListenerDispatcherImporterundefinedCandidateIteratorMessageModelFilterDispatcherConfigurationManagerMapInfoAdvisorInterceptorPrinterDescriptorWorkerImporterProxyExpressionEventContextInterceptorRequestAuthenticationPrinterThreadInvocationPool
that is over 2k chars
ok nitro user
i dont pay for it
enough funnies yall plox help appreciate it
apologies
we did get off-topic
that happened to me with paper lib, idk why
this
never managed to fixit
olivo definetly knows how to fix it
yea
hm fix what?
i mean he probably knows everything spigot
just like choco
because they have 5 letter names
I have a problem with gradle, basically I have a library that includes certain dependency and shades it.
However when I add that library to my project gradle still looks for the dependency that's already in the library
choko knows bukkit a lot
ahh found the Thread impl
i did an off by 1 error when creating my name ๐
imagine using gradle
shade the whole thing properly then.
i gave up my 6 letter name in favor of another cooler one for youtube purposes
dependencies {
compileOnly "org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT"
implementation "com.github.kaspiandev.kommons:Kommons:1-SNAPSHOT"
}
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
> Could not find com.github.retrooper.packetevents:spigot:2.0.0-SNAPSHOT.
something like this happens pretty muich
wdym by properly?
Are you planning on shading kommons?
๐
is there any way to use chatgpt if my country is banned from openai
no Oop, only OOP
vpn does not help somehow
i'm curious now
me and my best friend use hyperbeam to watch shows & stuff
that does everything
damn
(me too)
that's a highly needed class
there should be a button to create a room somewhere
yea do hyperbeam watch party
builder mthods >> anything
only thing i'm smart at is being dumb
same
we continue
totes
toes
look at this sleeping imajin
hand toes
sleep is for the weak
looks like java has pointer impls
which is why i sleep 6-10 hours nightly
sleep is for the week****
i am the weak
weekends are for all nighters
erdi should i close mozilla for this to work?
isn't literally every non-primitive a pointer? or at least a reference?
try to refresh
the class was named WHAT?
sun.jvm.hotspot.debugger.Address
i dont like the fact its called Factory when its a Builder
my built object are the builders
new BuiltObject().addstuff()
just most methods return this
I found that gives me the least overhead
let's fuck around
new BuilderFactory.with(...).build().getFactory().createFactoryEntity().getOrThrow();
thats cursed
perfrecte
wait untill you find out about getKey().getKey()
oh yeah
from namespacedkey right
keyception
or Enchantment.getByKey(NamespacedKey.minecraft(knownEnchantName))
addressception
erdi this does not seem to work i've recreated the room like 5 times ;-;
odd
i'll make a room, send it, and give you the remote
no way hyperbeam would be shadowbanned in russia
sure
Does anyone know how to check if killer isn't a player (so like void, mobs, entities or suicide)?
My current code but code if (killer != null) is always true apparently. So I'm trying to get a workaround maybe if (!killer instanceof Player)?
killer = victimProfile.getLastDamager();
} else {
killer = PlayerUtils.getNearestPlayer(victim);
}```
can i have that class
I'd appreciate help
for educational purposes
just write it yourself ๐
the killer on player death event will only ever be a player
yeah that's correct, it's not a "workaround" it's exactly what you want to do
i can do this
if (!(killer instanceof Player playerKiller))
i sent it in DMs
public enum ItemEnchant {
PROTECTION(Enchantment. PROTECTION ENVIRONMENTAL) ,
FIRE PROTECTION(Enchantment.PROTECTION FIRE),
FEATHER FALLINC(Enchantment.PROTECTION FALL),
BLAST PROTECTION(Enchantment.PROTECTION EXPLOSIONS),
PROJECTILE PROTECTION(Enchantment.PROTECTION PROJECTILE),
RESPIRATION( Enchantment . OXYGEN) ,
AQUA AFFINITY(Enchantment.WATER WORKER),
THORNS( Enchantment. THORNS) ,
DEPTH STRIDER(Enchantment.DEPTH STRIDER),
FROST _ WALKER( Enchantment. FROST _ WALKER) ,
CURSE OF BINDING(Enchantment.BINDING CURSE),
SHARPNESS( Enchantment . ) ,
SMITE(Enchantment.DAMAGE UNDEAD),
BANE OF ARTHROPODS(Enchantment.DAMรGE ARTHROPODS),
KNOCKBA Enchantment . KNOCKBACK) ,
FIRE ASPECT(Enchantment.FIRE ASPECT),
Enchantment. LOOT BONUS MOBS),
SWEEPING EDGE(Enchantrent.SWEEPIKG EDGE),
Enchantment.
SILK TOUCH(Enchantment.
UNBREAK Enchantment .
D16_SPEED),
SILK _ TOUCH) ,
DURABILITY),
windows did fine
probably
So how to check if player has died by everything else other than player?
.. i guess
me
yeah in this event killer is always a player apparently
so you don't need this check at all
nice event name then
so what do I do?
Why is REMOVE_PLAYER action removed from ClientboundPlayerInfoUpdatePacket in 1.19.3?
because they changed that
Separate packet
yeah I'm not using ProtocolLib atm
well there is a ClientboundPlayerInfoRemovePacket
thats probably it
I'm trying to incorporate bStats in my plugin, I'm using Intellij, have followed the directions on the bStats site, but intellij is not shading bStats into my plugin.
How are you building your plugin?
Intellij>Build>Build Artifacts
Is that something I can do from within the IDE?
Yes
interesting
You can make a maven or gradle project in your IDE
Thank you.
hmm okay so I wanna make a gui inventory so when someone opens the gui and clicks on the item x I wanna make it like it adds the item to the guys inventory
how do I do that?
using inventory click events
I was told to define the item with itemstack but where? in the main class or?
right after you create the inventory
you get the clicked item
@Override
public void run() {
for (Player player : Bukkit.getOnlinePlayers()) {
ItemStack item = player.getInventory().getHelmet();
if(item == null) {return;}
if(item.getItemMeta() == null) {return;}
if(item.getItemMeta().getDisplayName() == null) {return;}
ItemMeta meta = item.getItemMeta();
String ItemName = item.getItemMeta().getDisplayName();
if (ItemName.equals(ChatColor.RED + "Dctr's Space Helmet")) {
}
}``` so this is my main class file where I have defined the item stack so if I wanna add it to the gui listener do I just spacehelm = item and head over to the gui listener add it make it add this etc?
put it in your listener class
wasnt someone else doing that
i remember something exactly like that
yeah
they made a thread recently
but someone did it like 4/5 months ago
that was me
was it?
chatgpt?
it was
its great
dude why do you even document that in the first place
I had it document a 300 line class
the string is the string though, that's not incorrect
it is, but if i write my code like that all my files would 10x as big
the only things worth documenting are the non obvious things
if its something others are going to be working with, I document everything
what counts as obvious
like if this method also will flip the calendar or some shit
wtf are the odds
same here
atkeast 3
if I call my method getItem() i dont have to put docs saying, :"returns the item"
unless it does 20 other things
in which case you rename the method
no
How's your day going ebic
tiring
it might seem obvious to me since i've been working with it for hours, but to a random person it might not be as obvious
well thats what you can do if you wanna waste time
Im having gpt write me some interfaces for a program im doing atm lol
I can imagine lol. I just fixed another infinite task bug so yeah going pretty well
well yeah I just try to make it clear what the code does, most simple methods can be more easily read over
oh ive done nothing productive
unless you just have teh docs and not the actual code
in which case it would be a little more documentation, but still
seems productive to me
which
I assume you don't write docs for your getters if they don't do anything past returning the value?
wandavision
usually not, unless i want to explain in depth what the value is used for
Fair
yeah so where do you draw the line
((CraftPlayer).getHandle().playerConnection.sendPacket,
when sending the packet to the client, will this packet be received by the client in the next tick or will it already be sent?
i'm not an artist, i don't draw lines
bamn, argument destroyed
I think I could probably document a little better, but I see some folks commenting on everything like its a school assignment
well named methods go a long way
i believe it doesn't have anything to do with ticks
it should immediately send
i might be wrong, but that's what i think
i'll maybe have to research more
Sending packets is not synchronized to the main thread. There should be a send method with an optional callback, either a runnable, some future stuff or something completely new in 1.19 trash.
It's usually sent immediately, but there's also a queue for when the socket is currently unavailable, which shouldn't happen in normal operation tho.
It doesn't have to be immediate tho, as this heavily depends on the network condition.
queue for when the socket is currently unavailable wdym by that?
I'm not sure when the socket isn't connected tho. Maybe that has something to do with auto-reconnect when the connection has ben severed. Would be odd tho. Just forget the queue. It's still not guaranteed to be sent immediately, which is why there's a callback parameter available, which netty calls when the packet has been written.
Why am i getting this error when i change the chat format UnknownFormatConversionException: Conversion = 'm'?
Would probably be easier to answer if you could provide the code you ran.
player.sendMessage(mask.getCustomChatFormat());
event.setFormat(chatFormat);```
Looks like a bad format
Not sure what you think we can help with if you only send those three lines
the chat format variable contains only a string
If i use the same string putting it manually it works
Unanswerable without knowing the chatFormat value.
It contains "ยง7-"
doubt
heehee
haha
Anyone know why would a entity not actually appear? debug showed it did actually spawn Dungeon spawned SPIDER atLocation{world=CraftWorld{name=DwarvenCrypt-b52e5bfe-e5f7-3f4e-94a0-93e6f8cf35ef},x=288.3917820484588,y=53.0,z=-1.5090394101488653,pitch=0.0,yaw=0.0}
shrug
excel be like
looks like bytecode impl
well having the world marked as peacefull is not a ctually a good ideea
Don't think that it does contain this, as your exception said something about the caracter m. When you try to change the format, your format is validated and if it's invalid, an exception is being thrown (probably what you experienced). Maybe check how Java's String#format works before you try to work with it here: https://www.javatpoint.com/java-string-format
Java String format() method with method signature and examples of concat, compare, touppercase, tolowercase, trim, length, equals, split, string format in java etc.
:o
Is it possible to know which plugin logged something in the console? (if it didn't use it's own logger, but the server's logger)
I don't think so
There likely is a way, the question is just whether it's elegant. What are you trying to accomplish?
theres a PluginLogger#getPlugin but dont think that may help
trying to find out which plugin is logging something
how many do you have
that's if the plugin doing it uses it's own logger
not if it uses the server logger
too many to do it manually
and it's in a prod server
oof
damn java compiler package has the same stuff im using
hmm Reflection.getCaller or whatever its called would return Bukkit.class and not one of the plugins classes ig
Logging how? Could you show me an example invocation of the logger? Many plugins use ConsoleCommandSender#sendMessage, which in essence only prints to stdout.
why isnt this in the std lib
because its too good
I have no idea which plugin it is, hence why I am trying to find out lol
I have no idea which way they do it
You can change the output stream and then get the stack trace
You should be able to find the plugin from that
Using System#setOut
ConsoleCommandSender of MinecraftServer is public, you could easily change that to a wrapper where you intercept calls to sendMessage and use a lib to walk the stack until you encounter the caller and then map back from the package to a plugin instance to resolve it's name.
Or that, even better probably
I didn't understand anything lol, I am not that advanced in bukkitapi
would that work with Thread.currentThread().getStackTrace()
I'd probably use the java.lang.StackWalker. I'm experimenting with it right now, gonna post my result as I end up with something usable.
hmm never heard of
That looks promising already, before each print it's stacktrace of declaring classes is printed out, joined by ,. I guess you'd have to loop that list until you find a class which corresponds to a plugin for automatic plugin detection. Gonna tinker with it a few more minutes.
In terms of performance, readability and recommended code style, is there any difference between passing a reference to your plugin to a class through the constructor, vs using (MyPlugin) Bukkit.getPluginManager().getPlugin("MyPlugin") ?
I've been tending towards using the latter as it reduces a method parameter each time.
I have a static method get() in my plugin class that returns the instance
which does bukkit.etc
That sounds like a good alternative ^
public MyPlugin get() {
return this;
}
This type of thing?
how can I color the messages in console?
well no
make it static
Yes, sorry I missed out static.
then return bukkit.getpluginmanager.getplugin.whatrver
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
But if you're trying to get your plugin instance, you can just pass back 'this' rather than getting it from Bukkit, surely?
Or that won't work because the method is static I suppose.
would there be a way to get the Type inside of a Consumer?
wanting to get the GUISlot
Here you go, hope that helps. It's based on the smart idea of @chrome beacon, seems to work fine. It could probably be still optimized for efficiency, but who cares about that on an instrumenting tool.
Thanks Steaf, I prefer your method, it's cleaner than what I've been doing.
np
No, due to type erasure. These generic types are only available during compile-time and are all erased to Object afterwards. The only place where you can actually still retrieve them at runtime is on member-fields. If you need that class, you need to pass it as a separate argument, like GUISlot.class.
okay, thank you
is there a way to know how much a block is broken
Then consumer is not good func interface for this
Your probably want supplier
does the same thing?
With suppler you can call get() , and get instance made in anonymous class or lambda
No, a consumer consumes a value while a supplier supplies a value. Consumer: func(x): void, Supplier: func(void): x
ah
Yeah, you could actually run supplier.get().getClass(), xD. Just for the consumer I don't think that there's a way to do this, as it just takes an Object parameter. But the supplier actually gives you an instance of the type which satisfies the type which had been there at compiletime.
How the hell does this work?! ๐ตโ๐ซ๐ตโ๐ซ
Good question, no idea where that came from, xD
Wow thanks, hopefully that helps identify which plugin it is
plugin messages
Hello, this is a kind of silly question, but I hope you can help me. Recently I decided to try to make a "multi module" project, but I ran into a small problem... I have an API module - with basic interfaces and stuff, and a Plugin module - the spigot plugin. I looked in other plugins, like "SkinsRestorerX" and "HolographicDisplays", that I should make and initialize some "API provider" - I did that, but still, when I want to call some method in my other plugins - I get an error. ๐ซค
it uses a player connection to send data, what youre sending is the ways to send stuff
Let me know if it worked, I'm very excited to know if that actually catches everything. My plugin also used custom loggers, and it caught it, as I think everything just ends up at STDOUT eventually.
Sure, will test it and will let you know
Unrelated, but: Is that actually from an official source? Cause I love how they call ByteArrayOutputStream#toByteArray twice, only to get the length, and thus actually allocate an array copy twice, lmao.
ugh
.get()
oh that's it
check the docs too
alr
true true
Or just use your IDEs intellisense. If it's already grabbing gigs of your system memory, it better do something for it.
Yes it is from Spigot
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Yet another of the thousand words meaning auto completion, yes. I think it originated in microsoft's offices.
Ah yes, no surprises there.
Ah well now then my problem is to solve a way to get a s... wait nevermind I might have got the idea lol
nope i didnt
fuck
Hi , i am coding about TranslatableComponent in net.md_5.bungee.api.chat , can i get the key in locale file from an item id string?
i wrote a pull request for that but it didnt get merged yet
you currently need to use NMS for this
how do i change player's view distance?
is the key can be found with NMS?
yes
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1131/overview here's the pull request
So, I am trying to figure out how to set a block, that the player is looking at, on fir., the code below gives this error: Cannot resolve method 'setType(Material)'
player.getTargetBlock(null, 50).getLocation().getWorld().setType(Material.FIRE);
remove .getWorld()
setType only exists on block objects
alex could you send me the link to your website
and place.getBlock() there
ty
np
i wanted to say smth but i wont
haha yea thought u'd say that
it's a bad joke
umm intelliJ just crashed and is like opening and closing/minimizing and unminimizing itself..
I mean nobody ever said "oh my IDE doesn't look fancy", it's about features and not about how it looks lol
nvm it fixed itself ๐
i have the Clan plugin and i want to have the rank of the player in the chat to with the clan does someone know how to do this this is how it looks now Clan Trixy_clapps: test and i want this Clan Rank player message does someone knows how to fix this code is now ChatFormat: '%clan%&8 %player%: &f%message%'
just look at how many more classes fit on the screen using the old UI
the moment intellij choke and dies for a few seconds also eating 20gigs of ram and keeping an i7 10th at 90%
yea i agree.
you can use java .replace on string
Is the link can be view by anyone ?
or need to sign an account?
but after register , i still can not access the link. : (
what do you mean?
``` getting this error for some reason? Should be set
```java
public SpendingGUI(String name) {
new SpendingGUI(name, 3);
}
public SpendingGUI(String name, int rows) {
this.name = name;
this.rows = 3;
this.inventory = Bukkit.createInventory(null, (rows * 9), name);
guis.put(name, this);
}```
and my main
```java
SpendingGUI gui = new SpendingGUI("Test"); // Creating GUI Here?
gui.createGUIItem(new GUISlot(0, gui, new ItemStack(Material.GRAY_STAINED_GLASS_PANE)), () -> {
sender.sendMessage("Hello");
return (Player) sender;
});
gui.addPlayer((Player) sender);```
Probably not their plugin
just use their api
I think you need an account. basically you can get the NMS item of an itemStack using CraftMagicNumbers.getItem, then call getDescriptionId on it
wait wha public SpendingGUI(String name) {
new SpendingGUI(name, 3);
}
but how what do i need to do in my server files?
You're in the wrong channel. This is for making plugins
So Kacper suggested how you would fix it with code
is there a method to resend chunks to the player?
i guess your one constructor has to call the other one?
without nms you can only do Player#sendBlockChanges
this(name, 3)
calls the SpendingGUI(String, int) constructor
also 1 more question because i cant find it
is there a way to get the inventory's name?
Inventory inv = blah;
.toString()?
that's for the class itself tho
i think
getView().getTitle() I think
Don't compare inventories by their name
dunno if theres a field for the inv name
yeah but why would you ever need that?
is it ?
public BaseComponent[] createAsItemTag(ItemStack item){
...
CraftItemStack.asNMSCopy(item)
...}
btw I am dumb or I just did something wrong? Shouldn't this method send the message to all - curretnly two - whitelisted players?
public void multiplePlayerMessageTest(Player player) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(out);
try {
for (OfflinePlayer players : Bukkit.getWhitelistedPlayers()) {
data.writeUTF("Message");
data.writeUTF(players.getName());
data.writeUTF(prefix + "ยงfTesztรผzenet a tรถbb szemรฉlyzeti lehetลsรฉgre.");
}
} catch (IOException e1) {
e1.printStackTrace();
}
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
Only the first player on the list gets the message, second never afterwards, only if they are in first priority.
IntelliJ is just a pice of shit, I'm gonna dump it soon.
How do I like set this to a variable so I can change the block at this place, because it won't let me do setType anymore:
player.getTargetBlock(null, 50).getLocation().add(0,1,0). ??
no, it's literally exactly what I sent
getBlock
what are you gonna use instead?
paint ide
I believe you need to send a plugin message for each player in the loop
you only send it to "player"
It only accepts one identifier and data
Doesn't matters. I can set the player whoever to I want, it should NOT send the message to them unless they are whitelisted.
no
why doesnt it just use binary ieee754 encoding
you have to send it to every player that should see the message
And offline players cannot send messaegs
Meaning it would get me a lot of errors in console
is it possible to make it so squids dont need to spawn on water from squid spawners? via api
huh? but that's why you're using bungee plugin messages
It just can't send messages through null players
I can't set the player to "mfnalex", if "mfnalex" is offline
no clue what youre talking about. instead of sending the plugin message to only "player", send it to all players
Vim with lsp. The only reason we need modern IDEs is that our buildsystems are a overcomplicated clusterfuck. I'm gonna automate those few tiny things IntelliJ does for me otherwise, without 10G+ ram use.
i dont even know how to exit vim lol
I have
you wanna send it to multiple players but all you do is to send it to "player" and nobody else
player sends the message
players are who shall receive it
as said
I can't send messages thorugh offline players
Meaning at least one online player is required
I use IdeaVim, so all intellij does for me is the little maven panel on the right. That can go to hell with the whole IDE in my opinion. Gonna run maven commands from the shell and that's it.
is name of functions in NMS can be map to normal name? or a table i can found them?
hmm
?nms
dont press ctrl+c ig
or https://
nms.screamingsandals.org
would that exit out of the program?
you still do not send it to all
you do "players.getName()"
use "ALL" if you wanna send it to all players
public static void sendMessageToAllBungeePlayers(String message, Player sender, Plugin plugin) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(out);
try {
data.writeUTF("Message");
data.writeUTF("ALL");
data.writeUTF(message);
sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
} catch (IOException e1) {
e1.printStackTrace();
}
}
Offline player can not send plugin messages
I know how it works
offline players do not have to send plugin messages
just use "ALL" to send the message to all players
Why would I want to send staff messages to all players?
because earlier you said you wanted to send it to all whitelisted players
and I figured it would be hard to be online while not whitelisted
you only asked on how to send it to all whitelisted players and never mentioned anything about "staff" or "players who are online but not whitelisted"
hot java insertFunction(new FunctionCallSite("rand", 0, 2, ctx -> switch (ctx.size()) { case 0 -> Math.random(); case 1 -> ThreadLocalRandom.current().nextDouble(ctx.get(0)); default -> ThreadLocalRandom.current().nextDouble(ctx.get(0), ctx.get(1)); // 2 args }));
thanks
but looks like i somehow fucked up smth else
alternatively do it like this @trim creek ```java
public static void sendMessageToAllBungeePlayers(String message, Player sender, Plugin plugin) {
for(OfflinePlayer receiver : Bukkit.getWhitelistedPlayers()) {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(out);
data.writeUTF("Message");
data.writeUTF(receiver.getName());
data.writeUTF(message);
sender.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
ok~
I still wonder how you can have online players that are not whitelisted
If i have a queue that I want processed by a single thread, should I use a single thread executor OR should i use wait amd notify() and my own thread
what
getWhitelistedPlayers() basically retursnt he whitelisted players, right?
yes
you mean a blocking queue?
stdlib has that
no need to turn it on
joe biden
and what do you mean "it only has to have the players"
whitelist
?
idk what you mean
oh you wanna use the whitelist to keep track of who is staff without enabling the whitelist
getWhitelistedPlayers() will return the whitelisted players. This is obvious. No matter if the whitelist is on or off, it can always get them
Yes since that sounds an easier method to me
well obviously nobody expects such a behaviour so how did you expect me to magically know that you're abusing this feature like this to detect who's staff and who isn't lol
this should work
Ty
A blocking queue blocks the thread until something is inserted. Exactly what i was looking for
np lol
your problem was that you reused the same stream, but it cannot be read again after having it read once
it's basically like
while(stream.hasData()) {
stream.sendData();
yo epic who am I?
"this should be for api / bungeecord api help, not for syntax"
@remote swallow answer!
heh
PulseBeat_02#9425
lol ok
had to find it lol
oh they changed this channel's description
it used to say "ask other questions here" which never made any sense lol
Use SplittableRandom instead of ThreadLocalRandom
it's just better
Do I put 2 separate commands in 2 separate java classes/command executors?
yes
somebody help?
You do not have essentials
well I keep getting an error in the console when i try to do the second command, but the first command works.
are they both in plugin.yml
second command is trying to use essentials via a placeholder.
2 different people jan
lol
are both of the commands in plugin.yml
also what do you consider different commands
yes
name: SuperPowers
version: 0.0.1
author: amazingmation(amazingmationHub)
main: Powers
api-version: 1.19
commands:
giveflamethrower:
description: Gives custom Flamethrower to player.
usage: /<command>
givefblauncher:
description: Gives custom Fireball Launcher to player.
usage: /<command>
and you registered them in your main class correctly?
or wherever you register them
yes i believe so
getCommand("giveflamethrower").setExecutor(new giveflamethrower());
getCommand("givefblauncher").setExecutor(new givefblauncher());
thats in onEnable
?paste the error
?conventions too btw
Can somebody help? When i spawn vehicles [The paid one] it will give me the chest but when i place it it will disappere
which plugin
ask here instead https://discord.com/invite/VKAHkwTBZC
i got ban :kekw:
the item on that command is null
why xD
whats givefblauncher.java line 20
oops lol, forgot to do something in the ItemMangers, lemme try that rq
can somebody help with vault papi? i got %vault_prefix% it will work but the %vault_eco_balance_fixed% aint working
do you have an economy plugin that is vault compatable
heres that line
player.getInventory().addItem(ItemManager.fireballlauncher);
That the issue
yeah, something in the ItemManager is causing that
vault is only an api
essentialsX has an economy built it and it gives a load of useful features
can you say some economy plugin please
The essential plugin for Spigot servers.
yay, idk what i changed, but it works now! ๐
lol
a wrongly named class name
Can someone explain to me why the API returns null? I decided to make a multi-module project, using the example of others, but nothing works lol. Here's API module class: https://paste.md-5.net/vaxopevube.java, Main plugin module class: https://paste.md-5.net/hadebofaqu.java and just a test plugin class: https://paste.md-5.net/irufotupez.java
But actually I think that there's everything's wrong...
instance is null
TestAPI#getInstance() is returning null
show the pom of AnotherPlugin
ugh why is gradle's publishToMavenLocal so shit
anybody now how I can tell gradle to properly put this in the local maven repo
or do I have to run mvn install:install-file manually
you know what, I'll just upload it to jeff-media-thirdparty
so
they have maven publish
but dont set maven publish up
so smart
some people confuse me
problem solved
is 3rd party not public
thirdparty is private
it's stuff from all the people who dont upload their stuff to a proper repo so I dont have to mvn install two hundred thousand libs everytime
by being logged in lol
you can login to repo tags?
yes sure
hmmm
I mean how else do you upload stuff? o0
well yeah
that part i get
the login into it though
is this just me being a gradle user
.m2/settings.xml
but how would you add that
thats weird
how
you specify nothing but it has a login
huh
i dont get it
I tell it the url, the username, the password
what more would you need
you set it in settings.xml but it doesnt call on it
yeah maven reads that automatically
i find it weird
why would I need to specify where my settings.xml is if it's always in ~/.m2/settings.xml ? D:
which thing?
imo it should have a <credentials>id/something</credentials>
Here
you shaded the API
set the scope to "provided" instead
arent both java versions EOL?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
why after i run buildtool , added the section into pom.xml
running specialsource:remap ,
it shows an error The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.2:remap are missing or invalid
f-... How could I forget about it. Thank you very much.
and this is my pom.xml
public final class BlockBreak implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() != Material.STONE && block.getType() != Material.IRON_ORE && block.getType() != Material.DIAMOND_ORE && block.getType() != Material.EMERALD_ORE) {
event.setCancelled(true);
return;
}
event.setDropItems(false);
event.getPlayer().getInventory().addItem((ItemStack) block.getType().createBlockData());
block.setType(Material.BEDROCK);
new BukkitRunnable() {
@Override
public void run() {
block.setType(block.getType());
}
}.runTaskLater(getInstance(), 20*5);
}
}```
Hello, does any one know why it does not turn the broken ore to bedrock and give me the item?
usually you just add an execution to the javadoc plugin, e,g, like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
i did that but now when breaking the ore it just cancels it
when i break the event gets canceled
there is no error
wdym
Ye thats what i have
yep
does anybody here have some knowledge about bungee plugin development
that's normal
you have to tell it to ignore warnings
<configuration>
<failOnError>true</failOnError>
<failOnWarnings>false</failOnWarnings>
@sullen marlin can you help me how to get instance of bungeecord in 1.19 version of bungeecord
in the javadoc plugin
what is instance of bungeecord in 1.19 version of bungeecord
this to be exact
tehre is no import net.md_5.bungee.BungeeCord
yup totally true
it is indeed ProxyServer.getInstance()
yes yes in legacy like from 1.8 i believe it is BungeeCord.getInstance()
usually you put the configuration directly into <plugin> so it applies to all executions
but unless you run mvn javadoc:javadoc manually, this doesnt matter
oh yeah as said, this only disables warnings
not errors
you gotta fix the errors or also disable "failOnError"
e.g. you must not use "&" in your javadocs but rather use the escaped version &
it shows them, but it doesnt fail because of them
it fails because you actually have errors in your javadocs
as said, you gotta fix those or set failOnError to false
huh
usually it should be called -javadoc.jar
that depends on how your IDE works I guess, no clue
hm idk, I usually just do mvn deploy, then it uploads the whole stuff to nexus, and then it just works :/
send your full pom pls
hm weird
I also attach sources, maybe that's what does the trick
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
yeah
I have both
and for me intellij always shows javadocs
no, the one creates a -javadoc.jar and the other creates a -sources.jar
none
intellij should automatically get it from your local maven repo
when you do mvn install
np ๐
yep
Anyone got a tutorial / link for optimizing / improving your java code
Wanna improve my skills
Imo it's just expiriance and contributing to other projects, seeing how other people do things
only for files without nested keys
Hello , i am trying to add NMS in my project , but it fail with The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.2:remap are missing or invalid after run specialsource:remap.
And after i open a new blank project
retry the all step in https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
and run specialsource:remap
the same error shows The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.2:remap are missing or invalid : (
anyone can help me?
What version are you working with?
1.18.2
send your pom pls
I think you need to use version 1.2.3 of the specialsource maven plugin for 1.18 projects.
Alr
ok , i set 1.2.3 , and run remap again , it stills shows ```The parameters 'srgIn' for goal net.md-5:specialsource-maven-plugin:1.2.3:remap are missing or invalid
let me try it please?
Hmm. Did you run buildtools with the --remapped flag?
yes , i added --remapped flag
And you built version 1.18.2 and not 1.18 or 1.18.1?
i build two version 1.18 and 1.18.2
Did you run it normally first (no flags) or did you just run it with the remapped flag?
this is screenshot of my terminal before
i run with remapped flag
so doesn't need to specialsource:remap?
no
uuh how to use it right?
what is updateInstructionsFile
tbh no clue lol. i never wrote proper docs
lol. It's one of those projects.
the update instruction file contains a list of eg keys you want to get renamed or quotes added etc
maybe theres an example update file in chestsort
just run with mvn package and it is done , right?
yes
ok thanks~
np
this is more of a java question but if i make 2 lists and put the same object in both lists, does the object data exist 2 times or does it use some pointer system under the hood to only have one of the actual data?
just seeing if I am wasting memory atm xD
you simply store 2 references to the same object
okay
good
so when I modify the object they get changed in both lists since they share the same object
correct
yep
okay nice
you can .clone() them if you wanna have 2 separate objects
Hello,
I hope this isn't against the rules, but if so I will delete this message. But I am working on a premium plugin that I need help with. So I need one dev to help me make it. If you want to help me DM me please, I will only accept devs if you. Know how to use github, write clean code (with comments), and write efficient code.
To get more info on the plugin just DM me.
Thank you!
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I've tried to use this but the forum wasn't accepted by whatever admin was reviewing it or whatever.
Im doing java for(ItemStack itemStack : e.getClickedInventory().getContents()) { p.sendMessage("You chose " + itemStack.); Kit kit = KitPvP.getKitManager().getKit(itemStack.getItemMeta().getDisplayName());
and for some reason the getdisplayname is null, whats causing this
Try a null check such as
if(item.getItemMeta().getDisplayName() == null)
return;
Like a slot with nothing in it?
yea
I don't think so.
Yeah I realize that is probably a better idea then return;.
Yeah I realize it wasn't a forEach loop.
return@forEach moment
#getItemMeta() works on air, it just returns null
Hello
is there any nice and easy way to simulate damage on an item when BlockBreakEvent is cancelled or will I have to do all the math with unbreaking and such myself
should this code work like that? because for me it doesn't return true if something happens in the same chunk. Dealing with chunks is very wierd.
for(int i = 0; i < c.size(); i++) {
if(chunk1.equals(chunk1)) {
return true;
}
}
this code makes no sense
original code:
for(int i = 0; i < c.size(); i++) {
if(c.get(i).getTheChunk().equals(chunk)) {
sender.sendMessage(ChatColor.DARK_GRAY + "[Chunk claim] " + ChatColor.GRAY + "The chunk has already been claimed!");
return true;
}
}
shouldn't this code check if something happens in a chunk in a list?
because if a player interacts in that chunk that is in arraylist literaly the code is not executed
anyone have a better color method?
public static String colors(String message) {
Pattern pattern = Pattern.compile("#[a-zA-Z]{6}");
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String hexCode = message.substring(matcher.start(), matcher.end());
String replaceSharp = hexCode.replace("#", "x");
char[] ch = replaceSharp.toCharArray();
StringBuilder builder = new StringBuilder();
for (char c : ch) {
builder.append("ยง").append(c);
}
message = message.replace(hexCode, builder.toString());
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}```
or is this one good?
and I don't need break, since this is a return method
I use IridiumChatColorAPI
oh okay
You could use the method that most plugins have switched to.
public static final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");
public static String formatHexColorCodes(String string) {
Matcher matcher = HEX_PATTERN.matcher(string);
while (matcher.find()) {
string = string.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
}
return string;
}
IridiumChatColorAPI, or that?
that ^ you can also look at what I made
https://github.com/Y2K-Media-Creations/DustChat/blob/master/src/main/java/sh/miles/dustchat/DustChat.java
i kinda took the idea from iridum lol
I let ChatGPT and copilot write some of the code it was slower than myself writing it but was fun
so instead of return use continue? im trash at java sorry
is spawnparticle just shorthand to send a packet for a particle being spawned at a location to all players within viewing distance
the world spawnparticle method
Hello , could I get en_US.properties file with NMS?
where is it located in the jar file?
@tender shard thanks my dude
idk , but the default language of console is that : D
what mc version are u using?
1.18.2
I found from https://github.com/SpigotMC/BungeeCord/blob/master/chat/src/main/resources/mojang-translations/en_US.properties
but it seems is 1.14
the language file is in META-INF/versions/spigot.1.19.3.....jar/assets/minecraft/lang
too late :<
Boop
hmm , i open it before , but it seems not is directly to the translate key.
looks good to me
check out JeffLib ItemStackutils
Thanks
like , the translate key of Elytra should be item.elytra.name
but in the json , it is item.minecraft.elytra
because that's the correct translation key
which , the correct translation key is in json?
Yes the json key is the correct one
wait until my pull request got merged
or use NMS
CraftMagicNumbers#getItem(Material)#getDescriptionId()
oh ~ is that a correct translation key?
yep
thanks~~~!
np
nvm, I got it working. it was not the code I sent that was not working
when this gets merged, we can get the translation keys using api ๐ฅฒ https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1131/commits/f1c6863817a43bbb2b8f91f4314e96c761fc69da#src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
for items you can directly use the material name and then just to lowercase
but its kinda dumb since the matching the enum name is kinda weird
like for statistics or advancements it doesnt work for some of them since the naming is inconsistent
but yeah having actual easy API support for it is the best way
thank you very much , i have working it with 2 days long. : D
Hello, why sometimes player.sendTitle(...) doesn't show anything? It's only fixed after a client restart, but I depend on the titles really badly...
it has never failed for me
Huh?
The timings are probably messed up. You can send new ones with the second #sendTitle() method.
What's not clear?
Title timings are a little weird, but just send new ones and it should fix your issue.
I use -1 for all the timings
Well, that might explain it. lol
as far as I remember, they're the default values
The default values are 20, 20, 20 AFAIK.
but from my testings, the problem happens randomly
that maybe is a bug of client,
sometimes i left server ,when joining my single play world ,
the title quickly show and disappear.
most of the time the titles are sent, but sometimes they don't at all
I use the normal 1.19.3 vanilla client
and you are sure that code is run at the times it doesnt show?
Regarding the -1:
How many titles are you sending to the player at a time? Are you also sending them while the transitions are still in effect? Or are you waiting until they finish?
Just one, within PlayerJoinEvent
try set delay after few ticks?
Oh, well if it's on player join, you may want to delay it a bit since it will take time for the client to render the game screen.
that actually may explain why it happens relatively randomly
but it's weird that only a client restart solves this