#help-development
1 messages Β· Page 1129 of 1
allVehicleIds.addAll(vehicle.getIds());
?
Please write your entire question. Your ? says nothingπ
why intellij recommend addall
but removeall no
see other print
most collections don't have a specialised implementation for removeAll and can be quite bad for performance
list.removeIf((ignored) -> true)
that is not the case for addAll
but intellij recommend foreach
what collections not have impl?
hashset?
this is better foreach?
I mean, that's just literally a .clear() call
No
what
vehicle.getIds().forEach(allVehicleIds::remove);
i cant use clear here
removeIf(_ -> true) is just clear
but this is better right? vehicle.getIds().forEach(allVehicleIds::remove);
it's alright yes
just use iterators in for loop smh
It's fine to use java streams
thats not
It depends which collection is your base and which collection is passed for your bulk operation.
If you tell us the types we can explain in detail why the calls might be slow. And this often indicates
that a poor choice for a datastructure was made. HashSet#removeAll() will be always O(n) for every collection passed (which is good).
But there are several combinations where manual iteration via removeIf() is preferred since it can get into quadratic or even exponential space.
its fine but if we are talking about pure performance its often not ideal
i added the module and intellij not find the bukkit api, lombok. why?
i added the module because intellij decide bug and src folder not appears
What "module"? And what does lombok have to do with the bukkit api?
gradle not find my libs
Show your build.gradle
Alright. I respect this opinion.
Now show your build.gradle
intellij bugged on all my projects
i created a new project on other project and solved it
You are missing the spigot repository
maybe local repository?
because works on all other projects
lombok not works too
all libs not works
but if create a new project, the problem are solved
Invalidate your caches and restart the IDE
what happens if you try to build from the terminal
let me see
also you have a typo in your build script
wdym typo
implementation("co.aikar:acf-bukkit:0.5.1-SNAPSHOT")t
Hm this should def break the groovy syntax
.kts
the problem is on intellij
?
idk made it
huh
./gradlew <goal>
command not found
Are you using a gradle wrapper?
Anyways im off to the gym, the Nerd can take this one

