#help-development
1 messages · Page 433 of 1
I use those symbols all the time.
yeah
I use them in my plugins.
a lot of emojis are there
GUI's mostly
or these ones, what even are these
braille
what is braille
what do you mean what is braille
literally what it means
Braille ( BRAYL) is a tactile writing system used by people who are visually impaired, including people who are blind, deafblind or who have low vision. It can be read either on embossed paper or by using refreshable braille displays that connect to computers and smartphone devices. Braille can be written using a slate and stylus, a braille wri...
this
oh lol
unicode has a lot of cool characters
problem with my english knowledge there lol
in german it's also called braille
slight oversight with that, who reads braile on their computer using eyes
french also
also there are servers where you will almost never have ppl who use specific languages/font-sets, where you can be 99.9999999% sure it wont give any issues
and if it does, that person will have many other issues, as they cant even understand what the server is about
so yes, you shouldnt change chinese characters and stuff, i never said you should do that
but there are sets that are literally less important than my own shit
Sure, but that makes your implementation server/region specific.
Iunno I'm pretty sure ⛄ is more important than whatever you're doing
yeah ⛄ is more important than whatever you're doing, chloe
lets take a german server.
you will never see any people playing on there who use these weird sets, as they couldnt even read the welcome message
it always depends on what you are doing
isnt this the same as if active showError(new IO...)return;?
Guys someone knows a yt video that teach how to do a /tag command prefix suffix etc...
not true
i'm searching a bit and i didn't find anything
you should always use the designated PUA characters for your own purposes
if youre not on the "do it the way you want" group, yes
as i stated multiple times now, i am.
except your way is wrong and you're going against the standard
except i dont care, and didnt ever care
you should
i should also go work ._.
still i dont
i never did what people expect me to do
and will never do lol
When should I create the world? onload onenable?
This is fair, but it's important to consider all aspects. Just because you don't use those characters or have ever heard of them doesn't mean that other people don't use them. It would make sense to overwrite any other character if you're planning on only making the plugin usable for a certain demographic, but when people make things like that, it goes against the standard of creating robust systems. Yes, it'll get the job done and you can call it a day, but when someone else outside of your demographic comes along, they might get lucky and see it the way you intended it to be. However, the more likely case is that they will experience it differently because it's not made to cater to everyone.
That's the reason why we have a certain set of characters designated to do whatever we want with. If you need more than that amount then yea, maybe it's time to consider overwriting different characters, but until then, why not just use the ones designated for private use in the first place?
- I doubt you'll ever need more than the amount explicitly given
There's 137,000 PUA characters
ugh I thought this might work lol
How can I automatically upload the shaded jar to github release section using maven?
anyone know a solution to this?
do you mean github packages?
To like the release section yeah
for github packages, you just need this
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/username/repo</url>
</repository>
</distributionManagement>
and then in your ~/.m2/settings.xml you declare the username and password, like this: (1 sec)
you only need the <servers> section in <settings>
the same as you'd create a world with load: postworld
I am trying to create it on enable
but get this issue
?paste
iirc there was some sort of compiler that allowed that but ye probably not a good idea
Having a serious brain drain moment. If you set an alias for a command, why would the tab complete not show up for the alias?
It should
I don't think you can push to releases automatically. There might be a GitHub Action for it though
I know you can do it with GitHub actions
How would I make an API for my plugin so other developers can run methods inside my plugin?
Or workflows or whatever
Cool
Idk if you can do it with maven
Will look into actions
Well Actions will run your Maven stuff so that doesn't matter
Actions are cool
Any public method is callable from another plugin
They can even run buildtools
Do you think it's worth setting that up?
I guess it can be used on all the projects one makes
To automatically have the jar be uploaded, just handy stuff
Do you know anyone that has an example on how to do it?
How would they call it then?
The same way you would call it
They just need an instance of whatever it is they need to invoke on
Maybe you have a getter in your plugin class
💀
YourPluginClass.getInstance().getSomething().callAMethod();```
thanks, GH copilot
The only thing they need is to add your plugin to the classpath some way or another. Whether that be Maven or Gradle, or just manually
Why is the user yoghurt
github packages are shit
Well if you're not keeping your yoghurt in your spighurt class, I don't know what you're doing
everything related to github actions is shit imho
So they would need to have my plugin as dependency in their maven file?
Yes
i don't know, I only called the class Spighurt and then copilot wrote the rest
the 1 reason i hate github packages is the annoying thing of you cant access the repo with an unauthed device or account
like you need to be a contrinuter
contributer
its really annoying
Yeah the packages are meant to be internal
if you need a free repo use repsy
It's not a public Maven repo
it should be
👀 but it's not
new github update when
Uh, mind showing us more code perhaps?
what more do you need? 🙂
Entire main + command executor to begin with I think
Oh yeah also
Do you set the tabcompleter
setTabCompleter iirc
if you set executor you dont need to set tab completer
Yeah its a mix of both
@worldly ingot would they still be able to call the method if it is a kotlin public suspend function?
can you put chat components in text displays?
Yes you do
not every time ive done it
Yes
you set executor and imlpement TabExecutor
You need setTabCompleter also
But they would need to call it from another suspend function, right?
i can prove it to you if you want
Well, you should try to avoid kotlin’s coroutine if possible in ur api for java users from what I know
Lads my alias isnt working for a command that's tab completes work for the non alias'd command
Try to expose a CompletableFuture or sth instead
We can do our executor vs completer fight later xD
I'm using Kord in my plugin so sadly I cannot avoid the coroutines
Yes, but you can abstract them away from ur api
What do you mean by that?
Dont expose coroutines in ur api
Sure ur implementation might use it
But then decouple that good enough from ur api
check if the alias works lower case, iirc upper case commands dont work
why am i getting this error
java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class: java.lang.Integer. Forgot to register a type adapter?
code:
ItemStack item = new CustomItemStack(Material.STICK).setRightClickAction(event -> {
Logger.log("Witam");
}).setDisplayName("Bajka");
String json = new Gson().toJson(item);```
because gson doesnt know how to serialize an item stack
can i change it some way?
So in my command I have this code: player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(this.word)); Player is an Entity variable so it can be @p or MyName. I get this error message for the code. How can I resolve it? no suitable method found for sendMessage(net.md_5.bungee.api.ChatMessageType,net.md_5.bungee.api.chat.TextComponent)
Doesnt matter
toLowerCase is called upon registration
no
I mean it just calls toLowerCase there also
update the spigot API version
https://github.com/The-Epic/EpicSpigotLib/blob/master/epicspigotlib-core/src/main/java/me/epic/spigotlib/storage/ItemStackAdapter.java
https://github.com/The-Epic/EpicSpigotLib/blob/master/epicspigotlib-core/src/main/java/me/epic/spigotlib/serialisation/ItemSerializer.java#L27-L37
https://github.com/The-Epic/EpicSpigotLib/blob/master/epicspigotlib-core/src/main/java/me/epic/spigotlib/serialisation/ItemSerializer.java#L59-L68
fixed
smh
cheers
Actuallty not sure epic if it does on alises
this will work?
should do, i tested it before
ohh yea
yeah thats what got me confused
it does not :L
Fixed chaps
cheers
wtf is Cleanup annotation lol
Player is an Entity variable so it can be @p or MyName
This is your mistake. Entity.spigot().sendMessage() doesn't exist with a ChatMessageType because entities can't be sent action bars
It has to be a Player
Been realising quite a few odd ones lately in spigot.
Like there is an Offline Player object that DOESNT grab offline players, but offline and online players Without caring if they are offline
Player extends from OfflinePlayer
Im aware choco
It's just inheritance. You can call getPlayer()
but my point is its badly labeled
Not really
Can you get an online player with Offline player?
oh its lombok
getPlayer()
Yes, you can. getPlayer()
Then its Badly labeled
No because it still represents an offline player
You can also refer to a Player as an Object
No the Offlineplayer bit
it's a getter for a Player object and hence it's called getPlayer
That's how inheritance and polymorphism works
but getPlayer() returns a Player, and not an OfflinePlayer
well yeah imho they should have called OfflinePlayer Player and Player OnlinePlayer
Okay pretend for 5 mins you dont have the documentation for spigot.
You see an object "offlineplayer" and a method called "getplayer" what would you immediatly assume it does?
I would assume it gets a Player object, whatever that is
I always assume that "getX" gets me exactly X
So what I could do is one of these:
suspend fun sendImage(string: String) {
val client = bot.client ?: return
val guild = client.getGuildOrNull(guildId) ?: return
val channel = guild.getChannelOfOrNull<TextChannel>(channelId) ?: return
channel.createMessage {
val inputStream: InputStream = images.getInputStream(string)
addFile("discordo.png", ChannelProvider {
inputStream.toByteReadChannel()
})
}
}
fun sendImage(string: String) {
launch {
val client = bot.client ?: return@launch
val guild = client.getGuildOrNull(guildId) ?: return@launch
val channel = guild.getChannelOfOrNull<TextChannel>(channelId) ?: return@launch
channel.createMessage {
val inputStream: InputStream = images.getInputStream(string)
addFile("discordo.png", ChannelProvider {
inputStream.toByteReadChannel()
})
}
}
}
One is a suspend function and the other launches a new coroutinescope every time it is called. Which one should I use? Or did u mean something else?
not to mention, we DO have documentation
but if its in the offline player class you'd assume it'd get the player object... for a...
I would assume that it turns an OfflinePlayer into a Player
I wouldn’t want to work with a library without documentation ever, its fucking terrible
that is why it's called getPlayer() and why its decalred in OfflinePlayer
And that my friend is why it is badly labeled. As you can get an online player using OfflinePlayer because it inherits player.
wdym? it inherits player?
I don't get it. So because I knew exactly what the method does, just by looking at its name, it's badly named?
So you would rather have a method name that does NOT tell me what it does?
I really dont get it
I would rather have OfflinePlayer renamed to something more fitting like "RecordedPlayer" or something.
I.e. I looked at "offlineplayer" and assumed "Huh i'll need 2 checks, one for offline players and one for players on the server"
In reality offline player looks for both online and offline players when doing getplayer
That make sense?
Call me crazy, but I see a class called "OfflinePlayer" and ima assume its purely for Offline players xD
and wont account for online players
yeah as said, a better name would have been "Player" and "OnlinePlayer". I thought you were claiming that getPlayer() is badly named, not the OfflinePlayer class itself
i agree that OfflinePlayer is a weird name
Ah I see haha no no OfflinePlayer. ANd now i get u too 🙂
Got weirer when the big brain genius of [redacted] API has the AUDACITY to have an OfflinePlayer Object spelt EXACTLY LIKE BUKKITS in their API
Had me hair pulling for 5 mins
i need free c# lessons for a second
actually free logic lessons
so java suits me too
anybody has free time
You not need c# lesson
ig
give jree fava mess cree f# lessons
C# is lateraly java
tu mi
But better imo :<
In case you wanna help out with the videos: https://www.patreon.com/emulatoruniverse
Patapon - PSP Gameplay - https://youtu.be/WKwZg6Nvcw0
Patapon 2 - PSP Gameplay - https://youtu.be/iTATVyDgyqo
Patapon 3 is a rhythm game for the PlayStation Portable and sequel to Patapon 2. It was developed by Pyramid and SCE Japan Studio and published by Son...
10:20
guy has to click SQUARE on controller to make Pata sound
Cuz microsoft
linus being linus
and basically the game is 120BPM and 60FPS locked
and i need some code to force people click just in beat
some random, I beat linus tech tips youtube channel security
W linus
Is this a bug?
This compiles fine:
public static <E extends Enum<E>> EnumCache<E> of(Class<E> enumClass) {
return (EnumCache<E>) CACHE.computeIfAbsent(enumClass, __ -> new EnumCache<>(enumClass));
}
But this throws an error:
public static <E extends Enum<E>> EnumCache<E> of(Class<E> enumClass) {
return (EnumCache<E>) CACHE.computeIfAbsent(enumClass, EnumCache::new);
}
Hi! When/how can I cast an Enchantment to an EnchantmentWrapper? (I'm trying to get the name of an Enchantment)
From a stored Enchantment of an Enchantment Book
uhh there's no guarantee that EnumCache's constructor will be of the type of __
The anvil isnt giving the item the original item's name what do i do?
https://paste.md-5.net/nuyajazapu.cs
the value is Function<? extends V> while you want a ? super K
well, your enchantment wrapper has to extend/implement enchantment class/interface
it's odd
idk what enchantment is
wdym?
I mean the provided Enchantment class and EnchantmentWrapper class (extends Enchantment)
(EnchantmentWrapper) ench;
use Enchantment#getKey().getKey()
on your constructor
if you need the known name
doing __ -> whatever passes K
doing Whatever::new passes ? super K
or in your case, E
A thx that's what the Javadoc meant I see
it's a weird edge case
it also compiled fine on oracle jdk 17 but fails to compile on openjdk 17
then it's probably a jdk bug yeah
I'd honestly just use an if check and avoid such lambda hell
lambda hell? 😄
whats that for?
what exactly?
the whole EnumCache class
https://paste.md-5.net/onocucifit.java nothing interesting
public static Optional<ItemStack> convertBase64ToItemStack(String data) {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
ItemStack item = (ItemStack) dataInput.readObject();
return Optional.ofNullable(item);
} catch (IOException | ClassNotFoundException e) {
Logger.error("Failed to convert base 64 to item stack.");
e.printStackTrace();
return Optional.empty();
}
}```
doesn't work
error
[17:40:51 WARN]: at org.bukkit.util.io.BukkitObjectInputStream.newIOException(BukkitObjectInputStream.java:59)
[17:40:51 WARN]: at org.bukkit.util.io.BukkitObjectInputStream.resolveObject(BukkitObjectInputStream.java:51)
[17:40:51 WARN]: at java.base/java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1795)
[17:40:51 WARN]: at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1744)
[17:40:51 WARN]: at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:514)
[17:40:51 WARN]: at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:472)
[17:40:51 WARN]: at RDCakeLib.jar//me.placek.rdcakelib.data.persistence.nbt.Persistence.convertBase64ToItemStack(Persistence.java:57)
[17:40:51 WARN]: at RDCakeLib.jar//me.placek.rdcakelib.RDCakeLib.onEnable(RDCakeLib.java:39)
[17:40:51 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:279)
[17:40:51 WARN]: at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:192)
[17:40:51 WARN]: at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104)
[17:40:51 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507)
[17:40:51 WARN]: at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:560)
[17:40:51 WARN]: at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:471)
[17:40:51 WARN]: at org.bukkit.craftbukkit.v1_19_R2.CraftServer.reload(CraftServer.java:1021)
[17:40:51 WARN]: at org.bukkit.Bukkit.reload(Bukkit.java:930)
[17:40:51 WARN]: ... 24 more```
The anvil isnt giving the item the original item's name what do i do?
https://paste.md-5.net/nuyajazapu.cs
Online player and Online’t player
close/flush the streams
does anyone have a good itembuilder?
yo alex wanna see the dumbest collection I got
still doesn't work
you'll want to block me for this
code now:
public static Optional<ItemStack> convertBase64ToItemStack(String data) {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
inputStream.close();
dataInput.close();
ItemStack item = (ItemStack) dataInput.readObject();
return Optional.ofNullable(item);
} catch (IOException | ClassNotFoundException e) {
Logger.error("Failed to convert base 64 to item stack.");
e.printStackTrace();
return Optional.empty();
}
}
}```
Well... now... do you see a fundamental issue with what you've just sent?
[17:52:35 WARN]: at org.bukkit.util.io.BukkitObjectInputStream.resolveObject(BukkitObjectInputStream.java:49)
[17:52:35 WARN]: ... 24 more```
(Don’t close the streams before you use them)
lol my bad
does anyone have a good itembuilder?
yes
2 minutes work
thx
still doesn't work
Oh look who put the consumer method in anyway
Kek
getKey()#getKey() 💀
shut
theres too many methods i cba to add
@ Builder
for item stacks?
Not working ¿?
lomboks annotation to auto create a builder
yes
i would need to still add all the fields
Oh i never seen thatone, looks pretty cool
Yeah, Builder doesn't delegate calls
Not to mention, Lombok
, but that's besides the point
i love being lazy
You can use your editor to be lazy. You can generate getters and setters with 2 clicks
lombok better
wdym empty response lmao
- Using base64 is a stupid idea. It only has downsides and not one single advantage
- Why aren't you using a proper try-with-resources?
try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(input); final BukkitObjectInputStream objectInputStream = new BukkitObjectInputStream(inputStream)) {
return (ItemStack) objectInputStream.readObject();
}
and far less readable. Also requires a Java agent to be installed in your editor
Lazy men create magnificent things 👀
yeah and then you add a new field and have to do it again
Though we're getting into preferences here. I don't care. Lombok's Builder annotation would not work for delegate ItemMeta calls
but they forgot to add @Getter(name = "methodname")
getMethodName is fine imo
agree, can you PR them?
what would that be for?
why would you rename a getter
then use "fluent = true" and rename the field from X to hasX
what if you dont want 
but how to convert itemstack to byte[] then?
well if your field doesn't have the has prefix, the field is already badly named
customName = true? nah. the field would be called "hasCustomName"
this will only work if class implements serialzable?
What are you doing so?
Trying to save items to yaml file?
im trying to convert item stack to byte array adn convert byte array to item stack
Why? Will you store them in a db?
wdym? It takes in an ItemStack as parameter
becouse i'm working on my backpack plugin
Right, but if you wont use db, there is no need to save them like that
i wanna save it in nbt container
NBT?!
Just use the paper api and ItemStack#serializeAsBytes
why would you ever use NBT
(For legal reasons that's a joke)
Legacy versions 💀
persistent data container
NBT != PDC
I mean
pdc is an nbt wrapper
^
exaclty i wouldnt remember the word its was on my mouse
so
?morepdc use this
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
you can save the item stack and read it directly
whereiam?
Yes, what i was going to tell him*
Also paper 💀 💀💀 ou cant go to that level
?
Also using paper 💀
bruh had to print two empty lines
Dont you need to write all directly to output?
Instead of printing
when should you use base64
When you need something to be printed I guess, since base54 uses all writable characters
It's also decent for shoving into a DB
this was google gave me
somehow html.transferTo(out) doesnt work lol
if for some reason it HAS to be a normal string
does anyone has a link to a good simple item builder?
i dont have time..
I never understood the purpose of ItemBuilders.
If you use custom items, then they must be 100% configurable in the config
They still can be
customizable 🤡
i just want to create items as quick as possible
but then what would you use the itembuilder for
why don't you make the items configurable
cause I just want a Inventory full of random Items...
if (section.isString("texture") && material == Material.PLAYER_HEAD) {
builder.skullTexture(section.getString("texture"));
}
if (section.isString("display-name")) {
builder.name(StringUtils.parseToLegacy(section.getString("display-name")));
}
if (section.isList("lore")) {
builder.lore(section.getStringList("lore").stream().map(StringUtils::parseToLegacy).toList());
}
if (section.isInt("custom-model-data")) {
builder.modelData(section.getInt("custom-model-data"));
}
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
meta.setOwningPlayer(something);
playerHead.setItemMeta(meta);
``` compared to
```java
ItemStack playerHead = new ItemBuilder(Material.PLAYER_HEAD).texture(something).build();```
Greetings Esteemed Members of the SpigotMc Community
I am writing to you to try get some help with my code
switch (teamSetting.getValue().toLowerCase()){
case "sunny":
player.setPlayerWeather(WeatherType.CLEAR);
return;
case "raining":
player.setPlayerWeather(WeatherType.DOWNFALL);
return;
case "thunder":
player.setPlayerWeather(WeatherType.DOWNFALL);
return;
default:
player.resetPlayerWeather();
return;
}
how can I set a player's weather to Thunder?
WeatherType only has Clear and Downfall?
Does anyone have an example on how to use GH actions to automatically upload a jar to the release section of a repo?
is it not possible to set a specific player's weather type to thunder? or am I missing another api method
no, only rain/snow
but not thunder
isn't thunder just a rain
thunder is rain + lightning
I mean I guess I could fake it by creating a method to show lightning effects to a specific player
but that sounds like too muich work
as i can see there are only 2 weathers provided by spigot
I wonder if NMS has that feature. Never used NMS though, so 🤷
raining and not
Thunder is rain with an extra flag
and boolean weatherState
true rain, false norain
you can ofc just use a packet, spigot mappings:
PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, 1.0F);
1.0 = thunder, 0 = no thunder. Also requires rain to work
Love you!
my itembuilder fetches the data from the config and applies it
but sometimes you're making something quick like a test project and can't bother making a config file
yeah, thats true, ill keep that in mind, thanks
@hazy parrot Wait that's it really? 8 lines?
Yeah you could easily make a method for an itembuilder that pulls from a configsection
Yap, basically
Does that automatically compile the jar?
this is how mojang does it
Right?
i should make one of them
Oh wait no, you include your jar
From the project build
that's for all server ig
Nono, look what I did before, I compiled it and in release action just provide compiled jar
setThundering is indeed a method, too
and guy goes for fake one
well not for players 
thats per world
I want per player
https://hastebin.com/share/otohopived.kotlin this is a SUPER simple one. Just replace the <path to ItemBuilder> with your own path to the ItemBuilder class.
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
That is a very basic one
@return the <path to Itembuilder>.
you guys think it’d be useful for a plugin that you can alter itemstacks in game to see how they look and then to save them out to a file
cause i’m making on for personal use cause i’m lazy
spacial
Here's an example usage if you need it:
https://hastebin.com/share/uvusegazun.java
One message removed from a suspended account.
One message removed from a suspended account.
what's the issue
you can paste it here:
don't do this
equalsIgnoreCase
make the SimpleAnnouncement simpleannouncement
and that is a bad command system
each command should get its own class
he needs freejavalessons
5 min
why are you comparing the command's name?
@hazy parrot I cannot figure it out lol
Even asked chatgpt but I think it's wrong with what it's telling me
what exactly
create a default maven work flow and add the release stuff
this part is only putting body to file because of weird formatting with \n, you don't even have to use it
you dont register the command
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
2nd
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
That
That's the default, now just add the action to add to release
Well yeah just didn't paste it
ig that works, its just ugly
What's the action to push to release section? softprops/action-gh-release@v0.1.15?
im wondering how id add a callback to a runnable submitted to an executor hmm, tried overriding ExecutorService#afterExecute but that has a FutureTask instead of my runnable
while (true) + Thread#sleep() - How would that look ¿?
yes
ServerSocket#accept is blocking
yeah i just have something simple where you can run commands to add lore, set pdc, display name blah blah and then save it out to a file
Ok ok step by step
Shity java sockets 💀
Netty ❤️😍
pov: Reinventing the wheel*
Netty has already implemented module for http
Which internally use Netty for handling the protocol, sockets, NIO
Netty is so sweaty
Also it has an already implemented module for working with Netty and WebSockets
wait wtf
GH Actions are so cool
Does everyone use this already?
How can I deal with local maven repo libraries?
For GH Actions
everything
i mostly use it for lint checks and for example if i push tag that starts with v (v1.0.1)
it will create release with version 1.0.1
anyone know how to suppress this, and ONLY this, warning?
How can I deal with local maven repo libraries?
For GH Actions
I read on cache but don't comprehend
you already spent so much more time on getting github actions to work, that you could have setup your own reposolite or nexus like 12 times already lol
idk I hate github actions, the docs are so shitty
Well I believe my use case is simple enough but yeah, can't really understand much
not really, you need to run buildtools, that's already way more complicated than the dudes at github could ever imagine
what stuff
if you do alt enter it should say so
it will add a command which tells IDEA to ignore the next warning
on CombinedCOllection
wondering how id do smth like this but the task is always a FutureTask so this gives a cast ex and i should be using reflections to access the field, isnt there a cleaner way?
I have dependencies in my pom.xml that are locally installed, so gh actions can't see them
what deps
CMI and a local lib
might need to include them in a libs folder then mvn install them with an action
it can cache them but it needs them at somepoint
i think it can cache them anways
did it work @tender shard?
huh this breaks my compile 
oh sorry haven't seen. Yes, that works thx
np
then your pom is fucked
?paste your pom
the maven-jar-plugin is the only proper place to adjust the output directory / file name
you changed it in the maven-compiler-plugin
yah what i didnt get was why it was giving me symbol not found for the diff modules
@hazy parrot If I want to include local mvn dependencies in GH Action, I see there's a cache there. How does it work though?
Or should I upload what I use to a repo instead?
just add cache: maven
altrough its not persistent at all
That's fine but
Do I need to include the libraries in the project?
I assume yes
you would probably be better uploading them to a repo
- name: Cache Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
java.lang.IllegalAccessException: module java.base does not open java.util.concurrent to unnamed module @776ec8df :(
https://github.com/RazielMartelus96/LandsActivityProvidingIndicator I fixed up the naming conventions as best i could (still not entirely confident with em for java) . Any opinions would be appreciated 😄
The code takes a land from the Lands Plugin, grabs the members list and prints out their overall activity that month in minutes. If below a pre-determined value it will show as red
Could I whitelist which structures to generate and which not?
declaration: package: org.bukkit.generator, class: ChunkGenerator
Looks good but variables and field names usually have lowerCamelCase
I cannot figure it out lol. actions just refuses to copy my local mvn repo to cache
?paste
it doesnt copy your maven local, im guessing it caches what you give it
According to the docs it does but it does indeed not make sense
java 9 modules r very annoying for reflections
altho just calling trySetAccessible might fix
trying to figure out how id get a varhandle for a private field
How can I create a world onEnable() without getting this error?
https://paste.md-5.net/urelirufuq.sql
actually not a probably-- you do need a special Lookup
i did it for an old event manager i had made
initializing it should be simple enough, i think it has a public constructor now (java 8 did not) so u can do it without needing too much reflection hackery
seems like you can only create worlds in POSTWORLD
Where have i missed that?
any other way to make it?
Schedule a task in onEnable
It will run once the task executor is active, which is late enough to make worlds
MethodHandles.privateLookupIn?
possible?
Is there any way I can send an actionbar message while player can be an entity variable?
@young knoll how much time have you been with Java and Spigo tAPI?
well uh
Hmm
Like 10 years
boomer
He‘s at least 10
Thanks
np
But could I send an actionbar message to something like @p?
Bukkit.selectEntities
ive got this code for a super basic world gen, default minecraft biome generation afaik, is there some way to smooth out these rough biome changes? im very new to java so i might ask some stupid questions
Right, I know how to get the @p, but how would I put it in the actionabar command?
24
what
theres a command to show actionbar messages?
tellraw
oh i thought that just sent to chat lol
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message))
yeaaa
now we're talkin
ig I aint starting that late with Java/Spigot
You just need to make sure it's a player and cast it as such. That's all
Bukkit.selectEntities(sender, args[0]).forEach(entity -> {
if (entity instanceof Player player) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Hello world!"));
}
});```
But what if it is @p for example?
Then it will be an instanceof a Player and it will send the message
A player is an entity, it's just a more specific type of entity and you need to make sure that's the case
It's the reason you can't do entity.chat(). You have to check if it's a Player first, then cast, then call player.chat()
Or player.getInventory(). Same thing
i thought entities have inventories
I modified this code as my Bukkit.selectEntities function is in my command, and the actual sending of the actionbar is in another task. Here is the code, and the actionbar still throws the same error: if (player instanceof Player) { player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(this.word)); }
okay how do I explain this lol
player instanceof Player 🤔
You've named your Entity variable player. Entity player;. First of all. Bad. Call it something sensible like entity. Entity entity. It is what it is, not what it might be
You've checked instanceof which is good, but you're re-using that same entity (player) that is still an Entity type. You never casted it
Java 16 introduced in-line instanceof casts (which I used in my example) but if you're on a lower version you'll have to manually cast and you can do it in two ways
((Player) entity).spigot()// ...
// Or
Player player = (Player) entity;
player.spigot()// ...```
You're going to need to revise on some of the basics here. Types and casting are something you need to have a firm grasp of before making plugins.
declaration: package: org.bukkit.generator, class: ChunkGenerator
is there a way to decide which structures to generate or not?
how do i use plugin annotations without shading the entire of bukkit
hmm lemme try restarting again then. I got ClassNotFound's the first time
How worldguard works? I dont think it check every region location to check if players in X region.
its not compiled into spigot by default
paste your pom
?paste
the scope for the annotations should be "compile"
at least that's what the wiki says (they use no scope there which is "compile")
https://www.spigotmc.org/wiki/spigot-plugin-yml-annotations/ doesnt look like they need to be shaded
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yeah but that shades bukkit 1.14.4
sorry, 1.13*
in the annotation pom
i probs have to enable annotation processing or something
wtf does it need to even use bukkit api for ... never looked at the src
do you have annotation processing on
You can do it in 1.19.3+ with https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/world/AsyncStructureSpawnEvent.html
wdym? it's a maven project
What should i use to "mark" inventories? I see in many tutorials that people check if inventory title is equal to something, but it doesnt make sense, player can use anvil to change name, there is something called CustomName but i dont know what this is, should i use it or what?
is ur problem like Bukkit overriding Spigot import?
https://paste.md-5.net/yepawewuzo.xml this is my pom, it works fine

