#help-development
1 messages · Page 878 of 1
myPlayer.setGameMode(GameMode.SPECTATOR);
Thankfully eclipse does not do that
yeah it'd be really useful if IJ could do it like github
e.g. only show it as nested if there's anything else on that level
otherwise just show it as one level
Yeah that’s what eclipse does
by default it does iirc
yeah...
¯_(ツ)_/¯
Ah no, I was thinking of something else
I probably changed it at some point
your "player" is not a Player object
hover over "player" and send a screenshot again
the default under eclipse looks like this which is utter garbage
yeah and the "parsed" part
yep
yeah that's just an interface to send messages to
it's not an actual player object
where did you get the audience from?
minimessage example lol
somewhere you must have sth like this in your code
Audience player = ....;
show that line
Audience player = sender;
where does the sender object come from?
public class Gamemode {
@Command(name = "", aliases = {}, desc = "An example command.", usage = "")
@Require("react.gamemode.creative")
public void exampleRoot(@Sender CommandSender sender) {
Audience player = sender;
MiniMessage mm = MiniMessage.miniMessage();
Component parsed = mm.deserialize("Your gamemode is now <green>Creative");
player.sendActionBar(parsed);
sender.set
}}```
which command framework is that?
drink
That’s a new one
well then you'll have to check them how it works
they havent updated in 4 months
can't you just use Player instead of CommandSender in the method?
I bet that’s some kind of wrapped command sender
according to their examples, it isnt
Since bukkits command sender wouldn’t be convertible to audiences
it imports bukkit CommandSender
yeah I also have no clue about that
@final wharf you probably imported the wrong commandsender
wdym?
package lol.irazz.react;
import com.jonahseguin.drink.annotation.Command;
import com.jonahseguin.drink.annotation.Require;
import com.jonahseguin.drink.annotation.Sender;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.entity.Player;
public class Gamemode {
@Command(name = "", aliases = {}, desc = "An example command.", usage = "")
@Require("react.gamemode.creative")
public void exampleRoot(@Sender Player sender) {
Audience player = sender;
MiniMessage mm = MiniMessage.miniMessage();
Component parsed = mm.deserialize("Your gamemode is now <green>Creative");
player.sendActionBar(parsed);
}}```
oh you're using paper
yea
your Player object is called "sender"
you don't need the additional Audience player = ... part
just use the sender. It's already both a player and an audience
oh
and remember that your project will not work on spigot if you use adventure like that
Ah that’s why it’s a valid audience
yep
it works now
to set hte gamemode
also, WHY CANT I ALT TAB TO intellij
its so annoying
kek works for me
If using spigot, BukkitAudiences.createAudience(player) is the method iirc
yowza
Adventure is still 90% useless on Bukkit
well more or less illusion
BukkitAudiences has to be created with a plugin instance
BukkitAudiences audiences = BukkitAudiences.create(myPlugin);
Audience playerAudience = audiences.player(player);
got banned on cortex for adding emojis that say that kotlin is bad, and now spigot is my only option 🙂
what about the actual paper discord
they are slow
enjoy ths kotlin screenshot
However once choco pr™️ gets merged I can use the bungee serializer instead
i dont like annotating null
do you now like kotlin? this is valid code
no
Have you considered
no thankyou
that looks like python with more tabs
want me to pr one
basically all it is is your forced to use () and "" for stuff
oh and use tasks.name over name
ok then this
val `🙂` = "happy"
fun `🤔`() {
println("I'm so $`🙂`")
}
init {
`🤔`() // Prints "I'm so happy"
}
if it weren't for copilot I'd still use intellij 2017
idk what the fuck half of these symbols mean but they exist now
alex while ur here
i hate the new windows emojis
what the fuck is this: Jar!, what the fuck does the ! mean
It’s excited
It means "You got a Jar object, but it comes from Java, so I don't know if it's not-null (Jar) or nullable (Jar?)"
it's called a "platform type"
Jar = a Jar object, notnull
Jar? = a Jar object, nullable
Jar! = a Jar object from outside kotlin - may be null or not
kotlin auto detects jetbrains (and others) nullable and notnull annotations though
Okay but does Kotlin let me do
okay so ! is null that it doesnt know about
0/10
IOS automatically makes them fancy
ios moment
“Wow quotes”
Must be on a French keyboard
coll french moment
Oh wait no French uses << and >> for quotes for some reason lol
Wtf
does coll secretly live in quebec
« » more precisely
<<like this>>
@remote swallow this explains it ig
i also cant type that without wincompose
ig that makes sense
but if it returns a player? why doesnt it just infer send if not null
§ can do that too
you're supposed to handle it yourself. You can e.g. also do it like this
player?.sendMessage("hi") ?: error("player not found")
Only lets you operate on nulls
How would that work?
like java
Presumably NPEs
oh ONLY on nulls
Oops! All nulls
wasn't there a Unit or am I tripping
No it isnt. Is only one time registered
Did you add the plugin twice to your plugin folder?
No I dont
make a constructor and just log something
if it logs twice you're initing the listener twice
^
print out the hashcode of the event
System.out.println(e.hashCode())
if it's not the same, you registered it twice
Alr gimme sec
Wait. Each listener gets a different instance of their events?
🤔 hmm how can I make entities that don't save without reinventing player tracking
I am not allowed to sleep so ignore what I said, I'm tired @lost matrix
Ah. this.hashCode()
You would have to print this.hashCode
yeah that is what I meant
Why are you not allowed? 
oh no wait @lost matrix
what I said is correct
I wanted to check if the event is called twice or just once
now we know: the event is correctly only called once
But its registered once, I check it now
Did you check the hashCode of this or the event
because neither y2k nor coll have PRed their sql storage backend 🥲 #1196562355912446094
yeah now it's ulrich's turn
Class is used only two times, like static method and onEnable register event
4 hours of making a janky orm followed by 2 hours of trying to spawn stuff in villages then finding a bug in cb, making a pr for it, and getting in bed
Just add this to your code and tell us the result:
System.out.println("Event: " + e.hashCode());
System.out.println("Listener: " + this.hashCode())
"I spent 92751628 billion years debugging this"
I just only removed whole JDA and other from main
Fun fact: The english language also does it for quotes within quotes or something like that
Add the this.hashCode sysout
Its same
well send the full class
Whole main?
send the whole class
Show what your log printed
23:48:46 INFO: [|MrHarebug] -> UpstreamBridge has disconnected
23:48:46 INFO: [|MrHarebug] <-> DownstreamBridge <-> [Lobby] has disconnected
^
^
^
and this ^
if you keep removing parts of it, we can't find the issue
btw is there a reason why the PluginClassLoader refuses to load new classes in onDisable? Because this is extremely annoying
im so confused. Both 0 and 1 are sent but the inventory isnt opened
player.sendMessage("0");
Inventory inventory = Bukkit.createInventory(player, 9);
player.openInventory(inventory);
player.sendMessage("1");
When do you call this?
if you refuse to send the whole class, we can't help you. Have a nice day!
So now both the event and listener have different hashCodes? This log is impossible.
Yeah why don't they just follow the simple instructions? Either send both classes in whole, or print out both event.hashCode() AND this.hashCode()
Yes, they are different.. np. I just create new class where I create map and cancel second call
good luck lol
Btw, please fix your bio if you want to be part of this community.
Racial slurs are not as funny as you think.
Yes 🙂
I was banned on monday on LP discord for that 🙂
The problem is that they cant be all different.
If you have 1 Listener and 2 Events then you should have:
- Listener: X
- Event: Y
- Listener: X
- Event: Z
If you have 2 Listeners and 1 Event then you have: - Listener: X
- Event: Y
- Listener: Z
- Event: Y
If you have 2 Listeners and 2 Events then you have 8 outputs.
But you have neither of those, which is pretty much impossible.
I will check it later probably if my option didnt work well. Anyway thanks ^^
How do i get if arg 1 exists?
and to tab complete position 1 to all players on the server
check args.length
You can generally just return null to tab complete player names
for real isn't there a better solution than to do this?
/**
* Fixes NoClassDefFoundError for kotlin.collections.EmptyIterator during onDisable() because Spigot prevents
* loading new classes in onDisable() ...
*/
private fun fixSpigotClassLoader() { // This is called in onEnable()
emptyList<Void?>().iterator()
}
/**
* Can't even use lambdas / anonymous classes in onDisable() so we just set the enabled field to true...
*/
private val isSuperEnabledField = JavaPlugin::class.java.getDeclaredField("isEnabled")
.apply { isAccessible = true }
private fun setSuperEnabled(b: Boolean) { // This is called in onDisable()
isSuperEnabledField.set(this, b)
}
Is the dependency on mavencentral?
Wait its just std kotlin.
Try downloading via the plugin.yml instead of shading
What's the best way to listen to armor equip events on 1.8
yeah I used one I found on spigot forums and there are bugs
Alex does your armor lib support 1.8?
Sounds like a bug?
should do
oh let me look at it
I checked the java plugin classloader and it returns null if the plugin is not enabled in findClass
I thought it was on purpsoe
i get this error in the console [01:20:02 WARN]: Nag author(s): '[iRazvan2745]' of 'React v1.0-SNAPSHOT' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
you're using paper
We’ll get that EntityArmorChangeEvent soon™️
paper wants you to use the logger instead
just use getLogger() instead of System.out
A deep personal desire
I think we're logging too much
What's the repo?
SpigotLibraryLoader level logs
I guess the question is whether on disable should be before or after it's set disabled

