#help-development
1 messages Ā· Page 606 of 1
I would split the message at {hover-message} and then append the parts back together
Alright thanks
Hey Guys, i wanna create an API that sends the playerData from my Bungeecord to my Spigot Plugin, how to start?
hey, is there a way to change the repair count from an item? without changing the nbt
Search up plugin message channels, there's a page on Spigot wiki for it
Is it still ok to use the ComponentBuilder class though, it's kind of a legacy. And also I think it's hard to add color support?
Conversion from colored string to an actual colored message
Ohh rightt
I assume there would be a method if the repair count is saved differently in certain mc versions, but that doesnt seem to be the case
Check if ItemMeta is instaceof Repairable, and then use .setRepairCost
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/Repairable.html
declaration: package: org.bukkit.inventory.meta, interface: Repairable
your solutions:
- bungee proxy plugin (i don't like it personally cuz it makes you write another plugin from another library, even if it's lightweight)
- redis (i don't like it personally cuz it synchronises stuff through a database iirc and i consider it as I/O delay even if people will advocate its negligible)
- rabbitmq/postman/simialr (basically it relies on sockets but i don't like it because you have to keep a broker running seperatly from your plugin)
- plugin messaging (native to spigot api, but i don't like it because it REQUIRES one player connection on each backhand server to relay between both (one sender, one receiver); which is sometimes bad when trying to relay "player leave" msg)
- writing your own UDP sockets WITHIN your plugin: FEW CODE, easy to write, easy to understand. The solution i eventually opted for, i can send you code if you like
if you can send me some code, that would be perfect
Writing your own UDP socket is the worst option out of them all
oh nice!
thanks
Do beware of the properties of UDP though
And that it is a low level protocol that is prone to bugs when implemented manually. Why suffer when decent solutions already exist?
If you are not familiar at all with the TCP/IP stack, use TCP instead
it's the one i opted for and i love it
Short, straight forward, bug free
no dependency
no broker
just simple stuff
be aware udp has no error correction
seems like it doesnt save as repair count but penalty
also redis is in-memory, its not much of delay
Just use Redis. You won't have to deal with opening ports and all that crap and it just works
I don't see how the first three suck, if the database is hosted on the same machine the io is minimal
lots of setting up
stilll more disk usage than sockets
It is not, it is extremely lightweight. I run it with docker and it literally just uses a few mb of ram
as u wish
If you use straight-up NIO sockets I'll raise an eyebrow
I got sucked into the conversation I guess
I wanted to ask if I want to implement custom items (with events on left, right click etc) should I extend ItemStack or create a whole separate abstract class (CustomItem) then subclass it with items?
Extending ItemStack is a big big no-no
why is this coming up so much lately
Add a pdc value to your item to identify it
Since CB already does that with CraftItemStack
And use that as a key into a map or whatnot
the "do not implement interfaces" warnings apparently needs to be "do not implement interfaces or extend classes"
Add a persistent key into that item so that you can identify it again and listen to the intetact event
at least i gave him an exhaustive list of what he can think of, even if our opinions diverge
I wonder whether it would be possible to publish the spigot-api artifacts on the spigot maven with API classes that should not be extended being final?
Probably would break a few 3rd party projects though (such as glowstone)
could just annotated everythin and their mother with ApiStatus annotations
so intellij screams like crazy when you try to extend
Might take a while
.
BUT MY LOOPHOLES
good old @ApiStatus.NonExtendable
step 1. annotate everything. step 2. change annotation on BukkitRunnable. step 3. ???. Step 4. PROFIT
On literally everything 

BukkitRunnable should be nuked too
idk if you can smack it onto the package level
I made a conclusive list of everything meant to be implemented/extended too š
every can be implemented until it cannot 
While we are already at it, we should just repackage it all from org.bukkit go org.spigotmc
SignChangeEvent
1 tick after he is out of the GUI.
(i think)
but idk if he didn't change the sign
Damn that's straight facts
what's on the list?
Is there a tool to annotate everything :p
all I can think of is BukkitRunnable and one of the PDC classes
Player interface
MetadataValue is really the only one I was kinda iffy on but it's still technically extendable API
conversation API 
is CraftBukkit the sole impl of Bukkit ?
glowstone exists
No, Glowstone exists still
š¤
what is that ?
From-scratch server software
MapFont, that's an interesting one
No thatās a boat emoji
how do I check if he closed it?
ah okay, do they use NMS at least ?
damn
list looks good though
wild
ship it


Shipped
With what rationale if I may ask?
Custom fonts on maps? ;p
wdym, is it different from vanilla?
Shouldn't spigot just provide a simple implementation of the interface for such purposes?
I'll annoy you about it until the end of day choco
Just one day?
you just setChar for every sprite
Or all days
eyo moderator on spigot suggesting implementing non extendable api class ?!?!?
Wtfbanned
omg I keep forgetting about consumer
declaration: package: org.bukkit.util, interface: Consumer
lets hope tonights party is good enough for me to forget this 
I found myself messing with some cb code for a plugin recently
And I encountered
Guava Function
a living reminder to UPDATE JAVA VERSIONS on the API instead

smh machine just coming here to flame
𫳠š«³
were you able to find the path to enlightenment and join the gurus
I still need to update my component patch I'm just waiting on some other changes to make their way in first which will inevitably require me to rebuild my patches again anyways
So I sit and wait 
Sip on my juicy box
Waiting on that too
I DID ALREADY

See that way, when phoenix screams about a limit on that
you can tell him to use the component methods 
Now it's incentive
I wanna promote you to lead cutie 
Itās not legacy for the people that still use 1.8
Is there a quick way to know how many food points an ItemStack/Material gives through eating?
š„° 
Not yet. API to come
I- 
Let me guess
:))
Enum removal first
YESSIR
Lets goooo
marvin gonna die from stress when that fucker hits
Poor guy
ty
Thereās actually a lot of things Iāve seen that Iāve wanted to expose
But then itās like āOh wait it would be way easier if⦠shitā
We should seriously be pushing developers to test the experimental stuff
Just disable building anything else with buildtools
I want components already 
Will @MinecraftExperimental ever be used again tho? Only Mojang knows that :p
imma have an anneurism
Do you have anything left
I thought it was done
Nah, whole API is component-ified
Exception to the chat event
That thing's a mess
Yeah... I didn't wanna touch it
Do we just like not touch that with a 50 foot poll and pretend we didn't see it for now
Would you do it for a Scooby snack
I would like to eventually have the chat event support it, but I just didn't have the energy to do it
š
I just want @Since to be added the documentation.
Uhhh
deprecated for removal ?
I think it was on Bukkit.broadcastMessage
Too many changes, not enough benefit, would likely take donkeys ages to do because you'd have to refer to the blame for every... single method...
Or player.sendMessage
Yeah I had to use paper api for a server I worked on and it's a pain suppressing depreciation
One of those
And not only that, some blames aren't accurate because of the annotation changes
So you'd have to use the Stash history
Get to work then
not enough benefit
Chop chop
But modern api doesnāt work on my 1.8 server :(
honestly, I can see the benefit ngl
yeah I used it one place
gonna change it to Deprecated at some point in the future
for CommandSender#sendMessage
why did my grep not find it
@worldly ingot why did you add duplicate component methods to everything in your PR
Could it not be a gradual implementation?
Or at the very least just start marking new methods with it?
Also, why do people think that the inclusion of @Since would mean that we are supporting older versions???
Its only purpose is to inidcate what version the method was added in. Nothing more nothing less.
Maybe your grep was wrong 
what's the point of having method(BaseComponent) and method(BaseComponent...)
I was in the wrong dir
Some are arrays, some are single components. All existing API does this already
idk. If md wants I can just not do that lol
stuff like that needs to be all at once otherwise it never gets done or is just a random mismash
having the ... method is dumb
because you can do this.something(), with no components and that doesn't make sense in a lot of places
When do we get regex varargs
You could also do this.something(new BaseComponent[0]) and that also doesn't make sense
You could argue either way
yeah, that's why you don't do that
you do method(BaseComponent, BaseComponent...)
ĀÆ_(ć)_/ĀÆ
that pattern is all over for vararg stuff
so you can't pass in nothing, or something that doens't make sense
well this is putting aside how annoying it is that BaseComponents has arrays to begin with
Old API
opens adventure merge PR
I mean hey, it's pretty early on in your line of patches. Patch is already ready
eyo owen got PRs in
an actual open PR system? not possible on stash apparently. literally impossible
Stash be silly
waiting for the day we see gitlab or something š
not like there are extensions you can write, or other source control systems
yikes
atlantis software barely touchable with a stick
Gitlab would be kinda nice
Wonder how expensive it would be to setup and use gitlab though
ĀÆ_(ć)_/ĀÆ
Not that expensive if you are only going to be hosting like one thing.
I mean, depends on whether you need enterprise support 
Bandwidth would be your biggest problem if you want it to be quick.
Just a quick question, does anyone know if its possible to change the order in which tab complete options show up? Right now it's sorted alphabetically and i would prefer if it would Not do that
it's not so bad in 1.13, but pre-1.13 tab completion in non alphabetical would be confusing af for users
Oh right there was tab completion before brigadier
i kinda forgot about that
I bet transitioning accounts would be the real pain
I kinda wiped anything pre 1.13 from my brain
Yeah, that might take some time. Depending on how it's stored and whatnot.
Past that, wouldn't be all that hard to transfer things.
Are you volunteering
migrate accounts by hand
Shadow is suffering looking at BuildTools code rn
Facts
Method ()
{
{
Go 
And MD only has slightly cursed formatting
That formatting hurts me.
The formatting actually makes it hard to write code
That requires rffort

That's how I currently do it to make it manageable.
Just about the only silver lining to it.
On todays episode of bullying MDs style choices
The first thing I do when I get home from the airport tomorrow is fucking code
I'm literally addicted
The first 3 days I seriously couldn't stop thinking about coding
Do you dream in code
Then figure out how to pass in the dark mode to the modals. I'm at a loss here.
Sometimes yes
Why do the modals not already use it
Oh wait they are in the child process arenāt they
Yep
Mmm
I think you can set environment variables with ProcessBuilder
Not only that, but FlatLaf doesn't let you just use itself.
You have to use FlatLightLaf or FlatDarkLaf.
I remember having a JS test back in the day. Most of my friends didn't know how to do it but the issue was that obviously the teacher was going to check each test in case we shared/plagiarized code. I figured out that it was not an actual IDE, it was just a text block like pastebin.com so I wrote everything normally and then just removed all "\n" so it was all inside a single line. Then I shared the same line to all my fellows through hastebin.com (back in the day it kept its dark background before the toptal thing) and we basically cheated.
Then the teacher attempted to check but I still don't know why he didn't just copy each line and reformat it online... We kept telling him it might be a bug and he said "if system says you all set then yall set"
You know... that would probably work if we actually used environment variables.
What the plagiarism checker couldnāt handle a single line?
No. The teacher himself had to check if we did plagiarize
The system only checks if the code we wrote had the right functions and such
In the mean time, jank code will have to suffice.
I mean, I assume we could read them
š¦¦
Idk how system.getEnv works
Canāt say Iāve ever used it
Version?
Oh boy
Set the data value to 1
Iirc itās the byte in new ItemStack(material, int, byte)
Mhm
It brings us back to our original issue of setting the theme based on the user's system theme. Which there is not a defined standard for.
Not really?
Iām talking about it using it to pass the selected theme into the child process
Iām sure there are other ways to pass data to the child process as well
Aside from environment and arguments
I'll fuck around with the environment stuff.
both my highschool and college
that's one of the reasons I'm ditching this republic college and going to go to a private one next year
(also that we learn XML/Soap instead of JSON/REST)
Same it's horrible
Writing java on paper with no shortcuts allowed was one of my most painful highschool experiences
And college smh
So yeah nawe
Its so archaic
I also entered applied software dev.
and
we legit learn about the 'distribution of fluids' as a fucking class
That's just normal college
and one of the exam questions: For what is pipe cleaning fluid used for? To clean the inside of pipes or the outside of pipes
Idk I had my own laptop
ThinkPad baby
Lmfao
I'm still in HS smh the worst is still ahead can't wait to take Black Culture in Mississippi In the 1940s class when going for Software Engineering
I once had to argue during a defence of a project that I should use my own laptop because I fucked around to make a:
VPN + Driver for a SIM card + SSH server running on windows to connect to a remote WSL system over a 100Km's away
Because it's not fair towards the other students as the PCs provided on the college won't fucking compile the code because it's so borked (the system like windows 7 or something)
well most of my HS was just slandering Hungarians and Romanias
but it's an average Balkan moment IG
Sounds like a high quality highschool
I took my first college class last school year and I wrote one of my entire projects with annotations the professor gave me extra credit lmfao. Legit had @Loop at the top of the class
You say you but I saw 2 Hungarian kids holding a 3rd Hungarian kid and slamming his head as a ram to a coffee vending machine so they could get free coffee
Damn why didnāt I think of that
and then for the whole week the floor was sticky due to the sugar being everywhere
We already had to write full javadocs so why not
Yes but any kids would probably do that
I did write javadocs on C++ code cuz why the fuck not but there's not extra credits
(3rd year rn but again ditching it)
I'm so glad my HS is paying for me to be a full time college student next year 2 15 credit semesters
Haha
Not that I had to pay much for college so I canāt complain
eh my college was free but I still had to get a job to pay for an apartment and food
But the poor people that did, F
Thankfully spigot legit taught me how to code so now I have a webdev position for 4-5 years already
I just make plugins part-time for a living
I have a friend who'll be a 3rd year in HS next year and will graduate college at the same time as me cuz he's starting college rn xD
Its getting out of hand
Do you do front-end?
I never managed to sell a plugin, I was scammed most of the time
Really ive never had a bad experience
backend 99% of the time, frontend is only when i really need to
Thatās acceptable
Just ruby on rails code and elixir phoenix code
yeah most of the servers I tried to make plugins for just didn't launch properly and shit and oh well
The servers I worked for never launched either but still made away with 6 grand xD
I made some custom enchants for a server, server lasted like a month but I got my money
:p
If inwork for a server I expect hourly payments of 15 to 20 an hour payed out weekly
yeah I made shitty decisions but I did learn how to code properly, use git, dependency tools like maven etc
ye but I was like 16-17 at that period
so, eh
welp I don't really earn that much money internationally even now but that's because I'm in a country which is economically meh, so I'm search for oversea jobs
but proportionally w/ my rent it's around, oof
one sec
let me get the data online to not be biased
it's around 5k euros proportionally ig
that's the minimum at least
For rent?
Ah okay
i'm talking about proportional income
underpaid in the world but more than enough money 'ere to live a normal live, not too extravagant but enough to buy nice shit when I want nice shit
also getting a new apartment for my brother to move in w/ me so he can focus on college
ĀÆ_(ć)_/ĀÆ
I see
but the average monthly wage here is like
Hmm I'm struggling to name this one java class
400 euros?
Name it George
hm no
Welp Iām all out of ideas
I have this complex network system and I'm thinking of making a "network type" setting where if you set it as single-instance it skips all of that and just acts like a basic plugin
And if you set it as multi-instance it does crazy communication
SkyblockNetworkStructure maybe
I like to prefix class names
lookiing at it atm
tbh i've never seen shorter and more messed up code lol
does cancel just terminate the future without actually waiting for the response? @quaint mantle ?
yes
I mean if you only see true that means it should only say tru instead of the Future ended as you didn't close it gracefully
but idfk
don't take it personal lol
idk if it messes it up because it's in the same class
can you try to make a difference class and the initialize it?
the code above is an anonymous function so it might behave because of that differerntly idk
hey, is there a way to increase max stack size only in a certain slot of an inventory?
Hm maybe the executor service needs to be bound by the main process?
It'd be quite gimmicky
that's what i thought, but you guys always surprises me haha
Usually you wanna try to properly dispatch everything at the same time, so Iād say use a cyclicbarrier or semaphore or phaser
(Maybe just a countdown latch)
Countdown latches are goated
Yeah fr
Well locks are technically more reusable than a single latch, but ye
That shouldnāt matter
nvm I'm stuck on the while loop now (which is progress)
but I think that's the issue
that it just kills all of it without gracefully handling it
@quaint mantle
import java.lang.Runnable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class Main implements Runnable {
private static final ExecutorService exe = Executors.newSingleThreadExecutor();
public static void main(String[] args) {
new Main();
}
private Future<?> f;
public Main() {
start();
stop();
}
private void start() {
f = exe.submit(this);
}
private void stop() {
System.out.println("Calling an interrupt");
System.out.println(f.cancel(true));
exe.shutdown();
}
@Override
public void run() {
try {
System.out.println("And this is something");
while (!Thread.currentThread().isInterrupted()) {
System.out.println("Still not interrupted!");
};
} finally {
System.out.println("Future<?> Ended");
}
}
}
``` this only calls the ended rarely, that means that the shutdown kills the process before it goes to the finally block
it can give
or
but also this
same code just it happens by luck that the process lives long enough to get to the interrupt handler
Yes because you guys arenāt really testing it properly
Ye I did say this at the start that it's just the process is killed to fast
And like wtf why isInterrupted() infinite loop if u have a try finally
to be there until the statement is changed probably
I gave you the output above, it's the exact same code, you're killing it too fast
remove the shutdown and it should show the interrupt, it won't end the main thread but it will show the interrupt
probably because the executor is in the instance of the same class you're trying to run
No the shutdown literally doesnāt matter
it guarantees that it will get the interruption memo with the current code
Zastrix it doesnāt matter
All shutdown does is to prevent new tasks from being submitted
Did you run the code? I did, and it behaves vastly differently
Youād have to have some sort of loop or wait method to await the termination of the main thread
without the exe.shutdown it will always get the finally block memo, while with it, it can skip it (with the current implemention)
but eh, I don't write in Java or similar languages cause I don't want to have headaches about threads
ĀÆ_(ć)_/ĀÆ
Instead of just removing shutdown, use awaitTermination
That awaits submitted tasks to finish
fuck you copilot
copilot refuses to work if I cuss in a comment
Try this instead, have ur executor service, submit this type of code
sout(āsubmittingā)
var f = submit(
try {
for (int i =0;true;i++){
sout(i);
}
} catch (InterruptedException e) {
sout(āinterruptedā);
}
)
thread.sleep(1000)
f.cancel(true);
f.get(); //catch cancel exception also
and then just future.get() to await it
I think
On my phone but yeah
@quaint mantle
In a proper test we would use a countdownlatch to remove even more indeterminacy
strength can be null
It will be
The name is INCREASE_DAMAGE
Because yes
Use getByKey and a namespaced key
NamespacedKey.minecraft(āstrengthā)
Pretty sure thatās for the key
Yes but the variable name is increase damage
Youād have to look at the rest of the class
getByName for anything generally uses weird old names
And getByKey should be preferred
Ah
Thatās not how it registers it
Anyway DirectPlan, problem still is that getByName or getByKey can return null, so usually u wanna comfort that out by a null check
Notice that itās an abstract class, and getName is an abstract method
And the fields refer to another class, PotionEffectTypeWrapper
I believe this also involves a craftbukkit impl
Yep there it is
And populate them into a map
Anyone know what im doing wrong calculating the x and z for a chunk section there is a couple blocks that are shifted a few blocks away
val relativeX = abs(it.first.x % 16)
val relativeY = abs(it.first.y % 16)
val relativeZ = abs(it.first.z % 16)
chunkSection.set(relativeX, relativeY, relativeZ, Block.BLOCK_STATE_REGISTRY.getId(it.second))
well yeah, put them in a map, but you fill the map by iterating over them instead of hardcoding them
Statistic has a getKey and name(), but they are incorrect for like 5 of them
Anyone know how to calculate the relative 0..15 x / z for chunk sections?
I'd use the bitwise AND
And not abs it
But you already have the chunk section position so you can just subtract
What is bitwise again is it >>?
This is bit shift
Do you know how to do bitwise it in kotlin
why bother, just do it the normal way
Whats the normal way
& doesn't work in kotlin
assuming you mean you have a block position in the world and wanna know what block inside a chunk that is
use %
Thats what I was using before
Subtract what?
subtract the chunks position from your total position
which would leave you with a position relative to the chunks origin
chunkX - block.location.x?
Wouldn't that leave a very small number
then multiply chunkx by 16
wwhat about y?
@EventHandler
public void acquiringTrade(VillagerAcquireTradeEvent event) {
MerchantRecipe recipe = event.getRecipe();
if(recipe.getResult().getType() == Material.ENCHANTED_BOOK) {
Random random = new Random();
//if (random.nextInt(2) == 1) {// fifty/fifty
//Enchantment
EnchantUtils enchantUtils = new EnchantUtils();
ItemStack book = recipe.getResult();
EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) book.getItemMeta();
Map<Enchantment, Integer> enchantments = enchantmentStorageMeta.getStoredEnchants();
int oldLevel = 0;
int newLevel = 0;
System.out.println("book before: "+EnchantingItemsOrBooks.getEnchants(book));
for (Enchantment enchantment : enchantments.keySet()) {
String enchantName = enchantment.getKey().toString().replace("minecraft:", "");
oldLevel = enchantments.get(enchantment);
newLevel = Math.min(oldLevel * 2, enchantUtils.ENCHANTS.get(enchantName).getCap());
EnchantingItemsOrBooks.addEnchant(book, enchantment, newLevel);
}
EnchantingItemsOrBooks.formatEnchantLoreText(book);
System.out.println("book after: "+EnchantingItemsOrBooks.getEnchants(book));
recipe.setIngredients(ingredients);
System.out.println("result: "+EnchantingItemsOrBooks.getEnchants(recipe.getResult()));
event.setRecipe(recipe);
_______________________________________________________________________________________
[22:42:16 INFO]: [pluginzin] [STDOUT] book before: {Enchantment[minecraft:piercing, PIERCING]=1}
[22:42:16 INFO]: [pluginzin] [STDOUT] book after: {Enchantment[minecraft:piercing, PIERCING]=2}
[22:42:16 INFO]: [pluginzin] [STDOUT] result: {Enchantment[minecraft:piercing, PIERCING]=2}
what's wrong?
i really dont know why
both event and recipe doesnt have a .setResult() method, im really confused
why changing the original doesnt work?
It returns a copy
Hi do you think which is faster? (To get a list of player names)
return Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());
List<String> list = new ArrayList<>();
for (Player player : Bukkit.getOnlinePlayers()) {
list.add(player.getName());
}
return list;
Second
Ahh, I see. Thank you
Doubt it matters though
Streams are fairly optimized in modern jvms
it worked as a charm! thanks!
Unless this is an extremely hot piece of code I doubt it matters
Do you think this even faster or not?
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
List<String> list = new ArrayList<>(players.size());
for (Player player : players) {
list.add(player.getName());
}
return list;
the initial capacity of the list
i mean the amount of resources minecraft uses
is like so high compared to these tiny things
Yeah
that you will notice nothing even if you call it like 1000 times per second
Huhha I see
Yes technically pre sizing the list is faster
But these are basically micro optimizations
i want to reset the villager trades when someone energizes his workstation, but idk where to start
yep, i just need to get the Merchant Recipes
BlockRedstoneEvent should be called when something is energized, i think
but from the block i cant find the villager, or can i
maybe i limit for a 1 block distance
if there's a villager with the profession equivalent to the workstation, i reset it
another method would be allowing pistons to move all workstations, but idk how to do that either š
We donāt talk about that
complicated to do too?
Do you like manipulating bytecode
That should probably tell you the answer then :p
i can check if a piston is energized, see if there's a workstation where the piston is facing, set the type of the workstation to something that can be moved, like air, check if there's nothing on the end side, and tp the ghost block with the workstation texture while the air block is beeing moved, than i place it on the end
the tp thing i dont know how to do, maybe a custom event?
Hey! I'm currently looking for a dev that can work on some lightweight/medium level plugins! (I'm recreating a server and it would be GREATLY appreciated if anyone could help!) Shoot me a DM, thanks!
?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/
ah ok
I have an economy plugin that hooks into vault but other plugins are loading before mine so they think there's no economy
Anyone know how I can fix that?
https://i.imgur.com/NPaSFUL.png Trying to update one of my plugins, getting this now using mojang mappings. Any ideas?
When that was happening to me, it was because I didnt have essentials (or a plugin that creates the economy using vault) installed so vault would enable then disable, then my plugin would enable.
oh god not the bee
My plugin is acting as Essentials would
ptsd?
yes
me too..
I was able to fix it by doing a loadbefore: in my plugin.yml
finally got my otehr one updated fully, now this ones having issues
loadbefore for every plugin that requires economy sounds⦠painful
But idk the correct way to go about that
Probably depend on Vault and inject
its not every plugin, just the ones that disable themsleves when they can't find an economy through vault on start up
which isn't an ideal way to handle that anyway
I'd probably load before essentials and inject a dummy eco
my plugin is an essentials replacement so essentials wouldn't be there
Well do you register the recipe at startup
Sounds like your spigot isn't Mojang mapped
Because obviously all recipes are gone when the server shuts down
maybe inject it onLoad instead?
provides: Essentials ?
Wdym created before server startup
Itās possible the item data has somehow changed through saving and loading?
Is the recipe added each time the server starts
I donāt see why it would tho
Can happen, stuff like using an int for enchant rather than short
Oof
Int will load fine but it's saved back as a short
Iāve never tried it with heads but I imagine they might be particularly volatile due to how they work
What's the new method of registering custom entities?
public class CustomEntityRegistry {
public static EntityType<Bee> CUSTOM_BEE_TYPE = registerCustomBee("custom_bee", EntityType.Builder.of(CustomBee::new, MobCategory.MISC).sized(0.5f, 0.5f));
public static <T extends Entity> EntityType registerCustomBee(String id, EntityType.Builder type) {
return (EntityType) Registry.register(Registry.ENTITY_TYPE, id, (EntityType<T>) type.build(id));
}
}
This is giving me "cannot resolve symbol ENTITY_TYPE now, used to work in 1.19
(dont know if it worked, but it didnt error LMAO)
I had issues with my custom bees despawning/changing to normal bees
234```
Hello! I can't seem to use BuildTools to build me 1.20.1, 1.20, or even the latest stable 1.19.4 for that matter. Where can I seek support for this? Here is the log file: https://pastebin.com/fztWGL2v
@quaint mantle like this
try again
lol
no spaces between the ticks and java
screenshot ur message and send the screenshot
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_20_R1.CraftWorld cannot be cast to class net.minecraft.world.level.World (org.bukkit.craftbukkit.v1_20_R1.CraftWorld and net.minecraft.world.level.World are in unnamed module of loader java.net.URLClassLoader @1ed6993a)
at com.squallz.cadiabees.objects.CustomBee.<init>(CustomBee.java:20) ~[?:?]
at com.squallz.cadiabees.managers.BeeManager.spawnBee(BeeManager.java:46) ~[?:?]
public CustomBee(Location location, String beeName, Boolean isBaby) {
super(EntityType.BEE, ((Level) location.getWorld()).getWorld().getHandle());
this.setCanPickUpLoot(false);
this.setPos(location.getX(), location.getY(), location.getZ());
getBukkitEntity().setCustomName(ColorUtil.color(beeName));
getBukkitEntity().setCustomNameVisible(true);
getBukkitEntity().setPersistent(true);
getBukkitEntity().setGlowing(true);
if(isBaby) {
getBukkitEntityBee().setBaby();
}
}
(lines 19-30)
```java
Your code here
```
Im using remapped, shouldnt these be the mojang names instead of u, b, etc...?
https://i.imgur.com/1vgrb3R.png
In the client, if you press ESC while in the game and go to Advancements, why is there a black box saying "There doesn't seem to be anything here..." what's causing that
It means you haven't unlocked the root advancement for any category.
Are you using a correct import? org.bukkit.Material
Yeah
import org.bukkit.*;
import org.bukkit.Material;
import org.bukkit.block.Block;
these are my bukkit imports.
do you have vault api
me..?
yeah, do you have it as a dep in pom
yeah but what would that change?
oh, does Vault depend on an older Spigot api
vault have 1.14 bukkit api as a transitive dep
pre bees
I'm using spigot 1.20.1 api and I see BEEHIVE
bruh..
wait, this worked fine before though..?
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
thats correct
that doesnt matter
why..?
its vault
add this in vaults dependency tags
<exclusions>
<exclusion>
<artifactId>org.bukkit</artifactId>
<groupId>bukkit</groupId>
</exclusion>
</exclusions>
thank god I don't have these problems lol, I'm in eclipse
ew
you would if you had a vault api dependency
I have it
it has a transitive dependecy of 1.14 bukkit api
didnt fix it :/
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>org.bukkit</artifactId>
<groupId>bukkit</groupId>
</exclusion>
</exclusions>
</dependency>
ah, bukkit doesnt use that
one sec
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>org.bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
its telling me it needs the groupId
use the first thing and reload maven
Did that, also invalidated caches and restarted
Material.BEEHIVE works fine in another project using mojang mappings in vault, without the exclusions tag
i think somethings just broken in my project
does it work if you manually type beehive
Cannot resolve symbol BEEHIVE
Sound.BLOCK_BEEHIVE_EXIT this also doesnt work
its like the project is specifically hating beehives.
no clue then, thats about the extent of my maven knowledge
damn
You could do Material.valueOf("BEEHIVE") xD
nooo
yes
TileEntityBeehive, BEEHIVE material, hive sounds, honey particles ALL BROKEN
xD
this project just HATES bees
https://hastebin.com/share/fexuzaqore.xml my entire pom
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Yeah idk much about maven. how far are you with the project? create another one and copy&paste the code in the new one?
maybe that'll fix it
Hm
my project has a bee allergy..
n o
bee allergy
easy fix
rhymes with ptsd
p, t, d, are all words that rhyme with bee, not hard to see
it started complaining about this after I removed my 1.19 dependency
cause previously i accidentally left the 1.19 in with the 1.20.1
after removing 1.19 it started doing this.
can anyone help me figure out how to spawn my custom mob using a custom pattern? for example spawning a custom zombie using 4 dirt blocks and a pumpkin head and all placed in the same manner as if you were making an iron golem
I'd use BlockPlaceEvent and check block positions, and if they match in a specific pattern, remove the blocks that are required for the mob to be spawned, and spawn the custom zombie?
I had a multiblock util somewhere
how would I go about checking the block positions?
@echo basalt any idea why maven is being a hoe
You'll also need ChunkPosition which is just a basic class
that goes a little like this
I generally use gradle but I suck at both
So you know the world is made out of
x and z - horizontal,
y - vertical
I did clean, verify, install, etc
at a loss rn
yeah that vid's just basically telling you to hardcode shit
Hello! I'm fairly new to NMS, and I'm trying to create a custom NPC. I think I've managed to create one and now I have an EntityPlayer object, now I think I just have to teleport it to my location. I tried EntityPlayer#teleportTo(CraftWorld, Position) but I get an Illegal Entity Teleport Exception. Can anyone guide me how I could successfully spawn in and teleport the EntityPlayer to my location?
I'd make a structure and see if it matches
oh
although my multiblock structure system isn't the best
we need the full exception
I remember redempt had one
is the hardcoded part the forloop?
somewhat yeah
Here it is https://pastebin.com/B5JLgqjZ
The "easy" annoying way is to check each block manually
The proper way is to make a class that represents a structure and implementing checks
definitely
thanks for the help bro
š
Ok you were right, if I remove the vault dependency it fixes it
but my other project is also using the exact same dependency and it doesnt do this
put ur spigot dep at the top of the list and add the exclusion to the vault api
damn I just found out that chunk snapshots are easier to create than I thought
I was looking at the impl and it's just a bunch of array copies
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>org.bukkit</artifactId>
<groupId>bukkit</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.squallz</groupId>
<artifactId>CadiaCore</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
its still trolling me
ur missing the best one..
yeah, who tf would look that one up
CHILD CUSTODY
Help please my minecraft server is shutting down my neighbour's wifi
my minecraft server is making me lose custody of my child
what? my wife wanted to leave because she claims the server took over my life
happens
i told her to get over it and install EssentialsX for me
average maven/gradle issu
Material.valueOf(
)
can I delete all my external libraries and redownload them??
Heil Schnitzel
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
pom from my other plugin, WORKS FINE HERE!!
is spigot above vault in your problematic project too?
yes
š¤
ones in onedrive..?
wtf
invalidated caches, checked ALL options, restarted and nothing
what if you go back to 1.19 api?
then it works?
if it does then it's the jar problem. BEEHIVE is a part of spigot api jar
FINALLYYYY JESUS CHRIST
what was it
moved to desktop, deleted pom.xml and .git folder, re-imported to idea, re-imported the project, made a new pom.xml and pasted in my old pom.xml contents
then it did something
moved project back to original location..works fine.
huh
I would love to use IntelliJ but it's all so much work, a bunch of xml files.. I don't even have to worry about that in Eclipse
now im getting this,
public class CustomBee extends Bee {
private CraftBee bukkitEntity;
public CustomBee(Location location, String beeName, Boolean isBaby) {
super(EntityType.BEE, ((CraftWorld) location.getWorld()).getHandle());
this.getBukkitEntityBee().setCanPickupItems(false);
this.setPos(location.getX(), location.getY(), location.getZ());
getBukkitEntity().setCustomName(ColorUtil.color(beeName));
getBukkitEntity().setCustomNameVisible(true);
getBukkitEntity().setPersistent(true);
getBukkitEntity().setGlowing(true);
if(isBaby) {
getBukkitEntityBee().setBaby();
}
}
any ideas :/
Why is any of this nms?
I cant get this super to work right.
custom entities
I believe the nms one gives more options...?
All instances of a class have something like an ID, right? Something like org.bukkit.inventory.ItemStack@abc123d
It's not id, but memory location
I remember I've used some kind of method to get the slot an ItemStack is in, I think it was something like first()? Would that apply to there so I only get the exact ItemStack I need?
(It was copilot so Idk lol)
where do i get 1.19 / 1.20 craftbukkit maven repository
cant i use it with maven
you can
how?
yeah i will get a jar but idk how to connect with maven
Then I will need a dependency?
run buildtools, add the correct deps and reload maven (if on ij)
remove the -api from the group id
ok i will try
so apparently my question from yesterday got a lot of answers,
I'm wondering why is it not preferred to extend bukkit classes?
apparently Slimefun does it https://github.com/Slimefun/Slimefun4/blob/master/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java#L44
But on the other hand I've seen some plugins which have some items (for example custom enchantment books) which don't interact with ItemStack in such way
slimefun does it but you never should, slimefun shouldnt do it either
bukkit api classes should only ever be implemented/extended by server software, not plugins or plugin apis
Yeah unless stated its fine, donāt implement those interfaces and classes
Hello everyone, I search a way to cancel Horn interactions, so my first idea was to cancel PlayerInteractEvent but it seems not working, the horn still play its sound and still receive a cooldown.
Has anyone by chance ever tried to cancel the horns interactions ?
It should work no?
alright, thanks for the response earlier
my guess is I'll have to stick with an abstract base class for customitem and then extend it too, and have a method to get an ItemStack from my customitem
Okay after more test, it works for the other players BUT the player who interacted with the Horn still receive the sound and cooldown, I think its something client side
Try to mess with the event priority?
Hmm why the event priority will change something for this situation ?
I don't know but I guess if it already cancelled the event, then it doesn't matter.. I think this has to do with packets.. ProtocolLib
You'd need to send a custom packet to the player's client to cancel the sound, that's how I'd do it
Much better
Using sth like the adapter design pattern is way better
Is there anyway to open a horse inventory for a player?
Tried with the normal Player.openInventory() but i get Unsupported custom inventory size 2
I was thinking of having one central event listener class (for player interact events such as left and right clicks), in which I would get the item in player's hand, and if it's a custom item (i.e. has some sort of "ability"), get the function that this item has implemented and call it, also passing the event. However, the player.getInventory().getItemInMainHand() returns an ItemStack, while the example onRightClickAir event listener is registered in a class SomeCustomItem which represents that item. Since type casting is obviously not possible, how would I get my way to it?
that size has to be a multiple of 9 as far as I'm aware
You probably wanna have some class that converts between itemstacks and ur custom items back and forth
In a ServerBoundPlayerDigThingy packet is there a way to tell if they break a block because it has the action as FINISHED_DIGGING when it breaks but when u instabreak the block with haste / efficiency it only sends the start digging thing
how can i make org.bukkit.player to net.minecraft.world.entity
((CraftPlayer) player)
((CraftPlayer) player).getHandle will return you an EntityPlayer
How can I register a new entity?
What's the name of that really loud and long level up sound that plays after you kill the enderdragon
Not the one of the enderdragon decaying but the dun dun duuuuuuuuuuun one
I can't find the name for the life of me
how 2 block pdc?
entity.player.levelup. ?
Nop it's not that one I checked it
Maybe I'm imagining this sound and it isn't even real
hmm
oh the xp orbs?
after defeating the enemies in the raid in the village
Im not sure
Its also advancement sound
ui.toast.challenge_complete is the one I was after
minecraft:ui.toast.challenge_complete ?
I found it on 101soundboards.com lmao
How can I register a new custom mob
?
?blockpdc ?
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Just a quick question, can this (or is it the preferred way) to be used to remember what blocks are placed by a player so that for example timber/insta wood mine plugins only work on natural trees, not wooden player houses?
tag the block with a byte, lowest value you can store
(or a boolean)
so it's basically PDC https://docs.papermc.io/paper/dev/pdc
for blocks?
its a library that uses the chunks pdc to store data to blocks
But is it persistent through reboots/reloads?
yes
that's perfect
it just gives you a fancy wrapper for a child element in the chunks PDC of the block
for block 3/10/3, chunk 0/0 would have a PDC entry with a key similar to like, "plugin:3-10-3" and a value of the PDC you recieve from the library
if that makes sense
I could use it it to detect which blocks player have placed right?
yea if you mark all player placed ones with a PDC entry
Would that be okay for performance?
Eg. 10000 blocks?
It doesn't affect chunk loading right
But it is better than saving all the block locations to yml/json?
It is 100% better than a single file yml
Okay perfect
does github have anyway (not using the app) for me to sync branches, eg i push something to master and i want to also merge it onto other branches, bc the website is fucking shite
there are probably some github actions for that
not that that is always safe to do anyway, the changes might conflict obvs
just found the most hidden thing in intellijs git thing to merge it
i didnt wanna auto merge
i just wanted to merge branches
and for some fuckin reason it isnt on the website
not necessarily
like if i have 2 feature banches i havent touched but need to merge a commit i had on master to
knowing it wouldnt break anything
you'd open a PR from master to the feature branches ?
why open a pr when i can just merge
I-
you were asking for a way to do that on github ? 
Or you could just, have PRs open for the feature branch
and click the "update branch" button which does a rebase
i hadnt gotten the prs open yet
preferably, but ij worked
yea I mean obviously lol