nice
oh nice
let me check, ty
Can I delete 'test' directory from project or that directory is required?
can delete
thanks
hey, how would i put out a campfire in code?
get the block and cast to Campfire
Campfire#setLit()
yeah i dont have setlit
declaration: package: org.bukkit.block.data, interface: Lightable
i think ive done something wrong
Campfire BlockData
wrong campfire
Not the BlockState
get lit 🚬
tut tut tut
tutorial? none. just gotta experience it, yknow?
is there some way to smooth out these biome transitions? ive been searching online and cant really find anything that helps
@Command(name = "islands", desc = "Islands command")
doesnt work :(
what am i annotating with that btw?
thought it would just be the main class
isLit()
Man, I want to PR just a little "<o/" to the end of that method Javadoc now
ok it says Cannot resolve method 'setLit' in 'Campfire'
Show code
Just make sure you're importing the correct Campfire
There's also a BlockState of it
bruh bitch
.
there's a cli argument to allow illegal access
actually have the wrong field name too but it didnt even reach that
--opens whatever?
Just put it in a Set<Inventory> and check with .contains()
smh
Are you doing GUIs?
yed
yay
--add-opens java.base/java.util.concurrent=ALL-UNNAMED ig
thank you
where even can i add cl options in ij?
In your run configuration
^
thought it was somewhere there
DAmm command annotation isnt working
i use InventoryHolder
as it's like super simple
But does it work when i have 2 inventories with the same name ?
uh its clearly not in the program arguments section
it's better to use the guide above
but i always used inv holders
i can show how to if you want
ok
dm ig
aight got it, thanks 7smile
The idea of using inventory holders is fine but you might block
some functionality if an actual holder is needed.
For purely virtual guis it works
not only wondering what this means
its on the line where i call runnableField.get(runnable)
Tha fk is this RunnableAdapter class? The runnable has no access to the field. How is this supposed to work?
Hello, Is there any way to make that if player break some kind of block near the SculkShrieker then let it scream/set warning level +1?
declaration: package: org.bukkit.event.block, class: BlockReceiveGameEvent
Ohh thank you very, that's what I was looking for but do not know where is it hiding
yup @pure dagger
uhh its complicated
trying to get the exact runnable i submitted to a threadpool
Why don’t you create a proxy instead
thr "Runnable task" parameter is a FutureTask created in the executor
and how would that work?
For the thread pool itself
dunno a proxy in what kind?
Yeah just implement ExecutorService and proxy another impl
Or well what exactly are we doing, the current solution looks so hacky
can i rely on Bukkit.getOnlinePlayers for the exact player count?
uhh so i overwrote that method, and the task parameter has a field "Callable<T> callable" which is actually a RunnableAdapter<T> and that holds the actual runnable i submitted 💀
then casting it to my own client handler thingie
ah man
public class ProxyExecutorService implements ExecutorService {
private final ExecutorService proxiedService;
public ProxyExecutorService(ExecutorService proxiedService) {
this.proxiedService = proxiedService;
}
@Override
public void shutdown() {
this.proxiedService.shutdown();
}
... etc
why not
okay..
i mean it might differ in several milliseconds after, but still
ye ok
Still foruteen what the heck r u doing
hmm imma try that
If u need reflection for the std lib then something isn’t right
Some janky ass s**t
Yea lol
I love jank
uh well after a clienthandler runnable gets executed into a threadpool, it should get removed from a collection but i dont really see a way to bind a callback to the runnable
so i thought lets override that afterExecute method which looks up the exact runnable submitted and removes it
the clienthandler isnt aware of its surroundings so it has no reference to the collection or smth
Sounds like a delegation design is much better off here
Joys of code
lemme see if i can do anything with a proxy
uh oh lets extend threadpoolexecutor instead
That’s also better
Just no reflexción
Lets see it
@Subcommand("revert")
@Description("Reverts all the changes")
public void onRevert(OnlinePlayer sender, ProtectedRegion r) {
I'm trying to have a command called "/maincommand revert"
I have a Context that converts ProtectedRegion into the object or gets the possible region from the location of the sender. So far so good
Why does this happen
Try adding a syntax
@Subcommand("here")
@CommandCompletion("@ActiveCollegeUser")
@Syntax("<Target>")
public void onTpHere(Player sender, @Values("@ActiveCollegeUser") ActiveCollegeUser target) {
I actually just removed the syntax
It was there before
I have a question tho
Ummm
I assume the syntax and command completion
Work as the actual parameters in the function
The order, I mean
Yes
Ok that's good
I see you have <target> as the syntax
I did it completely wrong before then
@Syntax("/house revert")
I had that
So yeah, very bad
If you want to complete nothing then you need to throw in a @Nothing
well the issue is, this Runnable is of type FutureTask and not the runnable i submitted
maybe i could just listen for ::execute too
java.util.concurrent.FutureTask stores the callable field (which wraps the runnable i want) so i thought to use reflection
And last question @lost matrix
@Subcommand("here")
@CommandCompletion("@ActiveCollegeUser")
@Syntax("<Target>")
public void onTpHere(Player sender, @Values("@ActiveCollegeUser") ActiveCollegeUser target) {
If I have my ActiveCollegeUser.class context set to either provide a name or if no name provided, getlocation.
Meaning the user can either specify a specific name or the region they are standing on
Do I set my CommandCompletion to @CommandCompletion("@ActiveCollegeUser") but how can I not force the player to specify it if they don't want. Even though it will always be used.
Is that when I should use a @sick swan?
Im not sure if i understood that sentence.
But you can annotate a parameter with @Optional
This way it will be null if the player doesnt provide it
nono so
Let me show
My ProtectedRegion context:
acf.getCommandContexts().registerContext(ProtectedRegion.class, context -> {
String regionName = context.getFirstArg();
ProtectedRegion region //Will either get the value from regionName IF it was provided, or will get the region where context.getPlayer().getLocation() is at. Null checks are working correctly
return region;
}
So if I have a command like test region
Which can either be
test region <name> //Will get the region with the name from the context
OR
test region //Will get the region from the location of the player ( if exists )
That's what I want to do
How do i open a different inventory for each player every time?
'how'
Bukkit.createInv bla bla bla
Ah. Several ways of doing that. You can simply use @Optional and do a null check.
Alternatively you can use something like @Default("_SELF_")
And in your context resolver you check if the arg is equal to "_SELF_" and
resolve the region at the callers location
Bukkit.createInventory(...)
uuuu
Should I use length or lengthSquared in a vector to use it as a radius for a circle
Ok ok I like that
I want to open a certain already created inventory
ah fun my callable returns a Void 💀
then get it?
i cant handle this anymore
What?
Ah Several ways of doing that You can
Then open the already created inventory... i dont understand the question
Yes that would be what I already tried, though that doesnt do it. The opened inventory is being "shared" between players and if i dont remove the items onClose they will stay there when i open it again.
Then create a new one
Can somebody explain what exactly "NBT storage API" refers to? I am currently am dealing with the annoyance of wanting to being able to restore exact copies of entities etc. and there is no way to do that using Bukkit's normal API. I have been doing that using NMS in the past, but I would like to prevent it in the future. This I have been thinking of an API that allows the serialization and deserialization of NBT tags of certain objects, such as entities, items, etc.
I am very certain that this would get great use as NBT libraries are quite popular for good reason.
To be clear, I simply want a few classes with which I am able to access and modify certain NBT tags of certain objects without having to rely on a library or NMS. I don't want to implement actual File IO stuff
BukkitObjectOutputStream can serialize NBT data already. Spigot has an API for that.
how do i create a new one if the "class is the inventory"
Not for e.g. entities. And that it is actual NBT is not promised
BukkitObjectOutputStream simply serializes whatever ConfigurationSerializer outputs, that could be anything
This is a prime example of how you should not create GUIs
why
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/#post-4553427
Take a look at this
Yeah, not Entity. Entities aren't configuration serializable
Can I add conditions to showing command completions to a specific player using ACF
Maybe we should add a method to serialize an entity to bytes
Yes this is done in the completion which is registered
Would be nice
BukkitEntityOutputStream when? /j
problem?
create it and store somewhere
open when certain player needs
Would also need a method to add an entity to world
Well we're circling back to virtual entities lol
What about hiding default commands for a specific condition @lost matrix
It all goes back to virtual entities
Like, aliases and such
Yes, that's why my idea would be an NBT API with which you are able to deserialize them and serialize them to already existing instances. Spawning entities using a ConfigurationSerializable would be bad API ipo
Commands are hidden by using the @Private annotation
Priavte
fwiw, so would NBT. Bukkit doesn't really want to expose NBT and it really shouldn't be
It's an implementation detail
You know who has virtual entities
my MOM
Pap-
Your mom should contribute to Bukkit
thats gotta be a lovely piece of code
But @private doesn't have a condition option
Describe what you want again
/house is the default command name category
If a player doesn't meet a specific condition
/house won't show up when a player types at the start
No subcommand stuff yet, just the entire thing won't show up
What do you think of an EntitySnapshot that works similar to the ChunkSnapshot
just that you are also able to apply the snapshot
^
There's still deliberation on how to use that sort of API for spawners and spawn eggs
You can annotate subcommands with @CommandCondition
https://github.com/aikar/commands/wiki/Command-Conditions
If you mean from Stash, DerFrZocker
am i the only one that realizes how to do smth when i lay in my bed
is ther ean equivalent to 7locate structure ancient_city with spigot aip?
tysm
can i have multiple different events in 1 class and register the class once
or do i need multiple classes for different event types
can be in one class
You can do either or.
the server will look through that whole class for methods with @EventHandler
I don't really understand what you think of a virtual entity. What I'd think of that term would be an entity that continues to exist even after you remove it with the ability to always respawn it. My idea of the EntitySnapshot would be an object that basically just holds a copy of all the attributes of the entity. By itself, it shall not spawn any of them. NMS actually already has methods for exactly that
alr thanks
A virtual entity is just the equivalent of NMS's Entity
Which does not have to exist in the world
If I want to add a condition to every command inside a Class that extends BaseCommand in ACF do I need to add @Conditions on every single command or can it be applied to the class?
Where as a bukkit entity has to exist in a world (except for that one case where it doesn't)
Could you change the color of a portal without resource packs (like you do with leaf and grass)
No
Ye my idea would be different. The EntitySnapshot should simply only hold all the getters and setters that you have with an Entity
i have this
@EventHandler
public void onPlace(BlockPlaceEvent event) {
if (event.getBlockPlaced().getType().equals(Material.CAMPFIRE) || event.getBlockPlaced().getType().equals(Material.SOUL_CAMPFIRE)) {
Campfire camp = (Campfire) event.getBlockPlaced().getBlockData();
camp.setLit(false);
}
}```
and you can probably guess that im trying to put out campfires when theyre placed, but it doesnt seem to do anything and im not getting any errors
Kinda wish mojang kept that feature from the infinite snapshot tbh
it would be nice ngl
custom portals would be much better
Welp i'll add it to the list of things I need to smack them over
dont you need to update the block state or smth?
oh ye
You need to update the blockstate as well. BlockState#update()
You need to use block.setBlockData
any reason they removed it?
k nvm
How do i prevent players from inserting an item to a certain slot in a gui
cancel click event
tried, didnt work if player was dragging an item
InventoryMoveItemEvent?
That's for hoppers
mb
inv drag event too then ig
If I want to add a condition to every command inside a Class that extends BaseCommand in ACF do I need to add @Conditions on every single command or can it be applied to the class?
@lost matrix
uh are you calling config.save() cuz that config is loaded into memory?
One message removed from a suspended account.
im too tired to read but does that task keep reading the value?
How do you replace color codes using MiniMessage api, without getting the output as Component ¿?
legacy serializer
Its returning a component
one sec
right really thanks man
One message removed from a suspended account.
LegacyComponentSerializer.builder().character('&')
.hexCharacter('#').hexColors().useUnusualXRepeatedCharacterHexFormat().build(); lmao
The problem is that ChatColor#translateBlaBla() doesnt exists 💀
Atleast now i realize i cant use thats shits anymore, working with them is a huge headache
uh wdym fixed
wrong reply?
that thing just keeps reading config values from memory
how
youll have to reload it
return Minimessage.miniMessage().deserialize(text);
oh wait nvm, i removed MiniMessage. Its plain shity kyori - My bad
hey, ive got this
https://paste.md-5.net/sacumozove.cs
but when i try and relight a campfire with a flint and steel it just gets put out, is it triggering the blockplaceevent?