thought smile was in my walls aware of my lurking
Im aware that we got some lurking basement dwellers as well XD
basement dwellers π
No?
live in a tiny lil apartment we don't have a basement here
how i cancel all arrow dmg?
Check the EntityDamageByEntityEvent and see if the damaging entity is an instance of Arrow
See yall
Go pump some iron
??
I need projectilehitevent to be called
// Attempt to determine which Entity (if any) we hit.
// This is necessary because while the ProjectileHitEvent fires reliably,
// the EntityDamageByEntityEvent only fires once per round / bullet.
// This seems to work well enough, although I hope to find a better solution.
and I need to cancel the vanilla arrow damage
can i create a light around a player with spigotapi?
yes
any method?
while player is standing in air: replace air with the light block. then, after a set time, remove the light block you spawned
volia, light following the player
ahh u mean like this
aight
btw this will be lag ? if 100 200 player do this?
yeah I mean if you're really conerned you can only use the alternatives
which are actually modifying the light level with NMS
or work distroing the current setup
or packets
will cause issues with non-occludable blocks or whatever
flowers, tall grass
doors
I need to understand a thing. If I call this method:
ItemStack key = player.getInventory().getItemInMainHand();
and the player does not have anything in his hand, this should return null.
But why it returns me an empty ItemStack?
declaration: package: org.bukkit.inventory, interface: PlayerInventory
it has a @NotNull return contract
ok, but how can I check if the player has nothing in the hand?
check if its air
check the type?
hey illusion random question
do u know how to change block_entity_data of itemStacks? I find myself in need to work around a bug with it
I mean its anagolous to internals where there is no such thing as a Null ItemStack
spigot just happens to have this weird ambiguity with sometimes ItemStacks are null sometimes they are empty
https://www.spigotmc.org/threads/need-to-find-mped-plugin.662813/
if Anyone knows you can either dm me or reply in the thread.
this channel is for development help
oh you cross posted beautiful
clearly you don't give a shit then
eh
can the description in plugin.yml be queried from a game client connected to a server said plugin is loaded on?
not without sending it to them I guess
annoying. can you query it via code?
Plugin#getDescription#getDescription
doing some inentory manipulation. is there a way to empty the cursor without desync / force an update to the player so their view of the inventory is correct?
depends where you're doing it I've never had an issue using PlayerInventory#setCursorItem(null) in InventoryClickEvent
you should shouldn't use #setCursor for the inventory events
its prone to cause desync
This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.```
its saying that method doesnt exist
that depends on how you are doing it ig
my bad
its not in the PlayerInventory
declaration: package: org.bukkit.entity, interface: HumanEntity
you can also use InventoryView#setCursor
depends
lol
Want me to explain how inventories work quick :P I'm Number 1 inventory shill
im just rewriting some code i have no idea where i put it
specifically im trying to figure out all restrictions on inventory item placement and force it to not be restricted
Basically InventoryView is a contract between a Player and an Inventory. This is a strict contract so only one player can have one view. However, multiple players can view one Inventory (depending on the inventory). Basically Inventory is a list of items with a few fancy listeners to do syncing if their are multiple viewers such as a chest, but without fail every View will only have 1 player. This is how InventoryView can have a InventoryView#getPlayer method. It will always return the same player and it will always be associated with that one player
interesting
You can see this more with the new API https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/MenuType.html
declaration: package: org.bukkit.inventory, interface: MenuType
which allows you to create a view itself
MOOOOM, HE'S SHILLING AGAIN!
A Day does not pass where I will not shill
it will only get worse as I make more changes
should change my about me to #1 MenuType Shill
It's up to date!
he already did!
and I made a very mean comment on it already
I do need to address M's comment though lol
i don't have a stash account
L
don't need one :P
yeah I don't really think that's a right now concern I just want muh components!
whats it about
deprecate/remove string methods
!!!!!
Which I actually only partially agree with
paper pilled fr
Yeah I'm not doing that
I think string set methods should stay
Other M comment
watch everyone get angy
String get methods should probably go tho
just remove all of them next release without warning
and tell people to go use components
L
most of the time people actually use those anyways its often times for naive implementations
Any non naive use can be done with components relatively easily
like checking inventory title to know my custom inventory
yeppers thats like 90% of the uses i stg
removing string getters is the only reason any string methods should be deprecated anyways
just deprecate inventory get title
deprecate inventory
deprecate org.bukkit
it's called paper
Inventory isn't that bad tbh
ofc it could be better but comparitvely to the rest of that API its a non issue
Coming soon to an API near you
@Deprecated
Inventory createInventory(InventoryHolder, InventoryType)
@worldly ingot so when you gonna make the spigot String -> Component that is 100% MiniMessage compliant
Its not like you have a job or anything so why not get started now?
which also supports minedown and legacy
legacy support is easy
just replace all those super silly section characters with those good ol legacy colors
Not sure. Whenever I get to it. I might just adopt Adventure standard. If only MiniMessage were still an independent repo with a BungeeChat module 
alas he can't :(
L
yada yada legal jargon etc etc
someone is never getting their CLA approved
I feel like that's bad legal advise 
but you should if you don't want to sued
Lmao
Unless you live in russia and voided a US license I have a feeling it'd be hard to avoid that
who said i was gonna get one :)
womp womp
sounds like a skill issue
chat I think I might try and get an internship this summer
or should I go back to painting???
hot take should I just drop 50k on College then go back to working in the trades
this summer? summer just ended
byt his summer I mean this coming summer
because this summer is now over its now last summer
so next summer
nope this summer because last summer is now over
actually its 10 more days
I've had enough of you
xddd
shush it
United States Defaultism πͺ fuck you
football field isn't a time unit
so
I mean if you used football games this would work
but you'd still be wrong because that'd mean summer is oover in 24 days
when its technically over in 10 days
24 mcdonalds working shifts of 8 hours each * 3 hours for each footbal game
24 * 8 * 3
that is the number of hours
than you divide by 24 to get the number of days
πππ
24 * 8 * 3 / 24 = 8 * 3 = 24 this is the assumption ofc that you only mean 1 football game
if there is one football game per shift than it simplifies to 8 * 3 * 24 which is far more days than the end of summer
@valid burrow never make fun of the american units ever again
you'll never measure up to our ability to calculate completely arbitrary numbers into even more arbitrary units
no McDonald's worker ever has gotten an 8 hour shift. if they did then they would have to get breaks and proper management
i had a 297 hour shift once
what does that mean
she had a 297 hour shift once
that you should buy me a cat
I literally sold all the kittens my cat produced a few weeks ago, where have you been
and you didnt even think to ask me ππ
._.
WHY DIDNT YOU ASK ME
I WOULDVE BOUGHT THEM
Bro you live on the opposite side of the country
idc!
Lol
I'm surprised I haven't died
Ngl should've gone on that rollercoaster with that loop
same
But now I can't
Also, I might be in the wrong channel to regret my life decisions
But
I think the girl that wanted me to go with her to that ride didn't enjoy me despawning
I'm making hunger games in 1.8 (my first time making something using Java)
and I have a bunch of runTaskLaters for the countdown + deathmatch.
I've been trying to find a way to cancel them all for like a month now but nothing I've found has helped at all.
People have said stuff like "runTaskLater returns an event that can be cancelled", but that doesn't help because I don't know how to get their IDs and then cancel thhem from another class.
I know one way is to put the events themselves into a list but I cannot find how to do that.
If someone could give me an actual example which I could then tinker with to figure out what each part does, that would be amazing. Thanks :P
?scheduling
?1.8
Too old! (Click the link to get the exact time)
if this is your first time using java, using 1.8 is a poor choice to say the least
Do NOT use 1.8 and spigot community won't give you support for ancient versions
List<BukkitRunnable> tasksList = ...;
tasksList.add(Bukkit.getScheduler().runTaskTimer(plugin, () -> { //action }, 0L, 20L))
// to cancel all of them
tasksList.forEach(BukkitRunnable::cancel);
need old combat
It's hunger games so I guess he is forced to be on 1.8 and the question is not really version dependent so it's fine, thou it's also true that he won't get help with old stuff
thank you very much. I've been trying to get it's ID and then cancel it this way.
why forced xD
noone is forcing you
unless you are getting paid for it
whoch I doubt since its your first time using java
I want old combat.
so I use 1.8
same as saying no one is forcing you to live unless you're paid for it
okay thats a better reason
Imagine torture just for pvp combat
wtf does that mean
you better use ids anyway
strawman
that was jsut an example
OCM in shambles
you probably shouldn't keep hard references
100% worth it
keeping the BukkitTasks themselves is fine
just clear the list once you cancel them
1.9 pvp is torture itself
foxed

how calculate pitch between locations?
I need to get the slope between a starting point and an ending point.
i have PTSD when clicking on prnt sc links
hello, i can't use the EquipmentSlot enum on my project. it says "cant resolve symbol 'EquipmentSlot' "
update ij
the direction or the height difference? or the actual pitch the camera is heading?
ij as in intellij?
yes
okok
How can I make custom model as npc?
custom model in terms of skin?
or actual custom model like a deer or whatever
yeah, something like that
specific, like this.
you could put a regular villager or whatever there and give it a helmet with a custom model data
requires a custom resourcepack tho
or use modelengine and create the model with blockbench
there is a free version
oh really
but it has like 3 models max
i found this on server, and they don't use resource pack.
looks like a bunch of playerheads bound together
Is that 1.8+ version?
Maybe.. thats why i said armor stands. and also others people said the same. but there must be something because these aren't custom made by the server..
I know because these models are available on internet..
yeah there was a website where you can arrange armorstands to your liking and export them
so this plugin is ejected because isn't available for 1.8. and this server using 1.8
hm
thanks, i'll give a try now
they even had a lib to convert the model to code. their github is worth a look
or it was from minidigger not sure
assuming A and B are plugins that listen to the same event, A, then B.
what happens if A cancels the plugin?
does B's code run or na?
event priority
you mean cancel the event?
B will run code
Depends
Your listener can have ignoreCancelled
so unless it has that it wont run?
By default itβs false
im assuming thats a yes
what determines event priority?
https://paste.md-5.net/kehizuzefu.cpp someone can help me? why is the entity not on the path I wanted? start at turret.getlocation and end at pLoc
so I'm targetting a sign and it detects that im targetting it but for some reason the targetBlock instanceof Sign sign check fails. Anyone can help me?
You may need to get the block state to see if itβs a sign if Iβm correct
is targetBlock of the type Block
if so that cast won't work
^^
worked, thanks :D
can you clone across dimensions
clone what?
blocks
I am not sure what you mean by that but the dimension doesn't matter
nah, im planning on using a separate void dimension with entity spawning disabled to temporarily store structures
If the chunk is unloaded will the second one throw an exception?
final LevelChunk levelChunk = nmsWorld.getChunkIfLoaded(block.getX() >> 4, block.getZ() >> 4);
final LevelChunk lChunk = nmsWorld.getChunk(block.getX() >> 4, block.getZ() >> 4);```
A lot of world stuff just loads it if u call it
No clue about the nmsWorld though
Try it out
I'll try it then
can some people help me update a plugin
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
no i mean how do i update a plugin from source code
how
the exact plugin is Elevators V2
Try it
Hello there .. i have a bug :
cannot inherit from final class org.bson.codecs.MapCodec
how i can fix it?
iam usingn morphia and mongodb ..
Hey yall, having a strange problem. Trying to pull a HashSet i have in another class and it works everywhere but when i use Set#Size() it gives a null
public Set<String> getTasks() {
return tasks.keySet();
}```
That code gives us nothing
Explain what happens, when, and give relevant code
And exception
In my Inventory class i'm grabbing my TaskManager class.
public TasksInventory(TaskManager taskManager, PlayerDataManager playerDataManager) {
this.taskManager = taskManager;
this.playerDataManager = playerDataManager;
}```
in my TaskManager i have a set and it adds the tasks into the set onEnable
```java
public Set<String> getTasks() {
return tasks.keySet();
}```
In my inventory i have a createInventory()
```java
public Inventory createInventory() {
size = ((Math.max(size - 1, 0) / 9) + 1) * 9;
return Bukkit.createInventory(null, size, color(String.format("&aTasks &7(&c%s&7)", taskManager.getTasks().Size())));
}
The null
Caused by: java.lang.NullPointerException: Cannot invoke "me.arkallic.core.manager.TaskManager.getTasks()" because "this.taskManager" is null
at me.arkallic.core.gui.TasksInventory.createInventory(TasksInventory.java:59) ~[?:?]
at me.arkallic.core.gui.InventoryGUI.<init>(InventoryGUI.java:19) ~[?:?]
at me.arkallic.core.gui.TasksInventory.<init>(TasksInventory.java:24) ~[?:?]
at me.arkallic.core.command.TasksCommand.onCommand(TasksCommand.java:43) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]```
It happens when the inventory opens
But this.TaskManager is not null?
Evidently it is
Could someone help me?
Use the lambda method on #spawnEntity() to set the transformation stuff.
I think thatβll solve the split second changes.
But how is it not on any other method?
It's world#spawn
spawnEntity does not take a consumer
@neon wraith ^^
And make sure to modify your entity in the consumer to ensure it's modified before spawning
where's basics PR?
I'm not understanding why this is null
How are you creating TaskInventory class
In my TasksCommand class
public class TasksCommand implements CommandExecutor {
/**
* Executes the given command, returning its success.
* <br>
* If false is returned, then the "usage" plugin.yml entry for this command
* (if defined) will be sent to the player.
*
* @param sender Source of the command
* @param command Command which was executed
* @param label Alias of the command which was used
* @param args Passed command arguments
* @return true if a valid command, otherwise false
*/
private final TaskManager taskManager;
private final GUIManager guiManager;
private final PlayerDataManager playerDataManager;
public TasksCommand(TaskManager taskManager, GUIManager guiManager, PlayerDataManager playerDataManager) {
this.taskManager = taskManager;
this.guiManager = guiManager;
this.playerDataManager = playerDataManager;
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player p) {
TasksInventory tasksGUI = new TasksInventory(taskManager, playerDataManager);
guiManager.openGUI(tasksGUI, p.getUniqueId());
if (args.length == 0) {
return true;
}
return true;
}
return false;
}```
Is this the reason?
Nope, tried to make a getter in my main class with the inventory and it does the same
And how are you creating TaskCommand
In my main class by registering the command
Can you show it
public final class Core extends JavaPlugin {
private static Core instance;
private final TaskManager taskManager = new TaskManager();
private final PlayerDataManager playerDataManager = new PlayerDataManager(taskManager);
private final GUIManager guiManager = new GUIManager();
private final Listeners event = new Listeners();
private final Commands cmd = new Commands();
@Override
public void onEnable() {
// Plugin startup logic
instance = this;
LangHandler.getInstance().initialize();
taskManager.register();
//Commands
cmd.register("core", new CoreCommand(playerDataManager));
cmd.register("rank", new RankCommand(playerDataManager));
cmd.register("setrank", new SetRankCommand(playerDataManager));
cmd.register("home", new HomeCommand(playerDataManager));
cmd.register("sethome", new SetHomeCommand(playerDataManager));
cmd.register("deletehome", new DeleteHomeCommand(playerDataManager));
cmd.register("maxhomes", new MaxHomesCommand(playerDataManager));
cmd.register("tasks", new TasksCommand(taskManager, guiManager, playerDataManager));
//Listeners
event.addListener(new PlayerDataListener(playerDataManager));
event.addListener(new PlayerJoinListener());
event.addListener(new TaskListener(taskManager, playerDataManager));
event.addListener(new GUIListener(guiManager));
//Reload
for (Player player : Bukkit.getOnlinePlayers()) {
playerDataManager.register(player.getUniqueId());
}
getLogger().info("Core is online!");
this.saveDefaultConfig();
}
public static Core getInstance() {
return instance;
}
Sorry i do it through a commands class
public void register(String command, CommandExecutor commandExecutor) {
Core.getInstance().getCommand(command).setExecutor(commandExecutor);
}```
Why are you using di for everything but the core?
And you should be instantiating managers in your onenable ideally
You are either not sending the correct code, or you are running an old version of the plugin
Or there is smth i missed
There will be compile error, there is no Size() method on set
So I would say it's not correct code
I read that using static on your main instance doesn't hurt anything. just preference. Recently started learning DI
Technically thereβs nothing wrong with it, but itβs just bad practice. People will argue til the cows come home about it
Strange, it pops up though when i start typing
size() != Size()
Thats pretty much what i read when i was looking it up
That means you edited code before sending it here

