#help-development
1 messages · Page 1688 of 1
doesnt show up as a thing (not sure how to say this but like it doesnt show up jsut shows as red)
Entity bl = loc.getWorld().spawnFallingBlock(loc, Material.DIRT.createBlockData());
bl.setGravity(false);```
you are using an outdated version
or smthing
im using 1.16
weird hm one sec
Do you mean it flickers for like 1 tick and then vanishes?
no like it stays where it is forever
it falls eventually even if you set it to false
just tested it with vanilla commands, if you dont set a time it just disapears imediatley
so is there anyway to do this?
AN FB shoudl stay for around 5 seconds before it despawns, or touches another block
yeah but i need it to stay where it is forever
you will need to set a runnable to constantly update its location or it will fall
but even then, it will despawn eventually
so theres no other way?
Isn’t that LivingEntity
ill try it
any way to enable normal mode for world.spawnParticle in 1.12 instead of the default force without constructing the packet manually?
?
right now using that method will by default force particles, displaying them up to 256 blocks instead of just locally afaik
in 1.13+ you can configure that behaviour via boolean
tried this, despawns after like 50 seconds ish
Set its age to int min
What is the best way to access Cauldron's BlockData?
I don't see a subclass implementing BlockData made for cauldron
^I'm with him. To expand on this a bit, in Spigot-API-1.17.1 all uses of the "org.bukkit.material.Cauldron" class has been deprecated. As I'm sure you're aware.
The JDocs say to use "blockData" to get the data but it isn't implemented as a subclass so I can't import it. What should we do going forward to get the cauldron block data?
declaration: package: org.bukkit.block.data, interface: Levelled
So... I can just remove org.bukkit.material.Cauldron altogether?
I'm still really new to the Spigot API, could you have a look at my code for me and let me know if it will actually work if I just remove the class? Here is a link |||https://hastebin.com/deduhoqero.swift|||
Well, I've been developing this plugin for a long time. But in terms of what's possible with the Spigot API I might as well be a noob still. lmao
Basically, when you have a fire under a cauldron filled with water and right click with an empty bottle it's supposed to give you "Purified Water"
In 1.17.1 the entire water purification system breaks. Normally, if you pick up water from anything but a "boiling cauldron" you get "Dirty Water" and if you cook dirty water in a campfire you get "Clean Water"
As it stands, you get a normal MC Water Bottle no matter where you collect the water from. It's because a lot of things that worked in 1.16.5 don't work in 1.17.1
If I remember correctly, I use the material.Cauldron class to get the data on if the cauldron is above a fire source or not.
So...this isn't spawning anything.
current.getWorld().spawnParticle(Particle.BLOCK_DUST, current, 15,
hammerRadius, hammerRadius, hammerRadius, material.isSolid() ? material.createBlockData() :
current.subtract(Vectors.up()).getBlock().getType().createBlockData());```
aaand now it is. nevermind.
so, I did "invalidate caches" on Intellij and the plugin is no longer running?
other than that I did not change anything and it was working perfectly before that
the server just never runs it
nothing comes up in console
the plugin should send a message in the "on enable" method, and it was doing that, but not it does not
yeah
I mean... ok
k I'll try that after this
what should be in it
no...
All I see is plugin.yml and LibsDisguises
for some reason it no longer has that
I just checked an older working version of it and that had the files
I already tried invalidating and that did not fix it
for some reason the jar file just does not get outputed with the com file
@sinful egret I just noticed something
at the bottom you see the "target" thing, typically that contains all of the files in the src thing
for mine it does not contain that
why can't they list call
getMaximumLevel() - level internally
font's weird on the javadoc page
alright so
spawning a FallingBlock with the same material as an existing block in the same location...erases the existing block sometimes.
to be clear, I am cancelling the EntityBlockChangeEvent that occurs when the falling block hits something solid
yeah i'm thinking about using entity spawn packets instead, which sucks
They aren't hard
uses NMS though, doesn't it?
not saying it's hard, I just don't want to have to update my shit every time the game updates.
i'm very lazy
ProtocolLib then
is there any forum staff online, something really weird just happened moderation-wise to my account I think
Best way to contact them is email iirc
yep.
would have to do that for everyone in range
What are you trying to do
although it's a bit laggier
huh it says choco is online
he's having some weird block update issue
choco bby pls hear my plea
The most optimized way would be like
You could ping and pray he doesn't kill you 
Didn't work, sadly.
yeah
You can optimize the Player#sendBlockChange method slightly
by making 1 packet instead of <player count> packets
Here's how it works internally
That worked.
yeah
added another check just to make sure it doesn't call unless the falling block and the target block have the same data, since it was only happening in that scenario
thanks for the help!

oh
hey
was about to send the email
this is better
mr choco bring me moderation
What did you break
not my fault this time
can you help me figure this one out
I don't remember responding to spam but I seem to recall answering two questions on the forums yesterday
could you tell me what I replied to that got deleted?
Yeah, in your resource thread for EliteMobs, some guy was spamming the same message on like 30 different resources to get enough messages
Your response was just removed because you responded to him is all. You weren't in trouble or anything ;p
ok so this was retroactively retracting all of his posts?
Yeah just removing his messages because he post farmed
And your message just quoted his
yeah that makes sense, it's what I was thinking too
I also feel like I banned that guy from discord

