#help-development
1 messages Β· Page 538 of 1
Does that file exist?
yeah
could also be a onedrive thing too
in my buildtools folder
onedrive sucks ass
especially for vms π₯Ί
soooo how do i fix it
oh ok
is not in a onedrive folder
Is a recipe book click event a player event or an inventory event
That is the real question
Probably a PlayerEvent imo
It's not really associated with an Inventory, there are no slots
RaidEvent it is :D
dont we have an event for that
Yes
For recipe books?
No no, RaidEvent lol
It's an abstract base but ye
If he did mean for recipe book clicking, then no we do not have an event for it
Shouldn't be hard
It's a key and a boolean
Doh we don't have a base interface for crafting recipes
Just Recipe, but it shouldn't matter because the recipe book can show more than just crafting recipes
Do any recipes other than crafting support automatically moving the items
Yeah, furnace recipes
Recipe interface sucks
If we give the option to set the recipe, I wonder what will happen if they set a crafting recipe in a furnace for example
Doesnβt extend Keyed cause someone thought villagers also have recipes
Will the universe implode
Can probably throw an exception if it's not an instance of the original recipe
ehm, new CraftingRecipe interface? π
what aboot to md
I'm sure there are some common methods you could pull up
I implemented the event as a library
?paste
It's on my gh doesn't work with jitpack yet tho
Boo
Yeah it shouldn't have been a Recipe type
nupe
does dupe rhyme with nupe
Tf is a nupe
like nope, but with a u
Choco did you think about the Registry for registries for 1.20? Otherwise I'll build it myself via Reflection
Don't forget the RegistryRegistryRegistry
That's the most important one
Post-1.20 I'll look at something for it
We need more registries tbh
Lots more are getting exposed in 1.20
Fine I'll probably slack and not be done with 1.20 anyway lmao
ConsoleFactory.getSystemFactory().getBinaryFactory(OSType.Windows).getPrintFactory().print();
I want muh tag registry
There is no tag registry. Tags are a part of individual registries
Which I also have a PR for
Wait really
Yes
Wtf mojang
I want registry version to be 1.20 
I should comment on this stating that it's targeted for post-1.20. I'm sure md knows already, but yeah
I could become spigot contributor by opening a pull request for a typo in the documentation
Woo it covers the missing tags too
Yeah it adds all remaining tags that we have API for
I don't wanna sign the cla that's the thing
that we have API for
Yeah, some things we don't have API for
like wat
There was one tag type I couldn't add... can't remember what it was
Most packet stuff can be added to the api
I can name a lot of things XD
So long as it isn't exposing the packets directly, yes
Some stuff i see on the jira is stuff that already exists people just use wrong events or don't know xD
Player jump event
Just use the statistics event
is their a inbound packet you'd listen to for that?
Custom Biomes
Pathfinding
A bunch of worldgen stuff
Placed structures
funny I've not touched like any of this stuff cuz it sucks to work with xD
I'm also working on an api for placed structures
Which can technically be PDC holders
It does
I wonder how many of these PRs have been done and lost in the abyss
And it works
A fair amount do get lost
I've revived a few recently
Like the TNTIgniteEvent from 2016
Hey look it's Aikar
that was before he started paper isnt it
I'm honestly surprised my PR wasn't lost to the abyss
As long as PRs are active they generally don't get lost
that statement is like a tautology
But if the author disappears to get stuck on waiting for changes for eternity
Well I'ma fuck around with PlayerJumpEvent shit π€·ββοΈ I'm bored
You can basically create it out of the statistic change event - I think paper does the same
careful looking at papers code when making a pr
No, not careful. Just don't 
Looking at Paper's impl would be a terrible Idea
He doesn't have to look at it - just use the general idea. I didn't look at it either. Just from what I heard they use it
you look at everything except what you want
doesn't spigot have this?
Kill the original paper author and claim ownership of their code
They do - they don't create a playerjumpevent from it
mfnalex put a jump event together in his lib
I imagine their are some additional checks in paper
Idk
The statistic event isn't perfect
Yup there are more from what I heard. I don't know about those though
in my opinion if MC thinks it's a jump I'll accept it as a jump
Smh mojang just send something to the server to indicate the player pressed jump
The server code isn't really much better
they're starting to update some stuff im pretty sure
They did but "fixing bugs and increasing performance won't lead to more people buying the game" - therefore it's probably "continue to workaround more features in there fellas"
go find out
Effort
probably not as good as lot of the community made things lol
I know JellySquid and a job at Mojang were discussed
Idk if Mojang said no or Jelly said no
Non-profit developers are usually more motivated anyway since it's a hobby and not a "job"
Giving 150% just to make someone else rich is just demotivating
I mean they do get paid
Yeah and they still get paid with 70% effort
Tbf now that Mojang is owned by Microsoft I imagine the profits end up more spread out
Compared to when it was owned by Notch
I could imagine that the sales go downhill aswell. Not because it's a bad game but soo many copies were sold already
That's why they made bedrock
Now kids with nothing but a phone can also buy minecraft
And that's why they will abandon java in a few years
And purchase juicy Minecoins!
It's not an "if" question - only "when"
Then it's probably up to the community to keep it alive - or everyone shifts to bedrock
wow mojang really does have interesting names
Mojang Name ServerboundPlayerInputPacket
Spigot Name PacketPlayInSteerVehicle
The names lead me to believe these are completely different things
I only hope bedrock gets a lot of bugfixes before they force us to play that glitchy mess
i am playing java till the day i die
I doubt the Java devs will be happy if they get dropped
The Java devs are also the more public facing people in the company
Microsoft will be happy with saving 30-40% of their development costs
They probably automatically translate half the code anyway :p
Could be
C++ and Java are similar enough
However they are buying more and more companies anyway - they'll find other spots for the java devs
The end of java will be the end of another great childhood memory and I'll probably also ditch mc for good
I don't think they'll announce that before 2025 though. I expect it to be in 3-5 years
once they kill java I'll get back to game deving
I also don't like their pricetags on the new minecraft games. Minecraft dungeons is fun - it is however not 40β¬ fun
a lot more players play bedrock - simply because there are a lot more supported devices
Content creators usually play java because of the better plugin and mod support
Someone asked me to adjust one of my plugins so he can enchant items with impossible enchantments in survival. Like knockback on a stick
and I was like "huh? Just use gamemode and an anvil?"
turns out that's not possible in bedrock
thats posible to do in java version?
yes with gamemode and enchantment books you can enchant any item
nice to know
trueee
That's why I was asked to create a plugin for it. Made that in a few hours and published it
there probably are plugins for that already but I didn't find any that just have a simple command and no other clutter
Can someone give me an example of a build.grade file that shows how to add apis?
If building with Spigot don;t use Gradle unless you REALLY need to#
Why would you need to? o.o
Man spigot has some weird errors sometimes
Preconditions.checkArgument(key != null, "key");
not "key cannot be null" just "key"
Kind of been on my list of things to fix tbh
At least fleshing out those one line error messages
Well I got this one since i'm moving it anyway
:p
What's that one weird error people sometimes get
Caused by: java.lang.AssertionError: TRAP
Really? I thought it was much better
quicker too
Meh
That's thrown when an ItemStack is set to air when it shouldn't be
It doesn't really matter much which you use, but spigot itself uses maven
it has advantages, but it's also more complex. Spigot is based around Maven not gradle
If you try to use Gradle you will be hit with complications.
If you are wanting to dev on Spigot use Maven.
10/10 error
Is maven quick?
Ok, I knew how to build my project to a certain location with gradle, how can I do the same with meven?
you just need to learn how gradle DSL's work, if you're using groovy DSL there's plenty of basic tutorials how to work with gradle
on youtube
how do you listen for serverbound packets
packet events
protocollib
or injecting your own netty handlers via NMS
omfg i found md_5
iirc you need duplex handlers and playerconnection's class netty channel inorder to do that
i found dinnerbone
lemme decompile nms first 1 sec then ill find notch
would nms have git history
lets find the removed herobrine patch
prtty sure it does
can i do this ?:
when i write playername in chat
player see own name like this '@quaint mantleername' in chat
so can i do this without packets ?
Sure
Go through each word, check if it's a players name, and then add @ to the front
ty
Why does InventoryClickEvent#getWhoClicked return HumanEntity?
Shouldn't it be a Player seeing as that event is only for players?
It's an old event
And internally it involves a HumanEntity
Most newer events simply cast to Player for you
Since player is the only HumanEntity
I think it would be fine to change it to player
That shouldn't break compatabilty if my brain is working correctly
But idk if MD is down for that
is there a way to hide a custom command from highlights
Give it a permission and it will only show if the player has that permission
is there a way other than that or nah?
If you want to completely remove it use PlayerCommandSendEvent
yeah, it breaks ABI. you'd have to rewrite it with commodore
Really? I though a more specific type would be fine
you can by using NMS
and accessing command dispatcher
Or just
that handles the tab completions
Use the event I sent
its probably because player interface uses offline player class too
i might be wrong tho
tbh it should return Player
instead
since this is more backwards compatible
and allows better polymorphism
For example
public static PlayerLeashEntityEvent callPlayerLeashEntityEvent(EntityInsentient entity, Entity leashHolder, EntityHuman player, EnumHand enumhand) {
PlayerLeashEntityEvent event = new PlayerLeashEntityEvent(entity.getBukkitEntity(), leashHolder.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand));
entity.level.getCraftServer().getPluginManager().callEvent(event);
return event;
}
tbh downcasting like this is a small code smell
but who cares
Bukkit API is a big NMS hack anyways
99% of GUI frameworks rely on it
oh?
yeah
Why should it be removed
fuck the bukkit goal
Let's just make it a sealed interface
there's no real alternative to inventory holders atm for storing UI metadata that easily
Becase there are other holders?
storing it externally wouldnt allow for plugins to pass data easily between
its just easier to use it
its a hack, yes.
wdym by references?
oh i thought you meant different Reference types
(Or view)
WeakReference etc
Yeah just hold an instance of the InventoryView returned by Player#openInventory() π
There is an alternative, people just don't use it
Yea I do this too, but it would be nice if Bukkit API would add a way to store metadata on the inventory class
or inventory view
Make it implement PDC
Wait no that isn't how it works
Well also how would you hide it
wait till you see Win32 API with 3 different variants of api functions which just do things better than others, and are left out for backwards compatibility
Yay backwards compat
MessageBox(), MessageBoxA(), MessageBoxW(), MessageBoxEx()
The reason why bukkit packages are wacky too
I think you should see how Bukkit command api is implemented internally
you would be disgusted
π
I hate how Bukkit command api hardcoded <args> string inside tab completion command dispatcher
you cant literally edit it properly
without some kind of hacks
because PluginCommand class is Final.
wut
Event is done, still need to do the method
how do make a passive mob hostile in 1.8? only specific ones spawned by the plugin
NMS
You'll need to give them attack goals
You may also need to give them a attack damage attribute
Will I need to make a class for them? because I need it to be accessable via Lua
I can make my own pathfinder goals fine its just the setting the PathfinderGoals that I am curious about

