#help-development
1 messages · Page 742 of 1
Also you can do #getDataFolder to get the /plugins/myPlugin folder
Thank you!
How can i make a command which shows the player when he joined? In the PlayerQuitEvent i can get it with e.getPlayer().getLastLogin() but how do i do it with the sender?
I am using Spigot 1.16.5 with Java 16 if that helps
you have to cast the sender to a Player
but check before if the command was sent by a player
I am using showTitle once and then always sending parts but somehow if I do Duration.ofMillis(10000) its longer then my 10s timer does someone know what to enter?
It only lets me do "getLastPlayed(), does this return the time a player joined?
Yes
thanks
declaration: package: org.bukkit, interface: OfflinePlayer
how can i parse this?
I assume it's just a timestamp
block.getBlockData().getLevel() does not exist as a method... am I calling it correctly?
Did you cast it to Levelled?
what is a fished in this context?
When you go into the sea and catch a fish with your fishing rod
I am about to explode
is entity
aaa
i try
the plugin is 1.8.8 so java 8 so i cant do "item.getItemStack"
hahahahaa
yes
i think you need to go to sleep
To make this plugin I haven't slept for 3 days
?paste
https://paste.md-5.net/ovilujomag.cs The code sucks a bit and I'm trying to fix it
hahaha
Advice?
petition to ban zacken from all minecraft related and java related communities
What's the best way to hide an entity for all but one?
that is, I need to constantly send a package that there is no entity for all players?
wouldn't it be laggy?
hide entity does exist in the api so you're not wrong
declaration: package: org.bukkit.entity, interface: Player
you can remove the entity from the tracker and then let projectiles go through
you can hide entities now?
that's amazing
What I don’t like about #hideEntity is that I have to hide every tick from the player. The plan is to check if there are new entities and hide them
That method lets you avoid checking every tick
You don't have to set it every tick. Once it's hidden, it's hidden.
^^
constantly check if there is a new player in this radius and hide.
so suddenly there is some way to immediately hide it for everyone, and so that only one can see
Async
And it's perfectly fine then
It does
Do you know
How many packets are handled each millisecond
Or how many events are scheduled
Or that every entity is ticked through
looping all online players every tick is not heavy. checking distance can be, btu there won;t be enough players to cause issues
A great response without an actual reason. I'm sure you're a lovely and likeable person.
um, this is pointless
Not by much. Like .01 %
you ONLY have players so there is no point to filter
Tell me: why did you call me braindead. There must be a valid reason. You surely wouldn't spill insults for no reason?
Tell me
What is it?
What do I not understand?
Yet I say it with confidence?
So you're admitting
That you're the fool
Now I know the level you stand at.
Mfo
Damn, discord blocks insults
Because many people misuse it
Also
.
Support your argument
Speaking from experience
Many ppl called creating static methods
"abuse"
Instead of dynamic classes
Your guys giving me a headache lol.
Braindead.
This is super fun to watch
I always like to argue with those of lesser intelligence
Take some popcorn🍿
Damn, another claim without any evidence or arguments supporting it
Great job
You do know how to argue.
Ah
Fuck
Uh
Well
Okay, so we good now?
And so do many people
Myself included
I've read
That using many threads is beneficial
There still is ScheduledThreadPoolExecutor
I mean, it'd still be better than doing it sync with the main thread
the issue isnt async itself, its how java works sorta, since you'd have to make those checks thread safe which presumably would end up having to callback the main server thread, and im quite unsure how for instance folia could handle it, I mean sure thatd technically be async but you might run into som other issues
ReentrantLock and synchronized
Are a true blessing
That is if you don't require purely sync checks
who can make better css for my site?
Pretty sure this ain't the forum for that
Wat.
What do you mean?
its a "reentrant" implementation
Incrementation slow?
Weren't they before that?
I mean
Using my primitive benchmarking
ReentrantLock took 0.01 ms to both lock() and unlock() each
yes, because reentrant needs to keep track of the amount of locks and unlocks a single thread invokes on it
I do know
That this was a fast singlethreaded lock unlock
Hey guys, I was wondering if there is still a particle lib available that support 1.8 to 1.20.2
I used ByteZ1337 library as of now, but since it support from 1.8.x to 1.19.x my plugin won't display particles on a 1.20.x server
I saw that paper ParticleBuilder should be used now but I don't get it on how should I implement it to my gradle dependencies,
I tried with
implementation 'io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT'
But ofc it don't work like that
Yet still
ideally you wanna avoid locking at all and do it atomically
this can be done with varhandle, and memory fences
System.nanoTime() checks and
A rookie at using the Jdk benchmarking
The 2nd one usually results in much smaller results
That is, on the micro scale
did u test it properly as well?
I cannot promise that
if you wanna test the speed of those locks in a general manner u need to line the threads up and set up a semaphore and release them at fair conditions
But the synchronized keyword made a method execute less than 0.01 ms longer
Bukkit's Particle API supprots 1.9+. You should really only be supporting that anyways
I don't remember the exact value
well shadow its pretty well known that ReentrantLock and ReentrantReadWriteLock wins in performance the more threads you add, but the less threads you have, the better will synchronzied perform
with reentrant u also have fifo
and then u have stampedlocks which is just quite handy and fast if used correctly
I did not know that
What's the difference
With the ReadWrite one?
not sure if fifo is as performant since stack based impl tend be quite fast when u deal with smaller amounts of things
read write is a promotion lock sorta
when the write lock locks, all read locks are locked, when a read lock is locked, only the write lock is locked
can the defense value ( attribute ) not go above 30?
That's pretty handy
1024 is the limit I believe
like all the other java concurrency classes
it seems to be capping out at 30.0 🤷♂️
Btw, since y'all seem pretty knowledgable
Dunno then. Is there an exception?
nope
Is there a way to stop the player's info from being loaded by the server?
hmm, maybe with the async prelogin event
what info exactly tho?
Only certain players. Not delete, just make the server not load it. The nbt
The one stored in player data
Only thing I can think of right now is using ByteBuddy to directly modify the method
you could move the file somewhere else in the login event I guess
But I dunno if that's a good and possible idea
Yeah but I want a way to support 1.8.x to 1.20.x Ik that 1.8 is deprecated as hell but I really want to start from 1.8 till newer minecraft versions
That's pretty interesting
Is the nbt loaded after the Login phase?
And has the storing ever changed?
Like the naming of the files
Or their location
Or if it's always look uped at runtime rather than stored and updated or smthg
well anyway, I'll figure that out myself
I've created my own way of synchronizing tasks
but I'm not completly sure about it
it has worked for decently long without a problem
but I just wanna make sure an error that's untraceble never occurs
is there an event that gets called when an item is brought into the game? either from a drop, a villigar trade, or even crafting it?
that would be
3 events
maybe 4
ItemSpawnEvent, PlayerDropItemEvent, CraftItemEvent & PlayerTradeEvent (Paper)
?whereami
when someone sees paper
heyo, how do you update a player's permissions upon them gaining a certain rank in a faction?
Sounds like a #help-server question also provide the plugin name so it's more easy to help you.
If you are a dev use Vault or Luck Perms API spigot permission system is a mess. (Though that's because of how minecraft handles it)
@short pilot ^ forgot to reply
Can you get several rockets to go exactly the same upwards into each other?
oops, i meant for my own factions plugin i'm developing
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R2.block.CraftBlock cannot be cast to class org.bukkit.block.Furnace (org.bukkit.craftbukkit.v1_20_R2.block.CraftBlock and org.bukkit.block.Furnace are in unnamed module of loader java.net.URLClassLoader @28c97a5)
So it's an event related to an furnace... but you can't cast the block to furnace..
oooooh
🥷
thank you.
does it matter which?
yes
If you are trying to get a org.bukkit.block.Furnace you'd need to grab the BlockState
atleast you dont extend ItemStack
i've read the docs like just about now, thank u
Just lombok @delegate the entire item stack
it's says You may then cast that state into any accepted type, such as Furnace or Sign.

how does it work/adding to peopel?

is Furnace related to Smoker and BlastFurnace ?
public interface BlastFurnace extends Furnace
right..
i should open my eyes more on the docs.. thank u for help
Is there a way to achieve the same thing with schedulers as with Thread.wait() and Interrupt, because when I do that in the AsyncScheduler and the plugin turns off, then it tells me something like (I don't know the exact wording) -> [ . ..] uses synchronous tasks that do not close as expected
https://github.com/aikar/TaskChain/wiki/usage is useful if you really have a high level of delayed actions
I want to wait until a list is not empty anymore so I want to use thread.wait() and then [].notifyAll();

chilling in a PR as per usual
can you show code, im sure that is not right approach
bit slow
velocity took a bit longer ¯_(ツ)_/¯
just adapt ur own spigot
take a guess at changes that md will do
and poofyou have a spigot with probably minimal changes
ill backport you
is that a threat or a promise
fml, at least choose the cool versions like 1.5.2
imagine if we backported some good api features
I'd die
people stuck on legacy slow everyone down so much 😭
the hoops the fucking enum -> interface PR has to go through
new 1.20.2 feature, new api feature, 20 versions realease with updates
This is what I try to achieve but with schedulers because I was told I should not use Threads
couldnt we just like backport parts of the change to give old versions stuff to adapt/work with
The problem with backporting anything is that no one cares to download them
and also the precedent of backporting is a dangerous one
no project has the man power to actually support these older versions
okay so if we add something in spigort that forces people to update when we backport
so when you start porting back stuff, people ask for more stuff being ported back and more and more and more
all of the sudden you end up maintaining 10 different versions and you die
You never even start the thread
but that thread related code there doesn’t look quite good
yea, its just an example
cowoconcluwube do you know who ghost is
hmm, noo what ghost? :o
There are many swedes
Ghost is a Swedish rock band that was formed in Linköping in 2006. They released a three-track demo in 2010, followed by the 7-inch vinyl "Elizabeth", and their full-length album Opus Eponymous. The Grammis-nominated album was widely praised and significantly increased their popularity. Kerrang! included the album's song "Ritual" as one of "The ...
smh
you should know every swede
they even have a song about choco https://open.spotify.com/track/1WjcX541kITk0ACPf5K6Bp?si=1be310b4e15f4862
lol
🇳🇱 here😃
Does somebody know what a regex pattern could look like, that only filters different fonts?
With fonts you mean funny unicode chars that resemble ASCII chars?
stuff like this
𝔗𝔈𝔖𝔗
𝕿𝕰𝕾𝕿 ( test )
I want there to be emojis allowed, as well as all other special chars, only different fonts
So yes - funny unicode chars. In that case, there can be no such regex pattern. In your case you managed to hit https://en.wikipedia.org/wiki/Fraktur#Fraktur_in_Unicode
there are not patterns like this ??
At best you have something like
[a-zA-Z\uABCDE-\uABCDF\uABCDE-\uABCDF\uABCDE-\uABCDF\uABCDE-\uABCDF] ad inifintuum (obviously a made-up example)
🔥regex
?
A Set<Integer> makes more sense here
cant i just say that my pattern only accepts ASCII letters?
would there still be these fonts in this case?
You could do [^a-zA-Z] or something like that but that isn't great either
why wouldnt that be good?
There is Character.isAlphabetic(codepoint), but that isn't regex
However apparently there is an easy way to get these funny chars non-descriminatively (https://codepoints.net/search?dt=font), but Java does not expose this. Perhaps that funny library (forgot it's name though) does though.
Ah, ICU4J.
?
But uh, at 14 MB that library is gigantic
ScheduleSyncRepeatingTask is the way to go for a countdown right?
Could also be async depending on your needs
I would achieve less lag with async right because shortly before the timer there is a lot of world gen and Im getting a bit of lag in the timer
@inner mulch You'll want to use https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/lang/UCharacter.html#getIntPropertyValue-int-int- with type of https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/lang/UProperty.html#DECOMPOSITION_TYPE and compare the return value with https://unicode-org.github.io/icu-docs/apidoc/released/icu4j/com/ibm/icu/lang/UCharacter.DecompositionType.html#FONT
For a countdown you're probably not going to need asynchronousy lol
Right yeah...
But my countdown is lagging
get a pretty slow counter there maybe
?
probably because its interferring with the main thread, you could just use the timer api stuff in java and create a separate thread for it lol
what event is triggered before warden spawn naturally? with the shrieker thingies
But doesnt async do the same?
async is a bit different. If you have no clue what it does it is best to stay sync and optimize your code. However if you feel adventurous feel free to learn the nuances of it
async tasks in the bukkit scheduler run on a separate thread, yes, but they are still ticked/fired from the server thread
the actual running happens on a separate thread, but the scheduling depends on the server tick rate
So it probably wont solve the lag but just be more overhead?
yeah
I recommend to use spark if you want to figure out what lags the server
(Pls no use timings, thx)
thank god timings is on it's way out - I absolutely hated getting timings reports when users reported lag caused by my plugins.
Ok yeah I still have timings. I think I'll try this approach. But can I just access Players and so on on other threads and modify them?
ASYNC IS NOT THAT DIFFICULT
Yes, until people use the wrong datatypes
well thats another thing
Generally you should always use CME-safe datatypes even in sync envs but that is a rather novel idea
why
why?
its difficult to do a permission plugin?=
Life happened.
I mean I still have like 8 hours a day of free time and I'm basically at the point where I'm overwhelmed with it again
But my mind really isn't made for programming stuff. Like I know how to do it but I cannot really do it. It's strange. And depressing.
is there an event like shriekertriggerevent?
no clue. Probably not all too difficult
fucking hell bro
i have like 30 mins total of rest time scattered thru the day
i study from waking up to sleeping
just take a break from it 🙂
package me.skinnynoonie.characterwar.character;
import org.bukkit.event.Listener;
public interface Character extends Listener {
}
should I do this
or make an abstract class
for this
that impls Character and listener
ow
that is pretty vague, if you would have multiple "Character" listeners that share common methods you will go for latter, but I really can't think of scenario where that should be done, as listener should only... listen for events
Hello, I'm making a marketplace and storing everything about the item, but enchanted book 'enchantments' aren't marked as lore or enchantments, what should I use to know which enchantment the book has?
oh i see, thanks, will do!
Does someone know why my titles are staying longer then the fadein, stay and fadeout
I am sending Titleparts after the first title but that shouldn't affect the stay right?
You doing it via packets?
Title timings are a little weird. What you set them to is permanent for the player. Meaning that you need to send the reset packet before you set your new timings.
What?
Exception in thread "main" java.lang.RuntimeException: Error patching net/minecraft/world/level/gameevent/vibrations/VibrationSystem 2.java
Trying to download BuildTools 1.20.2
?paste the full log.
Also, #1117702470139904020 if you weren't aware.
I only set the timings once and then use sendTitlePart() and am using the built in adventure api
ok
Hmm, I can't speak for any paper api methods, but I know that Player#sendTitle() allows for manual timings. Pretty sure they get reset afterwards too.
Ah its Paper right
How do I get a shrieker that spawns warden?
SculkShrieker#setWarningLevel(4)
I mean get the block's location
Fixed it. The problem is the main title always uses the timings again
anyone know how to fill a region with worldedit api, eg 20% dirt 80% grass blocks
why WE? why not just for loops
try (EditSession session = WorldEdit.getInstance().newEditSession(worldeditWorld)) {
session.setBlocks((Region) getRegion(), BlockTypes.STONE);
}
That’s a single block, but you get the idea
whats an idea
how do i percent then
RandomPattern
would i put all percents in one or multiple
huh
it has no constuctor, only an add method
yes
RandomPattern pattern = new RandomPattern();
pattern.add(BlockTypes.DIRT, 1);
pattern.add(BlockTypes.STONE, 2);
it's weighted random, so dirt will be picked about 1/3rd of the time, stone 2/3rds
what would i use to make it function as percents in //set do
//set doesn't work with percents, it's also weighted random
is it?
you could also do //set 1%dirt,2%stone
makes sense through
and it'll be 1/3rd / 2/3rds
Well yeah because if the weights add up to 100, then you have a weighted list of blocks that can be represented as a percentage
canadian maths in action
i wonder if i should check that

to see if it actuall equals 100
Can I break a block somehow or only set type to air and then add sound and particles?
No, it doesn't matter if it equates to 100 in a weighted system
girl maths, boy maths, neurodivergent maths and canada maths
If you want a percentage you can do weight/maxWeight
There's two ways. Player#breakBlock() if you want a player to do it, and Block#breakNaturally() if you want it to just break
have you seen the size difference
husky is shoulder sized
could only probably kill small things
like rabbi rabbits
rifle >>>
by rabbi i meant rabbits
yeah i just googled that
probably germanic
Anyone know how to serislize a component into mini message I tried but it becomes bweird dtuff
doesn't even need to add to 100. You can just arbitrarily decide where 100% is at lol
I know. I just mean user input wise
33%stone67%dirt is a total weight of 100, so it's conveniently expressable in traditional percentage values
even more so if you know the size of the area too
20:58:17 [WARNING] [/189.131.204.141:0] <-> InitialHandler - could not decode packet! java.lang.IndexOutOfBoundsException: readerIndex(20) + length(😎 exceeds writerIndex(27): PooledSlicedByteBuf(ridx: 20, widx: 27, cap: 27/27, unwrapped: PooledUnsafeDirectByteBuf(ridx: 28, widx: 28, cap: 256))
20:58:17 [INFO] [Geyser-BungeeCord] santvemox has disconnected from the Java server because of Connection closed.
20:58:17 [INFO] [floodgate] Floodgate player logged in as santvemox disconnected
I like the sunglasses part
B) B)
B)
B)
B)
hi, does anyone know of a plugin to create in-game menus?
Deluxe menus
is configurable in game?
I put Authme plugin but I want to add music, I want to make a plugin that will play music after the player enters the game, that is, when the player "join", if the player "login", I want the music to turn off slowly after a few seconds, is it possible?
Can you help me which api syntaxes should I use example :"playerfishevent" ....
private void uuidLock() {
ItemMeta meta = itemStack.getItemMeta();
NamespacedKey key = new NamespacedKey(ItemGuiLib.getPluginInstance(), "custom-item-" + owner.getUniqueId());
meta.getPersistentDataContainer().set(key, PersistentDataType.STRING, UUID.randomUUID().toString());
itemStack.setItemMeta(meta);
}```
should that make it so items of same material and lore are not equal
persistent data container should also be a factor in itemstack#equals right?
private void openAnvilGUI(Player player) {
Inventory inv = Bukkit.createInventory(null, InventoryType.ANVIL, "§8§l» §a§lWelt erstellen §8- §7Namen Wählen");
inv.setItem(0, new ItemBuilder(Material.NAME_TAG).setName("Map Name").getItem());
Main.getInstance().getMapCreating().add(player);
player.openInventory(inv);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onInventoryClick(InventoryClickEvent e){
Bukkit.broadcastMessage("click");
if (!e.isCancelled()) {
HumanEntity ent = e.getWhoClicked();
if (ent instanceof Player) {
Player player = (Player) ent;
Inventory inv = e.getInventory();
if (inv instanceof AnvilInventory) {
Bukkit.broadcastMessage("1");
if(e.getView().getTitle().equalsIgnoreCase("§8§l» §a§lWelt erstellen §8- §7Namen Wählen")) return;
if(!Main.getInstance().getMapCreating().contains(player)) return;
Bukkit.broadcastMessage("2");
InventoryView view = e.getView();
int rawSlot = e.getRawSlot();
if (rawSlot == view.convertSlot(rawSlot)) {
if (rawSlot == 2) {
ItemStack item = e.getCurrentItem();
if (item != null) {
ItemMeta meta = item.getItemMeta();
if (meta != null) {
if (meta.hasDisplayName()) {
String displayName = meta.getDisplayName();
Bukkit.broadcastMessage(displayName);
}
}
}
}
}
}
}}
``` why cant I rename items in it?
if I click on the finished items it doesnt say click and it gets canceld
In an normal anvil every thing works
Listener
Problems
}}}}}}}
I'm doing command tab completions, how do i filter by players already typed? This doesnt let me use Collectors.ToList at the end
Arrays.stream(Bukkit.getOfflinePlayers()).map(e -> e.getName()).collect(Collectors.toList()).removeIf(e -> Arrays.stream(strings).toList().contains(e))
i mean that works but i still cant squash that in a list again
how do filters work again
ah
so it needs buffer var
wouldnt that only return the players already in the arguments
which i dont want cuz i only want the players not in there
lright
whats the filter for partial names again?
ah its the last element in args
ay its longer xd
whats the difference between e->e.method to Class::method anyways
Syntax sugar
fair
commands:
spawnentity:
usage: /<command> entity_id
permission: iransky.admin
description: spawn a custom entity
yeah i think im missing something after not using the spigot api for 2 months
is there anything wrong?
Not only
They are a bit different as well, one thing being null evaluation iirc
for instance
myCallback(foo.bar()::yes)
here foo.bar() is evaluated eagerly
myCallback(() -> foo.bar().yes())
here its lazy instead
iirc because of this eager vs lazy loading, classloading is somewhat different as well. Lambdas (since they are lazy) can reference classes that may not be loaded, where as if a method reference does that it may end up failing
(@smoky oak as well)
eh, that does not really matter tbh
and there are cases where the jvm can make singletons out of lambdas but not a method reference
but it's one of those cases where it does not really matter
no lol
My argument would be clarity. The jvm doesnt care if it invokes an anonymous method or a named one.
But every functionality deserves a name. Personal rule is: If the lambda has more than 3 lines, then i create a named method for it.
Sounds like a good standard, I know of some organizations that rule it out similarly
When enabling the plugin can't find Main class, but I think all its good
show your root package sir
you mean this?
it's not in the kingdoms package
yes
so its just org.qascadia.Main
why if I open this inventory the title is just: Reparing and if I open an placed anvil it is: Repair & Name
and If im in my opend Inventory renaming just doesnt want to work
?main
btw
Main
okay just changed
?paste
https://paste.md-5.net/ohukupirez.md how i can resolve it?
cant really help without the code
Help!!!!
Has anyone ever listened to custom events of other plugins?
https://www.spigotmc.org/threads/how-to-register-a-listener-for-custom-events-sent-by-the-【quests】.622438/
All you need to do is register it just like a normal event
Yes I did that! but it didn't work
I tried calling this event in my plugin and it works fine
Sounds like the plugin you're depending on isn't firing the events
But I can’t listen to what Quests sends.
or you're using the wrong event
Hi, I'm trying to change the death message to make it look nicer, the emoji I'm trying to add supports the minecraft chat, but whenever someone dies ingame it just sends weird letters instead of the skull itselfe.setDeathMessage(ChatColor.RED + "☠ " + e.getDeathMessage());
the Quests
final QuesterPreStartQuestEvent preEvent = new QuesterPreStartQuestEvent(this, quest);
plugin.getServer().getPluginManager().callEvent(preEvent);
if (preEvent.isCancelled()) {
return;
}
my plugin
@EventHandler
public void questTake(QuesterPreStartQuestEvent event) {
log.info("-----questTake-----");
}
I also hope I wrote it wrong
Are both your plugins?
also don't use the quest plugins plugin manager for registering your listener
Just use your plugins
Quests is not my plugin
I register my listener like this
getServer().getPluginManager().registerEvents(new QuestListener(this), this)
Which quest plugin are you using
You want the BukkitQuesterPreStartQuestEvent
QuesterPreStartQuestEvent doesn't seem to exist
Seems like the latest commit is quests 5
yep
There is a link on the Spigot page
and github page
reall? I gonna go see?
o!!!!You are geniuses
thank you! ! ! ! !
I am very confused as to why the break points of the two plug-ins are different when looking at the static final variables in the same class.
You can only use icons which are included in the minecraft font. Unless you provide a resourcepack.
Ive seen it on other servers tho without using any resource packs
Then they used icons which are supported by the vanilla font
Minecraft supports a shit load of emojis now. Pretty much the standard set of emojis are all supported
Try to send ☠️ in the minecraft chat, it does support it
Hi, I'm trying to use the EntityToggleGlide event and its triggering when I start gliding and stop as expected but both times isGliding() is false but I need to differenciate between starting and landing....does someone know how to do it or when isGliding() changes
Then make sure your project is utf-8 file encoded
Yup, already did, it is definitely weird
make sure you are compiling with utf8
Using p.isGliding() and not the isGliding() from the event seems to work
can some1 send me a script how can i make that a pvp area resets every 15 min?
Sure,
PvPArea area = new PvPArea(); //<- you should define this
area.reset(); //<- Make sure you implement reset
well if you want to know why this is how CB calls the event
+ if (getSharedFlag(7) && !org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) {
the first parameter here is the entity the second, is whether its gliding or not
its always false
my guess is that its a bug, I'll check it out later today. Well I was wrong its called true here
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) {
``` but rather confusing why this wouldn't show to you
how can i select what area i wanna reset?
Define 2 corners using XYZ locations and then calculate the box between them.
what box?
The area
and where can i say what world
Are you using a plugin or making one
mv
multiverscore
the world is naymed sand
can you make me an exampel with cords an worldname sand
@hasty prawn
You need to write an actual plugin for this. Its not trivial, even with external libraries like worldedit
Coordinate are tied to worlds juts provide a BoundingBox
wdym?
then every 15 minutes you'd need to run code that clears out the bounding box
can we prob vc?
no
then no one here can help you if you're looking for a plugin go to #help-server
be patient and wait for an answer once you ask there too
why cant I rename in an custom anvil inventory?
hi, can i ask ?
how can i using BukkitRunnable with dragon and delay task of fireball for 0.5 second ? Make dragon would be shoot fireball loop on it
public void run() {
Location original = winner.getEyeLocation();
Vector direction = winner.getEyeLocation().clone().getDirection().normalize().multiply(20);
Location newLocation = original.add(direction);
stand.teleport(newLocation);
for (Block block : UsefulUtilsVD.getBlocksInRadius(dragon.getLocation(), 10, false)) {
block.setType(Material.AIR);
}
if (!ShopKeeperHandler.arenas.containsKey(winner.getWorld().getName())) {
this.cancel();
stand.remove();
dragon.remove();
}
if(dragon.getPassenger() != winner){
dragon.setPassenger(winner);
}
Fireball fireball = winner.getWorld().spawn(original, Fireball.class);
fireball.setDirection(direction);
}
}.runTaskTimer(Utility.plugin(), 0L, 1L);```
If you're making your Inventory with Bukkit.createInventory the answer is well not simple.
When you create an inventory with Bukkit.createInventory it really isn't doing what you expect.
Basically it shows you the type of menu you want, but under the hood its just a bunch of slots. There is no underlying proper container to actually provide functionality to the Anvil.
the code would like this
like when Fireball
how can i do that when running dragon ride task but making fireball task delay ?
so I need to do it with packets?
nein. No packets required you can do this fairly easily with NMS
can anyone have a answer ?
be patient
if you want the NMS code to make a working Anvil that's not bound to a block I can send
yeah that would be nice
one second need to push changes of my lib its in
ok
@NotNull
@SuppressWarnings("deprecation")
public InventoryView openWorkstation(@NotNull Player player, @NotNull Material workstation, @NotNull Location location) throws IllegalArgumentException {
if (!(player instanceof CraftPlayer cplayer)) {
throw new IllegalArgumentException("Unable to cast player to CraftPlayer, only pass in CraftPlayers");
}
final Block block = ServerAdapter.toMinecraftBlock(workstation);
final BlockPos position = CraftLocation.toBlockPosition(player.getLocation());
MenuProvider provider = block.getMenuProvider(null, cplayer.getHandle().level(), position);
// if (provider == null) {
// provider = getException(workstation).apply(position);
// }
if (provider == null) {
throw new IllegalArgumentException("The material %s can not be opened as a workstation".formatted(workstation.name()));
}
cplayer.getHandle().openMenu(provider);
cplayer.getHandle().containerMenu.checkReachable = false;
return cplayer.getHandle().containerMenu.getBukkitView();
}
``` this is abouts how you do it. for anvils you can ignore the stuff I I commented out completely. Yours would probably look more like
```java
public InventoryView openAnvil(@NotNull final Player player) {
if (!(player instanceof CraftPlayer cplayer)) {
throw new IllegalArgumentException("Unable to cast player to CraftPlayer, only pass in CraftPlayers");
}
MenuProvider provider = Blocks.ANVIL.getDefaultState().getMenuProvider(cplayer.getHandle().level(), CraftLocation.toBlockPosition(player.getLocation());
cplayer.getHandle().openMenu(provider);
cplayer.getHandle().containerMenu.checkReachable = false;
return cplayer.getHandle().containerMenu.getBukkitView();
}
if you want to do things with the container before its opened you need to do that all prior to calling openMenu.
Otherwise you can just use the BukkitView and add items with Bukkit API which imho is easier and will be fast enough that it won't be noticeable at high TPS
@peak depot ^ sorry its a bit long
all good thanks
Bukkits inventory API is an absolute mess under the hood, unfortunately with how it is currently setup idk if there's much you could do to improve it 🤔 I have a PR open to add this functionality to bukkit API right now, but I'm debating whether I should just try and come up with a better system. rather than just fix the holes with band-aids
Quests quests = (Quests) pluginManager.getPlugin("Quests");
When I encountered an error while using this piece of code, do I need to adjust my Maven?
error :
java.lang.ClassCastException: class me.blackvein.quests.Quests cannot be cast to class me.blackvein.quests.Quests (me.blackvein.quests.Quests is in unnamed module of loader 'Quests-4.8.3.jar' @6f2f8481; me.blackvein.quests.Quests is in unnamed module of loader 'mclll-custom-1.0.jar' @2c7a9fb0)
do you have to plugins with the same plugin.yml in your server
seems you might be shading is another idea
You are shading the Quests plugin. Set to provided in your pom
ahhh my second intuition was correct ^
quick question how can I set an item in the first slot
before you open? you'll want to make an AnvilMenu. You can do this pretty simply. first though you'll need to make an AnvilMenu rather than using the MenuProvider
mappings.cephx.dev/1.20.2/ this website is really helpful when looking through NMS
AnvilMenu has a constructor of int syncId, Inventory inventory. to get the syncId just use ServerPlayer#nextContainerCounter. the inventory is simply the Players Inventory
then you have access to all the methods from. AnvilMenu, ItemCombinerMenu. and AbstractContainerMenu
https://mappings.cephx.dev/1.20.2/net/minecraft/world/inventory/AbstractContainerMenu.html this class provider setItem
version: 1.20.2, hash: 35796b9623
btw I installed the nms and it cant resolve MenuProvider and Blocks
How do I remove an item from an item stack? Currently I am doing item.setAmount(item.getAmount() - 1); but this doesn't always work when it tries to remove the last item
also my code is for 1.19.4-1.20.2 it may break in older versions
set the material to air?
o!!!!!!!!!!
Jesus! ! !
you are right! ! !
that's what I am currently doing but it isn't working
no clue why
the item just chills
Thank you my friend!!!!
no youre setting the amount to the ammount -1
if (item.getAmount() == 1) {
item.setType(Material.AIR);
return;
}
else {
item.setAmount(item.getAmount() - 1);
}
This is the exact code I am running as of right now
now it cant resolve the dependency anymore
I tried a couple different things
Reducing the count by one is enough in modern versions
In older ones you’d have to set the item to null when trying to reduce from 1
oh really? I seem to remember getting hit with an error on Spigot 1.19 when doing that
might be a misremember moment though
i recently uploaded a plugin in spigot I need to update it what do I need to do then
how
how
?paste
Hi, i am making a timer for a score board but i doen't work any one help (1.8.8) ?
provide code and tell us what doesnt work
private static int timeSeconds = 0;
private static int timeMinute = 0;
static void timer() {
Bukkit.getScheduler().runTaskLater(ElementUHC.PLUGIN, () -> {
timeSeconds++;
if (timeSeconds > 59) {
timeSeconds = 0;
timeMinute++;
return;
}
if (timeSeconds < 59){
return;
}
timer();
}, 20);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
if (p.isOp()) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard scoreboard = manager.getNewScoreboard();
Objective objective = scoreboard.registerNewObjective("element", "dummy");
objective.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Element UHC");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
Score s12 = objective.getScore("");
timer();
Score s11 = objective.getScore("Duree: " + timeSeconds);
s12.setScore(12);
s11.setScore(11);
p.getWorld().setPVP(false);
Collection<? extends Player> players = Bukkit.getOnlinePlayers()
for (Player player : players) {
player.setScoreboard(scoreboard);
}
return true;
}
your timer never gets past the first cycle
also, use a repeating task so you don;t have to call it over and over
goofy ass thing
you never update your scoreboard either
you should be using classes for this
screams static abuse to me
I keep getting this error when compiling the plugin. It was working perfectly about 5 minutes ago
mvn clean
thank you
@young knoll in the future, you shouldn't use varargs the way you did with Biome in the locateNearestBiome methods
It compiles now but I get this nasty error when loading the server:
having just one varargs on the end lets you call world.locateNearestBiome(loc, type, 5); which makes 0 sense
If you have the method be locateNearestBiome(Location loc, int radius, Biome biome1, Biome...biomes); then you have to supply at least 1 biome, and can supply optionally more
a zillion spigot basecomponent methods have this same issue
lol I even said this to you before...
i think ive talked about this exact thing before myself
#general message
back in Q1 of the year lool
For the record, we have very few component methods and the ones I'm adding to complete the API no longer do this
oh they don't? I haven't looked at that PR in a minute. that's good
Yeah. No more arrays
I was including that PR in the "zillion"
I still see them in the PR?
Yeah I haven't pushed yet because I need to make another small change before I can consider it functional
It's done locally though
👍
I actually probably just need to make changes to CraftBukkit so that its fields and whatnot are represented as base components so there's less duplicate code in Spigot
but atm there's a legacy text requirement that I have a PR for in BungeeChat that I'm waiting on
choco so good
Choco just trying 
If it were my decision I'd promote everything out of the nested Spigot interfaces too. Death to legacy strings. But it's fineeeee...
snipe the slime
Technically it should be fine to change this
you would probably takeover
Especially if we do it quickly
i cant say what i was going to
Someone pester me to look at CraftMetaItem and reimplement it all some time
Not right now. Can't be bothered. But eventually
isnt coll doing that
I wish spig00t had better methods to turn objects to byte[]
What’s that for, people won’t need to use packets to make entities antmore?
And make their own system
Well yes that would be possible
It mainly allows for expanded API for spawners/spawn eggs, and just more general control over entities
I am trying to go past the bad omen V limit of vanilla minecraft and for some reason, it is still capped at VI. I don't understand why this doesn't work.
public void kill(EntityDeathEvent event){
if (event.getEntity() instanceof Raider && event.getEntity().getKiller() instanceof Player){
Raider raider = (Raider) event.getEntity();
if (!raider.isPatrolLeader()){return;}
Player player = event.getEntity().getKiller();
int banOmen = player.getPotionEffect(PotionEffectType.BAD_OMEN).getAmplifier();
player.removePotionEffect(PotionEffectType.BAD_OMEN);
player.addPotionEffect(new PotionEffect(PotionEffectType.BAD_OMEN, 1000*60*100, banOmen+1));
}
}```
Is setBedSpawnLocation the same as /spawnpoint in game?
preymuch afaik
Ok thx I couldn't find anything else
But then I get errors since there is no actual bed hmm
seems like its not as easy as I thought
I don't think there is an easy way
Ok I will have a death handler anyway
seems like something that would be in NBT if you're not affraid to edit it
What would be the best way to protect generated structures, as in the best way I mean the optimized way of doing it
Hm my problem is world spawn would be ok but the players are spawned to the world spawn of another world and the deathEvent also doesn't have anything like this
Wait my bad there is a respawn event
Does anyone know why this isn't working?
?paste
https://paste.md-5.net/upixesoriv.js
I'm trying to get instances of the subclasses of an abstract class, but keep im always getting this:
"InstantiationException"
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
you are trying to instance the parent too
hmm i just want to instance the subclasses
Looks like you are only trying to instance the main class
:(
I only see you adding it to the set, and nothing else
Class<? extends RankBuilder, doesnt this mean it looks for classes extending the abstract one
No that is just the type you are declaring it as
Doesn't magically make the set find the classes you want
i want to have it automatically add the classes extending the abstract one
do you know how I can manage to do this?
Something like
ClassPath.from(RankBuilder.class.getClassLoader()).getAllClasses().stream().filter(clazz -> RankBuilder.class.isAssignableFrom(clazz)).toList();
I wrote that on the fly so take it with a grain of salt
ok, thank you
There is no way to remove tooltips for example the tips from templates because they are client side right?
wdym by tooltips? attack damage of an axe etc.?
try adding ItemFlag.HIDE_POTION_EFFECTS
its called something along those lines
if that doesn't hide it then you can't
for example
Ill try it thx
I think there is a new flag for trims
HIDE_ARMOR_TRIM thats one for trims
also wtf is this doc Setting to show/hide armor trim from leather armor.
specifically leather armor wtf
what is the difference between these?
(vehicleentitycollisionevent)
?jd-s
Blame choco
wow no java doc for the latter, I'd just try and sett I'd assume CollsionCancells stops the collision
why why is there an extra setCancelled in this even and why does it have 0 docs
then what different would the first one do?
do what setCacnelled does for every other event 🤷♂️ no clue
hell they might do the same thing lol
I guess we can check
I'm not in the mood to look at CB internals right now lol
have fun'
Yeah but i need to hide the info of the template so Hide_Item_Specifics worked
there's no HIDE_ITEM_SPECIFICS
There is and its working xD
🧻
theyre downstream
lynx looked at me funny
its so fast
don't remind me 😭
its still downstream
🤔
welp @Deprecated PR?
@worldly ingot made a pepe emote, he could probablyt make that
thats not a video
I'm not a wizard
ur not?
Hey, it's better than nothing
I assume that method was used at one point? Idk I don’t feeling like looking into the past
Almost certainly. Entity collision existed in early Minecraft, then it was removed, then it got re-added in 1.9
Although not used currently, I suppose. Best to deprecate. I did exactly that with Projectile#setDoesBounce() or whatever it was
Those methods did nothing either
Anyone have an idea on this?
The game does actually keep track of generated structures and their bounding box
I’ve been meaning to expose it in the api but haven’t got around to finishing it
How would I find the current ram, as in what Pterodactyl shows it as?
am i stupid or is intelli stuipid cause this shouldnt be true if they are the same should it?
i is always going to be < that value because that's what you're using as your condition
but it says <= not < in the condition
so it should also be triggered if they are the same
Sure, you're going to iterate one more than <
Does anyone know how to program the HG minigame?
whats that hunger games?
Look at it like this
for (int i = 0; i < 10 + 1; i++) {
if (i < 10);
}```
Its a brazilian and germany minigame
Who uses soups to heal life
yeah but in this example you are giving the foor loop only < and i would understand it in this case
idk how to explain this
xd
What do you want to do?
i just want to build a String out of a String list and after each string add another string except the last one
Have you seen the MCPVP server?
Remember #size() returns a non zero-indexed number.
i know thats what i want it to return
StringBuilder builder = new StringBuilder();
int size = BanShowCase.size();
for (int i = 0; i < size; i++) {
sb.append(BanShowCase.get(i).replace("%time%", formattedDate));
if (i < (size - 1)) {
sb.append(", ");
}
}```
However, you could alternatively use a StringJoiner
StringJoiner joiner = new StringJoiner(", ");
BanShowCase.forEach(joiner::add);```
That's all you need :p
oh thx i didnt know that was a thing
thank you choco
but
wait acutally
yh i can use that
Useful but not well known utility class
Is that Java 11 or 14 that that was added?
Java 8
damn
Maybe String#join()? But that was also 8
I'm probably thinking of that one.
I swear some newer functionality got added to Strings in some version after 8
repeat() was added in 11
text blocks my beloved
is there any ways to do this "better" or more eficcent? cause i hate doing it like this
if you're using replace a lot and are worried about optimizing it you could use StringBuilder
if you're worried about threading use StringBuffer instead
and you can reimplement replace with StringBuffer, Granted your gains are very small unless you do lots of string manipulation
TL;DR: You're probably fine
oi math nerds
Although you are doing two of the same replacements
not really worried about the usage at all tbh i just hate repetetive code
it hurts to look at
Yeah not much to do there, really
There are many ways to tackle this
yh but like if i have 20 parameters in my config thats a different storry
Okay just tell me I'm wrong then >:((
the more parameters the more worth it StringBuilder becomes
But generally replace is the easiest unless you need to do 1000 of them
My suggestion is to make simple Class to do this for you
if i have volume as x, and i have a amount of volume mined as y, then i have a percent needed to trigger something as z
would
if (x * ( y /100f) >= z) go through if z percent has been mined
ill think about it if i ever have more
ive scared the math nerds off
Use regex to extract each placeholder and look them up in a map<String, Supplier>
Kek
this is terribly over-engineered but this is what i do https://github.com/Y2Kwastaken/Suketto/blob/remaster/bukkit-core/src/main/java/sh/miles/suketto/bukkit/chat/translation/TranslationComponent.java
@worldly ingot math nerd wake up
why are you using volume?
Well, y/x would be your progress from 0 - 1, no?
bc thats what i have
idk
So you have the choice of either (y / x) * 100 >= z, or (y / x) > (z / 100.0)
I'm assuming x is your total volume in blocks and y is the amount of volume that has been consumed
one sec
if (this.regionVolume * (blocksMined / 100f) >= resetPercent) {
resetMine();
lastReset = Instant.now();
blocksMined = 0;
}
You could also do
have some var names
Yeah, so ^
Both are equivalent, it's just preference
how is the second one gonna work with 2 z
Or like 1000 other things
y /z > z
it ignores x
z -> x
y / x >= z / 100
hahahaha
DON'T LAUGH AT ME, I'M CHRONICALLY STUPID
I AM SORRY 😭
You can cache z / 100 for that sweet sweet micro optimization
If it's constant, yeah
I dunno if multiplication or division is faster but tbh we're talking clock cycles here so it probably doesn't matter lol
Preference
division is slower than multiplication
Probably not on modern CPUs
has my brain got this right
MUH clock cycles
Muh
Fuckin
Clock
Cycles
I mean implicitly you already do with that statement
Nothing needs to change in that snippet
cool im adding a double
Make sure either blocksMined or regionVolume is a double by the way, otherwise you're going to get integer division and it will always be 0
-1
blocks mined is an int bc im like 90% sure you cant break 0.8 of a block and call an event
region volume is long atm
Not with that attitude
Yeah you'll need some sort of floating point value, so cast either of those two to a double
ill make volume a doubl
don't have to change the type, just a cast will suffice
Well I think the type makes sense as an int
long can auto convert to double right
if it doesnt work i want a husky
Just do if ((blocksMined / (double) regionVolume) * 100 >= resetPercent) damn it!
no
YES
i can just convert the entire variable
anyone else been having intj crashing when pasting something latly? always happens when my pc is on for longer then a few hours i feel
The type is correct as an integer 
bc this is its only usecase
no
Wait how do float point numbers work
it is most deffo a long
oic it's a WE value
If you convert MAX_LONG to a double will it just not have space for any decimals
thats a you issue
it has good exception stuff though
so ill take it
wait a fuckin minute
I’ve been working with it lately too
Even though I had 2 vectors to choose from
I decided to make a 3rd for my use
Why? I have no idea
the fuck ya mean it might be null
thank you for the smallest screenshots ever
Thank you for 0 context
why do they have to be so different with a custom class for everything
yeah well
do better
and also have an adapt method for vectors
so i dont have to write my own
add it nerd boi
could put that in shitib
fromOrgBukkitUtilToComSk89qWorldeditMathBlockVector3
Lol MD wouldn’t accept an NBT api
NBT and API do not belong in the same sentence
Direct NBT manipulation won't ever happen
What if I wrap it in persistent data container
Kek
Imagine Entity#toPersistentDataContainer
Then you could save the entity inside itself
what about saving an entity in a pdc in an entity in a pdc in a pdc in an entity
Annoyingly
😭
one of my assembly and comp organizations quizes made us hand convert binary to floating point numbers
Yes
Put a chunk in a chunk in a chunk
Tbf being able to convert some of these things would be useful
Imagine how easy it would be to make a mob catcher
Is there a way to fix G looking like this?
Pretty sure there is an attribute modifier constructor that takes an equipment slot
Limiting the effect to just that slot
Or you can use the ItemFlag to hide attributes
im gonna go insane why does this if not work
the year is 9999 when printed out but when compared to 9999 its not???
i think it does cause i can print it out just fine?

