#help-development
1 messages · Page 1680 of 1
yeah
If you want to check that, you should store the values in a set
it's a list of strings
And call toLowerCase() before inserting, and also before checking contains
HashSets are ideal for this
ok awesome
i guess it just assumes that the dev knows cause they put it there
But keep in mind they are unordered, cannot contain duplicates, and cannot be indexed
Well, config is a big hash map
To my knowledge it loads everything in at once when you load config and keeps it in memory
It must make the distinction when it's loading
oh yea true
The easiest way is probably to store it in a long, and if it's with int bounds then you convert it to int
makes sense
Hey. I've been getting strange runtime errors related to PathfinderGoals ever since the update to 1.17, I believe it has to do with obfuscation maps having missed something since I've seen issues like https://github.com/PaperMC/paperweight/issues/24. This is the problematic code I'm running inside a custom Villager class:
@Override
protected Brain<?> makeBrain(Dynamic<?> dynamic) {
//Initialise the brain with our own custom goals
Brain<net.minecraft.world.entity.npc.Villager> brain = this.brainProvider().makeBrain(dynamic);
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 1.4D));
this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0D));
this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(4, new RandomLookAroundGoal(this));
return brain;
}
The error I'm getting is
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.navigation.NavigationAbstract.d(boolean)" because the return value of "net.minecraft.world.entity.EntityInsentient.getNavigation()" is null
at net.minecraft.world.entity.ai.goal.PathfinderGoalFloat.<init>(PathfinderGoalFloat.java:14) ~[patched_1.17.1.jar:git-Paper-249]
You're not using spigot
The goals in question are taken down from the chicken class, so they work internally
I've tried with spigot as well. Give me a second and I'll get the error from that as well
The error returned by Spigot remains the same.
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.ai.navigation.NavigationAbstract.d(boolean)" because the return value of "net.minecraft.world.entity.EntityInsentient.getNavigation()" is null
at net.minecraft.world.entity.ai.goal.PathfinderGoalFloat.<init>(SourceFile:14) ~[spigot.jar:3236-Spigot-6c1c1b2-6719d1f]
You should probably be initialising goals in the goal initialisation method, not the brain one
I'll have a crack at that
I came to the conclusion that the villager class as of 1.17 doesn't use goals, but activities exclusively - which is why the getNavigation() method returned null
Changing the base entity to chicken/pig made it work
Now I have to figure out how to emulate goal behaviour with activities
Thanks for your help!
how do i use functions across different classes without making them static
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
yeah check out that one
Could be a dumb question but, which is better to do a bungee command or a server side command?
For example a command to change the MOTD on redis so it doesn't really matter, just which one is the better practice?
MOTD is generally handled by the bungee so a bungee command
event.getResponse().setDescriptionComponent(new TextComponent(Chat.colour(bungee.getApi().getMOTD()))); Is how it works, it was an example command. I was just asking is it better to put a command in the bungee plugin or a server plugin
The one best suited for the command is what you should use
As I said for MOTD a bungee command would be better
I'm having issues with the Loot Table / Loot Tables API in Spigot. Anybody know how I can convert a LootTables to a LootTable?
LootTables.ZOMBIE.getLootTable()
oh its that easy. thank you!
is it possible to set a default loot context? null would throw an error, but I'd like to define it without any modifiers.
What do you mean?
You can specify the LootContext by calling LootTable.fillInventory
Yes, but how would I specify it? On the JavaDoc, it's got a bunch of getter methods but I can't seem to figure out how to set a default.
Will do, thanks.
Its teh same as all builders Builder(Location) .killer(killer) .etc .build();
Thank you, I'll be using it soon.
When using .getLootTable(), does it return a memory address or the proper json file?
Since it's getting a key, would it be the file location of the loot table? (eg; data/loottables/whatever)
it returns a LootTable Object
Is there any method of reading a LootTable object?
For example, if I wanted to list the possible contents of a loot table as Strings, is there a method of converting the LootTable object into a readable state?
You can read the javadoc as well as I can https://hub.spigotmc.org/javadocs/spigot/org/bukkit/loot/LootTable.html
I'll have to do a bit more reading. I appreciate your help!
can someone confirm for me that this is red 0xFF0000
hm weird
RGB
how can i get a block entity that's already placed and get the contents? like an item frame with a stick
Entity != Block.
so if I used 0xFF0000 it should turn out red
I can't remember what they're called so i meant like block entities like item frames and paintings
if you only have the location World#getNearByEntities
ohh ok, but then how would i get the item that's in the frame?
oh, thank you!
Elgar please explain to my why it's not giving me red
Does anyone know how to import an entire function?
static imports?
what colour are you getting? and is this OpenGL or MC?
im getting invisible
mc
hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??
I can see it being possible in GL but not MC. RGB has no transparency
unless you are using something which only supports the fixed MC colour pallet
do i get it like this? ItemFrame frame = (ItemFrame) world.getNearbyEntities(new Location(world, 0, 40, 0), 0, 40, 0); something about it feels wrong though
like the two sets of coordinates
second is not cords, they are distances
hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??
It returns a collection, so no casting it to an ItemFrame
ok idk
elgar
I thought maybe GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); would help it but no
Does it need to be 9 characters?
no
you just posted above GL code
a glColor4 which has an alpha channel
I just wanted to see if that would fix it
How do I import all this automatically into intellij?
This image is from the eclipse to show as an example. I write switch and use Ctrl+Space and it imports everything.
i don't think that you're thinking of the same import i'm thinking of..
I just want to import this quickly into intellij
without having to write everything down.
i'm not too sure if eclipse has them but maybe use a plugin for that if it does, also, i think importing would be pulling classes to use elsewhere in your project using import
so
oh wait i thought they meant eclipse oops
9 characters?
hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??
that is not a Minecraft color. Its hex and will probably display something but MC is 3 Hex codes
then you are not using MC color codes
hello! how can i it so i can have two command arguements. like args[0] and args[1] bc i made a command with two arguements but it only ran args[0], can anyone help??
I'm going to stop helping you if you keep telling me one thing and then changing your mind.
<command> <arg0> <arg1> etc.
im working with forge man
show some code so we know what you are trying to do
A natural assumption in the spigot development help channel
I specifically asked earlier if you were using MC colors or GL
if(args[1].equalsIgnoreCase("2")){
//run code here
}
} else {
p.sendMessage("§cCannot find enchantment:§c" + args[0]);```
are you testing your args.length?
testing??
Do you check there are 2 args in teh command that was entered?
if(args.length == 2)
ohhhhh right.. thanks for helping me
show the actual OpenGL code you are trying to use colours in
public static void drawRoundedRect(int x, int y, int width, int height, float radius, int color) {
float f1 = (color >> 24 & 0xFF) / 255.0F;
float f2 = (color >> 16 & 0xFF) / 255.0F;
float f3 = (color >> 8 & 0xFF) / 255.0F;
float f4 = (color & 0xFF) / 255.0F;
GlStateManager.color(f2, f3, f4, f1);
drawRoundedRect(x, y, width, height, radius);
}
wierd ordering.
but it has 4 entries which means it has an alpha channel
f1 "should" be the alpha. 0.0 would be opaque (visible)
GlStateManager.color(255.0, 0.0, 0.0, 0.0); - red
from a quick glance at that math it seems to be reversed
so 0x00FF0000
Not really awake but try 0xFF00
nope
what did FF00 do?
invisible
what about 00FF?
is this your method, or one you've taken from Forge?
Because that math looks so wrong
public static void drawRoundedRect(int x, int y, int width, int height, float radius, int color) {
float f1 = (color >> 24 & 0xFF);
float f2 = (color >> 16 & 0xFF);
float f3 = (color >> 8 & 0xFF)
float f4 = (color & 0xFF);
GlStateManager.color(f2, f3, f4, f1);
drawRoundedRect(x, y, width, height, radius);
}```This should accept 0xFF0000
how can i set an entity's health in the EntityDamageEvent ?
setHealth(Double)
sethealth isn't an available thing
would i have to check if the entity is damageable before setting health then?
idk but intellij says it cant resolve method "setHealth" in "Entity"
@EventHandler
public void onDamage(EntityDamageEvent event) {
if (event.getEntityType() == EntityType.PLAYER) {
if (event.getEntity().getWorld() == Bukkit.getWorld("lobby")) {
event.setCancelled(true);
event.getEntity().setHealth();
}
}
}```
now my other colours are messed up
also didn't work
test if instanceof Damageable, cast and you have setHealth
yeah uh
didn;t work? what did it do?
made it invisible also made all my colors black
if (e instanceof Damageable) ((Damageable)e).setHealth(...)
does e = event or entity
entity
well if you already use that method for other colors you can;t change it
how are you calling it with other colors and its correct?
DrawUtils.drawRoundedRect(this.x, this.y, this.x + this.width, this.y + this.height, 1, this.color);
yes
Oh ok, still not awake. I forget its floats. 1.0 is max, thats why its divided
So GlStateManager.color(1.0, 0.0, 0.0, 0.0); should produce red
the method is accepting ARGB
which means I don;t see why its not working with 0xFF0000
like 0x7EFF0000 should be a faded red
try 0xFFFF0000
that should be a transparent red
if not they have teh alpha inverted
then you have to provide an alpha of 1.0, so FF
weird
0x ARGB or 0xFF + R + G + B
also do you know why I am missing the music assets?
I have that?
you just have to prefix any RGB with FF
yes, but you have to provide that in your hex
yea
oh okay bump 🙂
no clue. Didn;t really know what you are doing
Somethinh like skinning a client using Forge
they are taken from bitmaps so don;t scale well
I can see that
I can't find a shaded white you got one?
google is pretty useless right now
FFFFFF is full white, so add whatever alpha youwant on the beginning
4?
if you want full on white yes 0xFFFFFFFF
what if I don't
white is the presence of all colours, black is the absence of all
shaded
Anything where the R, G, and B components are equal will be grayscale
so to move it towards grey reduce all three colours evenly
F0FFFF
a better one https://rgbacolorpicker.com/
anyone know how to rotate falling blocks left-right
velo?
FallingBlocks are entities so you can set their yaw
setRotation
@eternal oxide did not know that existed
thanks
is there a way to have them inherently turn around by themselves with NMS
or am i just going to have to resort to a scheduler
FallingBlocks have no AI so you would have to do it manually
i see, thank you
What's more efficientRuntime.getRuntime().exit(); or System.exit(0);
if you don;t care about file locks or corrupting data the first, if you want a clean exit the second
ok cool
The first will exit instantly. It will not wait for anything to finish
Sounds like task manager end button
worse
how could it be worse
If you use it you better not want to open that application again
odds are 50/50
its great if you are running docker or somethign and just want a quick exit
kinda wanna test it
does System.exit(0); save?
How to play a sound when the player hits someone with an arrow?
yes
ProjectileHitEvent call a Player.playSound or World.playSound
Can I call files from the minecraft.jar if I have the Key/Namespaced Key for them?
wym
I'm trying to call a loot table so I can read the items in it as Strings, and so far I've used
LootTables.ZOMBIE.getLootTable().toString()``` to get the Key for it. Can I access the loot table as a String/JSON file using this key?
That's not exposed in the API. Shouldn't really be accessing the JSON file for it. No reason to
How else can I view the contents of the loot table?
Do you mean no reason to as in "there is another, easier way"? Or as in "there is no method to, and you shouldn't be doing it anyways."
Loot tables are random and depend on various things
Its content isn't a simple concept
You could fill a dummy inventory and check its contents that way
But again, contents can change
I thought loot tables had values in them, back when I tried doing datapacks/custom entities using command blocks.
It usually has multiple items, then a weight and drop count. The game then uses that table to determine the loot with a random seed. I was hoping to read the file that contained the weights and drop counts.
Something like this.
Asking about your attempted solution rather than your actual problem
I'm currently trying to make a plugin that can read loot tables on the server by using /command (loot table name here) to view the loot table in an easier fashion, using inventories to display the items with names and lore based on their weights and drop chances overall.
Most of it should be if statements, math, and for loops, but this is the part that is really getting me tripped up.
I think you'll find it more involved than you expect, there's a lot of different functions
But you'd have to read the file from the jar
Same way you read any file in a jar, getResourceAsStream
Thank you, that really helps.
I'll be sure to mess with it more tomorrow and to read up on the JavaDoc.
If all goes well, hopefully some actual progress can be made :)
I really like this btw thank you.
does anyone know hwo to set an NMS falling block's type
afaik you can't change it once it's been spawned
Thus why the API doesn't support it
i meant when spawning it
ive actually got smth
might work
ill post it if it does 🙂
Why are you spawning it with NMS?
Just spawn it with World#spawnFallingBlock
And if you really need NMS, you can just get the entity's NMS handle after you spawn it with the spigot API
@waxen plinth i want it to be immune to being moved
if im not wrong if you spawn it in normally and set it to nogravity its still affected by explosions and what not
super(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY(), loc.getZ(), iBlockData);
WorldServer craftWorld = ((CraftWorld) loc.getWorld()).getHandle();
this.setPosition(loc.getX(), loc.getY(), loc.getZ());
craftWorld.addEntity(this);
}```
ive got this but it just despawns instantly
I don't see why you would need NMS for that at all
why wouldnt i need nms for that
Because you can set the velocity of an entity
is there something in spigot that prevents any sort of movement
You could just literally set its velocity to 0 every tick
yes but if it gets hit by a powerful explosion i dont want it to move at all
i would rather not use a scheduler every tick for it 🙂
How do you expect to do it with nms
just cancel the movement
You could set it to be riding an invincible marker armor stand with noAI and no gravity
Marker armor stands do not have a hitbox
You can call setMarker(true) on an armor stand
It makes it invisible and have no hitbox
1.9 I think?
are you able to rotate these?
im not sure if im doing it wrong or if they just cant be moved
Just clearing something up. Setting an armor stand as a marker still has a hitbox. It's just 1 pixel and doesn't get touched by anything.
Shouldn't be able to as it's just a "marker"
But if you show hitboxes using f3+b you can still see its hitbox
ill take a look
more important im trying to rotate it
but it wont work 😦
this.stand.setRotation(this.stand.getLocation().getPitch() + pitch, this.stand.getLocation().getYaw() + yaw);
}```
Need to teleport
Marker stands do not move
oh really
Why would they
They're meant to be markers
As in, mark this location
It doesn't move, it can't be interacted with
Why would you need to rotate it?
cosmetics!
looks ugly just floating there as an indicator
well ordinary falling blocks definitely can't rotate
md5!
I don't remember, but you can definitely set the stand to be invisible if it's not invisible already
armor stands can on the other hand, so it seems like your initial idea wouldn't work anyway
yeah i learned they cant move just now
I don't get what you're trying to do
Why don't you just remove the entity from the explosion damage event?
Make a falling block that can't move... but also moves?
@stone sinew could do, was just trying to see if it could be done easier
Easier than a scheduler setting velocity to 0
yea, like just make it so it cant move from external forces but can rotate, but i guess now that ive tried it ive learned that wont work
the blast event? yeah
Yeah falling blocks can't rotate but you can set falling sand as the head item of an armor stand
I'm not sure if armor displays on marker armor stands
But at the very least you can still make them invisible
so dont add the block as a passenger but as a helmet
ohhh TRUE
To my knowledge you can also make minecarts that hold blocks with an offset
i think you can yeah
I think so. Check to see if there are any velocity change events to see if you can narrow it down.
I'm not sure the spigot API has support for this though
declaration: package: org.bukkit.entity, interface: Minecart
i believe its gonna be a challenge to find it but i think down the track ill look for it bc honestly the more directions you have the cooler it looks
setDerailedVelocityMod() probs
setDisplayBlockData(BlockData blockData)
Sets the display block for this minecart.
void
setDisplayBlockOffset(int offset)
Sets the offset of the display block.
Oh perfect
gonna do that now tbh
That sounds like exactly what you need
hide the minecart and the block will still be visible i assume
my whole idea has been transformed into something better 😅
Not sure if the invisibility potion effect applies to minecarts
But if nothing else works you could always have them be under bedrock with a high offset on the block they're displaying
i didnt know that was how it worked, so you can offset the block thats inside of them? thats pretty interesting
this game is so intricate
How can I detect when a player adds a new item to their offhand?
Like from the inventory or something
Preferably getting the old item too
look at the inventory events'
it seems materialdata is deprecated in many ways
is there a new way to create material data
trying to do
this.cart.setDisplayBlock(type.getData());
(cart is minecart entity and type is Material)
tells me to cast it to materialdata but its deprecated
i guess thats just the way to go
might be version dependent
there are two methods. One takes MaterialData, the other take BlockData
try using blockdata if it supports
with --remapped I belive
Hello, how to make bossbar line hide bar only show text
might be a resource pack
Im not positive that you can do that
I am dead certain monitors like these only exist for programmers that refuse to break lines
get three of them together and you will never have to scroll laterally again
breaking lines looks messy 😄
I'm going to just keep buying these until I can see my entire codebase on a single line
infinity desk
😮
set up webcams to track where you're looking
fair
that way if you keep spinning on your chair it keeps going sideways
there's a bug 40 spins counter clock-wise
how did you find my mad max throne
XD
which a chair that large you'd think the computer case could fit inside the chair
it's clearly not hollow
i could make it hollow!
because thats where you hide your deep web hard drives from the FBI
no you hide those inside the wall
then only connect to that pc via wifi
on your local network
those monitors are made for those guys that like to put texture data as a hardcoded string
so me
and me
flip it vertically and you'll love your new discord experience
I feel personally called out
nah I do it too
I don't get that at all
but then again it's a 4k monitor so it has all the space it needs
and then some
Finally, the power to see the entire line for my AbstractEntityFrameworkControllerProviderFactoryManagerBuilderPipelineFixture
one more
that guy must make 130k a year
Oh god
he's an efficient programmer
he even skipped his github pfp because that's a waste of time
username? punches keyboard
I don't like pfps
lmao wtf
i want to make a plugin for me and my friend, so we can change our in game names. Idk how to do that, what are the basics for a plugin like that?
can anybody help i want to create a text channel on disocrd through which we can read and message in minecraft server
Just use discordsrv it already has this.
Make a command -> call Player#setDisplayName (might be a diff method I haven't used spigot in a while)
thx i will try but i am not good in this
Is there a plugin that make nametags always behavior like you sneak when you sneak and when you not sneak
Okay
?paste
any tips for saving a bed's state, destroying both parts of it then resetting it
Bed is Directional. you can getPart on each section to find the other half. Just Store the BlockData for each half.
any help on this? i still cant figure this out
I want to start learn java any tips where to start?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
lol
Thx
they have a Discord server https://www.spigotmc.org/resources/discordsrv.18494/
i figured it out - I sentPacketPlayOutEntityMetadata before PacketPlayOutNamedEntitySpawn
so i kinda changed the skin layer before i made it visible
Anyone know the undepricated methods for playeritempickup event?
Cause at the moment I have this and it doesn't add a lore to the items on pickup, and as I am typing this I think I know the issue is that I am not calling .getworld and .getserver
package me.Teric7.rarities;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
public class rarities extends JavaPlugin implements Listener {
@SuppressWarnings("deprecation")
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
ItemStack item = new ItemStack(e.getItem().getItemStack());
ItemMeta itemMeta = item.getItemMeta();
Player player = e.getPlayer();
ArrayList<String> lore = new ArrayList<String>();
lore.add("§8");
if (e.getItem().getItemStack().getType().equals(Material.DIAMOND_SWORD)) {
lore.add("§e§lRARITY: §b§lCOMMON but in blue");
} else {
lore.add("§e§lRARITY: §f§lCOMMON");
}
itemMeta.setLore(lore);
item.setItemMeta(itemMeta);
player.getInventory().addItem(item);
e.setCancelled(true);
e.getItem().remove();
}
}
@shadow skiff read the docs
the docs will always tell you the alternative to a deprecated method
Idk i always preffered using the discord oficial jda than the plugin..
I feel like its better in term of what you can do
I don't think they know java. They couldn't even Google the spigot page
how i active command block on my server ?
Ok thanks
Hi there, I appreciate that NMS is advised against now but I have a need for it; disabling ArmorStand's gravity without disabling it's velocity.
Can anyone tell me where CraftBukkit is hosted so I can add it as a maven dependency, or how I can add it as a dependency in a pom.xml?
I know an alternative is teleporting the armorstand every tick, but I'd like to explore this option too ^
Gravity is... velocity?
CraftBukkit is in Spigot. run BuildTools to add it to your maven local
Don't ask me, I don't make the rules stellrow lol
how i get beutiful server hud ?
Can someone help me in #help-server
Ty, just had a look at BuildTools again and noticed I need to include --compile craftbukkit now
i have this in my pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <outputDirectory>/pickle/dodo</outputDirectory> </configuration> </plugin>
but i get this error ```Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar (default-jar) on project picklestring: Error assembling JAR
How can i get mapView of a map inside an item frame?
Just trying to get NMS working still
On compilation, I get this error:
cannot access net.minecraft.world.INamableTileEntity
My pom includes (without error):
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--Bukkit & CraftBukkit-->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>```
Am I missing something? 😄
check the #announcements forum post. You need to run BT with --remapped
Oh ty, I thought when they said it was no longer included it wouldn't be. Does that just mean it isn't included if you don't use --build craftbukkit ?
you just build spigot. It has CB and Bukkit
ty, apparently i've misunderstood the changes to be way more complicated than they actually are
hey does anyone know how to replace block into air
package main;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockEvent;
public class blocks_replaced implements Listener {
public void block_changed(BlockEvent event) throws InterruptedException {
Block block = event.getBlock();
Material material = event.getBlock().getType();
if (material.equals(Material.SLIME_BLOCK)){
Thread.sleep(10000);
}
}
}
wrap code in three `
i am sorry i dont understand
put three ` before your code, and three more ` after
It creates a code block and makes it readable
in Discord
as for your code, you can;t listen to BlockEvent its an abstract class
and you can;t use sleep or wait on the main thread
oh k thank you
all of the subclasses are events you can listen to https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockEvent.html
Hi sorry, now getting failure to find org.spigotmc:minecraft-server:txt:maps-mojang:1.17-R0.1-SNAPSHOT when remapping when building.
^ That file isn't in my local maven repo either. If anyone can send me that txt file it'd be a great help. Ran BuildTools again, still not appearing (with the --remapped as well). Thx
can someone help? i made a custom crafting gui thing but there's a lot of bug to be fixed, pls help
code: https://paste.md-5.net/radiqexewi.java
bug 1: it doesn't set the result item when i put a correct recipe unless i click on an allowed slot / the result slot
bug 2: when i do click on an allowed slot / result slot then take the result it doesn't remove 1 item from each slot for a second (it's for a second intentionally for testing), then it puts the result in the result slot again
there might be more bugs that i haven't found yet
bug 3: it seems that one recipe does not require clicking on an allowed slot / result slot but the other one does?
public class BlockToAir implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Block block = event.getBlockPlaced();
if (block.getType() == Material.SLIME_BLOCK) {
block.setType(Material.AIR);
}
}
}
Something like this should work
may be
if (block.getType().equals(Material.SLIME_BLOCK))
?
Well i mean, pretty sure either or works
What do you mean exactly
class Class1 {
public String name = 'n';
}
class Class2 {
public String myname = //here i need get a field name from Class1
}
in Class2 i get to get filed "name" from Class1
Yes
Though it’s called that you need to pass an instance from one class to another
And that brings up the point what the notion of an instance is
Conclureeeeeeeee
Itzzyaa helu
Hmm
Yes yes yes
I need to get some breakfast first then maybe
Okay ConclUwUre
Stop lol
😂
use == to compare enums, don't use thread.sleep that will block the main thread why is that even there, you need an EventHandler annotation, use BlockPlaceEvent or BlockBreakEvent
whoever named themselves event I am sorry for pinging
Someone knowing, why the points are sorted that way?
Thats my query: "SELECT stats, JSON_EXTRACT(stats, '$.points') AS points FROM RageMode_30d WHERE month='SEPTEMBER-2021' ORDER BY points DESC LIMIT 10"
@charred wind is points being treated as a string for some reason?
No, ENUMS are compared by ==
in the json it is a integer
yo since when can signs be lit
also I can't find the 'lit' value when looking at a sign in game
1.17 iirc
im in 1.17.1
I mean I figured out how to do it but it still doesn't show up as 'lit'
and I can't /setblock a lit sign
because it isn't a blockstate
rather NBT
idk what wiki that is
but it should be part of the signs NBT
hmm yea ig but wiki lists it as block data in the same list w rotation, waterlogged etc
which do show up
Probably the json_extract function is not returning integers, then. Maybe it returns a string or JSON data type?
can anybody tell a plugin through which we will not able to see player nametag
I should think so. There is a CAST function you could wrap it in, to turn it into an unsigned or whatever
how would that look?
Why does this if (i == Gui.powerMiner) {
result in false, even though when ever you open the GUI it is being set up in the Gui class like this:
Google is your friend there 😁
help me pls (1 more bug below that message)
is there a way to make tnt do no environmental damage when you spawn the tnt primed or do i have to listen to the explode event?
Hi do you know if there is some ByteBuffer builder in java that would work like this ?
SELECT stats, JSON_EXTRACT(stats, '$.points') AS 'pointsString' FROM RageMode_30d WHERE month='SEPTEMBER-2021', CAST(pointsString AS int) AS points ORDER BY `points` DESC LIMIT 10 I've tried it like that, but it doesn't work.. any idea?
Bump, if anyone's able to get me this file or tell me where to get it. It didn't appear when I ran buildtools :).
Context: 1.17 NMS, remapping using pom & the example pom from the 1.17 announcement post
Fix: update pom to use 1.17.1 everywhere, not a mix of 1.17 and 1.17.1
I would wrap the cast around the json_extract, something like CAST(JSON_EXTRACT(stats, '$.points') AS UNSIGNED INTEGER) AS points
Or there might be a json_value() function - I don't know what dB you're using
https://www.spigotmc.org/threads/free-code-sending-perfectly-centered-chat-message.95872/ How many pixels do I need to use for the scoreboard line?
How is it people make treecutter plugins
Where you hit the bottom part and it takes out the whole tree
mysql
it works, thanks, very much!
Awesome! No probs!
They recursively remove adjacent tree blocks
help! (pls)
Flood-fill algorithm
?paste
@eternal oxide remember the problem from yesterday? It was easy: I was just looking at the default config, and NOT at the user made config
Okay really stupid question, but how do I make so a class is serialised (via the java serialisation API) as another class. More specifically I am extending java.util.Vector (in the name of "performance") however I want to keep fully compatibility with the old system, which made use of the unaltered java.util.Vector class. I've been thinking that having something like
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.writeObject(new Vector<>(this));
}
would work, but apparently it does not and yields
java.lang.ClassCastException: cannot assign instance of java.util.Vector to field de.geolykt.feedbackvectors.collections.IdentityLookupVector.lookupMap of type java.util.Map in instance of de.geolykt.feedbackvectors.collections.IdentityFeedbackVector
even if the class is present (if the class is not present it results in a CNFE). Would I need to extend the ObjectOutputStream here or is there a simpler approach?
Take a look at Externalizable
https://docs.oracle.com/javase/7/docs/api/java/io/Externalizable.html
Wait im not sure if i understand your problem.
hm, yea, that might work. Surely didn't test that one
Probably not what you want. The class identity is always serialized by java. Im not sure if you can serialize the bytes of one object to another.
ah.
yep, Externalizable doesn't work. I guess I'll need to do some more hacks and extend the ObjectOutputStream
Why do you want to use the java serialisation API anyways?
And why cant you just deserialize the byte stream to your own Vector class?
well, I need to to be able to be compatible with a protocol that someone wrote that used java serialisation
I really dislike the API, so if I had the choice I wouldn't use it
Oof...
Hello, I created a method that is supposed to remove all swords until there's only 1 left but I realised it doesn't work. I'm having some trouble finding out what I'm doing wrong, could anyone help me? ``` private void removeSwords(final Inventory inventory) {
for (int i = 0; i < inventory.getSize(); i++) {
final ItemStack item = inventory.getItem(i);
if (item != null) {
final boolean isSword = item.getType().name().contains("SWORD");
if (isSword) {
final boolean inventoryContainsSingleSword = inventory.contains(item, 1);
if (!inventoryContainsSingleSword)
inventory.remove(item);
}
}
}
}```
- Get the number of swords in the inv
- Iterate like you do
- Set index to
nulland decrement the number until i reaches 1
Your current approach iterates the inventory quite often (inventory.contains).
The one just proposed only exactly twice.
Ok thanks a lot for the help, I'll try it out.
This should have an even better performance
public void removeWithPredicateUntilAmountReached(final Inventory inventory, final Predicate<ItemStack> predicate, final int amount) {
Preconditions.checkArgument(amount > 0);
final int size = inventory.getSize();
final Deque<Integer> matchingSlots = new ArrayDeque<>();
for (int i = 0; i < size; i++) {
if (predicate.test(inventory.getItem(i))) {
matchingSlots.add(i);
}
}
while (matchingSlots.size() > amount) {
inventory.setItem(matchingSlots.poll(), null);
}
}
does anyone know?
Using scoreboard teams, you can add players to a team and set the nametag visibility to never. Or just set the name to ""
i cant do that on 1.7, i tried but the methods dont exist
AAAahaahahah. You must be joking. You mean 1.17, right?
xd
Right?
Wow... You know that this version is ancient and you wont get any support for this anywhere.
Look into NMS and reverse engineer the code or dig in old forum posts. Usin 1.7 is just seriously masochistic.
That packet didn't exist on 1.7 Gotta find the one that did.
should i use nvms? its possible to get armor stands in 1.7 so im sure it will be possible to hide the nametags in that version
Finding these ancient versions is hard
ok
armor stands are 1.8
Its possible to get them into 1.7
nope not without mods
No. The client doesnt know they even exist and neither does the server.
similar to how holo displays patch achieved this it is possible
This has nothing to do with armorstands.
it does, it spawns a armor stand if the player is 1.8
or horse if player is 1.7
ok but thats still not armor stands in 1.7
But a horse is not an armorstand. Its not possible to get armorstands in 1.7
yeah just it is possible to spawn them in though
No its not
through 1.7, not in 1.7
You can always write a packet and send it to a client. Even if you are in 1.2.5 you can technically spawn the wither for a 1.13 client if you just send the right bytes to the client.
That doesnt mean it is actually spawned. Just that the client thinks it is.
yeah
Hello, I have question with spigot. I'm now setting up CI for plugin development and I want it to fail when there's exception happens
is it possible to change mobs ai in spigot for example i want to make a cat have a baby zombie ai
oh i found it out, spawn a horse and set the health to -1700000
and it will display as a armor stand
Pretty sure you cant do that with the API. NMS is needed here.
Compile time exceptions?
Can I change the way spigot handles exception from plugin?
oh k thank you so much
String a = null;
a.equal("asdf");
I want it to fail when I do that
I see NPE on log
oh and i am sorry what is NMS
Right now CI only compiles the plugin
Have you tried Thread#setDefaultUncaughtExceptionHandler? As almost everything just runs on a single thread.
And unit testing is not an option?
can i use hex color code in setPixel instead of MapPalette ?
It is option, I just didn't know how to do it
Another thing you could take a look at.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/plugin/PluginLogger.html
declaration: package: org.bukkit.plugin, class: PluginLogger
For unit testing:
https://github.com/MockBukkit/MockBukkit
thank you
how to use byte color ?
is it possible to remove this speed limit? when I sprint & jump on a pressure plate (launchpads plugin) I get too fast and i get a teleport bug in game and this warning in the console: https://romano.eats.dog/7mSZ1pAz
do you guys know by chance how to make a good scoreboard for the server
Hey guys im making a blockparty plugin, tho i would like to set the block as a sort of a grid instead of them being completely random but i really don't have a base and don't know where to start, as anyone got an idea? I got two corners that represent the size of the "terrain" the Y is always the same due to the terrain being only 1 block tall
What is blockparty?
like musical chairs but you have to get on a specific block in time before all the other blocks disappear
yep
the game works great, tho i would like to achieve patterns, them being smaller and smaller everytime
If there is someone who writes World Generator for a fee, can they contact me?
I think this might be the solution, thanks for the support
npc.getBukkitEntity().setCustomNameVisible(false);
Would dripstone growth be BlockSpreadEvent or would it just be BlockGrowEvent? Or BlockFormEvent? or something else?
i install nms and change the api but it still dosent work
What pattern do you want? Just a circle or rectangle?
Hey! When compiling I suddenly get this error. Anyone know how to fix?
This is how i registered the command
Does your DoomWand implement CommandExecutor?
It does
Do you use maven?
hey i made an object named handcluffs and i set its meta when im executing command handcluffs and it gives me default tripwire_hook not the meta one
So how comes my own abstracted interface that implements bukkit's mob fails to compile with this error?
It is not interacting with a vanilla entity at all
Make sure spigot has the scope provided
I removed the onCommand and pasted it back in and now it builds.. Weird
Just to be clear: You implemented org.bukkit.Entity?
No, org.bukkit.Mob
Hi, I am trying to do command "/god" but something went wrong. Who could help me with that?
Set the meta back to the ItemStack.
Just to be in the picture: Do you fork Spigot and are trying to add a new interface for API level usage?
No, this is just a additional library I am creating
I have created a new vanilla entity that I am abstracting through this interface for a actual plugin to interact with
And no, it is not a modded entity, as far as the client is concerned, it is a pillager
Ok but your NMS entity does not implement Pathfinder. Right?
No, I have created a proxy spigot entity named CraftPathfinder which extends CraftMob, implements Pathfinder and holds a PathfinderMob handle
Ah ok good
List<String> testlist;
testlist = Arrays.asList();
testlist = Arrays.asList("1","2")
someitemmeta.setLore(Arrays.asList("test","test1",testlist);
^^
the code above is an example
and the last line outputs me the following error:
The method setLore(List<String>) in the type ItemMeta is not applicable for the arguments (List<Object>)
Anyone knows how to fix that ? or help me to
?paste
is there anything wrong?
So why is it complaining about poses
For me this looks like some NMS class is trying to implement a Spigot interface. The NMS class has a private getPose() method and the interface
ofc has a public one. This causes a visibility problem.
But the pathfinder interface is in no way related to the nms entity object
Do you call your constructor somewhere?
no
What does your NMS class look like in terms of inheritance?
Including imports
Hi !
Does someone know a good tutorial to create my first plugin with visual studio code ? (i've search and i only find tutorial with eclipse)
Then the code inside the constructor is never run and the meta is never set.
cause i don't have much space on my computer
i have to install eclipse
visual studio code is on my pc because i need it
for other works
so if i install eclipse it will be VS Code + Eclipse
Eclipse doesn't really require that much disk space, if you're running out already you should get more space.
You're just delaying an inevitable problem
I dont even see net.minecraft.world.entity.Mob as a class...
yeah i know but i also prefer to use VS Code cause i use it for many other things
It is
and i know it's possible to do a plugin with it
Mojang Mappings I assume
but i don't find good tutorials
Probably because most people don't use VSCode for Java.
Ah i see
Like datapacks in minecraft and Bots in discord
thanks i did it and now i know constructors better
Is js = java script ?
Yes
bump!
and when writing .toString() next to it, all the lore becomes shrunk in 1 line
Aren't Datapacks basically just text files?
no

Sure. But rarely any people use vscode for java. You need to search some tutorials for that first then write a bit of java code and after that you might be able
to write a spigot plugin.
I am using mojmap, indeed
Otherwise working with NMS is basicially impossible
they are Json and Mcmeta
is minecraft client based on ticks. What if i create other thread that send packets to client faster then 1/20 sec?
oh
ok
Hey sry but i dont see any problem unless there is some nms class implementing a Spigot interface.
How does your CraftEntity look like?
Those are basically just text files, pretty much any IDE can open and write to those 😄
Packets are handled by netty. You can send as many as you want but they get processed in batches.
Vatuu what are you trying to do?
I am creating a abstract pathfinder entity for custom mob ai
Vanilla goals are not suitable for what I need
meh ;/
You can make custom goals by just extending Goal and overriding the methods.
But the client explicitly requested that the entity is compatible with existing spigot wrappers
The very structure of vanilla pathfinding does not fit
?paste
I am replacing the entirety of the vanilla entity's path generation and controller
Ah
CraftMob already implements Mob.
unless you can tell me how to make a mob clear and jump gaps like a player
But that should be fine in my head...
Doesn't matter, multiple implementations are no problem in java
https://paste.md-5.net/kaciyogama.coffeescript i have this code i want player to open other players' inventory with that item. And while player clicked entity with that item i set Clickedentity's walk speed but i want to reset clickedentity's speed after closing the inventory how can i do that
Do you have a static getPath() method somewhere? (Im guessing at this point)
nope
The only static methods in this context are the spawn method and the verification if it can reach a location
There has to be either a static and/or private/protected method which is clashing with the interface method of Entity.
I dont see any other logical explanation.
Listen for the InventoryCloseEvent and use the PDC of the player or a hash collection.
what is pdc
im beginner
.
Ill write you an example of how i would write a simple cuffing system.
private static final String CUFF_TAG = "__CUFFED__";
public static void setCuffed(final Player player) {
final Set<String> tags = player.getScoreboardTags();
tags.add(CUFF_TAG);
}
public static boolean isCuffed(final Player player) {
final Set<String> tags = player.getScoreboardTags();
return tags.contains(CUFF_TAG);
}
public static void unCuff(final Player player) {
final Set<String> tags = player.getScoreboardTags();
tags.remove(CUFF_TAG);
}
@EventHandler
public void onMove(final PlayerMoveEvent event) {
final Location from = event.getFrom();
final Location to = event.getTo();
final Player player = event.getPlayer();
if (!this.isCuffed(player)) {
return;
}
if (from.getX() != to.getX() || from.getY() != to.getY() || from.getZ() != to.getZ()) {
event.setCancelled(true);
}
}
I used a bit more static than i normally would to make it simpler to use.
But generally you would want a way to check if a player is cuffed or not and then react on that somehow.
this reaches me sry
Make sure to check if the player is being moved or is trying to move in PlayerMoveEvent other wise this will cancel them moving at all.
I think so
not spigot
paper
No idea what you mean
lol
How would i check the initiator of this event?
IDK might have to do some hacking thing. Was thinking check for the player that is making them move (The one that cuffed them) and add them to a map.
Hm. I think listening for incoming move packets of the cuffed one is probably a solid approach.
Yeah. Just gotta worry about performance
Hi Guys, for some reason using nuvotifier on two plugins the vote event is not fired on latest bungee. Is something broken?
you can see the debug log of the vote received but nothing is fired
InventoryHolder will never be an instance of Inventory
Idk what you are trying to accomplish with this check.
But remove it
You cant check if a player opens his own inventory
Not possible
Even in huge plugins i rarely have more than 10 eventhandler methods. This is def not the way to go.
Hm. Couldnt you build a PlayerInventoryOpenEvent by using a custom achievement like the vanilla "Taking Inventory"
one and then revoking it afterwards?
Events would be your best bet. A scheduler for every player can get pretty laggy.
plz
@dense goblet, GodCipher, 7smile7 thank you very much for helping me in develop piano
plugin. Here is video of MidiPlayer test https://streamable.com/htvlnz
Now that's cool

Could maybe have a loose schedule, where the schedule simply adds a task to a queue to perform in small portions whenever it has the opportunity.
Then you have to worry about timing. So he's doing bingo so what if someone gets bingo first but their task doesn't run till after someone elses.
So instead of saying "At exactly 2:00 PM, not a second earlier or later, you need to immediately drop whatever you're doing and start doing this thing", you'd be saying "Hey, starting at 2:00, would you mind checking this thing whenever it's not too out of your way?"
Well if you're also using Events, they could compliment eachother.
So it's like the equivalent of glancing at somebody's cubicle as you walk by on your way to do something else.
As opposed to actively going in and thoroughly searching every person's cubicle.
ayyy nice!
if you're trying to implement custom functionality (custom items, custom blocks) then unfortunately you do need to have a lot of event handlers to intercept vanilla behaviour
unless you have a custom core that allows you to register new items and send them as vanilla items to the player
InventoryMoveItemEvent?
Any one good with custom pathfinders? I did my first one, But doesn't seem to work 😂
I just need one single listener for custom items which activate by interaction
public class CustomItemManager {
private static final NamespacedKey INTERACTABLE_KEY = ProjectRevenant.asNameSpaceFor("custom-interactable");
private final Int2ObjectMap<Consumer<PlayerInteractEvent>> interactableMap = new Int2ObjectOpenHashMap<>();
public void registerInteraction(final String key, final Consumer<PlayerInteractEvent> eventConsumer) {
this.interactableMap.put(key.hashCode(), eventConsumer);
}
protected void handleEvent(final PlayerInteractEvent event) {
final ItemStack itemStack = event.getItem();
if (itemStack == null) {
return;
}
final ItemMeta meta = itemStack.getItemMeta();
if (meta == null) {
return;
}
...
Some more logic inclduing PDC stuff
And my Listener is literally just this
Is there a clone method for lists?
private List<String> list = new ArrayList<>();
public List<String> getList() {
List<String> listClone = new ArrayList<>();
listClone.addAll(list);
return listClone;
}
```This is what I am currently using.
private final List<String> list = new ArrayList<>();
public List<String> getList() {
return new ArrayList<>(this.list);
}
Will that clone it so the initial list won't be affected by the changed list?
yes new ArrayList<>(your_list) will do the trick
Yes. This is the proper way to provide the content of a wrapped collection so that changes are not reflected on the original collection.
Seems not 😭
^^^ is for you to xD
for blocks I need to intercept any events that change the state of the world (block mined, exploded, changed by entity, burned, moved by piston, etc etc etc).
For items, I have to listen for:
-player interact event
-player interact entity event
-block place event (so you can place custom blocks using corresponding custom items)
-item held event
-player logged in event (to update custom items in their inventory in case their stats changed)
and to stop custom items from being used inappropriately (e.g. using steel as netherite in the upgrade table):
-inventory click
-inventory drag
-inventory move
and for custom recipes and disallowing custom items to be used as substitutes for vanilla items:
-prepare item craft
-furnace burn event
-furnace smelt event
Yes sure for protection and block related interactions you need to implement a lot of listeners for different events.
I was talking about implementing multiple listeners for the same event.
ahh I see
yeah I don't see the need to listen to the same event more than once unless it's a clearly different purpose
e.g. in my item events class I listen to FurnaceBurnEvent to stop vanilla furnaces burning custom items, while in my world events class I listen to FurnaceBurnEvent to stop custom blocks, which use the furnace as their model, from burning any items.
So it appears the getPose() method in the nms entity and in bukkit's entity conflicts
Which I find weird, because the actual nms entity never touches any bukkit interfaces
is there an event for when the server starts?
No. The onEnable() is called when the server starts. If you want something earlier then use the onLoad() method.
Hey, I'm trying to get a world with Bukkit.getWorld in the onload method, seem like worlds aren't loaded yet which result in an NPE, is there any other way to handle this without having to put my method in the onEnable ?
Depends. What are you trying to do?
How would I go about making a BlockBreakEvent or similar drop a different item than the harvested block? Or a custom item
BlockDropItemEvent
you can only remove drops there
or you can cancel teh break event, set to air and dropItemNaturally
Then just get the world from there and drop an item at the broken blocks location.
yep
ok thx
I don't understand this, how is the nms entity attemping to implement the bukkit entity interface
BlockDrop Item is probably best as you leave all the tests to see if it can be broken to other plugins
I'm creating a Location from config values
you just deal with the drops
should i cancel it first then set the block to air or otherway round?
It usually doesnt. CraftBukkit wraps the NMS entity like you did.
if you only want to change the drops do as 7smile7 said, use BlockDropItemEvent, cancel it and drop the item yourslef
Yet it clearly does somewhere
I would use the BlockDropItemEvent instead of BlockBreakEvent
Otherwise this would not be a problem
But I don't understand where
This seems to be something the ide should catch onto
Do you get a compile time exception or runtime? Should be compile time and the IDE should catch it.
[INFO] -----------------------< dev.vatuu:pathfinding >------------------------
[INFO] Building Pathfinding 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ pathfinding ---
[INFO] Deleting C:\Users\Vatuu\IdeaProjects\Comissions\Pathfinding\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ pathfinding ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ pathfinding ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 13 source files to C:\Users\Vatuu\IdeaProjects\Comissions\Pathfinding\target\classes
[INFO] /C:/Users/Vatuu/IdeaProjects/Comissions/Pathfinding/src/main/java/dev/vatuu/pathfinding/ReflectionUtils.java: C:\Users\Vatuu\IdeaProjects\Comissions\Pathfinding\src\main\java\dev\vatuu\pathfinding\ReflectionUtils.java uses unchecked or unsafe operations.
[INFO] /C:/Users/Vatuu/IdeaProjects/Comissions/Pathfinding/src/main/java/dev/vatuu/pathfinding/ReflectionUtils.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/Vatuu/IdeaProjects/Comissions/Pathfinding/src/main/java/dev/vatuu/pathfinding/entity/Pathfinder.java: getPose() in net.minecraft.world.entity.Entity cannot implement getPose() in org.bukkit.entity.Entity
return type net.minecraft.world.entity.Pose is not compatible with org.bukkit.entity.Pose
[INFO] 1 error
[INFO] -------------------------------------------------------------
Compile time
how do i drop the item?
Why you gotta come into spigot and instantly do some weird stuff like that...
net.minecraft.world.entity.Pose Make sure this is actually on your classpath. Do you compile with
the mojang mapped jar?
Yes, I do
i am not sure how to use the dropItemNaturally event?
Because this ain't my first rodeo, and this is the first time I have issues of this magnitude
Not an event. Just a method you can call.
It literally takes a location and an ItemStack
ye i meant method
This is far from the worst stuff I have done, that would probably be where I modify the network thread to sent armorstand pose Update packets at 60/s
If there is really no nms class implementing any spigot interface then we might have to assume that
the compiler gets confused by the Pose class? Do you have the moj mapped jar and the spigot API as a dependency?
Ok but how do i call it in my event class? e.g.
public void onBlockBreak(BlockDropItemEvent e) {
Block block = event.getBlock();
if (block.getType() == Material.GOLD_BLOCK) {
event.setCancelled(true);
block.setType(Material.AIR)
//call dropItemNaturally method, but how?
...

Don;t cancel the event, just getDrops().clear().
Did you install the moj mapped jar into your local maven repo by using BuildTools?
block.getLocation().getWorld().dropItemNaturally(...
Yes
ok thank you
It must be something related to my creation of the entity
Before I went for the spigot-esque abstraction, it worked fine
Could you send nms, craftimpl and interface again pls?
It doesn't seem to work, it didn't drop the item i wanted it to drop. I made sure that the event is registered in my plugin class.
public void onBlockBreak(BlockDropItemEvent event) {
Block block = event.getBlock();
ItemStack test = new ItemStack(Material.APPLE);
Location blockLocation = block.getLocation();
if (block.getType() == Material.GOLD_BLOCK) {
block.getDrops().clear();
block.setType(Material.AIR);
block.getLocation().getWorld().dropItemNaturally(blockLocation, test);
}
}
Your code will fail as the block is already broken. use getBlockState
kk
use BlockBreakEvent?
no, he;s doing drops
yeah but you can do drops from blockbreakevent
you can but you have to mess with event order etc in case another plugin cancels the event
easier to use the event thats specifically for drops to handle drops
hm, fair point
maybe instead of dropping the item yourself add it to the getDrops?
getScoreboardTags cannot resolve method it says
No you can;t
it says so in the javadocs
not a copy, but not permitted to add
getItems
@NotNull
public List<Item> getItems()
Gets list of the Item drops caused by the block break. This list is mutable - removing an item from it will cause it to not drop. It is not legal however to add new items to the list.
Returns:
The Item the block caused to drop
Still didnt work. Did i work this correctly into my code?
public void onBlockBreak(BlockDropItemEvent event) {
Block block = event.getBlock();
ItemStack test = new ItemStack(Material.APPLE);
Location blockLoc = block.getLocation();
if (block.getState().getType() == Material.GOLD_BLOCK) {
block.getDrops().clear();
block.getState().setType(Material.AIR);
block.getState().getLocation().getWorld().dropItemNaturally(blockLoc, test);
}
}
no thast wrong
you can't use getBlock, use getBlockState in the event, not on the block
oh ok
ye
BlockState state = event.getBlockState();
use getItems() to remove the drops
@lost matrix Found anything?
dude what is this scoreboard thing can u explain
Nope. Makes no sense. Make a new branch and let CraftPathfinder not extend CraftMob but still implement Pathfinder. See if that even compiles.
Thank you finally
Just a Set<String> every entity has.
did you fix yoru clear to use event.getItems().clear() ?
What version are you on?
1.12
if anyones got the time, you know a good tutorial on how to save a hashmap to a file?
I wish you could remove the number every scoreboard line is prefixed as tbh
to yaml? just set it
just config.set(data)? assuming data is the hashmap?
yes
path, map
Sure. If key and value type are both properly serializable
ok thats easier than I thought. was going around looking at custom config files
thanks
If it doesnt work you can always just iterate through the map and save all pairs one by one
Ive got the key as String for uuid.tostring and the value as Location
you will need to save and reload after setting a Map
ye
If not it will be a Map in memory. It gets converted to a MemorySection upon load
not sure what that means, but Ill figure it out 😄
Any idea why my tab suggestion doesn't work? I'm not even receiving the "Test" in the chat while typing.
https://pastebin.com/jK7GWLvU
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.
tried restarting the IDE?
read for 6 times still didnt understand that uncuff, setcuffed, iscuffed things
Why extends BukkitCommand? just implement TabExecutor
I need BukkitCommand for the execute() method. Seems that if I try to use TabExecutor instead of TabCompleter it wants to add onCommand() instead