You should be able to use the existing goal class
It can take any entity type as a target
ye but I wanna set custom goals
i think the common method is using packets to disguise a hostile mob as a passive one
that would work too
Imma ask ChatGPT what it thinks lol
It will cause them to bug out. You can see this when you attack some entities. They turn hostile for a moment and then back to passive
But sometimes it glitches out and causes this to constantly happen
But yeah if the server is set to passive mode or peace mode you wont get mobs to attack at least not properly
The only issue I had is that they had no attack damage value which caused a crash
But you can add one with some reflection iirc
ah
also do I need to add some dependency to access PathfinderGoals because they don't seem to be showing up
Idk what they are called in 1.8
does screamingsandals go that far back?
net.minecraft.server doesn't exist
But as long as you have NMS you should be able to find them
then you need spigot/bukkit
not spigot-api
run buildtools and it'll install it to your local maven so you can use it
Bukkit wonβt work :p
yea idk what the 1.8 development setup looks like
Pretty sure itβs the same in that regard
Wish our $250 cannon jar also worked for 1.20
i just stay on latest and enjoy my life
craftbukkit?
The only reason to ever depend on craftbukkit/bukkit is if you are developing a PR
non modular moment
Buying stupid paid forks moment
what is a cannon jar
WineSpigot
because Factions
but muh mulithreaded async hyper optimized tnt explosions!!11!!
what feature does it have that you desperately need that you couldn't just get on regular spigot or paper
it makes tnt cannons way way more effective
im sure you could find sooommeee plugin that does that
its way faster and stuff
and also doesn't cost $250
but likkkkeeee
no because it changes the calculations that are done in the jar
is it?
yes
like have you benchmarked it yourself
its literally that
oh no, i know
Its a lot more than just tnt
ive got a friend that works on a fork for factions-related stuff, TNT cannons are like a ridiculous niche that they care extensively about
I am but also focusing on a recode for a plugin that is desperately needed
nice
well hopefully one day you'll make it to 1.20 π€
are there any beta builds for the pre-releases?
spigot doesnt do those iirc
can I build /next and it'll magically support 1.20
i remember them doing it like one time
that is the plan and ideally modular
last I remember them doing was 1.14
yea that's probably it
I remember some paper devs saying all the paid 1.8 forks are just the same broken patches over and over again
I hate that they dont do them but I know why they dont
And tbh I believe it
:v yeah
Idk why MD doesnβt do public pre builds
probably starts at TacoSpigot and then has a bunch of stuff hacked ontop of it
or NachoSpigot i think is what ppl use now
well
"now", i think that forks dead too
Maybe heβs worried people will be dumb, run them, and then foobar their world
because paper instantly patches and people go straight to paper
could still benefit from pre-release releases, gives plugin devs more time to make sure their plugin works on new versions asap
ye
Like I know a build exists
Itβs on #spigotcraft
But afaik only MD has access to it
md5got fork when?
is there not just compileOnly 'org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT' in the spigot repo?
redistributing mc would would be a policy breach methinks
Are we allowed to ping MD to ask why no pre releases?
Correct
sorta why stuff like BuildTools and Paperclip even need to exist
nope
because spigot contains mc code
yea
It contains patched code but yeah, itβs mostly Mojang code
building 1.8.8 with btgui
it contains some amount of copyrighted mojang code
I think my Adhd brain is dopamine starved atm
All mod loaders have a system to patch a vanilla jar
And spigot is basically a mod loader but server side only
spigot-client when?
forge
forge is not spigot
forge implements bukkit afaik
That would be cool having plugins in single player
oh wow, building 1.8.8 took like no time compared to newer vers
Forge and fabric both have their own api
never processed the size difference lolwtf
but its very similar to bukkit, no?
No
The difference 7 years makes
that + insomnia caused me to get like 2hrs sleep I think imma nap if I can
I wonder if spigot will hit that 70mb milestone in 1.20
spigot 100mb when?
it is similar in that it has an api
and that is it
A large part of this is because of fastutil
fast but large
I thought a lot of it would be the million json files
nah I think 20 megs is fast util
Yeah, fastutil is 12mb lol
I remember that being annoying when they first added it
what is FastUtil for
Specialized collections
ahhh
e.g. IntMap, LongSet, etc.
Yeah it's stupidly overengineered, but it kind of has to be
It can run doom
vigna has a very bad name
its interesting that spigot 1.8.8 is as large as it is tho, the client jar is only 8mb
ah wait, its bundled
right
Yeah the client's libraries are all external
forgor :v
lol, a lot of the implementations are automatically generated
you should see what the vanilla server jar's size is
trying to download it but i dont have the official launcher lol
i run multimc n it has no button to dl the jar like mojangs
i mean its on the website somewhere
just for latest ver i think
here
MCVersions.net offers an archive of Minecraft Client and Server jars to download, for both current and old releases!
server.jar is also 7.9 mb
Xd
i have no clue
looks like it
lol
u think mojang uses maven or gradle for minecraft
how do I make an event only happen in a particular world?
its okya its hard to convey that stuff over the internet
yes
ah, CSS
how do I get the name of the world I am in
do you mean you want to cancel the event if it isn't in the specific world
why do you need the name just grab the instance
player.getLocation or whatever.getWorld
and compare the instance
ok
pass the instance of the world into your listener when you create it
the one you're looking for
per-world events api when?
ew
PR time βοΈ
folia skipped straight to per region