But why would it be null just in the one class? thats what im not understanding
My only guess is that itβs being passed in at the wrong time or smth
If you habe the plugin instance why not use a getter
Bit anti di tho
Somewhere out there π
there a tutorial on how to setup debugging for, and step through spigot code? would help debugging some of my code
(probably) if you disable the watchdog
?
i mean its already showing me which methods it's in using step into but having that single line of information aint useful
thats all you get with an attached debugger. you can expand and see variables
you saying i have to launch the server in my IDE?
yes
google I'm sure π
lol true
Never heard of that engine before
@eternal oxide what're you looking up that you dont want google to see ?
π
Bing user
I used duck duck go for a while but they went all crazy political
Now I use startpage. Nice clean and no mess
I looked into that browser on android. i didn't like it. Anyways were talking in dev, whoops to general i go
if you want a good mobile browser and are on android
check out Mull or Fennec
I'd personally reccomend Fennec for mobile because it retains the ability for most sites to work. Mull is too hardened and its not as easy to switch things off on mobile
as for search engine I use duckduckgo, but searx is also really good
Does anyone know the minimum and maximum values for setTextOpacity in a TextDisplay? Thanks
?jd-s
I tried it, but both -127 and +127 make the text about 40% transparent. I also tried with -255 and +255, but in those cases, there's 0% transparency
Maybe it's not possible to make the text completely invisible, but that would be strange
MCwiki says Since there are no unsigned bytes in NBT, values greater than 127 need to be replaced with alpha-256. So, the value is from -128 to 127. Similar to the background, the text rendering is discarded when it is less than 26. Defaults to -1, which represents 255 and is completely opaque.
but also has a {{verify}}
so not more than 26
Thanks! It works perfectly π±
You are able to make the background completely invisible, and can make the letters opacity, and can change the font. You can apply MiniMessage for the colors. Iβd suggest checking out this plugin on spigot TextDisplay, which is really lightweight yet has all of this
i'm trying to get hex colors in minimessage in adventure to work and fsr this won't display properly:
<color:#666666>[<aqua>Admin<color:#666666>] <gray>
It just ignores the hex
holy crap you can make random floating text?!
Show ur code
text displays
audience.sendMessage(MiniMessage.miniMessage().deserialize("<color:#666666>[<aqua>Admin<color:#666666>] <gray>Your chunk is <red>already chunk-loaded<gray>. You can <red>remove <gray>it using <red>/chunkloaded remove<gray>."));
manually built the message from variables together for this
so ignore that a prefix is just in the string
How do you know it ignores the hex?
bc it doesnt apply the color
i mean
it doesnt ignore it
something like #000000 works
does it only support the hex for the default minecraft colors?!
no
that would kinda defeat the point
#666666 is gray
yea
before i had
#555555
dark gray
then i wanted it to be slightly lighter
now the first bracket is white
and after the Admin text everything is blue fsr
or aqua
if you're struggling with minimessage just use: https://webui.advntr.dev/
A web interface for MiniMessage.
it seems to work there idk
in console it's shown like:
ignore the different message it's just about the prefix
ModCheck ban?
@young knoll ^
or is it just the console not supporting those colors??
Istg this worked yesterday wtf
Some consoles don't support colour and half the time there isn't a need for colour
Most colour needed is logger level identification
yeah i just did this for testing
but istg the console let me use the color yesterday
so fkn weird
damn wtf it actually is the console
lol
could #sendBlockChange be ran async?
im looking at a 1yo code of mine and it was runnung sync
Probably
hello
Can i modify at anyway inventory title?
It doesn't seem respondiing to my Components with custom font
On chat everythings works fine
Paper kekw
Why?
No there's no good way to do this
You need to reopen a new view
Wdym reopen?
I mean i understand what is reopeniing
but just open close and open the same iinventory?
No open a brand new inventory
Open one inventory and then open another one with modified title with custom font?
wait what it can't work like that
I create custom inventory (chest 6x9) and just want to lower the title of that Inventory a little bit. So i created custom font with lowered text and when i append thiis font
It doesn't affect the title text
If i do the same on chat
It does affect
so you mean the font just isnt working on the menu title?
Yes chef
how are you setting the font on the title in the first place
Component.text("text")
.font(Key.key("minecraft", "boss_bar_2"))
oh are you using paper?
siii
may I kindly redirect you to the paper discord?
If i could i would go. I have beef with the owner
spigot doesnt allow components by default so its kinda hard to say if spigot is the cause
kekw
well
So spigot just takes plain text on title?
yeah
its a string for titles
and paper added the component titles
but afaik cuatom fonts should just work
like do you just see the default font?
or like what is going wrong
like are you modifying the title of an inventory thats already open or are you creating a new in inventory with the component title
Just the default grey font. For the test i set the size of that font to 20 and the same component sent on chat works and makes the text BIG but it does not affect inventory
Creating inventory
And the component iteself works because for example
omponent.text("text")
.color(TextColor.color(255, 255, 255))
.font(Key.key("minecraft", "boss_bar_2"))
if i do that, the text becomes whte
what is the actual issue
The title is not reacting to the font i set to it
Idk if that's how it should be
If i can make it some other way. if manually sending inventory packet would work
show your code
protected void createBukkitInventory() {
this.bukkitInventory = Bukkit.createInventory(this, this.inventoryDeclaration.getInventoryProperties().getInventorySize(), this.inventoryDeclaration.getInventoryProperties().getInventoryComponentTitle());
}
package pl.maxhard.commons.tiermc.inventory;
import net.kyori.adventure.text.Component;
import org.bukkit.event.inventory.InventoryType;
import utilities.helper.InventoryHelper;
public class InventoryProperties {
private final Component inventoryTitle;
private final InventoryType inventoryType;
private final int inventoryRows;
private final int inventorySize;
public InventoryProperties(Component inventoryTitle, InventoryType inventoryType, int inventoryRows) {
this.inventoryTitle = inventoryTitle;
this.inventoryType = inventoryType;
this.inventoryRows = inventoryRows;
this.inventorySize = InventoryHelper.calculateInventorySize(inventoryRows);
}
public InventoryProperties(Component inventoryTitle, InventoryType inventoryType, int inventoryRows, int inventorySize) {
this.inventoryTitle = inventoryTitle;
this.inventoryType = inventoryType;
this.inventoryRows = inventoryRows;
this.inventorySize = inventorySize;
}
public InventoryProperties(String inventoryTitle, InventoryType inventoryType, int inventoryRows, int inventorySize) {
this(Component.text(inventoryTitle), inventoryType, inventoryRows, inventorySize);
}
public Component getInventoryComponentTitle() {
return inventoryTitle;
}
public String getInventoryTitle() {
return inventoryTitle.insertion();
}
public InventoryType getInventoryType() {
return inventoryType;
}
public int getInventoryRows() {
return inventoryRows;
}
public int getInventorySize() {
return inventorySize;
}
}
i mean
last time i checked spigot didnt have native createInventory support with a adventure component
protected LobbyPanelInventory() {
this(net.kyori.adventure.text.Component.text("text")
.font(Key.key("minecraft", "boss_bar_2")),);
}
In the constructor like that. Then from that iis constructed InventoryPropertes
i'm using paper
banned from paper
and what exactly is happening when you do that
i cant believe paper hasnt pulled the new menu type api yet
iirc they have? idk
Well if i could i'd use spigot i have custom forks of that engines. I think that puttiing kyorii inside paper is fucking stupid and literally forcing people to use some shit API. But i have joined the project and i have to
no they havent
Literally making custom API based on Builder type of everything is stupid
or if they have they havent built anything yet
they get it
what
also @river oracle where is bungee component support on menu type api
The text is applied without this font
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
?img
How was that?
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
https://prnt.sc/b615uyIxUmDq -> This is on chat
https://prnt.sc/Ilxd6YHYXoZN -> When i open inventory
You can use MiniMessage to create components if you prefer that instead
@Override
public void execute(LiteContext<CommandSender> context, Player executor, PlayerProfile profile) {
Key key = Key.key("minecraft", "boss_bar_3");
executor.sendMessage(net.kyori.adventure.text.Component.text("test for u guys")
.font(Key.key("minecraft", "boss_bar_2")));
Code is literally the same
protected LobbyPanelInventory() {
this(net.kyori.adventure.text.Component.text("test for u guys")
.font(Key.key("minecraft", "boss_bar_2")));
}
Set the color
show your font definition
https://prnt.sc/3EIpS7zRM_0Z It becomes red
? did you set it to red
Yes
Ohh
Okay
Omfg
{
"providers": [
{
"type": "space",
"advances": {
" ": 4,
"β": 0
}
},
{
"type": "bitmap",
"file": "minecraft:font/ascii.png",
"ascent": 3,
"height": 20,
"chars": [
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
" !\"#$%&'()*+,-./",
"0123456789:;<=>?",
"@ABCDEFGHIJKLMNO",
"PQRSTUVWXYZ[\\]^_",
"`abcdefghijklmno",
"pqrstuvwxyz{|}~\u0000",
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000Β£\u0000\u0000Ζ",
"\u0000\u0000\u0000\u0000\u0000\u0000ΒͺΒΊ\u0000\u0000Β¬\u0000\u0000\u0000«»",
"βββββ€β‘β’βββ£ββββββ",
"ββ΄β¬βββΌβββββ©β¦β ββ¬β§",
"β¨β€β₯βββββ«βͺβββββββ",
"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000β
β\u0000",
"β‘Β±β₯β€β β‘Γ·βΒ°β\u0000ββΏΒ²β \u0000"
]
}
]
}
Do you mean that?
Or what else do you mean by font definition
minecraft namespace or non minecraft stuff 
i mean
what do you expect it to do
you have the mc font in there
and it's displayed as mc font
The height is set to 20
So thiis one is bigger
So i expect it to be bigger for now
it's under minecraft namespace
Not happening until it's stable
I'll prob add it myself
@blazing ocean i am so stupid it works i didn't build the code of the platform i use
So sorry for wasting your time
lmfao
It wont compile π
π€£ π€£ π€£ π€£ π€£ π€£ π€£ π€£ π€£ π€£ π€£ π€£
π₯Ίπ
sendMessage is all whack
sorry first site
Het ur eraser and remove the brackets
It won't compile
what
To compile it just fax it to the nearest government office
But you have a compile error
So it'll just be returned
ζθ½ζΏη
English only bucko
Is there an alt for MapPalette.matchColor()?
Deprecated in 1.20.2, but map data packets still use byte to indicate map colors
θ½ζηζΏ
I had my own util to match colors
How do I make an "autoclicker" for left click to specific players?
At 1 hit a second it eats up 10% of the server performance
In some cases 20%
Show your current left click code
if(!(entity instanceof Player)) {
Vector3 entityLocation = new Vector3(entity.getLocation());
if (((entityLocation.x >= minCorner.x) && (entityLocation.x <= maxCorner.x)) && ((entityLocation.y >= minCorner.y) && (entityLocation.y <= maxCorner.y)) && ((entityLocation.z >= minCorner.z) && (entityLocation.z <= maxCorner.z))){
entity.remove();
}
}
});```
is there any more resource efficient way of doing this?
Boundingbox
And Bukkit's vectors
Bounding box wouldnβt be much more efficient
It cleans up the code
There isnβt any faster performance wise way to do this
At the end itβs just a couple checks
But this shouldnβt be too much performance
Looping all entities though
^
How often do you call this
every 5 secs?
That definatly will cause some performacne issues
hm
Is getting all entities within distance of a location more efficient by any chance? Or does it just secretely loop all entities and check distance on the back end
oh
getNearbyEntities() checks with a box?
π
Only check the chunks that are actually possible
Or use getNearbyEntities yeah
what packet was used by the server to inform the player about their death or damage being dealt to them?
Set Health
ah okay
how do I make commands that appear red when the players try to write them as if they didnt exist
change out commands packet
dont register them and listen to command pre process event
and listen to command preprocess and cancel em
what if they don't control it or would like some other players to see them?
so register it and not give players the permission
this might be a little bit more complicated
but doesnt preprocess event only fill in the tab when writing the command
how do I make the command actually work
if Im not registering it
use the data the pre process event gives you
but
it gives you getMessage
if it starts with a slash its called
you have getMessage which gives you the entire chat message
so youre telling me its when you send something with / in front of it?
I thought it was when player starts typing / in they chat
afaik ye
alright good
its called after they press enter
I knew the docs were scamming me
thx
I just git cloned a plugin. How do I fix this import?
nevermind
it instantly fixed itself
how to check if player is hooked on fishing rod? get the hook entity and player that uses the fishing rod? - no events, in bukkitrunnable
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerFishEvent.html
Not sure if this helps, seems to be a get state method perhaps you can find something useful?
declaration: package: org.bukkit.event.player, class: PlayerFishEvent
I didnβt see an event thrown specifically for when an entity is initially hooked
Probably gonna have to run through some packet shit then
but the leashes are hidden too...
That's what events are made for
How do I hide slimes without hiding their leashes?
cant u just give them invis?
hey, don't say that :/
does anyone know how to detect players putting items into the decorated pots?
Probably playerInteractEvent and check the action / block
I believe that would be right click
yeah but i m looking for a better way
playerinteractevent might be the final decision
Does decorated pot have an inventory?
no
players can put items into the pot by right clicking it
i want to prevent players putting certain items into the pots
Right ok so not one they can interact with, I donβt see any event specific to putting an item into a decorated pot
Pretty easy with playerInteractEvent
ok i will do it with playerinteractevent thx
Sure!
btw, how to detect player shift clicking the pot?
just if (player.isSneaking()) ?
because players may put the blocks nearby the pot
Sounds like thatβd be fine
okay
hi, can anyone say why when i have my plugin and i try use commands it automatly coplete is pluginname:pluginame
You have a naming clash probably
but is only one plugin what use this command
how can i fix this bug?
Not a bug you could say it's intended can't do much to help you tho
You can do /command or /pluignname:command
If you only have the latter you have clashing command names
Please check out to make sure your plugin wasn't Reloaded wasn't loaded twice there isn't another plugin on the server with the same command
i have /command and /pluginname:command
i packege plugin and paste into plugins folder
I tested it on different verions and it has the same result
that is your plugins namespace
I don't have spaces in my plugin name
your plugin name is the namespace
it having /command and /plguinname:command is default behavoir
How to disable it?
I want to hide this /pluginanme:command
spigot.yml commands.send-namespaced
But i want to someone who use my plugin don't see this
Automatically
every plugin shows that
and this is intentional
if 1 server wants to disable it they can
if you have two plugins with the same command, this is the way the system distinguishes between them both
But some plugins you can download don't have this
such as?
I have one
Luckperms
luckperms does have it
Have what?
luck perms has it
^ that
?nms
Do you just want to remove teh namespaced command?
they want all servers to not see his commands with namespace:command
There is a way
He can use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerCommandSendEvent.html and remove his namespaced command
But are you cool enough for the forbidden knowledge
I don't know
I don't see point of hiding namespace because players except staff doesn't care
event.getCommands()... remove if command is yrou namespaced version
until some other degen plugin calls performCommand which doesn't trigger events
ggrr
Yeah but that won't be an issue here as he only want to prevent players seeing the namespaced command

nut paradise is crazy
huh
oh god
Crazy
Is there a way to get the attributes given by a potion when applied?
For example, a strength potion that gives +3 damage. Is there a way to retrieve this AttributeModifier for both custom potions and vanilla items?
Or should I do it with NMS?
wouldn't getting the attributes of the ItemStack do?
or is this the case where you want to get the default attribute modifiers
Yes, in the case that the potion isn't custom, I'd like to get the default values
I meant from the material
Potion of Strength isn't a material is the issue.
Maybe it's in the PotionMeta if anything
Yeah
But like idk outside of that
Nope
Because it's not really a normal attribute
I mean, that attribute has to be stored somewhere
I'm not near a pc so I can't look at mms but my guess is the effect isn't realized until its drinken
I'll check, though I only have paper's source at hand
Iirc it's stored as a MobEffect which I think is the one that is STRENGTH-POTION and STRENGTH-POTIOM-STRONG etc
Oh no that's potion type
Forgot how that's stored internally
I'll just check the Items registry
MobEffect
haiyaa
if it is just the amplifier, you can get it from the PotionEffect/PotionType instance, don't remember which one holds that info
honestly, could just call that method and call it a day tbh
Yes, I didn't know it existed on the server side. Where can I find it?
net.minecraft.world.item.alchemy.PotionContents in mojmap
same name in spigot apparently
Alright, now I need to access it from an ItemStack
I'm going to investigate how it works
Yeah well us over here at spigot co have a weird horrible amalgamation of mappings
yeah I just check https://mappings.cephx.dev/index.html for good measure
I agree. Thanks to this website, I found it xD
net.minecraft.world.item.alchemy.Potions is where the vanilla potions are populated and added to the built-in Registry.POTION, each one registers a Potion instance (PotionType in Bukkit) which holds one or more MobEffectInstance(s) (PotionEffect in Bukkit) which in itself holds a MobEffect (PotionEffectType in Bukkit)
the tooltip however seems to be derived from the PotionContents, which is a data component
if you can get the ItemPotion instance from the ItemStack, you can do ItemPotion#appendHoverText and off you go
Thank you! I'll see what I can do
you could have been able to re-create the method but PotionEffectType doesn't expose the createModifiers method (oh it does in paper)
there is no evemt for what i need
the PlayerFishEvent literally is made for that
but what are you trying to do
no, it doesnt detect when Player stops being hooked, not all scenerios
you didn't answer my question
what are you trying to do with the fish hook?
There could be a more appropriate event, but without knowing what you're trying to do, I wouldn't be able to tell
oh sorry, i Just need to know if Player is hooked or not
it would be better with an event than bukkit runnable
have you tried the ProjectileHitEvent?
I'm pretty sure that one gets fired when using fish hook
but how do i check if projectile is in the Player
ProjectileHitEvent#getHitEntity and check if it is a Player
and ... i need then to apply some effect, and when Player is no longer on hook stop applying the effect, sorry i didnt say that earlier
?server
you could go about it in two ways
in the ProjectileHitEvent, schedule a repeating task which checks whether the ProjectileHitEvent#getEntity (aka the FishHook) is alive, if it is then continue applying your effect, otherwise cancel the repeating task
oh because if it stops being hooked it fΓes
dies
you mean like for every fishing rod crΓ©ate separate runnable?
or better sdd them to some list and 1 runnable
the other way is in the ProjectileHitEvent, get the FishHook#getShooter, apply a boolean PDC or just track it with a Map, whichever way you prefer and then in the PlayerFishEvent, check if the same Player is reeling in and if so stop applying your effect
umm what
the only thing that changes with the second way would be how you cancel the task, but you'd still schedule a repeating task anyway
but fish event doesnt detect it as i said, Player May die or get so fat that the hook breaks and then the event isnt calle
oh, ig dying doesn't count as reeling in
makes sense, then just go about it the first way
this is probably better, so you don't queue a bunch of short lived tasks
though that'd only work as long as the period is the same for every effect
you could do a one tick repeating task and then handle the delays inside the task itself but eh, it gets janky
at that point, you'd rather just create your own executor so you can freely create repeating tasks there
but all of those are impl details anyway, the basic idea is this
umm is this also possible to check all entities around Player maybe in distance of 3 3 3, check if they are hooks and if they are hooked on player?
noo.
i think it wont work
I mean, it would be possible to do it that way, just not very efficient lol
is there any way to know which event listener will be fired first?
i have two eventListener classes in same package with identical event,(ex- entitydamageEvent) and one listener always executed primarily. (ex-when i hit a zombie with a fist).
can i adjust there sequences? or figure out which one will be first?
sry i found a way-(EventPriority) nvm
Can i make plugin compatible with different versions and use craftbukkit functions?
depends on the versions
you'd have to reflectively call the method so that you don't directly reference it, or use interfaces and modules to depend on each specific version you want to support, loading only the interface implementation for the currently running version
the reason people avoid it is because historically, one couldn't import NMS/CB classes without worrying about version compatibility since the current version is embedded in the package name, making it break on every version change. This is by design, it's a way to prevent people from using internal classes instead of API, though NMS classes don't have the version in the package nowadays, CB ones still do afaik
there's also the fact that internal classes change much more often than the API, for obvious reasons, so you'd still have to worry about compatibility even if the version isn't embedded in the package
all of that being said, it doesn't mean using them isn't possible, it is annoying but not impossible. If you do your reflection properly, there's no worry about performance as well so nowadays people do mostly that
Would still recommend separate modules, while naming/packages might change which could be fixed by reflection, logic changing is gonna become annoying rather fast
that and there's also the fact that using reflection adds a level of indirection which makes the code much less intuitive to understand
Using packets to update icons on map, but on client these icons just appeared and then disappeared instantly. Is there any solutions?
You mean map markers?
yes
Well, you may be getting clapped by the fact that maps are rather horribly implemented internally and update themselves a lot
so the server may just be sending another update packet overriding your changes
I have removed all renderers from the associated map view
not an answer to your question directly, but I'd just take a look at how some map api like cerus one does it
and listening for MapData packets, however there's no any other update packets.
okay, thank you
I've been trying for a while to remove the brackets from the beginning and the end, but I can't figure it out. In the chat, they don't appear, but when I put it in a TextDisplay, they do. Can someone help me?
json: https://paste.md-5.net/salepuyigu.json
π
?paste

Sorry xD
I didn't expect it to be so big
For some reason, it looks fine in the chat, but the TextDisplay adds those brackets
Ignore that. It has a fix(IChatBaseComponent) method, so I tried it, but it didnβt work
Lmao
I mean, ChatComponentUtils.a is 100 not what you wanna call
I just fixed it, and Iβm not sure what I changed xd
See, if you were using normal mappings you'd know that that method is actually called
wrapInSquareBrackets

Would strongly recommend moving to mojang mappings if you can
makes your life a lot easier
Haha
I swear I had the error before adding it xD
Thank you. It looks correct now :D
how did you manage the tooltip btw
Did you just get the PotionContents from the DataComponentMap of the ItemStack?
oh, is the appendHoverText thing something common to all data components?
I looked a bit more and found that ItemStack also has a method to get the tooltip with all the details included
Hm?
yes
I just checked myself, it is
Yea I mean, all of them can
yeah, I just didn't know till earlier today when I was looking at the potion thingy that the component is the part that handled the tooltip
. for context
it didn't used to be that way, but yea, since components got added that logic was moved there
hello, can i refresh an inventory without closing and open it?
What do you mean refresh
I'm using the vault api for the first time, but when I register the serviceProvider it returns me null;
https://paste.md-5.net/vukupebepu.cs
cmi




||