I should update my pr for that
I think MD wanted the parent deps to be logged even if the verbose flag isn’t set
I mean it makes sense to disallow registering tasks in ondisable
Maybe there should be isDisabling that replaces current !isEabled, and a real isDisabled for the classloader
ArmorEquipEvent for Bukkit. Contribute to mfnalex/ArmorEquipEvent development by creating an account on GitHub.
Mb lol
doesnt work wth?
its probably me being stupid anyways
Thats not a good idea imho
i forgot how to use getLogger
.
In your plugin main
yeah
Without arguments
Just remove the ""
It returnd a logger object
yeah, but how do i make it say stuff
getLogger().info(„asd“);
Tell it to le slime :p
I should say top level not parent
But yeah
is gateway to adventure finished
I don't use softdepend on purpose because paper decided to refuse loading plugins that softdepend on each other
so my plugins would always show warnings for using other plugin classes 🥲
nah its colls plugin
oh I thought spigot'd get adventure
minetweaks was
True
huh
But no, gateway to adventure is not
i thought minetweaks was from this sachin dude
no thats the other one
hmm
Tweakin
ah yes
right, his plugins are always 'n
lootin
tweakin
cosmin
and his name too lol
hey one question, if I'm trynna do like a mana system, how can I save the max Mana and the actual mana of the player? I'm still learning plugin development so I'm kinda curious on that
because I know I can use a file to save the max Mana
or: Why you should NEVER use NBT tags again! Spigot 1.14.1 added the biggest improvement that (in my opinion) ever made it into the Bukkit API: The Persistent Data Container (PDC). It can be used to store custom data on Entities, TileEntities, and ItemStacks. Using a bit of math, it can also be used to...
hmmmm ok ok ty
PDC allows you to store custom data in players (and elsewhere)
thats actually cool wtf
public final NamespacedKey MANA_KEY = new NamespacedKey(myPlugin, "currentMana");
public final NamespacedKey MAX_MANA_KEY = new NamespacedKey(myPlugin, "maxMana");
// ...
double playersMana = player.getPersistentDataContainer().get(MANA_KEY, PersistentDataType.DOUBLE);
example. ^
@tender shard
if(newArmorType.equals(ArmorType.HELMET) && (equipping ? isEmpty(event.getWhoClicked().getInventory().getHelmet()) : !isEmpty(event.getWhoClicked().getInventory().getHelmet())) || newArmorType.equals(ArmorType.CHESTPLATE) && (equipping ? isEmpty(event.getWhoClicked().getInventory().getChestplate()) : !isEmpty(event.getWhoClicked().getInventory().getChestplate())) || newArmorType.equals(ArmorType.LEGGINGS) && (equipping ? isEmpty(event.getWhoClicked().getInventory().getLeggings()) : !isEmpty(event.getWhoClicked().getInventory().getLeggings())) || newArmorType.equals(ArmorType.BOOTS) && (equipping ? isEmpty(event.getWhoClicked().getInventory().getBoots()) : !isEmpty(event.getWhoClicked().getInventory().getBoots()))){
Wtf
yeah yeah i was reading it... seems way simpler than what i thougth
That's all in one line LOL
what
use "```" in between code
plz
mb
my eyes cannot support that
oh yeah that's from the original author
I only forked it and updated it and uploaded it to maven central
Oh alr
blame Arnuh for that 🥲
This is also why it never came up when I was looking for similar ones before making mine :p
I didnt change stuff that wasnt broken haha
rq one last thing, does this data persist in restarts? like... is there a way to lose its information?
PersistentDataContainer 🙂
Pdc on players persists as long as their player file does
if there was a way to lose it
yeah ok its linked to player file
ty
there isnt, unless you remove it on purpose
okie dokie, ty kind ppl
(or if you delete the playerdata file but then the inventory etc is obv gone too etc)
for non-persistent data there's also the Metadata API but I guess you don't need / want that
Good evening (better said good night haha) - Walking through the Spigot Javadocs I've seen World#getWorldType is deprecated - since I want to avoid deprecated methods, how can I determine whether a world is overworld/nether/the end (without guessing it on the name) - or is there no other possibility than guessing it from the name?
there is no such method "getEnvironment"
declaration: package: org.bukkit.generator, interface: WorldInfo
World extends WorldInfo though so can be used on the world object directly
^
u dont need to change that @real palm
if u dont see the method maybe ur api version is too old?
idk when getEnvironment was added tho, cant be TOO new
I use 1.20.4 🫣
Yeah, just found it.
It's 1am in here, also my day were kinda harsh 😅 also I'm new to the 1.20 version - my last proper plugin was on 1.12 🤣
Woo new api to have fun with tho
what the fuck is a jojo
Animes
hm I again checked bukkit's classloading code and I don't see any reference to Plugin#isEnabled there. Maybe this is just a paper issue? Or does CB / Spigot apply patches to Bukkit's plugin loading / class loading code?
well the thing is, it even only happens on paper like 1 in 20 times
I supposed I could run a bash script that restarts the server 50 times, then come back in half an hour lol
yeah I am indeed scheduling async stuff with CompletableFutures.runAsync() but I also call get() on them in onDisable()
what's the difference though? In both cases onDisable() will have to wait until the future is "done" and only then should the classloader be rekd
one has no ugly trycatch
Doesn’t solve the issue tho :p
lol wtf is that
Pro tip
YOu can just return that future
and pass a timeout in the get method
instead of making a new executor
noob
and how does this solve the class loading issue
also I don't use a timeout in get(...) because the future itself must have a timeout
Is there a way to have a command where the name can be set through config.yml (other than listening for commands ran and manually calling it)
It shall timeout after X seconds even when I don't get(...) it
use the command map. its not exposed so you'll need to use reflection
it is
just gotta cast it
oh my bad, it isn't. I confused it with PluginManager <> SimplePluginManager
it is indeed not exposed unless theres some new API method
^ general IDEA
Alternatively use aliases
I think you can edit those at runtime without anything wacky
that's just lazy for custom command names
thanks!
it "abuses" something that should just be exposed
what's better? that these are my real mysql credentials or that the 500ms is the default setting for io delay
so much easier just to manually listen for the command 💀
Yeah but that won’t tab complete properly
true
Not really
It's like what a couple lines of reflection
If you need help I can walk you through it
public final class CommandHelper {
private final Plugin plugin;
private final CommandMap commandMap;
private final MethodHandle constructor;
/**
* Creates a new CommandRegistry
*
* @param plugin the plugin used
*/
public CommandHelper(@NotNull final Plugin plugin) {
this.plugin = plugin;
this.commandMap = ReflectionUtils.getField(Bukkit.getPluginManager(), "commandMap", CommandMap.class);
this.constructor = ReflectionUtils.getConstructor(PluginCommand.class, new Class[]{String.class, Plugin.class});
}
public Command createCommand(@NotNull final String name) {
final PluginCommand pluginCommand = (PluginCommand) ReflectionUtils.safeInvoke(this.constructor, label.getName(), plugin);
if (pluginCommand == null) {
throw new IllegalStateException("Creation of PluginCommand failed");
}
if (!commandMap.register(plugin.getName(), pluginCommand)) {
throw new IllegalStateException("Command with the name " + pluginCommand.getName() + " already exists");
}
return pluginCommand
}
}```
this functions the same way as getCommand(String) but it actually just dynamically created the command for you
Why reflection to make the command too
it mocks internals
PluginCommand isn't a public class
you could extend BukkitCommand or whatever it is, but then you need to add implementation yourself
the important thing isn't that its final its that its protected
you still can't extend / implement or ccreate instances of a non visible class without reflection
it's just Command
when did that change
Idk
it was protected for the longest time i stgh
The constructor is protected
But if it wasn’t final you could just extend it with a public one
extend Command, implement PluginIdentifiableCommand, call it a day
what's the purpose of extending PluginCommand anyway? It basically just combined the interface from Command with a TabCompleter and CommandExecutor and logs exceptions if it goes wrong
runs
That must have been what I did in the past
Idk but I know I only reflected the command map
How does registering commands after the normal registration period behave? Do they automatically get sent to conencted clients?
As expected I'm not 100% sure on internals, but it may also require you to update the players commandList
if you register commands after onEnable, you need to call CraftServer#uhhh i forgot
if you just register on enable that's enough then
I love the uhh method
wow its a real CraftBukkit method
favourite method
I wouldn’t be surprised tbh
syncCommands i think it is
Does that essentially just do Bukkit.getOnlinePlayers.forEach(Player::updateCommands)
Ah
I'm going to build your biradier tree Coll
Thanks?
np
Is that a threat? Idk
imagine if mojang hard coded commands
💃
ah yes let the client hallucinate shit
then it'd be like it is on discord
or was Ig
prior to / commands
who are you xying
I was exampling
o
why not collbot
Ah yes JishBot
make it for populus if it ever gets finished
Do I ever finish anything
You can use PlayerQuitEvent then check the cause of the quit or the quit message
Also there is a PlayerKickEvent but idk if there is a ban event
Idk what you are trying to do though so i cant say whats best to use imo
Some kind of announcement/broadcast saying "A player was banenned from the entwokr"
public void h(PlayerQuitEvent event) {
if (event.getPlayer().isBanned()) {
}```
worth a shot
theres player kick event with somethibg like getReason() where u can check if it was because of a ban
If you using 3rd party punishment system you should use their apis
bans use kick
@quaint mantle
to answer both in that regard
there is no such thing as a playerban. When players get banned essentially what happens is that they get put on the list of banned players and then kicked
Ah makes sense
Might even happen in reverse
i doubt it
I mean it could be handled by a plugin and therefore isn’t “defined”
well i was talking about how minecraft itself does it
Unsure how minecraft itself handles it
But it wouldn’t be good to rely on mcs implementation if it usually gets implemented by other plugins too
well all plugins i know implement it this way too
and i wouldnt see a reason not zo
to
Just because you can’t see a reason to implement smth a different way doesn’t mean someone else didn’t
Spigot is full of shitty plugins so don’t be too surprised
Essentials bans and then kicks btw
Some plugins even handle their own banlists
And if they’re in a database a kick and then an async operation might mean that the ban actually gets added to the database after they were kicked instead of beforr
since it is the standard, this is really the only thing you can rely on.
Instead of relying on an uncertain implementation look towards the plugins which your server runs
this is because essentials does what the vanilla mechanics does because it isn't going out of its way to change anything. It uses the api. So the default way is add to the ban entries, then kick.
Sure, some plugins are dumb and do things out of order
but personally I never cared about such things myself XD
Or simply
True
I probably wouldn’t either
yh that’s exactly what i said xd
is your life hard
Anyone experienced with towny/siegewar/squaremap api and wanting to help me with an addon of sorts basically when a siege starts create a new icon for squaremap that displays at the sieged town's spawn location, and on siege end, if there is an icon at that town on squaremap, remove it.
I think I have it in a working order currently, but this is like my second time ever working with towny/siegewar api so i am not sure if I'm doing this correctly
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
I know sorry, the damn pastebin site wont load
@wet breach does this work?
Not like in game, on the squaremap... the web map or whatever
Minecraft Dynamic Map
The function is to create a new icon on the map at the spawn location of a newly sieged town and remove it once the siege is over
not entirely sure as I am not very familiar with that api
Same here haha
No?
is there any way to apply a potion effect to a player asynchronously
got a custom block breaking system and it works fine and all, but the packet listener is async and to stop players from breaking blocks normally i gotta give em mining fatigue. i do that when i receive the "start breaking" packet, but giving them fatigue on the main thread requires a task that takes a tick to run. as a result if players can instant break a block they're not supposed to, they can anyway
if its not possible ill just have to cancel the break event if the player hasnt been given fatigue yet, though that'll look weird
sounds like a flawed design. not really any need for the packet listener to be async
just makes more headaches
also the whole block breaking system can be done without packets now
how so
Block Damage event, set mining fatigue, player.sendBlockDamage
what about when the player stops mining
how do you know when to remove that fatigue
BlockDAmageAbortEvent
oh thats a thing too
yeah you can avoid packets all together
idrk where else to ask this and i fsr can't quite manage to find the right words to google it so i'll just ask here:
Is it possible to create objects from classes using a string?
What I mean by this is something like this:
getCommand(commandName).setExecutor(new commandName + "Command()");
for using this in a for-loop?
ah though one thing, i want to support 1.19+ because a significant part of my userbase still uses it. any resources i can look up for a sync packet listener (no netty channel)?
I know it's possible in Vue for example and I was wondering if Java can do that too
May I ask what you're trying to achieve ?
It may be possible to use reflection, but there may be even better way.
Its just a CommandExecutor so dependency injection, but I see no point
just pass a Consumer if you want to do it like that
I kinda doubt it now... I somewhat got it to work, but only if there are no constructer-parameters for the command
I'm trying to automatically register all commands in a for-loop
oops, i pinged twice, brain shut off, mb
unless their code is identical you can;t
unless you name the command identical to teh Class
I just didn't want like 100 lines of registering commands
yeah i did that
100 commands?
if your commands are named the same as your classes you can just instance trhem
But how would I pass constructor parameters?
depends what you are needing to pass
depends on the command
sometimes i need maps and the main instance, sometimes only the main instance
Then how are you going to know what args you need, just from its name?
newInstance() is a varArgs method but you still need some idea what you are going to pass. Its not magic
how is the code to know in a for loop?
i could get around passing this but not the maps :/
I don't quite understand that sentence ._.
The only way I could pass different args would be, by checking the name but that would defeat the purpose
Can I check if a constructor has args?
you can search the constructors but you only get types
hmm
what does #getParameters return when there are no Parameters?
Class<?> clazz = Class.forName("mypackage.MyClass");
CommandExecutor cmd = clazz.newInstance(this);```
ignoring casting of course, but thats the basics
CommandExecutor cmd = (CommandExecutor) Class.forName("<package name>" + commandName + "Command").getDeclaredConstructor().newInstance();
commandManager.registerCommand(cmd);
Yeah, this is what I currently have
Can I use nms to set velocity on a block display?
you can getConstructor(JavaPlugin.class) but newInstance is varArgs
Cuz if I could check that, I could continue the for-loop if it has parameters and at least do it for all commands that don't need parameters
no, those entities do not process movement
or just have all your command classes accept a JavaPlugin instance, even if they don;t need it
You'll have to move them yourself
That's kinda meh ngl
Or you can make them ride a different entity
Also: I have commands that accept more than just JavaPlugin
By teleporting it or what do you mean?
So I spawn in an armor stand for each block display?
Depends on what exactly you're doing, but yes
(If you're trying to do like a structure, you can make them ride one armor stand and set different translations for the displays)
I make a rocket out of block displays that goes up into the air
why can't you just create their instances normally?
Then I would say just use one armorstand, make all display entities ride that armorstand and change the translation of the block display.
I can, but that's a shit-ton of lines
it sound slike you have too many commands
it's just for prettyness ig
there is no too many commands
Personally I think hacking in instances with reflections is not pretty
not in a plugin that will eventually basically be the new "essentials"
Maybe you should have a main command with lots of subcommands or something
even essentials has a base command
Way less painful
And generally a good practice
all commands run off a root
and for shits and giggles... and for not needing to write the getCommand()... stuff over and over
ummmmmmmmmm, yeah if I know knew how to use subcommands, that would be pretty cool ig
Okay, so all my block displays should be passengers on an armor stand, but can I make it so that I spawn in all the block displays that I do now but also put each displayblock a passenger on this armor stand or how should I manage where each block display should be?
Sounds like you want annotation commands
but doesn't subcommands mean something like
/command subcommand args?
Another thing I refused to learn... custom annotations. guess it's time now? .-.
I just can't wrap my head around what annotations do exactly
metadata
Use the Transformation of the display entity to change the translation
or, I don't really get what you're asking
anyway, maybe i'll just use my helper method to register commands so that i at least don't have to write the getCommand(<commandname) part over and over, lol
You know... copy pasting exists
yeah
i'm the type of guy that wants to automate everything so that he doesn't even have to press ctrl+c and ctrl+v lmao
by themself, nothing
or ctrl+d
and not by themself?
basically anything xd
no
Never jump to packets because an answer was no
There is almost always a better alternative
lol
you need keepalive!
Just spawn player in void or something
Then you don't care what player does
may i ask why?
why would anyone want the player be able to chat if they have not logged in?
does the logon take so long that you have to do that? I don't get it
they shoudl have nothing until they are logged in. they are unknown, they could be anyone
lol
unless of course you are talking about offline so you have no actual player login
oh-
that ends my interest then.
now it makes more sense
i smelled that message from a mile away
lmao
why are people still actively developing for game cracks?
only pirates need an auth plugin
Yarr
for development, not theft
what do you consider "optimized"
Sure people "need" this, but why would you support piracy?
if you consider "optimized", "yours" then please go take a walk
yarr harr fiddly dii
lmao
You know, I get piracy for triple a games costing 70 bucks... but NOT for minecraft.
Not real pirate, no peg leg
:(
cmarco proves the haters wrong!! fuck haters we pirating 
So what you're saying is:
"I don't give a shit about people robbing the devs of the game I'm making addons for and actively spend my time on as long as I get money for a plugin which basically already exists"?
I did pirate a game around 15 years ago. Early access, I wanted to see if it was worth buying. It was and I did.
Marco changes topic when people start shitting on him, a timeless classic
I only pirated sims and the old version of Dark Souls PTDE
sims because sims and dark souls because i never got the chance of buying it
I pirated minecraft when I was like 5
felt
bought 3 accounts since
same, but 2
lmao same
yeah, I bought MC years ago. two accounts
I think I bought a 3rd but can;t find it, so its gone
my one account got banned on my fav server eventually (so i bought a new one, duh) and i gave my other account to a friend that had an email-address linked to his mojang account, that got shut down. So it was never possible to change the e-mail and since mojang accounts don't exist anymore that account is GONE
I bought an account for my wife but she's not a gamer and I can;t convince herr to play 😦
Sadge
elgar flexing on us poor devs that he has a wife
IllusionTheDev and ImIllusion :D
stalker
nu
LMAO
You wouldn;t want my wife, she's totally crazy 😛
me in my head as i read the message:
my wife is crazy too
i'm fine with my gf rn, been together almost 5 years but kinda too young to merry
(bc money lol)
Why handicap myself
(did i just accidentally reference something?)
a wife is like a memory leak (not mine tho)
purple's going through that foggy love phase
what
Where your chick's perfect and flawless and the best thing in your life :p
real
maybe
and by go work I mean fuck around with code in vc and pray someone joins
Should I save data to a config file every time new data is available, every x minutes or everytime the server closes/crashes?
Hmm
2 and 3, maybe 1 depending how often
So 1 to save for example ranks and settings, and 2 and 3 for everything else like stats that increase frequently?
I save inventories to files for example. I do this with a scheduler and onDisable obviously.
the interval for the schedular is changable in the config.yml and i wrote a recommendation as a comment. Then the server-owners can decide themself when to write to files basically
otherwise: what md_5 says
I see, thank you
You can compare hashcodes if craftbukkit inventory have hashcode method
Do you mind sharing your recommendation for the interval?
## Configure the interval for saving the vaults in minutes. The lesser the number the more the server will lag when it gets bigger. (Minimum is 5)
This is the comment I added to the config.yml
The minimum can obviously be set to whatever you want
I just thought 5 is a nice number and when the server is big, i feel like the lag would be BAD BAD
i went for the method of creating 1 file per saved inventory instead of a big file so that it's at least somewhat fast.
Eventually I'll save the inventories in a sqlite database anyway
Thank you 🤝
anyone got any resources for a sync packet listener (no netty channels)?
Guys, I have weird issue, I have inventory GUI canceling InventoryClickEvent if it's my Inventory, but player's are able to take items using SHIFT
show code
@EventHandler
public void invClickEvent(InventoryClickEvent event){
Game game = games.stream().filter(_game -> _game.getGUI() == event.getClickedInventory()).findAny().orElse(null);
if(game == null) return;
event.setCancelled(true);
}```
with null it's okay, no?
you can't even use equals with null
like you could but it's nonsense
is there a way to check if player has a permission but ignore the fact player is OP?
You would have to use Objects.equals(obj, null)
it's the same
you mean that ops can't use the command?
in any case dont use ==, your game found is obviously null so the event isnt being cancelled
nope
equals can't compare to null
it is being canceled
because when i just click it
it is? huh
it canncels
but with SHIFT i can take out item
can't do anything with it (ghost) but when i leave server and go again it becomes normal blcok
inventories have reference equality
oh
nvm
what
you could try to update the players inventory ig
the same when i restart server
basically i dont want op without a permission to do X
Ye that's how i'm doing it right now but still
I thought that there is better way of doing it
did you check if the event is being cancelled with shift clicking yet
that maybe elsewhere its being uncancelled
hmmmm i'm not sure if that's possible tbh
You mean in my code?
may depend on what you do after the fact that makes it more prone to visual bugs
maybe something like
if (player.isOp()) {
if (!player.hasPermission(<permission>) {
// send info message or sum
return true;
}
}
?
idk how pretty that is tho
if you make the permission default to false it will not be available to opped players by default
assuming the permission is yours to do that with
oh right, that's a thing
if its not your permission then you could also maybe change it on startup
why it's not making a new line when i'm using \n
kits.setItem(15, getItem(new ItemStack(Material.OBSIDIAN, 16), "&eOssidiana", Utils.color("&7Left-Click: &c375$ &f1x" + "\n" + "&7Right-Click: &c6000$ &fx16")));
Each lore line is it's own entry in an array
\n doesn't make new line
then how can i make a new line?
show code of "getItem"
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
List<String> lores = new ArrayList<>();
for (String s : lore) {
lores.add(ChatColor.translateAlternateColorCodes('&', s));
}
meta.setLore(lores);
item.setItemMeta(meta);
return item;
}
kits.setItem(15, getItem(new ItemStack(Material.OBSIDIAN, 16), "&eOssidiana", Utils.color("&7Left-Click: &c375$ &f1x"), Utils.color("&7Right-Click: &c6000$ &fx16")));
oh ok thx <3
You literally wrote your code to support that....
ye xd i just figued out
lmaooo
is anyone here experienced with drink command lib?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
im not asking to ask
there arent many using drink
made a simple /gmc command using drink but i get this error
import com.jonahseguin.drink.annotation.Command;
import com.jonahseguin.drink.annotation.OptArg;
import com.jonahseguin.drink.annotation.Require;
import com.jonahseguin.drink.annotation.Sender;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
public class GamemodeC {
@Command(name = "", aliases = {}, desc = "", usage = "")
@Require("react.gamemode.creative")
public void gmc(@Sender Player sender, @OptArg("1") Player t) {
if (t != null) {
MiniMessage mm = MiniMessage.miniMessage();
Component parsed = mm.deserialize("Your gamemode is now <green>Creative");
t.sendActionBar(parsed);
t.sendMessage(parsed);
t.setGameMode(GameMode.CREATIVE);
} else if (t == null) {
MiniMessage mm = MiniMessage.miniMessage();
Component parsed = mm.deserialize("Your gamemode is now <green>Creative");
sender.sendActionBar(parsed);
sender.sendMessage(parsed);
sender.setGameMode(GameMode.CREATIVE);
}
}
}```
here is the whole class
the optional arg is meant to be the default value it seems
It tries to find a Player with name "1"
Try reading the documentation
https://github.com/jonahseguin/drink?tab=readme-ov-file#optarg
Can anyone hop into a call with me to help me with a quick fix
If it's quick why not just ask here
how am i supposed to set flyspeed and walkspeed?
what is the error?
Your IDE is underlining it with an error. What is the error?
hover your cursor over the red underline
You can't set the walk speed to a string lol
"How fast would you like the player to go? Yes"
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Can I set my walk speed to
The FitnessGram™ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. Line up at the start. The running speed starts slowly, but gets faster each minute after you hear this signal. [beep] A single lap should be completed each time you hear this sound. [ding] Remember to run in a straight line, and run as long as possible. The second time you fail to complete a lap before the sound, your test is over. The test will begin on the word start. On your mark, get ready, start.
lol
so i just do this?
public class Speed {
@Command(name = "", aliases = {}, desc = "", usage = "")
@Require("react.speed")
public void speed(@Sender Player sender, int s) {
sender.setWalkSpeed(s);
sender.setFlySpeed(s);
MiniMessage mm = MiniMessage.miniMessage();
Component parsed = mm.deserialize("Your speed is now <green>" + s);
sender.sendActionBar(parsed);
sender.sendMessage(parsed);
}
}```
Well ideally you'd want to learn java. Yes, that would work, although I'd rather cast it directly than parse
?whereami
😭
i litterally dont have any other choice other than spigotmc
Sucks to suck 🤪
Not usually
He might just be using an outdated version or smth
what outdated version?
im on 1.20.4
with java 21
XD i cant ask in paper tho
im using pufferfish as the server jar
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
We can be less useful 🤪
Java 21? Isn't even the current minecraft/spigot version supporting Java 17? I mean yeah Java 21 works, but it's recommended to use 17, no?
So, if I switch to spigot, I'll get support?
Yes
I mean that's what the server is for/the people on here specialize in
Yeah, no, thanks tho
what's wrong with using spigot?
I'm just not familiar with it
oh alright, i get that
i wouldn't want to switch to paper, lol
as of that exact reason
Paper is spigot with better optimization
And ability to have Velocity modern forwarding
is there a way to send a plugin message with no one on the server?
No
what does that even mean?
Plugin messaging is a spigot mechanic to communicate between servers/the proxy
But it requires a player
How exactly does the logger work? For funsies, I tried logging a message of each level and anything that is not Level.SEVERE, LEVEL.WARNING or LEVEL.INFO isn't even logging.
Are those just the only allowed Levels?
ohh, ic
thanks
Better than sysout
Better than Bukkit.getConsoleSender().sendMessage()?
Wait, can it even use colors?
No iirc
logger cant, console sender can
But logs aren't really meant to be beautiful generally it's useful info like my plugij started config values loaded database connected etc
i tend to only log things which are absolutely neccesary, everything else clutters up
I'd consider the use of ConsoleSender vs a logger in places where you aren't directly interacting with a console e.g. a command an abuse of the ConsoleSender
yeah, obviously.
but if i do have to use it, i'd rather have it have colors. easier to read
(at least imo)
it's kinda like that method of printing certain parts of words fat that makes you read faster
not really, but kinda
Sure but a logger isn't meant to be pretty It's meant to print information that's potentially useful
tbh the logger levels are supposed to indicate severity. what indicates severity better? a red word or "ERROR" written at the beginning?
Use the proper logging level e.g. Logger#info or Logger#warning or Logger#severe some of these types also allow displaying stack traces
that's what i was saying with my message
config, fine, finest etc
I mean are any of those important?
public static final Level OFF = new Level("OFF", Integer.MAX_VALUE, "sun.util.logging.resources.logging");
public static final Level SEVERE = new Level("SEVERE", 1000, "sun.util.logging.resources.logging");
public static final Level WARNING = new Level("WARNING", 900, "sun.util.logging.resources.logging");
public static final Level INFO = new Level("INFO", 800, "sun.util.logging.resources.logging");
public static final Level CONFIG = new Level("CONFIG", 700, "sun.util.logging.resources.logging");
public static final Level FINE = new Level("FINE", 500, "sun.util.logging.resources.logging");
public static final Level FINER = new Level("FINER", 400, "sun.util.logging.resources.logging");
public static final Level FINEST = new Level("FINEST", 300, "sun.util.logging.resources.logging");
public static final Level ALL = new Level("ALL", Integer.MIN_VALUE, "sun.util.logging.resources.logging");
These are the levels
naah, i was just wondering
I'm sure MD would respond
why they didn't print anything
because log4j is configured to ignore those
why though
ask mojang
those levels could be useful
Mojank
fr
Really though those levels aren't that important :P