I'm writing a system to apply enchants to items by clicking on them. I'm having trouble getting the enchantment item meta of the item that the enchantment is being applied to.
Any ideas? Thanks in advance.
public void onInventoryClick(InventoryClickEvent e) {
ItemStack equipment = e.getCurrentItem();
ItemStack enchant = e.getCursor();
Player p = (Player) e.getWhoClicked();
if (equipment == null || enchant == null) return;
if (e.getInventory().getType() != InventoryType.CRAFTING) return;
if (equipment.getType().equals(Material.AIR) || enchant.getType().equals(Material.AIR)) return;
if (!enchant.getType().equals(Material.ENCHANTED_BOOK)) return;
if (!ableToApplyEnchantTo(equipment)) return;
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) enchant.getItemMeta();
if (meta.getStoredEnchants().isEmpty()) return;
Enchantment enchantment = meta.getStoredEnchants().keySet().iterator().next();
if (!acceptableEnchant(equipment, enchantment)) return;
e.setCancelled(true);
ItemMeta equipmentMeta = equipment.getItemMeta();
if (equipmentMeta instanceof EnchantmentStorageMeta equipmentEnchantMeta ) {
Map<Enchantment, Integer> enchantments = equipmentEnchantMeta.getStoredEnchants();
if (enchantments.containsKey(enchantment)) {
int equipmentEnchantLevel = enchantments.get(enchantment);
if (equipmentEnchantLevel >= 3) {
return;
}
equipmentEnchantMeta.addStoredEnchant(enchantment, equipmentEnchantLevel + 1, true);
} else {
equipment.getEnchantments().keySet().forEach(equipment::removeEnchantment);
equipmentEnchantMeta.addStoredEnchant(enchantment, 1, true);
}
equipment.setItemMeta(equipmentEnchantMeta);
}
}
it is due in two hours and 17 minutes
Each block gets its own thread
can't wait
take true advantage of your threadripper
which you were using for your 5 player vanilla smp of course
actually on one hand this doesnt sound too bad but on the other it sounds just so absolutely useless
Thereβs a plugin for that
i guess theres usually always enough context somehow to deduce the world an event originated from
Handles any events that have an accessible world afaik
im getting this error when I try to package my plugin
public class PerWorldEvent<E> {
private World world;
private E event;
public PerWorldEvent(World world, E event) {
this.world = world;
this.event = event;
}
public World getWorld() {
return world;
}
public E getEvent() {
return event;
}
}``` but like, not as basic
as a dependency
I used IntelliJ and chose paperspigot
wouldve put <E extends Event> but iirc Event and Cancellable are both their own classes
:v
what do you do for a teleport event where they're changing worlds
paperspigot doesn't exist anymore
idk, die?
yea but like did you add whatever as a dependency
some events obv couldnt be per-worlded
i mean papermc mb
MultiWorldEvent π π π π
You also want the option to always let some run
For example blocking the join event might foobar a lot of plugins
well that goes back to this
some events just simply dont really originate from a world
but rather the server itself
Iirc the available plugin has an option to ignore it
it doesn't make any sense to have world events
if an event has a world there's a way to access it
Holy shit is that minecraft2
ok i lied
that's 30 fps
because i forgot that i frame limited it ;D
wait
are windowed mode applications vsynced by default
?
No
Well depends on your settings especially with the gpu
But non fullscreen applications do miss out on some optimizations though
List<CommandElement<?>> subCommandsCopy = Collections.unmodifiableList(subCommands);
does this effectively create a copy of the list?
like can I modify subCommands and still use subCommandsCopy in the for loop
Yes
Well actually
It creates a view over the list, so I donβt think itβll help you avoid ConncurentModificationException if that is your goal
yeah I thought so
intellij doesn't warn though
probably cause it doesn't go that deep
If you are just removing use an iterator
If you want to do more than that just make a normal copy
now that I'm looking at it I'm not sure why I wanted to do that
I'll just create a new list
@Override
public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, @NotNull String[] args) {
int index = args.length;
if (index < 1) return new ArrayList<>();
Map<Integer, List<String>> completionsMap = new HashMap<>();
getCompletions(index, 1, completionsMap, CommandElement.this.subCommands);
}
private void getCompletions(int reqIndex, int currentIndex, Map<Integer, List<String>> completions, List<CommandElement<?>> subCommands) {
List<String> completionsList = new ArrayList<>();
completions.put(currentIndex, completionsList);
List<CommandElement<?>> newSubCommands = new ArrayList<>();
for (CommandElement<?> subCommand : subCommands) {
if (reqIndex != currentIndex) {
newSubCommands.addAll(subCommand.subCommands);
}
if (subCommand.registerAliasCompletions) {
completionsList.addAll(getAllAliases(subCommand));
continue;
}
completionsList.add(subCommand.name);
}
if (reqIndex == currentIndex) return;
getCompletions(reqIndex, currentIndex+1, completions, newSubCommands);
}
I feel like this is the like most inefficient way ever to do tab completions
and would be very laggy
(the tabComplete method is incomplete)
should I do this after everything is registered and store it in the base command then call that data in the tab complete method?
registering all the tab completes instead of recomputing each time would probably be better yeah
what is the easiest way of making an arrow that disregards collisions?
like thru entities or thru blocks
how would i make it a specific block cannot be broken by an explosion?
where the heck is intellij getting this CmdTest class
Listen for the explosion events, go through the collection of blocks and if it contains your specific block remove it from the list
ok
There is entity explosion event and primedtnt explosion event
Dont remember if there is a third one or not
did a maven refresh & validate and it fixed
livingentity#launchprojectile moves the entity around right
no, I am an idiot who couldn't find the code I had to rotate the shooter
I am currently still trying to find the event that triggers when a chorus flower is destroyed by a shot arrow, anyone know how?
I want to prevent it from being destroyed by the arrow if it's on x chunk.
Is there a ProjectileHitEvent?
yes
?paste
Vault Dependencies
I'm making a plugin which involves randomized block drops and I want to display these drops in the lore for blocks a player could hover over. I want the player to be able to see this information before they even craft an item, but CraftItemEvent (despite the description, which would suggest otherwise) is only called after the player takes the item out the crafting grid, not as soon as it appears in the output box. I would assume it was just handled client-side, but I remember a video where someone spammed between two reciped in the crafting book in order to crash a server. So, is there an event I can listen to to be able to modify the lore as soon as it appear in the output box of the crafting menu?
PrepareItemCraftEvent
Ah, thanks so much!
what framework are you using? or does win32 has its own stuff for that?
same
How can I get the item that was moved when someone shift clicks an inventory using InventoryClickEvent?
I know I can get the slot, but that's the slot that was clicked that is now empty as a result of the shift click. Getting the cursor is also useless because there is no item on the cursor, it got transferred instantly. So how am I meant to know what was transferred, or where it went to in the other inventory?
Does getCurrentItem() not work ?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
how can i configure a working build.gradle for a github repo? My build.gradle looks like this right now:
https://pastebin.com/S8GMQQX5
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
and i get this warning:
Cannot resolve resource filtering of MatchingCopyAction. IDEA may fail to build project. Consider using delegated build (enabled by default).
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
were you responding to me ?
lol
https://github.com/RaydanOMGr/GunStop/ here is the source of my plugin. For some reason guns that have 6 shots can shoot 7 times and the ones that have 1 shot can shoot 2 times. Idk how to fix this so I need help, thanks. (I'm bad at maths)
I have no footage rn
if bullets >0 then setBullets(player, bullets -1);
else it's empty so do your empty bit
if i want to give feature to custom item can i do this only with name,lore,enchants equals ?
Use pdc
what is pdc ?
?pdc
ty
I'll try this once I'm home
?paste
"public void sendBreakAnimationPacket(Player player, BlockPosition position, int stage) {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().b;
playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(-player.getEntityId(), position, stage));
}" sendPacket go error
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
He reaches the player in the upside down
Finally a plugin that is compatible with the shadow realm
can I set velocity to BlockDisplay?
im setting it but yet the display doesn't move at all
im parsing vector of 1,0,0 and then multiplying it by 100, yet no movement occurrs
oh damn
how shall I make my own version of this velocity thingy?
I want them to move smoothly, not like teleportation
Does someone have experience with mods coded in Kotlin and trying to connect to Bukkit? For some reason this line doesn't work. It's to connect the economy from vault
var econ: Economy? = Bukkit.getServer().servicesManager.getRegistration(Economy::class.java)?.provider
I found this code online and I changed it because it gave an error
It compiles but when I excecute the command it doesn't do anything
when are you trying to get teh provider?
are you getting the provider IN the command or a field in a class?
It's outside commands
class gtsGUI(syncId: Int, player: PlayerEntity, server: MinecraftServer) :
GenericContainerScreenHandler(ScreenHandlerType.GENERIC_9X6, syncId, player.inventory, SimpleInventory(9 * 6), 6) {
val LOGGER = LogManager.getLogger()
val world: ServerWorld? = server.worlds?.first()
val timer = Timer()
var currentpage: Int = 1
var filepath: String
var p = player
val pm = ParseableMessage()
var refreshbool = false
var previouslistings: MutableList<GtsItem> = ArrayList()
//RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
var econ: Economy? = Bukkit.getServer().servicesManager.getRegistration(Economy::class.java)?.provider
init {.......
when do you instance gtsGUI?
this class is new every time the command is used?
no clue then. I don;t know enough kotlin to tell if you code is messed up.
it looks like you should not need the .java though
I do, otherwise I get this
Type mismatch.
Required:
Class<TypeVariable(T)!>
Found:
KClass<Economy>
"Location blockLocation = player.getLocation();
BlockPosition blockPosition = new BlockPosition(blockLocation.getBlockX(), blockLocation.getBlockY(), blockLocation.getBlockZ());
PacketPlayOutBlockBreakAnimation packet = new PacketPlayOutBlockBreakAnimation(0, blockPosition, -1);
((CraftWorld) blockLocation.getWorld()).getHandle().sendPacket(packet);" I tried to fix the code but it doesn't work
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
then try Economy.javaClass
I'm creating a block failure plugin with NMS animation but it gives "sendPacket" error
I'm guessing send packet doesn't exist
e.getitem get holding item ? for mainhand and offhand ?
If he gave us teh error we might be able to help
Type mismatch.
Required:
Economy?
Found:
KClass<Economy>?
Item used in the event
Ok I don;t know enough Kotlin to advise
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
i have to use "PacketPlayOutBlockBreakAnimation" from NMS
I can only use javaObjectType or javaPrimitiveType
Most of us here don't use Kotlin
I know but I thought I could ask, maybe someone knew
If i make a plugin on ex. 1.16 will it work on all versions above or does it need some extra configuration?
It should, but sometimes breaking changes are introduced (very rarely) backwards compatability is pretty much guaranteed minus a few exceptions.
@EventHandler
public void cancelShear(PlayerInteractEvent e){
Block farmland = e.getClickedBlock();
ItemStack item = e.getItem();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (item != null && farmland != null && item.getType() == Material.WATER_BUCKET && farmland.getType() == Material.FARMLAND) {
e.setCancelled(true);
Farmland data = (Farmland) farmland.getBlockData();
data.setMoisture(7);
farmland.setBlockData(data);
}
}
}```
i do this works but i see this in 1 sec can i block this water ?
the block null check isnt needed, just create the variable if its a right click block action
The water you see is client side. You can not prevent it
it vanishes when you cancel it
yeah
as a warning or error in console
Ok thanks
Hey can someone give some feedback on this? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/862/overview?commentId=10627
yes they do tick, they can be passengers
don't have stash access lol
I don;t see a point to it. it's just reversing the already existing hidePlayer
can i control horse armor slot without packets ?
Point is to provide more utility and convience.
The current hidePlayer is confusing,
with this it allows for more intuitive use.
R.I.P.
I see no use for it. just easier to confuse.
These 3 new functions would make it less confusing
hidePlayer and hideEntity are enough
you already have the player objects if you want to hide so the direction of hiding dictates which player object you call hidePlayer on
pretty sure it won;t be accepted.
The functionality is already there. No need fo rmultiple methods to do the same thing.
that wasn't even the question π
You asked for feedback
I wanted to know if adding a craft bukkit implementation or default methods would be the best approach
Sorry it wasn;t the feedback you wanted
On the comment that mentioned the above
Seems my comments agree with Phoenix616
got it. Thanks!
@EventHandler
public void cancelShear(PlayerInteractEvent e){
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
ItemStack item = e.getItem();
Block farmland = e.getClickedBlock();
Block crop = farmland.getRelative(BlockFace.UP, 1);
Farmland data = (Farmland) farmland.getBlockData();
if (item.getType() == Material.LEATHER_HORSE_ARMOR && farmland.getType() == Material.FARMLAND) {
data.setMoisture(7);
farmland.setBlockData(data);
}
else if (crop.getType() == Material.WHEAT || crop.getType() == Material.CARROTS ||
crop.getType() == Material.POTATOES || crop.getType() == Material.BEETROOTS ||
crop.getType() == Material.MELON_STEM || crop.getType() == Material.PUMPKIN_STEM) {
farmland.setBlockData(data);
}
}
}```
i do this for fix this warnings
no errors but i got error in console
why ?
you can ignore thoses 2 warnings
you probably would want to check if the item isnt null
hi
if (spawnerItemMeta != null && spawnerItemMeta.hasLore()) {
List<String> lore = spawnerItemMeta.getLore();
for (String loreLine : lore) {
if (loreLine.startsWith("x")) {
String PigamountStr = loreLine.substring(1);
try {
int Pigamount = Integer.parseInt(PigamountStr);
// Get the spawner name
// Get the coordinates of the placed spawner
int pigx = block.getX();
int pigy = block.getY();
int pigz = block.getZ();
String PigworldName = block.getWorld().getName();
// Save the coordinates and amount in the configuration
ConfigurationSection PigspawnersSection = iroconfig.getConfigurationSection("iron_golems");
if (PigspawnersSection == null) {
PigspawnersSection = iroconfig.createSection("iron_golems");
}
String PigcoordinatesKey = pigx + "_" + pigy + "_" + pigz;
ConfigurationSection PigspawnerSection = PigspawnersSection.createSection(PigcoordinatesKey);
PigspawnerSection.set("world", PigworldName);
PigspawnerSection.set("amount", Pigamount);
```
PigspawnerSection.set("expiration", expirationTime);
PigspawnerSection.set("length", timetofill);
PigspawnerSection.set("experiance", expirationTime);
// Save the configuration to file
try {
iroconfig.save(new File("plugins/DonutSpawners/spawners/iron_golems.yml"));
} catch (IOException e) {
e.printStackTrace();
}
} catch (NumberFormatException e) {
}
break;
}
}
}
}```
?paste
twhy does that code only work when the user is in creative
totherwise it treasts it as a pig spawner
Also I hope that isn't IO on the main thread
You can't place spawners with set mobs without creative
What event can I use to tell if a player has fallen into the void or not?
still better than database calls on the main thread
are you doing it in teh block place event?
You can listen for void damage
yh
ok
set the spawner type 1 tick after the event finishes
what is the name of the event for a player taking damage?
?scheduling
EntityDamageEvent with an if to check for the type of the entity (or instanceof Player)
and one final question: How do I check to see the type of damage taken?
getCause
getCause()
ok ty
why tho
yes
?paste
This is what I did to try and make it so when a player takes void damage, they get teleported to spawn. It is not working tho https://paste.md-5.net/disexonora.java
Don't run a command
don;t use getLastDamageCause
should I just tp them to some coords instead?
This. use the method we told you to
if (event.getCause() = = EntityDamageEvent.DamageCause.VOID)
ok tysm
should I just tp them to some coords instead?
player.teleport(world.getSpawn())
did you register the listener?
?main
lmao I thought it was the opposite way around
Check you updated the jar on your server
yeah plugins are not apps. They have no main
anyway, you either didn't update the jar on your server, you missed a build error or you have a startup log error you ignored.
theres no errors and I updated the jar on my server
the code is fine, you missed an error somewhere
You are in a world called "practice" right
yes
I used a test case and I turns out that the plugin doesn't even get to the damage caused by void part
?paste your latest.log
where do I find the latest.log?
it says something went wrong when I paste it into the hastebin link you gave me
it might be too long
throw the file in here then
whats your plugin called?
PracticeableUtilities
no startup errors
Did you put the jar in to the server after building?
yes
so long as your world is correctly named and you DID put the new jar on your server there is no reason for that code to not work
test it on spigot
Can I spawn an Ender Dragon with its AI? Because EnderDragon#setAI(true) does not work.
do you think part of it might be me using a paper minecraft server?
No idea but there is nothign wrong with the plugin code
The dragon AI requires specific conditions to work
It doesn't like being outside of end and the end fight
After doing a test case it seems that the plugin breaks when I do an if statement to check for the world name.
its weird bc thats the name of the world
Do you want to respawn the dragon in the end fight?
Or just have a dragon anywhere
sysout the actual world name
ok
I don't want to use the default dragon in the end world. I despawn it and create one, so that next time I can confidently create another one after the old death.
bro its the world
lmao
I chose the name for the wrong world on accident
it works now I think
yep it works thanks
you need to add a check it is an actual player
else anythign falling into the void will teleport to spawn
ok
world.spawn(location, EnderDragon.class, dragon -> dragon.setPhase(EnderDragon.Phase.CIRCLING));
Should get the dragon to behave correctly
Though if you plan on adding your own end crystals you will need NMS for that
NMS for setting the crystals?
Oh. Is that tracked? I thought the dragon didnβt care for them. I thought the only situation where crystal location matters is when you are respawning the dragon.
ah nvm it looks like it can lookup nearby EnderCrystals within 32 blocks
So it's fine
So, I did that, I tried debugging but I still didn't get it to work properly
oh interessting it appears to be using the spawn position as the end portal location by default I was just close to 0, 0 ;/
Yes
Hmm, let me try
Are there any YouTube tutorials for it?
All the ones that are on YouTube seem to be in a different language
i think so yes
?bool
Doesn't cancel out but takes priority
Gotta set the phase.
You'll probably want to wrap your ||'s in parenthesis
Aw, do we not have a Boolean logic command?
is my code is good ?
That will be if (first two are both true) OR third item is true
Is there an error or unnecessary code?
e.g. if (itemType == Material.LEATHER_HORSE_ARMOR && (blockType == Material.WHEAT || ... || blockType == Material.MELON_STEM)) {
&& takes priority, so the parenthesis are necessary
ah alright
There might be a Tag.CROPS btw
There is
if (itemType == Material.LEATHER_HORSE_ARMOR && Tag.CROPS.isTagged(block.getType()))
Aren't all crops farmland crops?
maybe sugarcane
wait, player#swingMainHand() is a method? Or is that your own?
cocoabeans
beetroots, carrots, potatoes, wheat, melon_stem, pumpkin_stem, torchflower_cropβ[upcoming: JE 1.20], pitcher_cropβ
That's all that's in crops
i add Player
now
no chorus? huh
method
Any chance you'd be willing to share that method? Happy to credit you.
wdym wait
its spigot method i mean
Ah ok, thanks
π
Had no idea that existed... happy to hear it!
Anyone thats good with coding?
i got these bosses and they have drops
but i cant change the percentage of getting the drop
is it the same code everywhere or is it very diffcult?
could probably use a set or something for the item list
How do I get the name of the inventory that is being clicked on by the player?
Is there a site where I can hear minecraft sounds?
don't use inventory names to compare
What can I use instead?
contents?
inventory instances
im in 1.16 and i can listen dripstone sounds ?
how do I do that?
how ?
uh what?
if (event.getClickedInventory() == instanceYouStore)
ah i don't know
ok thank you
u can get help from bossland's discord
You might be able to find some sounds on the Minecraft Wiki, but I prefer to use this plugin.
https://www.spigotmc.org/resources/β‘-playsoundtester-β‘-1-8-latest.84469/
ty
Now my whole reload system broke
How do I get the instance of an inventory that is in a different class?
Down below you can see the code I use
Even if I dont use unicode my name on the tablist is still white
You have to store the instance somewhere. You'll likely have to make it a global variable and create a getter for it.
Im just experimenting a bit with unicode stuff. Didnt planned on making this a public or production plugin
Just some testing. This doesnt solve the problem though
ngl I love comments like this.
imagine someone new to coding would ask a question related to code like this. Your comment is just useless and toxic. If you have a better idea then tell the people how they could improve instead of a simple toxic answer.
How is someone new who doesnt know better supposed to learn how to improve?
Thats just a fact morice. Comments like those are bs. Either help those people to get better or dont comment at all
Doppelbemme, you should first try to do it simple, just a simple line trying to set to the player display name
Your code is just terrible
Like an heavy fog
So please first test with a simple line
I know it is. Its just for testing around with server texturepacks
Don't blame others, if you want help, you need to make it clean