hard to remember off the top of my head but I seem to remember he was trouble
Hey guys, I'm having an odd error while building. Can someone help me?
/main/java/veth/vetheon/survival/commands/PayerDataCmd.java:[23,8] class PlayerDataCmd is public, should be declared in a file named PlayerDataCmd.java
Your file has a typo in the name.
It's PayerDataCmd when it should be PlayerDataCmd.
I feel like the ide should point that out
Bold of you to assume they're using an IDE.
It did point it out didn't it? That's a build error 
Shouldn’t have to build it for it to complain though
Maybe they are red-squiggly-line blind
how do i register an event class to a listener method
Wdym, like a registering a custom event?
no
i got a Class<? extends Event> and a listener object
what can i do to register it
uhhhh
doesnt help
i mean its just
@EventHandler
public void onEvent(Event event) {
try {
eventLogger.write(event.getEventName(), event.toString());
}
catch (IOException exception) {
Bukkit.getLogger().severe("Could not log event:");
exception.printStackTrace();
}
}
I know there is a registerEvent method, without the s
Don’t remember what it does though
seems like a functional interface
How can I get if the player is in an inventory? their own or furnace, crafting table etc
InventoryOpenEvent doesnt work for the players inventory
yeah it does
Nah that’s client side
But why
ah okay, thanks
thats just horrible?
would getOPenInventory be null? if theres none open
i dont know why they'd do that
Not sure if it returns null, you’ll have to check
thanks
I mean the server doesn’t really need to know when the client opens their inv
As much as it would be nice
There appears to be minuscule documentation on whatever EventExecutor is meant for.
The only code example I could find that used it was from a vanish plugin that had their listener class as also an event executor, but that likely won't work in your situation.
Also found some old Bukkit tutorial on registering events but that was no good since it used registerEvents and not registerEvent.
So EventExecutor is called when RegisteredListener::callEvent is invoked, that RegisteredListener is added to a list of listeners on PluginManager::registerEvent.
Because it would be delayed if it was opened by a packet.
Same thing as if you're lagging you can't open chests, that would happen with your inventory.
Which would be awful
The client could still send a notification packet
True it could
But that would purely be for server devs
Tbf Mojang does seem to somewhat care about the dev scene.
If someone made a ticket for it they might add it
Mojang has no reason to add anything they don't intend on using
Nor are they obliged to add whatever we ask
They won't do it if someone asks either ;p They've got no reason to have the client tell the server that a client-exclusive inventory has been opened
If, however, they add a feature that requires it, then they will add it
Someone go request a feature that requires it then 
300 iq
Ok so, as far as I know, EventExecutor is literally just used to execute code each time the corresponding event class is found.
I think you can get away with just creating an empty one lmao
But it seems like they're mainly used if your plugin needs a callback when the event is called.
is this actually the general exp for them, or specific for the current level?
like... is the exp reset to 0 when it lvl's up?
How can I kill all of the items? I know that you can do /kill @e[type="item"] to do it in Minecraft.
Loop all entities in a world, check if they are an item, .remove()
Get world.. get entities in that world... check type... destroy..
Bukkit.getWorlds().stream().flatMap(w -> w.getEntities().stream()).filter(Item.class::isInstance).forEach(Entity::remove);
One-liner to remove all items in all worlds 😌
Love em
They still feel so cursed
Why
Not sure if I'll be able to get any help here (I'm probably going to ask in an eclipse community aswell)
I'm using github as a source control for a plugin I'm working on, but I'm working from both Windows and Mac devices, and everytime I go from one OS to another I always have to reconfigure the build path, is there anyway around this to package the spigot.jar internally?
EDIT : I'm not sure if IntelliJ will be able to achieve this, but I've never used it and have no clue on setup
Use the same path to the lib on both systems (relative to your project) or use a build tool like maven
I've done that before from different systems with the same OS, but due to Windows and MacOS having different file structures that can't be done afaik
I'll have a look into setting up maven
Would you suggest sticking to Eclipse or migrating to IntelliJ?
I use eclipse as I like it and I'm used to it. Use whatever you prefer.
Alrighty I'll look into how to setup eclipse and maven
maven is included with Eclipse
you just create or convert your project to maven and it does it all for you.
You assume I have the braincells for that 😅
I'll figure it out and ask if I need assistance
wtf
What
Is there a simple way to make an NPC and check if it is attacked?
wait how can i fix blank lines
a sharpie
in intelij...
i cant get sharpie ink off of my monitor :(
havent tried using whiteboard sharpie tho
you can adjust the blank lines in the code style settings for java (settings -> editor -> code style -> java -> tab blank lines) and reformat the code (alt+ctrl+L) if that's what you mean with fixing blank lines
any ides why runes.yml is not like runes-data and the yml syntax is not correct
when i make it yaml
it is fixed
what is wrong with yml ?
in intellij
weird
for me it works normally always, never had smt like that
maybe an intellij bug :3
tried restarting ij?
yep
really weird
ok fixed somehow
oh
wait
when i name it runes
it will get wierd
bruh ok
no problem with it i will rename it
i renamed it something else
you can also manually assign a file type when the file is open with ctrl+shift+A -> override file type -> YAML
don' think that fixes it
well it seems to not figure out it's yaml by it's own, telling it to use yaml directly should certainly remedy it
alchohol
got an issue..
when rightclicking with a workstation, i want to give a villager the corresponding profession.
problem is..
when i set his experience to 0, he instantly loses his profession again
if i set it to 1, it is filled a bit already...
is there a workaround for this? i mean.. when they change their profs by default, they don't have any experience either
If anybody has an answer to my question here I would very much appreciate it 🙂
Material.CAULDRON.createBlockData()
a cauldron is not levelled tho :>
idk what the goal is here, but Material.CAULDRON is pretty useless as only the filled variances (water, lava, powdered snow) are levelled
What I'm trying to do, is determine if the cauldron is placed above fire and if it has water in it. Then listen for when the player right clicks the cauldron with a empty bottle.
I posted the entire code in a hastebin if you scroll down from the questions
if (block.getType() != Material.WATER_CAULDRON) return; // Not a water cauldron
if (block.getRelative(BlockFace.DOWN).getType() != Material.FIRE) return; // no fire under cauldron
final Levelled waterCauldronBlockState = (Levelled) block.getBlockData();
final int currentWaterLevel = waterCauldronBlockState.getLevel();
so something along this line ?
I know kind of spoon fed
but /shrug fight me
@EventHandler(priority = EventPriority.HIGHEST)
private void onItemClick(PlayerInteractEvent event) {
if (event.isCancelled()) return;
if (event.hasItem()) {
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE) {
ItemStack mainItem = player.getInventory().getItemInMainHand();
if (mainItem.getType() == Material.GLASS_BOTTLE) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (event.getClickedBlock().getType() == Material.CAULDRON) {
Levelled cauldron = (Levelled) (event.getClickedBlock().getBlockData());
if (cauldron.getLevel() > 0) {
Block fire = event.getClickedBlock().getRelative(BlockFace.DOWN);
event.setCancelled(true);
event.getClickedBlock().getState().setData(new Cauldron());
cauldron.setLevel(cauldron.getLevel() - 1);
event.getClickedBlock().setBlockData(cauldron);
ItemStack waterBottle = ItemManager.get(Item.DIRTY_WATER);
if (fire.getType() == Material.FIRE) {
waterBottle = ItemManager.get(Item.PURIFIED_WATER);
}
player.playSound(event.getClickedBlock().getLocation(), Sound.ITEM_BOTTLE_FILL, 1, 1);
this is what it is now
oh god, use early returns
the point in time when your code is intended for the 5th time you know you are doing something wrong imo xD
You underestimate my level of noobiness lmao
It's taken me over a year to build it to this point. Then 1.17.1 comes out and they deprecate the class I was using
Jeez... can you tell it's 3:45 AM?
I don't particularly mind the spaghetti code, I just need it to work and I'm completely out of my depth and google isn't helping
private static TextComponent makeName(String string, int r, int g, int b) {
String content = "";
for (int i = 0; i < string.length(); i++) {
content = content + TextColor.color(r, g, b + i) + string.charAt(i);
}
return Component.text(content);
}
``` I made this function to have quick rainbox strings but the result is http://prntscr.com/1rxg4vf why they stay white
colour is not passed into the content of the component. See https://jd.adventure.kyori.net/api/4.9.1/net/kyori/adventure/text/Component.html#color(net.kyori.adventure.text.format.TextColor)
Changing Skin
how can I make rainbow texts using this?
by chaining multiple components together with difference colours?
whats the Spigot version of System.out.println
the plugin logger
TextComponent content = Component.text("");
for (int i = 0; i < string.length(); i++) {
content = content + Component.text(content.toString() + string.charAt(i), TextColor.color(r, g, b + i));
}
return content;
``` Im sure its obvious but whats the mistake here
you cannot chain components together using the + operator
how can i do it?
yo does anyone know that hypixel skyblock magic find sound?
is there any way to check if a hit is critical in EntityDamageByEntityEvent ?
what instrument d othey use?
there is a super cool method called #addExtra
getLogger().info("");
getServer().getConsoleSender().sendMessage("");
is it better than content = Component.text(content.toString() + string.charAt(i), TextColor.color(r, g, b + i));
This doesn't even works
yeah it kicks me xD
but this works content = content.append(Component.text(string.charAt(i), TextColor.color(r, g, b + i * 4)));
i dont know about addextra
i used append
You can use instead content.addExtra(Object)
And you don't have to use content = here
wdym?
Is it possible to open the advancement menu with player.openadvancement or something similar?
i can interact and damage an armorstand that is invulnurable
i have done as.setInvulnerable(true);
maybe i done something wrong wait
nope everything is ok
why is it not working then
Is there any way to copy a config section into another place?
can someone tell me the formula for making a simple sound effect?
i cant seem to get the tones correctly
Why does it crash every time I click into the sky instead of sending me the "Block is to far away" message?
Block targetBlock;
if (PlayerInteractListener.getTargetBlock() != null) {
targetBlock = PlayerInteractListener.getTargetBlock();
targetBlock.setType(Material.AIR);
} else {
int distance = 0;
for (int t = 0; t<31; t++) {
Block block = player.getTargetBlock(null, distance);
if (distance == 30) {
player.sendMessage("§cThe Block is to far away!");
return;
} else if (block.getType() != Material.AIR) {
targetBlock = block;
targetBlock.setType(Material.AIR);
return;
}
distance++;
player.sendMessage(String.valueOf(distance));
}
}
return;
You can use ConfigurationSection#getValues() and then ConfigurationSection#createSection
i am trying to change a players skin. when i activate the code it will change the skin in the tab list but not atually on the player. here is the code i am using ```java
public static void changeSkin(Player player, String skinValue, String skinSignature) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e,
((CraftPlayer)player).getHandle()));
profile.getProperties().removeAll("textures");
profile.getProperties().put("textures", new Property("textures", skinValue, skinSignature));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,
((CraftPlayer)player).getHandle()));
}```
Does anyone know what i am doing wrong. thanks
the armorstand is Invulnerable but its still taking damage
why
i still can attack it
You are in creative
In creative you can destroy it
what to do if i am in creative
it cancels attack
?
should i cancel anything in the evnet ?
What do you want it to do?
shows health as hologram
and disapear after 1 second
its ok
but the problem is the creative
Then if you set the armorstand to invisible and invulnerable it should be unattackable
in creative
and i want it to be ignored. i mean if a player attacks it, it can attack through it if it doesnt do it already is it a way ?
and for a moment the armor stand apears and then disapears is there anyway to spawn the armor stand invisible ?
use teh spawnEntity that takes a consumer
how to do that ?
ArmorStand as = (ArmorStand) event.getEntity().getWorld().spawnEntity(eloc.add(0, 0.3, 0), EntityType.ARMOR_STAND);
this is my code
i done as.setVisible(false)
but it apears for a single moment
can you give an example ?
its a consumer so just use a lambda
What would that be for?
Oh
I see
how to use these consumers i dont get it
spawn(location, ArmorSrand.class, a -> a.setInvisible(true));
getWorld().spawn(loc, ArmorStand.class, e -> { //code here to set invisible });
oh ok thanks
I cant seem to get the exact note block tones i want
any formula on how to get the exact tone?
If you can tell me if it is possible or not, please let me know.
No its not possible
Oh. Thank you!
You could probably do it using packets
serious? I'll do my best.
i dont think its possible cause it is client side
I know you can change tab with a packet, but not sure about opening it
Or use the vanilla way with locking slots or removing hitbox with marker tag
even
@EventHandler
public void asManEvent(PlayerArmorStandManipulateEvent event) {
event.setCancelled(true);
}
doesnt work
this is creative
but in survival they dont take damage and prevent you from damaging the entity cause the hitbox is there
the server has little control over creative
thats the same thing in survival
but not taking damage
poor spider
still asking for a way to EFFICENTLY make custom sound effects
I see nothing. fails to display for me
and no resource packs cause resource packs = cringe
is it possible to change the EXP that it needs in the Anvil? don't see anything in PrepareAnvilEvent
ah nvm it's in AnvilInventory
does opening an inventory for a player yields the thread until the jobs done
opening an inventory for a player is a fire and forget
ok ty
i am trying to change a players skin. when i activate the code it will change the skin in the tab list but not atually on the player. here is the code i am using ```java
public static void changeSkin(Player player, String skinValue, String skinSignature) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e,
((CraftPlayer)player).getHandle()));
profile.getProperties().removeAll("textures");
profile.getProperties().put("textures", new Property("textures", skinValue, skinSignature));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,
((CraftPlayer)player).getHandle()));
}```
Does anyone know what i am doing wrong. thanks
It's determined by a nbttag i think
RepairCost
there's AnvilInventory#setMaxRepairCost
didnt saw that first
That also
Thought you were talking about the amount of xp for the item
to have it low everytime or something
When i make plugins on intelij with the minecraft development plugin how can i use other libraries in my plugin?
i ran the build tools 1.17.1
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT'
}
repositories {
mavenCentral()
mavenLocal()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}
oh wait
i have 1.17.1
bruh
i am trying to change a players skin. when i activate the code it will change the skin in the tab list but not atually on the player. here is the code i am using ```java
public static void changeSkin(Player player, String skinValue, String skinSignature) {
GameProfile profile = ((CraftPlayer)player).getHandle().getProfile();
PlayerConnection connection = ((CraftPlayer)player).getHandle().b;
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e,
((CraftPlayer)player).getHandle()));
profile.getProperties().removeAll("textures");
profile.getProperties().put("textures", new Property("textures", skinValue, skinSignature));
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a,
((CraftPlayer)player).getHandle()));
}```
Does anyone know what i am doing wrong. thanks
Got a bungee related problem if its ok to ask:
I have bungee plugin that takes up /f command on my server, yet this is conflicting on the factions server obviously. Whats best way to fix this? I realized I can't simply disable /f easily on factions ONLY, since command is registered regardless of the server you are currently in, and I am not sure how redirecting commands would even work also
dont you have to send the packet to everyone else too?
so they can see the change
or is this something different
o yes that is a good point i will do that now but i dont think that will change the fact that it doesnt work cus it already dosnt work for the player that the packets were sent to
lol
Didn't read it lol Thought you were talking to makvo
i am trying to activate it in a command and it doesnt work there but if i do it when the player joins it works. do u know what i have to do to make it work in a command
how to set nbt tag for an entity in 1.17.1
like marker:1
if (e.getDamager().isOnGround() && e.getEntity().hasMetadata("SkeletonKing")) { Bukkit.getScheduler().runTaskTimerAsynchronously(SMPCore.getInstance(), () -> e.getEntity().teleport(e.getDamager().getLocation()), 0, 30);
why doesnt this work
something is false?
yeah but i want for the skeleton to teleport to the player every 10 seconds to avoid climbing on a tree and exploiting
yes. to the damagers location
hmmm
ItemStack potion = new ItemStack(Material.POTION,1 , (byte) 16421);
this gives me a drinkable instant health II potion but i want a splash potion , what am i doing wrong here
is there any kind of boolean possible?
well for one, that value does not fit in a byte and you'll end up with a value of 37
use the pdc api
?pdc
change the bungee command
This tells you that your java version is outdated. Use Java 16 for spigot 1.17 development
?
using 16
Just like you would normally do with maven. Add the dependencies to your pom.
Nope you use java 11
Do you use maven?
gradle
Did you specify java 16 as your target and source version?
After 1.8 the versioning changed to 9, 10, 11 etc
the same thing
compileJava {
sourceCompatibility = '16'
targetCompatibility = '16'
}
the same error
oh wait
let me change to 16
wait there is another problem
let me fix it
nms suddenly stops working
You should not do that via the NBTTag. Spigot has an API for that.
If you want persistent data then just use the PDC
great
Location location = ...;
World world = location.getWorld();
ArmorStand marker = world.spawn(location, ArmorStand.class, as -> as.setMarker(true));
Hey guys quick question. I want to deny mobs from destorying things like ArmorStands, but players should still be allowed to do so.
I found the EntityDeathEvent to check when an ArmorStand is destroyed. But how can I check if the cause was for example a Creeper or a Player? Or are there any other ways for this?
EntityDamageByEntityEvent
ok but wtf
repositories {
mavenCentral()
mavenLocal()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}
dependencies {
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}
@EventHandler
public void onDamage(final EntityDamageByEntityEvent event) {
final Entity defender = event.getEntity();
final Entity attacker = event.getDamager();
if (!(defender instanceof ArmorStand)) {
return;
}
if (!(attacker instanceof Player)) {
event.setCancelled(true);
}
}
thank you ^^
Make sure your mavenLocal is resolved properly. You probably have to local repos. One is boundled with IntelliJ and the other one should have been setup by you
that got fixed
Can I do it the same way for ITEM_FRAME and PAINTING?
- Navigate to: File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
- Gradle JVM: change to version 16
- Re-run the gradle task
Sure. But then you should create a Set<EntityType> and check with contains on it.
Tried that but they still get destroyed.
private List<EntityType> noneDestroyableEntities = Arrays.asList(ARMOR_STAND, PAINTING, ITEM_FRAME);
...
final Entity defender = event.getEntity();
final Entity attacker = event.getDamager();
if (this.noneDestroyableEntities.contains(defender.getType())) {
if (!(attacker instanceof Player)) {
event.setCancelled(true);
}
}
private final Set<EntityType> playerOnlyKillableTypes = EnumSet.of(
EntityType.PAINTING,
EntityType.ARMOR_STAND,
EntityType.ITEM_FRAME,
EntityType.GLOW_ITEM_FRAME
);
@EventHandler
public void onDamage(final EntityDamageByEntityEvent event) {
final Entity defender = event.getEntity();
final Entity attacker = event.getDamager();
final EntityType defenderType = defender.getType();
if (this.playerOnlyKillableTypes.contains(defenderType) && !(attacker instanceof Player)) {
event.setCancelled(true);
}
}
Lists are slow when it comes to contains()
But you are close
wdym slow
They scale horribly
would a for loop be faster?
No. A list already uses a for loop internally to check every single element with .equals()
oh
@ivory sleet Gradle is your field. Fix this guys spaghetti setup.
Really usefull guide, thanks
Move the buildscript section up to the top of the build.gradle file and see if that helps
what is the buildscript section
Btw gradle only supports java 16 in the very latest version. 6.3+ or something. Make sure its up to date.
how to update the gradle in intellij ?
it is using 5.6.1
and i have the latest
in my C:\Gradle\gradle-7.2
go to gradle/gradle-wrapper.properties iirc
its empty
is it?
oh
the wrapper
wait
or you can manually set it to the path, theres an option in settings for gradle
ok
now ?
and then in that props file change the version and reload gradle project
yeah
k wait
thats so outdated lol
mhm lol
like this ?
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
yes
it is not
searching in local
did you run build tools
yes
it was working before
let me reopen intellij
or
wait
16
wait let me see the language level
im waiting for intellij to open
@ivory sleet
ok
then go to File > Build, Execution, Deployment > Build Tools > Gradle
and if the gradle jvm is like on version 8 or something, set it to a more recent one
preferably the same as the project sdk
also u can set project language level to 16
it is 16
oh thats weird
whats ur intellij version btw
update if possible
ye also I assume you have tried restarting and invalidating caches already
Just to let you know: it seems like that this event does not work for hanging entites. First of all: EntityType.ITEM_FRAME and EntityType.PAINTING did not work since the entity.getType() was DROPPED_ITEM. But adding that to the list didn't work either. After some research I found the HangingBreakByEntityEvent event which solved my problem.
@EventHandler
public void onEntityB(HangingBreakByEntityEvent event) {
event.setCancelled(!(event.getRemover() instanceof Player));
}
actually send ur build.gradle
But thanks for the support :)
they exists
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
}
group = 'com.trexmine'
version = '1.0-SNAPSHOT'
compileJava {
sourceCompatibility = '16'
targetCompatibility = '16'
}
repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}
dependencies {
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}
processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}
ye this is weird
the issues I have listed is the only things I can come to think of which might mess it up
gradle jvm version, project lang level, project sdk level, gradlew version (& restart & inval caches)
Well update IntelliJ to latest if not done ofc
That’s too bad
ok i download community 2021.4
Idk but you should be on latest
I'd just check what gradle itself has to say, and then move on to intellij
and just run ./gradlew build and see what error it has
if that still errors with not found, then there's something messed up in the repo
yeah well the grade ij ui should execute using gradlew
the file is there
Can u run java -version in the cmd
where is the spigot repo o.O
Seems to be missing 
I am jealous of your emoji superiority
🩴
LynxPlay nitro booster 🙂
I am keeping a server alive with my two boosts 😭
well a repository might be useful first step
this error specifically fails to find spigot api
From what I understand he declared the artifact spigot not the api variant, and then also declared both the spigot repo and the local maven one
Alright, this is just weird
Though not surprising that gradle could do something like this
an interesting jar name tho. How did you install the server jar into your local maven repo ?
epic
so I didn't remember it wrong huh, it should have that spigot- prefix too
EPIC
Oh wtf
yea I recall a spigot prefix as well
welp
start looking on amazon for an external hard drive
no i will clear some space
when you updated, did you remove the old configurations? you can otherwise delete those which should give you some space back
the installer doesn't select that automatically for the new versions for some reason, which I'm always surprised by
pretty sure toolbox does that, no?
no idea about toolbox
oh damn
i forgot that
i had
the whole assassins creed unity on C
- csgo and dota
@ivory sleet smells
👃
guys anyone knows how to change directory of a steam game ?
and it doesnt bug out
its not related to this channel
but ah
theres some setting when you right click a game i think
dont remember tbh
i will change dota and cs:go
why
oof
i just delete dota 2 anyways
xD
epic 2021 soluton
but yeah anyways you might want to redeploy spigot 1.17.1 to ur maven local repo
so like run bts again
works?
same error
done
then run build tools again
ah come on ok
yeah ik its annoying lol
epic 600M
oof
yessir
ok lol
does calling + on a string creates a new stringbuilder every time?
i heard it somewhere
it allocates a new string
like if you use something like
"lol" + enumconstant + "abc" I am pretty sure it gets interned
maybe not
I mean those are micro and pretty w/e
ye indeed
bigger issue is people building whole text docs (e.g. html) using += on a string
as it has to copy the entire string over
MutableString 😌
oh
anyways fourteenbrush
assume you have something like
"hi " + args[0]
then it should compile to new StringBuilder("hi").append(args[0]).toString() iirc
so in that case it wont use a billion string builders
String name = e.getCurrentItem().getItemMeta().getDisplayName();
Player target = Bukkit.getPlayer(name);
if(!(target != null)) return;
if(!(Actions.inDuels.containsKey(target.getUniqueId()))) return;
p.setGameMode(GameMode.SPECTATOR);
p.teleport(target.getLocation());
Actions.inSpec.add(p.getUniqueId());
p.sendMessage(Utilities.color("&3&l(!) &7/leave to leave spectator"));
it does everything except for changing the gamemode
but yeah also that being said, you dont have to care about that, afaik it uses the array copy function provided by System which is quite fast
it means that one of ur predicates you test above the setGameMode code isn't passing
might wanna debug it with print statements or smtng
what event is it btw
Player Interact event
ye well thats weird should work
wtf
@ivory sleet sorry for tag
send ur build.gradle
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
}
group = 'com.trexmine'
version = '1.0-SNAPSHOT'
compileJava {
sourceCompatibility = '16'
targetCompatibility = '16'
}
repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
}
dependencies {
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'
}
processResources {
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}
but why not just use inbuild resource processing / expanding
^
im using groovy
should not be too hard to convert xD
bruh why should i convert
no
convert my snippet to groovy
not your entire layout to kotlin (tho it is superior :>)
it was the default
in minecraft development
and
the plugin.yml problem
how can i fix that
send the plugin.yml
yeah idk what it really means but feels like that has to do with replace tokens
pog
let me test it
check if it actually processed stuff xD
put this in your processResources: duplicatesStrategy = DuplicatesStrategy.INCLUDE
wait if you already fixed it nvm
never had to use that UwU
how can i cancel END_CRYSTAL placing.
just e.setCancelled doesnt work
like this ?
what event r u using pillow man
above the sourceSets.main
I am using BlockPlaceEvent
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from(sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: version]
}
}```
use the EntitySpawnEvent
ok
end crystals are entities right
yeah..

unit tests?
Is placing a flower BlockPlaceEvent?
yes
but that doesnt work
how can i get the checker
ok nvm i got that one working
now i need to send the placer a message to not place it
but i cant find that
btw @ivory sleet EntitySpawnEvent also doesnt work
im
idk the command
im very lost at it
?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.
ok thnx ig'
how can i use player.Teleport
by passing in a location to teleport them to?
yeah but how can i get the worldSpawn
By calling World#getSpawnLocation
ah thx
Have you considered reading documentation?
?jd
Didn't you just tell someone above to learn java lol
i told what everyone does
Don't copy what others do if you yourself don't know what you're saying to do lol
Do you expect us to just give you a fully-functioning plugin or something
You have to ask specific questions
whats the best way of storing an uuid with a horse so that only the owner (who spawned it) can ride it? btw i dont want any files
pdc or something?
Map<UUID, Horse> horseOwner = new HashMap<>();
ArmorStand.getRightArmPosition()
but i dont want to save it in a file
It will remove keys and values after restart
Read his above message
you can probably store the owner in the PDC, yeah
^
PDC can only hold so much data so make sure to remove the data as its removed from the server.
Would it not be automatically removed if the entity dies
No. Cause I assume he would be storing a list of entity uuids that belong to the owned horses.
You'd attach it to the horse not the player
Do horses have pdc?
ugh is there an interaction type for right clicking on a entity?
All entities do don't they?
worldguard seems to block something
News to me. If they do that would make a lot of shit easier lol
Yeah Entity implements PersistentDataHolder
PlayerInteractEntityEvent
Nice, then yeah redempt is right.
entities, chunks, itemmeta and tile entities all have their own PDC
notably every one of those is cleared if they are removed (tho that becomes kind of hard for chunks)
Updated no atEntity sorry just PlayerInteractEntityEvent
doesnt have much either
declaration: package: org.bukkit.event.player, class: PlayerInteractEntityEvent
ah wait
getRightClicked()
how could i send a player a random join message
create a list with messages i guess and take a new random
List<String> messages = new ArrayList<>();
Random r = new Random()
on join: event.setJoinMesage(messages.get(r.nextInt(messages.size())))
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.
for that
wow ty
ofc
is this something with the iterator thingie
wtf
you're running a forEach on an interator and then also use .next() inside that forEach? that can only break
ah
also you're setting a singular value in the config so overwriting it over and over
if it can't serialize the UUID just map over the list, call toString on it and save the resulting list
ah like this
.set("vanished_players", vanishedPlayers.toString()
no, that'd create the text representation of the list as a whole, you want instead a list of the text of the uuids
this doesnt work, and dont tell me to learn java, cause im already learnigng
:/
uh oh, here it comes
i want to see the listener part
you are setting the join message twice :/
oh ok lmfao
Also, how are you setting those messages?
Bukkit.getPluginManager().registerEvents(new KaboomJoin(), this);
new KaboomJoin().setMessages(messages);
```?
kaboom :kekw:
are you adding something to the messages?
any ideas how to set the marker nbt tag to 1
with https://www.spigotmc.org/threads/a-guide-to-1-14-persistentdataholder-api.371200/
is it a byte
or int
so you never call setMessages()?
marker nbt tag? For an armour stand? Just use ArmorStand#setMarker(true)
you have to
Yeah. PDC is for non-vanilla tags
an arraylist has an initial capacity with 10 and values null right?
Anything vanilla NBT is going to be covered by either ItemMeta, Entity, or anything else wrapping some object
o/ general question, are craftbukkit (not spigot) servers guaranteed to include net.md_5.bungee apis?
like custom? example setting "mobType" to "LeEpicTrollZombie"
Yes
nice
Assuming "mobType" is your special tag
You can set whatever you want
Just can't manipulate vanilla ones
wow
@solid cargo does it work?
Initial capacity of 16, load factor of 0.75, and no. You can't .get(15) on a new array list
ok im already dying inside
No. CraftBukkit does not contain Spigot APIs
been on pc all day
ah
and it get saved in world data right ? (like when a server stops the tag is still there)
so its just unitialized or something
PDC? Yes. It's saved on the object itself.
I WILL NOT GET SPOONFEEDED
:/
spoonfeed = bad
PillowMan your code looks fine as far as I'm concerned. What's your ultimate goal here?
Right now your code is setting their join message to a random message
to send a player a custom join message
player.sendMassega
but i can change that quickly
Right, so that will at least fix that.
ik its joinMessage rn
is there an error or spmething?
I asked this of you earlier too,
<#help-development message>
yes
e.setJoinMessage(messages.get(r.nextInt(messages.size()))); server doesnt like that
fix it then
java.lang.IllegalArgumentException: bound must be positive
Yeah, just confirms what I asked then
This is where Java experience and knowledge and understanding of instancing helps
?learnjava was a good one 🙂
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.
i do this shiz for fun anyways
That List is a member field meaning a new instance of it is going to be created when you use the new keyword
wew
KaboomJoin listener = new KaboomJoin();
listener.setMessages(Arrays.asList("whatever", "another message", "hello"));
Bukkit.getPluginManager().registerListeners(listener, this);```
Notice how I'm using the same instance, I only use new once?
ohhh
If you do new KaboomJoin(), that messages list is also going to be different
Bukkit.getPluginManager().registerListeners(new KaboomJoin(), this);
new KaboomJoin().setMessages(messages); // You're setting the messages of an unrelated instance that wasn't registered```
Alternative would be to scrap setMessages() and just pass a List<String> through the constructor of Kaboom join as well to avoid the call and just do this
Bukkit.getPluginManager().registerListeners(new KaboomJoin(Arrays.asList("whatever", "another message", "hello")), this);```
this goes in main right? 👉 👈
well, it replaces the above code
Yeah, it would go wherever you're registering your listener
Preferably in the plugin class, yes
did you mean registerEvents?
Yes, sorry
ok
Bad habit lol
registerListeners would be a better name anyways
https://gist.github.com/d8acb4201b95d4e6c49ddfe96ec427e4 TRIGGER WARNING GIVEN
It really would. That's why it's a bad habit of mine because despite writing plugins for 7 years, I still make the mistake unless I'm in my code editor.
bro i just wanted a decent surprise for my private smp players
but java says: 'KaboomJoin()' cannot be applied to '(java.util.List<T>)'
bro i should really learn java
?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.
Yes you should ;p I suggested the use of a constructor instead of the setMessages()
at least my typing speed improved :)
yo at least as i said my wpm increased from like 50 to 70
what you are typing should make sense though. Even 200 won't matter if noone is left to understand the words
in typereacer i mean
point still stands
true.
Ive had days where i literally wrote maybe 10 lines of code in total. Programming is not all about words per minute.
Rest was compiling, searching the internet and yelling at Jenkins for not recognising my cool web hooks
Programming is not all about words per minute
Yeah. It's about hating yourself and how much of it you're willing to tolerate before giving up

I know several ex devs that just said fk it and went into gardening or something else non technical.
Programming is about words per minute when you're writing getters and setters
Location eloc = event.getEntity().getLocation();
EntityArmorStand as = new EntityArmorStand(((CraftWorld)eloc.getWorld()).getHandle(), eloc.getX(), eloc.getY(), eloc.getZ());
as.setInvisible(true);
as.setNoGravity(true);
as.setInvulnerable(true);
as.setMarker(true);
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(as);
((CraftPlayer) player).getHandle().b.sendPacket(packet);
why the invisible, nogravity and stuff arent working its just an armor stand ?
1.17.1
cause i dont want others to see it
The spawn packet probably doesn't send that metadata
If you want a packet based entity then you also need to send a packet that contains the metadata (DataWatcher)
net.minecraft.world.entity.Entity entity = ...;
final boolean forceAll = true;
final PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), forceAll);
why everyone is suddenly using invisible armor stands it was added 6 years ago x)
witch one should i send first, spawn or metadata ?
and the name is not showing
as.setCustomName(IChatBaseComponent.a(text));
as.setCustomNameVisible(true);
The client throws away all metadata, position etc packets of entities it did not witness spawning first.
Thats all metadata
no
as.setInvisible(true);
as.setNoGravity(true);
as.setInvulnerable(true);
as.setMarker(true);
i want the armor stand to spawn
with these metadata
at the same time
Yeah you spawn it and then send the metadata
There's nothing you can do about that
No. If you send them in the same tick then it should not occur for even a moment.
how to do that ?
Couldn't it still theoretically happen if the metadata packet fails to make it for some reason
Sure. This could happen but is highly unlikely

ok so what should i do
the name is not apearing
and the packets arent sent at the same tick
Show your code
Try sending a named entitiy packet maybe.
PacketPlayOutNamedEntitySpawn
Ide is for that
Click on the class then press F4
// Default IntelliJ toString
@Override
public String toString() {
return "MyObject{"
+ "values" + '}';
}
which class
PacketPlayOutNamedEntitySpawn
ok now what
Generating code is for weaklings
Strengthen your fingers
I use lombok for that... I really feel like verbose getters and setters are sometimes overcrowding a class.
ok i did now what
Look at the constructor. You should be able to figure it out.
i cannot figure out a and b
