#help-development
1 messages · Page 1704 of 1
Does via version use ProtocolLib?
loadbefore: [ProtocolLib, ProxyPipe, SpigotLib, SkinRestorer]
viaversion loads before
so probably not then
Is this an issue you have brought up with viaversion
they wont fix it
If the packets reach ViaVersion first then ProtocolLib wont work, yes.
does anyone know how to use this? https://github.com/AmberWat/NegativeSpaceFont
or maybe a tutorial video?
so u saying grabing packet my self
editing it
or blocking
it
could u point me to some good example xd
You need to distribute this as a resourcepack and then simply use text components like described on this page.
Its pretty straight forward.
Is that NMS magic?
well i dont really get it so thats why i asked if there is a tutorial, if there isnt well i guess thank you 😄
Nope thats Netty magic. Even worse.
Epic
hello spigotites, im wondering how to spawn a firework as FireworkEffect.Type.BALL_LARGE ?
Get it's meta and then add a new FireworkEffect
Use FireworkEffect.Builder
This will return a FireworkEffect, not just a FireworkEffect.Type
Quick question for you guys, Is it nessicarry to run almost everything async? If there are tons of things going on in the server for example I have lots of NPC's and do tons of logic and ai checks and pathfinding operations, that stuff will be async, but even the small things being async would keep the server pretty much lag free with the exception of normal operations of the server?
Something as simple as this even though it hardly uses resources but is ran across hundreds of npc's every couple seconds.
NPCStuckController.this.isStuck = true;
++NPCStuckController.this.beenStuckCount;
} else {
NPCStuckController.this.lastPosition = npc.getEntity().getLocation();
NPCStuckController.this.reset();
}```
If you can run it async without it being a massive headache then it's probably worth it
I found an api that makes it pretty simple, which brought me here with that question haha
Can someone explain to me why this is not reliably working when a player is crouching off a block?
private BlockPos getNonFloating(Entity entity) {
BlockPos standingBlock = entity.blockPosition().c(0, -1, 0);
if(entity.level.getBlockState(standingBlock).getBlock() == Blocks.AIR) {
System.out.println("Air!");
AABB bb = entity.getBoundingBox();
if(isColliding(bb, standingBlock.c(0, 0, 1)))
return standingBlock.c(0, 0, 1);
else if(isColliding(bb, standingBlock.c(0, 0, -1)))
return standingBlock.c(0, 0, -1);
else if(isColliding(bb, standingBlock.c(1, 0, 0)))
return standingBlock.c(1, 0, 0);
else if(isColliding(bb, standingBlock.c(-1, 0, 0)))
return standingBlock.c(-1, 0, 0);
else if(isColliding(bb, standingBlock.c(1, 0, 1)))
return standingBlock.c(1, 0, 1);
else if(isColliding(bb, standingBlock.c(1, 0, -1)))
return standingBlock.c(1, 0, -1);
else if(isColliding(bb, standingBlock.c(-1, 0, 1)))
return standingBlock.c(-1, 0, 1);
else if(isColliding(bb, standingBlock.c(-1, 0, -1)))
return standingBlock.c(-1, 0, -1);
}
return entity.blockPosition();
}
private boolean isColliding(AABB bb, BlockPos pos) {
return bb.minX <= pos.getX() + 1 && bb.maxX >= pos.getX() &&
bb.minZ <= pos.getZ() + 1 && bb.maxZ >= pos.getZ();
}```
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.
the interact event is being called twice
one for each hand
What would be the best storage option for an economy plugin?
Modify the database on every transaction or create a caching system?
Could do both
You have the cache, however you could queue the database after every write maybe?
and the cache would mainly be for reading then
So use both to save data on every transaction and cache to read?
I’d say in short
on connect -> read from database and put dto in cache
on read -> read from cache or query database if no dto was found in cache
on write -> write to dto and query database write
on disconnect -> save dto to database and remove from cache
As long as the database calls are async you can in principle avoid using a sync buffer of some sort and write directly and read as mentioned previously.
Yes but I'm a little scared about data loss, even being 5min
I'm going to use both as he said
Thank you both ❤️
You really dont need that sync buffer
as said just save whenever you write to ur dto
(dto, data transfer object)
InventoryOpenEvent may only be trigger synchronously
Yeah I got it
🤔
that message is self explanatory, innit?
Bukkit.getScheduler().runTask(plugin, () -> {
//Open here
});
yeah
❤️ u, all homo

Ive havent used lambda much before and am running into an issue, is anyone familre with this problem?
one more thing: you need to know what type of data you will save. if it is a data that will be less used, you can save it directly but if it is a data that needs to be used everytime (the conomy in your case), it would be good to avoid that
This code doesn't ban the player when executedjava if (entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue() <= 2) { Plugin.getPlugin().getServer().dispatchCommand(Plugin.getPlugin().getServer().getConsoleSender(), "ban " + entityUUID + "message"); }
Don't do that
try it without parentheses around the lambda variable
it returns void iirc
same error with no ()
hasMoved is the lambda param
why dont you use entity.getMaxHealth()?
its deprecated
a
is there something wrong with it being depricated?
yes and no
It means you shouldn't use it
y
magic values ig
huh
yes: soon it will be deleted
no: you can use now :D
yay
I don't know about soon
how do I ban I player, because I find that executing a command from the console inefficient
?jd
Yes, it definitely is. ;p
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getBanList(org.bukkit.BanList.Type)
player.banPlayer("Your a troll!")
you're
Y'roue*
ur
yur
u
_ _
||
||
Ello
does this return the max health? java entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()
nah it returns mcdonalds
Hey I am using 1.16.5 version of mc but covid 19 plugin is doesn't working for me...
this is help development
lol
thats offensive its programmers
lol
I think @gray saffron 's question should go in the dev's official server, not here lol
Where is it?
who is the developer of the covid 19 plugin?
plugins are not mods 👍
We can't able to do anything for that?
when using java Plugin.getPlugin().getServer().getBanList(null).addBan();what do I put in getBanList() and how do I use a UUID for addBan()?
read the docs
I did, they don't answer either of those questions
read harder
lol
declaration: package: org.bukkit, interface: Server
either BanList.Type.IP or BanList.Type.NAME
the former is for banned IP addresses, the latter is banned names
declaration: package: org.bukkit, interface: BanList
but, uhhhhh, ban by UUID
how
lol
sorry
@lavish hemlock
only got 15min
Is it possible to run plugins in a single player world? Cause my PC doesn't work at its best when I'm running a server with minecraft open and Intellij running in the background
No
Get name by uuid I guess
holos:
Test:
location: world, -337.9180889181425, 72.0, -446.26819453769014
owner: e42b60b0-c35a-462f-a2b4-b1a9980f399e
lines:
- '&cTest 1'
- '&cTest 2'
- '&cTest 3'
- '&cTest 4'
If I wanted to, is there an easy way to change "Test", or should I change my config format to a list, and move "Test" to a variable
I think you can use getSection to get the entire test section
And then .set with your new key
Wouldn't it just write a new one instead of overwriting this one though?
You can set that one to null
Which event value to check in playerinteractevent to get when player drinks water from the default minecraft water bottle?
use PlayerConsumeItemEvent
Oh okay
public static ItemStack WaterBottle() {
ItemStack item = new ItemStack(Material.GLASS_BOTTLE, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§7Flint Axe");
meta.setCustomModelData(1);
item.setItemMeta(meta);
return item;
}
How to set the value of bottle to water
Like in a give command in game
we can set minecraft:glass_bottle{potion:water} or something like that if I remember correct
How to do same for the itemstack
potionmeta something? like item meta? or did you just randomly make a word
Like we use ItemMeta Is PotionMeta there too?
mhm
@young knoll Is this how one adds potion meta?
PotionMeta pmeta = (PotionMeta) item.getItemMeta();
mhm
mhm is yes?
coll
pmeta.setBasePotionData();
How can one use this?
wait nvm I forgot about google
public static List<Block> getSphere(Location loc, boolean hollow, int radius, int height){
List<Block> blocks = new ArrayList<Block>();
int bx = loc.getBlockX();
int by = loc.getBlockY();
int bz = loc.getBlockZ();
for(int x = bx - radius; x <= bx + radius; x++){
for(int y = by - height; y <= by + height; y++){
for(int z = bz - radius; z <= bz + radius; z++){
double distance = ((bx-x) * (bx-x) + ((bz-z) * (bz-z)) + ((by-y) * (by-y)));
if(distance < height * radius && !(hollow && distance < ((height - 1) * (radius - 1)))) blocks.add(new Location(loc.getWorld(), x, y, z).getBlock());
}
}
}
return blocks;
}
im terrible at math
m pretty bad especially at fcomplicated things like this
i got this code off of some spoonfeed spigot thread
modifeid it a tiny bit, not quite sure what im doing wrong.....
i added "int height" to it, and it didnt really seem to effect anything that is going wrong
so here's a screenshot of what happens if i generate a sphere of radius 15, height 5
so as you can see, im 99% sure it has something to do with the if(distance < height * radius && !(hollow && distance < ((height - 1) * (radius - 1)))) code
im just not sure what to modify 💀
please ping in a reply, if needed i might even make this a thread tbh
How to use it .. to set custom type of potion ...
Cant find anyway on google either... nor any bukkit or spigot docs for a guide...
I'm using async to pull data from the database
to pull cached data from the hashmap is it necessary to use async too?
that is add custom effects
I need tutorial or help on how to set type of potion
Like I want to set the potion type to water
it's not height, it's radius
what do you mean
wait what
nvm
It gets the height from the middle?
and calculates it up and down?
sso are you going to provide any help
or just comment about code wthat isnt mine
and seemingly (maybe) disrespect it.... without any explanation?
I made an observation only
I made a bungeecord command and whenever i try to forcefully make a player run it using player.performCommand(), it just says unknown command
?bungeecord
oh
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
please read that
the command works if i type it manually
duh
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Hey, so what would be the best way to flip an armorstand's head across the x axis? basically need it flipped 180 degrees so the nametag will be more in the center of the body, as opposed to above it
with protocollib ^
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(16, WrappedDataWatcher.Registry.getVectorSerializer()), new Vector<>());
I have this for it so far, not sure if it's VectorSerializer I need, or something else
https://i.gyazo.com/56d563f55d353cfe6faae3bfd08d45fe.png
I know I could also just send a packet to rotate the head but id prefer to do it with the watcher
edit: I tried using this
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(16, WrappedDataWatcher.Registry.get(Rotation.class)), Rotation.FLIPPED);
and it's giving me an error that there was no serializer found for Rotation.class, which WOULD work if I knew what serializer to use possibly, according to this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Rotation.html
declaration: package: org.bukkit, enum: Rotation
Anyone ?? I cant find any way to usee the set potion type value ? anyone got any example/knows
t
@carmine nacelle
Just an unnecessary ping, but the trouble that we got yesterday, actually because of the check world 😂 Everything working fine, but somehow the check world don't work, so they can't put the key and value into the treemap. This is the needed code for it to work lol:
for (String locationName : locationsData.getCustomConfig().getConfigurationSection("locations").getKeys(false)) {
sorteddistance.put(p.getLocation().distanceSquared(locationsData.getCustomConfig().getLocation("locations." + locationName)), locationName);
}
e.setRespawnLocation(locationsData.getCustomConfig().getLocation("locations." + sorteddistance.values().toArray()[0].toString()));
sorteddistance.clear();```
Anyways, *now i need a way to check the world without make this whole code dead.*
So it works now?
Yeah, without the check world (one of the most important thing)
Wait, i think i have another way
instead of using the locations section for all the loc
Well, why doesnt the world check work? That should be super simple.
i will use the world name as the section
Idk it dont work
i try like 3 code
but nothing work
😹
for (String locationName : locationsData.getCustomConfig().getConfigurationSection("locations").getKeys(false)) {
sorteddistance.put(p.getLocation().distanceSquared(locationsData.getCustomConfig().getLocation("locations." + locationName)), locationName);
}
print the values of locationName to console.
🙂
its not hard
for (String locationName : locationsData.getCustomConfig().getConfigurationSection("locations").getKeys(false)) {
sorteddistance.put(p.getLocation().distanceSquared(locationsData.getCustomConfig().getLocation("locations." + locationName)), locationName);
}
System.out.println(sorteddistance.values().toArray()[0].toString());
sorteddistance.clear();```
oh ok
System.out.println(locationName);
for (String locationName : locationsData.getCustomConfig().getConfigurationSection("locations").getKeys(false)) {
sorteddistance.put(p.getLocation().distanceSquared(locationsData.getCustomConfig().getLocation("locations." + locationName)), locationName);
System.out.println(locationName);
}```
put the print before the other just in case the other line errors it will still print
print before the sorteddistance (should be sortedDistance btw)
lol
[INFO] .... Firminus issued server command: /setspawn Firminus2
[INFO] .... Firminus issued server command: /kill
[INFO] .... Firminus fell out of the world
[INFO] .... [Firminus: Killed Firminus]
[INFO] .... Firminus
[INFO] .... Firminus2```
ok so it's printing that part correctly
so..what is the name of the world you're in
nope. btw i gtg eat lol
of course they're not gonna match, its 2 different strings
console errors would be cool
public static TextComponent textWithHover(String text, List<String> hoverText) {
TextComponent textWithHoverVariable = new TextComponent(text);
textWithHoverVariable.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text(hoverText)));
return textWithHoverVariable;
}```
https://i.imgur.com/VFAuXE8.png
help please
what that
An easier class for making messages
Your original code is fine
Just add the correct import
Your ide should suggest it
but you just said to use conponentbuilder
none of these work btw
https://i.imgur.com/1UDMBk8.png
only the util one but then the hoverText has a red line below it
world = locationsData.getCustomConfig().getString("locations." + locationName + ".world")
world is the name of the world
hey md_5, I dont wanna @ you but if you happen to see this, how could I flip my armorstand's head with ProtocolLib?
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(16, WrappedDataWatcher.Registry.getVectorSerializer()), new Vector(0, -180, 0));
can't figure it out
List is java.util
You might want to learn more java if you're struggling with a List
the list should work fine, it's just not working in the setHoverEvent
Is "world" a string?
yes
also i don't see that import you said
i use p.getWorld().getName()
It's not working cause it's not imported
@quaint mantle Print the result of world
where is it even supposed to be imported
ok
@lean gull The third List (java.util) is the one you'd want.
Your last screenshot had import suggestions
yes it did lol
i was thinking about the last last one
hover over it or press Alt + Enter to print it back up
for (String locationName : locationsData.getCustomConfig().getConfigurationSection("locations").getKeys(false)) {
System.out.println(p.getWorld().getName());
System.out.println(locationsData.getCustomConfig().getString("locations." + locationName + ".world"));
sorteddistance.put(p.getLocation().distanceSquared(locationsData.getCustomConfig().getLocation("locations." + locationName)), locationName);
}
sorteddistance.clear();```
alt+enter best friend!
@carmine nacelle idk because my answer would be to use the API
so i need to import java.util right
Which API? the general Spigot one...?
yes
then this thing happens
No, print locationsData.getCustomConfig().getString("locations." + locationName + ".world")
the one from the first screenshot
i print both
?
Yes, is there a reason you need packets?
ok what are the results of the print
Packet-based armorstands for holograms which are interactable. I have most of the system done, just need to flip the stand's head so the customname is more in the center so people don't try to click the name and wonder why it's not triggering the events.
Edit: what I mean is how the name of this stand is in the center of the stand: https://i.gyazo.com/95b1c02551d63f149fcba2ffd731df7b.jpg as opposed to on top of it.
wait a little bit
I don't know if this is allowed but can i link my forum here? https://www.spigotmc.org/threads/scoreboard-not-updating.527159/
b u m p
man...
[INFO] .... Firminus issued server command: /setspawn Firminus
[INFO] .... Firminus issued server command: /setspawn Firminus2
[INFO] .... Firminus issued server command: /kill
[INFO] .... Firminus fell out of the world
[INFO] .... [Firminus: Killed Firminus]
[INFO] .... null
[INFO] .... world
[INFO] .... null
[INFO] .... world
[INFO] .... null```
why null huh
Well do you actually have any code to update the scoreboard
update how?
What if I told you I know why you're getting the error?
Firminus:
==: org.bukkit.Location
world: world```
i think this is locations.Firminus.world
:?
You're serializing locations, then trying to get the string from it
uhhh
just get the location from the config, then call #getWorld()#getName()
Well you're putting your values as the score names once and then never changing then
At the very least you need to call showScoreboard on a timer
can you give me example?
@quaint mantle ```java
Location location = cadiaCore.hologramConfig.getHoloConfig().getLocation("locations" + "." + locationName); // Gets the location
String worldName = location.getWorld().getName();
Something like that 😄
yeah
make null checks and stuff ofc
System.out.println(p.getWorld().getName());
System.out.println(locationsData.getCustomConfig().getLocation("locations." + locationName).getWorld().getName());```
can someone help please
Look up the scheduler API for how to use timers
@sullen marlin can you add me as a friend as a flex 💪🏽 ❤️
i still prefer the println for quick debug
why do i feel like i know the name md_5 hmmm
or logger
Orange Slime Guy 🤪
almost like he's the creator of Spigot
no wonder .-.
thats why his name is familiar lo
😂
lol*
maybe you heard about md5
🤪 🤪 🤪
well i still need an example of the code and i think md_5 is either doing the code or something else
he's a busy guy
true
Example of?
im surprised hes active in here, lowkey kinda fangirling ngl
example of this lol
ok man done lol
[INFO] .... world
[INFO] .... world
[INFO] .... world
[INFO] .... world```
so it does or doesnt work
does.
thanks for helping lol
gg
np
nice job
insporational
it took me 4d 😂
please someone i require help
for some 6 codes
better than never :)
me too
make sure to run checks to make sure the world isn't null before trying to get data from it
me three
me nein
the things that surpised me alot that adding another section of locations work
nein!
yeah, crazy
lol
yay 😂
twanty oen
you can't loop through something that doesn't have a key
guys anyone can help?
you didnt have a key
i need someone to write this down cause idk how to
we will rock u moosic
we need! we need help please! help please!
yes we need, we need, help please!
iderpy chill lmao
k sory
this is my issue rn
why is your showScoreboard() static REEE
hm?
wdym
~~ ~~ vs ----
It's not going to update because you aren't calling for it to be updated.
you didn't write this did you
that ^
okay then
ok @lean gull and ur issue is..
^^^
how to add it?
what's the issue
look at screenshot
Okay man, the spawn at nearest location has done! Now gotta work to the soul points...
like what is the thing that i need to add
do the suggestion it says
@lean gull
many*
it gives a string.valueof
Yeah
are u sure it'll work with a list?
The string value of a list?
It'll print, yeah but it'll print a bunch of nonsense that you can't really work with.
soo what do i do
@carmine nacelle
scheduler.runTaskAsynchronously(...);
``` is this the one?
Just make a new BukkitRunnable()
@solar sable https://www.youtube.com/watch?v=luODHdp8awM
In this episode, I show you how to create and schedule tasks with Spigot Plugins. #Spigot #MinecraftPluginDevelopment
Reference: https://bukkit.gamepedia.com/Scheduler_Programming
Stay Updated!! 👁
Discord: https://rebrand.ly/discordlink
Twitter: https://twitter.com/kodysimp
More Videos coming soon.
Leave a comment for any future video suggest...
this guy has great tutorial videos.
https://www.youtube.com/watch?v=yVBFAx-qjkQ&t=26s and theres that
Hover and click on all the messages you want! Learn how to code and use TextComponent and more :)
------ Links ------
Download Eclipse: https://www.eclipse.org/downloads/packages/release/2019-03/r/eclipse-ide-java-developers
Download Spigot: https://getbukkit.org/download/spigot
Build Spigot: https://www.spigotmc.org/wiki/buildtools/
Starti...
im quite sure this is where i got this from
he uses ComponentBuilders, which you arent
If it is where you got it from, you didn't watch the entire video
watch the video
@carmine nacelle is that where i am supposed to add the bukkitrunnable?
No, it needs to be inside of a method
so inside the scoreboard code?
make a void called like..updateScoreboard(Player player)
i looked at the code, he only has one line of text in the hover event
you can't just skip through the video and expect to understand it
watch the whole video, he does a great job explaining
@carmine nacelle like this?
ok please just stop helping, thanks
remove abstract
can anybody else help?
?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.
what did i just say
😂
anyone wanna spoonfeed iDerpy..? anyone..?
don't wanna be spoonfed
i'm just sayin all you've done so far is very basic
and it didn't help
I literally linked you an in-depth video on how to accomplish what you are trying to do.
lol
but ok
apparently not..but alrighty :p
and also, ya wrong, it does not help me accomplish what i'm trying to do
i just told you i looked at the code and you can clearly see he only has one line in the hover event
Why do you need more than 1 line
Hey vivian i wonder if comparing world object or string is faster
hey guys!
@carmine nacelle
welcome to the clown band
Xin chào bạn, tôi là nhà tuyển dụng của tập đoàn giải trí Rạp xiếc Trung Ương Group. Trong quá trình tìm kiếm và đào tạo những người hài hước của chúng tôi (đi săn chất xám và nhân tài) tôi nhận thấy bạn là người có khiếu hài hước, tập đoàn chúng tôi thật sự cần một chú hề đúng nghĩa, tôi đã thấy bạn vừa mở mồm là mọi người đã cười ầm lên, không cần phải biểu diễn. Đặc biệt đối với chúng tôi thì những vị trí lãnh đạo rạp xiếc cấp cao phải tìm người "có tâm, có tầm" Một môi trương cua nhung thien tai he, xung quanh ban la nhung nhan vat: cha đe cua tieng cuoi, nha khoa hoc he, chua he đia phuong, bait đo te, chua te rap xiet Moi truong lam viec nang đong, hai huoc
no
english
Sorry that's vietnamese
years ago, i was chinese
yes
Hello everyone, I'm an employer of Clown Band entertainment corporation. In the process of finding and training our humor people (hunting new talent), I found out that you have a great sense of humor, our corporation needs a true clown. I have seen you only need to open your mouth to make people laugh, don't even need to perform anything. Especially with us, to find right the senior circus leadership position, we need a clown that "have a mind and a vision". A great place for the genius clown, surrounding you is: the dad of the laugh, the clown science, baiter god,...
what is the event for player moving item to another storage (chest, shulker, furnace, etc
InventoryClickEvent or drag event
Hey, how can I make armour stand holograms clickable thru?
Try the marker tag
I’ll try, ty
@chrome beacon heyyy, so any idea how to flip the armorstand's head with ProtocolLib?
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(16, WrappedDataWatcher.Registry.getVectorSerializer()), new Vector(0, -180, 0));
I'm trying to do it with the datawatcher
You've already been awnsered
I'm trying to :p
public void setupHolo(Player player, Hologram hologram) {
for(int curHoloLine = 0; curHoloLine < hologram.getHoloLines().size(); curHoloLine++) {
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
Optional<?> opt = Optional.of(WrappedChatComponent.fromChatMessage(hologram.getHoloLines().get(curHoloLine))[0].getHandle());
WrappedDataWatcher metadata = new WrappedDataWatcher();
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x20);
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(2, WrappedDataWatcher.Registry.getChatComponentSerializer(true)), opt);
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true);
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(15, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x01 | 0x08));
metadata.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(16, WrappedDataWatcher.Registry.getVectorSerializer()), new Vector(0, -180, 0)); // Line in quesetion
packet.getWatchableCollectionModifier().write(0, metadata.getWatchableObjects());
packet.getIntegers().write(0, hologram.getHoloIDs().get(curHoloLine));
try {
protocolManager.sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
Is this for block breaking tools or fighting?
Is the issue only when the tool has no unbreaking?
You could just create an NMS armor stand and geta data from that. Other than that you'll have to experiment
what does .getI18NDisplayName do? I cant find it in the spigot docs.
I'm already using ProtocolLib for all of my other things :/ ill make a thread, thx
You need to set the Itemeta back again
That's not a spigot method. Judging by the name it will get the localized name of the item
You might also wanna put a break; in your case 2 there
i just want it do do for either
You might also want to check item InventoryDragEvent depending on what you're doing
No. the answer coll gave is not what I ment... coll gave me the answer to How to set custom effects to a custom potion itemstack but I wanted answer for how to set potion type in a potionmeta
Not sure if htere's a general SHIFT_CLICK enum, but if theres none, just use an or condition
I tried InventoryDragEvent but did not know how to get the item as with InventoryClickEvent it can just do .getCurrentItem()
You can't. You can only do what he said or use deprecated methods
Actually never mind
Use setBasePotionData
@sharp kelp ^^
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta pmeta = (PotionMeta) potion.getItemMeta();
pmeta.setBasePotionData(new PotionData(PotionType.FIRE_RESISTANCE));
potion.setItemMeta(pmeta);
Is this it? Did not try it for myself
Yeah that's it
Never worked with Potions before almost missed the setBasePotionData in javadocs
YES
I was trying to find how to set the type
I thought it was POTION which was not working but its PotionType
thanks so much
javadocs is your friend
When i build and use the plugin it keeps saying this :
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getDisplayName()" because the return value of "org.bukkit.inventory.ItemStack.getItemMeta()" How can i fix this, I dont even know why it is null.
tool.setItemMeta(meta);
Oh then yeah, since you made the changes in that meta
Why do you even have the ItemMeta meta in there tho lol
Nice, I have that habit too. Really gotta tidy up my codes
Anyone know about right click detection and raycasting?
I have not made anything but want to make:
every stick make particles on right click for 10 blocks
(I am new to spigot, came from datapacks)
any examples? (ping me)
PlayerInteractEvent == for detecting the click
There are methods under world and Player iirc for ray casting
can i copy ur about section its dope
sure ig lol
sick
tanks
how to compile spigot server with custom patches?
Spigot or Paper
How would i stop the player from moving a specific item by checking for the display name of the item to another storage (chest, shulker, etc) but still allow them to move it in their inventory?
I know it is InvetoryClickEvent
And i know how to cancel it
but
the problem is when i check for the displayname
it keeps saying the itemmeta is null
check if it has item meta before checking the item meta.
It does
check if it has a displayname before checking the displayname
im saying in code
make sure you arent checking what the meta IS before checking if it even HAS it
ok, then you wont get nulls
but i am
code?
ok
So some sort of one way thingy where you can only take from the container and not place into it?
oh no
i have this item
it gives the player a set
for 15 sdeconds
that part works
but i dont want them to move it into a chest
and keep it
i can stop them from dropping
but the moving into a chest or smt is the problem
still waiting for the code where you check the meta
breh
Oh, then you could do some magic with the getTopInventory and getBottomInventory from the InventoryView class
i just closed it by accident
one second
lemme send code
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.
ignore the Objects.RequireNotnull part
without that i still get the same error
im trying to prevent players for enchanting, disenchanting and ..... custom items, but this is not working and it is cancelling the event when i try to move the item when it is in the disenchanting or... slot
#currentItem().HASITEMMETA
do i have to even though i know it definatly does have an itemmeta?
Does an empty inventory slot have item meta?
AIR i guess
if the item is null, return
if the material is air, return
if it doesnt have item meta, return
if it has item meta, but not a displayname, return
can somebody help me with this ?
k thank you
Is it safe to send packets async or do I need to put in a runTask(
np
i guess packets ARE async
Ok thanks
You can skip all of this if you use event.getCurrentItem() == null
No..
how can I make sure that if an event is executed twice, it is executed 1 time? there is a code, but it only works 1 time
private int everyOther = 0;
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if (everyOther % 2 == 0) {
everyOther++;
Or maybe not all of it
just because the item isn't null doesnt mean it has item meta and a displayname.
But don't every itemstack have an itemmeta?
Oh
What are instances where an itemstack returns its getItemMeta() as null?
if (event.getCurrentItem() == null || !event.getCurrentItem().getItemMeta().hasDisplayName()) return; This works fine for me
yea that works fine
just better to be safe, hasItemMeta must exist for a reason, so.
I guess ItemMeta cant be null on anything except a null item/air
its just unspecific
Well, true. Never hurts to be too careful
and cant get values from unspecific data
thank you vivian
np
the only problem now is that they cant move it in their inventory
why not
i just want them to not move it in a chest or other storages like that
well
see if the clicked inventory is the top or bottom inventory
cancel/not accordingly
top is always gonna be a chest or whatever, bottom is player inventory
ok thahks
np
Is there a way to set a command’s usage to a component
a who what
You know adventure text components
like you want it to show how to use the command when hovering over something in chat..? or
command.setUsage( requires a string
I want to put in a component though
Is that not possible
You would have to send your own message
@chrome beacon Do you know if it's possible to use a Switch with something like...
switch(clickedItem.getItemMeta().getDisplayName()){
case ChatColor.YELLOW + "Test":
break;
}
Any way to bypass the "Constant expression required"?
switch > if if if if if if
If I want to put in Color codes do I just use the ChatColor strings
if i want to make a hologram plugin, when should i send the armor stand packet to the player ?
im currently doing the same, have fun its been interesting
when do you send the packet to the players ?
I sent it once it's created, then i send it to the player when they join, and to all players online at onEnable
and I send it once its updated through my gui and many other times
my system is pretty complex
ok so when a player switches the world, should i send the holo again ?
im not sure if switching worlds unloads them or not.
they're packets, not actual entities so its not like they despawn.
i will try i guess
and i have another question
the y coordinate
how much should i decrease for each hologram
Switcy statements work with Strings yed
Yeah, but it won't let me combine the chatcolor with it
That or the other symbole
The § is bad practice
Depends on how youre getting the string
You know the ChatColor constant just adds that
Yeah, but it can cause issues supposedly
Literally every post on Spigot where the person is using the symbol, they get told to use ChatColor instead.
yes because it provides cross version support, it is more readable etc etc
not because it will actually cause issues afaik
looks like what i said
Am I still be able to edit the scoreboard after I did player.setScoreboard(this.scoreboard); ?
Yeah, you'll have to get the same scoreboard object and re-set the scoreboard again.
So I can only do player.getScoreboard() and then edit it further??
correct
well, yeah thats the main issue with scoreboards
theres ways to make them not flicker
ive never really used them but there's ways you could probably find on the forums
Yes I know
They do it with team prefixes
But I still have to use the method mentioned above
whatever works for u man
I will test it out
gl
Thx
can anyone give me a method to save and one to load objects from a file?
i have an array of Sign objects that need to be saved and loaded
actually, the save part is working, what I need is to load them back
You cant just save/load any arbitrary object to/from disk.
How did you save the sign and how does it look in your yml file?
for (RecipeSign sign : signs) {
this.getConfig().set(sign.getName(), sign);
}
}
```i
public void loadSigns(){
for (String s : this.getConfig().getConfigurationSection().getKeys(false)){
}
}
RecipeSign?
//list of 10 items: 1-9 are the recipes, 10 is the crafting result
private List<Item> items = new ArrayList<>();
private String name;
private int posX;
private int posY;
private int posZ;
public RecipeSign(int posX, int posY, int posZ) {
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
}
public List<Item> getItems() {
return items;
}
public void setItems(List<Item> items) {
this.items = items;
}
public int getPosX() {
return posX;
}
public void setPosX(int posX) {
this.posX = posX;
}
public int getPosY() {
return posY;
}
public void setPosY(int posY) {
this.posY = posY;
}
public int getPosZ() {
return posZ;
}
public void setPosZ(int posZ) {
this.posZ = posZ;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
This looks like it can easily be made ConfigurationSerializable
well, i want every message sent by a player to have a clickable text, how to do it?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
do you have an example?
u lost ur nitro
that is sad
hes gonna be 7frown7 now
Yeah i miss my peepo emojis...
7financiallyResponsible7
It looks like you still have nitro tho?
just no boosts
More like 7brokeStudent7
lol
😢
take this 🧻 ||this was supposed to be a Tissue Box but i didn't find one||
i got the free epic games nitro and then i got addicted to the higher file size & emojis
🐮
I have to react with this generic crap now...

ig you can leave a tonne of servers as well lol
cause you dont need them for emojis
don't u have classic nitro?
Yeah
Not here apparently
🤔
thats weird cause afaik there is no "Use external Emoji" permission node for nitro normal/classic
:hyper_concern:
u need to imagin the emoji

- what is the event to listen to Player sending a message in chat
PlayerChatEvent / AsyncPlayerChatEvent
PlayerChatEvent?
actully i can't tell the difference between them in the docs
what is it?
what is ment by async?
Uh, its short for asynchronous, basically where things are done concurrently rather than blocking the main thread
im probably not the one to explain it lol
google is your friend
i'm not sure about that one
- a while a go i was making a command for a bungee server but when i make the player send /server using the plugin it shwos the unknown command error
why does this line shows this error
textCompanent.setClickEvent(ClickEvent.Action.RUN_COMMAND, "<command>");
the error:
'setClickEvent(net.md_5.bungee.api.chat.ClickEvent)' in 'net.md_5.bungee.api.chat.BaseComponent' cannot be applied to '(net.md_5.bungee.api.chat.ClickEvent.Action, java.lang.String)'
setClickEvent takes one argument of type ClickEvent
So
component.setClickEvent(new ClickEvent(Action.RUN_COMMAND, "<command>"));
Can you not cancel BlockRedstone events?
oh i forgot the new
You can set the new current to 0
Would that not power the block still?
Not sure.
And also kill the redstone signal when it goes through the block
You can listen to more specific events like the BlockDispenseEvent or the BlockPistonExtendEvent
I know how to set a lore to a item but how can I make the words in the Lore be in separate lines?
The lore is just a List of Strings. Each entry is a new line in the lore.
?paste
ah okay thank you
So your suggestion is to kill the redstone line and handle all redstone interactions from thenforth manually?
I have no idea what your goals are 😄
I want to disable noteblock interactions
You suggested setting the new current to 0
Which would disable any further redstone action through that block
declaration: package: org.bukkit.event.block, class: NotePlayEvent
You can cancel this event
What about changing the note
That is not what I asked
changing the note via right click still updates the blockstate even when no note is played
I think this can be prevented using the BlockPhysicsEvent
PlayerInteractEvent is probably also worth visiting.
PlayerInteractEvent seems to only target entities
BlockPhysicsEvent only when a block is modified by turning it into a falling block to, well, simulate physics
Really?
I have used it for clicking blocks & air before
PlayerInteractEvent has a getClickedBlock() method
PlayerInteractEntityEvent and PlayerInteractAtEntityEvent are called for entities only.
Hang on, no
Idea was having a stroke
It showed me the class outline for PlayerInteractEntityEvent while hovering over PlayerInteractEvent
F
So how can I make it so that the block acts like a regular block
i.e. placing a torch on it works without crouching etc
Hm. Maybe let the block be a STONE server side and just send the client a packet with your Noteblock state.
Registering a packet listener that listens for outgoing chunk packets and modifies them could be one approach.
But this sounds like it should have a full fake block framework where you can define a server side and a client side
BlockState separately.
Check if the player crouches and dont cancel it in that case 🙂 👍
Great suggestion, now the player can fuck with the blockstate while crouching
https://www.spigotmc.org/threads/prevent-noteblock-blockstate-updating.483242/
Have you played around with the BlockPhysicsEvent?
Oh, I already solved that issue long ago
I didn't even realize buildtools makes a maven version of spigot, I should really switch now lol (I'm just using eclipse, not even gradle)
I have an array of multiple data types, ive been using object[] so far but I wanna switch to that wrapper thing, and I pretty much dont know anything about it. Can someone help me out on making one or send me a thread about it? because I couldnt find for some reason
what wrapper thing (give more detail)
Ew. Using a raw Object[] seems bad.
well he wants to switch to a wrapper thing
but idk what that is because he won't give more detail
What data types?
no
sorry guys I looked up on google one final time and I think ive found what I was looking for
and what is that?
Pls share. Im curious.
If you just wanna wrap your array to a List use Arrays::asList Ig
Where doggo pick? Imposter conclure.
Oh I tried switching to another one and then it just disappeared
Where’s your pretty pink tho? 
Can you post emojis from other servers as discord helper?
Yeah lol
I don’t have the cat gun one 😩
like mine?
👀
isnt it possible to open a crafting inventory? https://romano.eats.dog/YTQiVmn5
I'mtrying to display custom craftings in a crafting table inventory
I meant helper...
Oh lol, if I only had permission I’d have done that long time ago
Crafting is the players 2x2 inv
Not a fully functional one
Not unless you do all teh recipe processing yourself
or attach to an actual crafting bench
oh, thanks it works now
yy im doing that
Player player = ...;
Location location = ...;
player.openWorkbench(location, false);
yeah I just had to switchto InventoryType.WORKBENCH instead of InventoryType.CRAFTING xd
can I help with anything about the pathfinding I mean I dont think so but I wanted to ask
Not rly. I just have to fix the last pathing issue and then its done. But ill have to check on that later.
Can help at general? Thanks
okay👍
public void addShopItem(int slot, ItemStack item, int cost, boolean points) {
how do i add a name and lore argument to the list of arguments? whats the syntax
how to sleep dynamite smoothly? so that it does not move
p.getWorld().spawnEntity(l, EntityType.PRIMED_TNT);
Just expand on what you have already. Add String name and List<String> lore to your arguments.
But this sounds like a very questionable design.
how so
What do you mean by that?
Set its velocity to [0, 0, 0] for example
thanks
public void addShopItem(int slot, ItemStack item, int cost, boolean points, String name, List lore) {
also ur saying i can just do this?
setVelocity?
List<String>
Sure. You can do whatever you want.
so that when igniting the dynamite does not move and stands exactly like a block
It should not move on its own... Make sure to offset the spawn location by [0.5, 0, 0.5] so it lines up with the blocks around.
https://paste.md-5.net/otociqelip.cs i getting this error on thread how can solve it
okay, thanks
for (int x = -2; x < 2; y++) { This line
x never gets incremented and so it loops infinitely
so I was told to ask here even tho it's spigot specific and I am having a general java issue
so I am trying to use the command prompt on windows to compile a HelloWorldPlugin.class file and a plugin.yml into a HelloWorldPlugin.jar file, but the command doesn't work
it's jar -cf HelloWorldPlugin.jar HelloWorldPlugin.class plugin.yml and windows tells me that either the command is misspelled or doesn't exist.
it does exist, I have confirmed that, jar.exe is in JDK's bin folder, and I also didn't misspell it
yes I did manually set the environment variable to the correct path
yes I did try reinstalling JDK
yes I did restart my pc
and I also asked on the r/javahelp (or was it r/helpjava?... idk) subreddit, like 15 hours ago but still no useful response
nothing seems to fix it
and yes I am aware I can use an IDE like Eclipse to compile my files into .jar files, but I first wanna learn how to use the console for that
so like... does anyone have an idea what might be going wrong?... and how to fix it?
?paste
Two hand placing, favoring HAND https://paste.md-5.net/vasiqixaku.java
Usually you would use the java compiler 'javac' to compile java code like this.
But i have never manually compiled like that and i also have never seen anyone do it like this.
I would just stick to using your IDE for that kind of work.
oh, thanks!
I've only used javac when making basic code without dependencies/resources tbh, it just becomes a hassle when you try to do anything more complex 🤔
well the thing is the command is the correct one
with javac I can make a .class file out of a .java file
but jar compiles into a jar file
and the "I'd jsut stick to an IDE" argument doesn't work, as I already said i do know that they can do it easier, if I would want to make it that easy, then I would
and I will later
but for now not
sry if that seems aggressive but.,. the arguement jus sucks imo
it's nothing complex so far, just a simple hello world on startup, that's all
For a single .java file written on a Pi you can do
javac -d ./build *.java to compile all java files
then go into the create build folder and just jar all the files using
jar cvf YourJar.jar * to include everything inside this folder (including .yml files) in a jar file.
I wont say what I was going to say
uhhh
sry but like... what is Pi? ':D
Was just an example. I personally would use javac from command line only if i wrote a quick java file in vim and wanted it to compile quickly.
okay and what is vim?...
sry I literally started with java yesterday
but still, I'm only looking for a fix to my problem, not a workaround
Are you writing your code with notepad?
nah, I used Sublime Text, but I could use notepad
why?
That was a rethorical question.
I would highly recommend just using a proper java IDE and compiling with it.
Anyways. Does your terminal recognise the jar command at all? What happens if you just type jar in it?
Is there a better way to know how many UUIDs I got in my ArrayList than looping through it and doing int++ everytime it gets through?
lol
what haha
what did I just read
Yes. Just use ArrayList#size()
did you do this yourself?
I would highly recommend just using a proper java IDE and compiling with it.
sry but like... stop saying that, it doesn't matter to me if you recommend it, since if I would want to do taht, then I would. and as I already said, I will later. just rn that is not what I want
-_-
Does your terminal recognise the jar command at all? What happens if you just type jar in it?
says the same thing, that it either doesn't exist or is misspelled
yes, I had a play last night
What happens if you type java -version in your terminal?
thank you very much
it tells me:
java version "17" 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
Hm ok. Did you add your java directory to the "PATH" system variable?
Should look something like C:\Program Files (x86)\Java\jdk[some_version_here]\bin
cant I just do String instead of <list>String? it gives me an error when i do the list
yes I did manually set the environment variable to the correct path
Or better. Add the JAVA_HOME variable value: C:\Program Files (x86)\Java\jdk[some_version_here]
Then add %JAVA_HOME%\bin to your PATH variable.
List<String>
Both JAVA_HOME and the entry in PATH?
jsut %JAVA_HOME%\bin and nothing else? noThing like C:\?
idk what JAVA_HOME is but I put the path of the bin folder in JDK's folder into the PATH
(gtg eat, will respond soon)
My algo is screwing with me -.-
hahaha
It didn't want to squeeze between those blocks
Is it though? That's probably a more efficient path 
I think your algorithm just proved you right
Does the Bukkit.getPlayer() Method return null if the Player doesnt exist AND if he isnt online?
yes
okay thank you
Lol
you can just create a if statement to check if they aren’t null
It returns null even if player is offline
So you can check if player isn't null and else you can cast it to OfflinePlayer
yes I know ElgarL told me but thank you

I couldnt do that because he can also not exist right?
It could be just a random string
okay did this (and the other one) now
previously I had them in the user variables, I prolly understood some instruxctions wron
but I also only had jdk's bin folder path there
so now I did what you said, so let me try that rq
IT WORKED!!!
Thank you sooooooo much <3
and since I noticed you're german...
Dankesehr, hast mir echt geholfen ^^
7smile7 is vry pog
agreed!
So I am trying to just emulate block placing myself
ItemStack itemStack = e.getItem();
Block block = e.getClickedBlock().getRelative(e.getBlockFace());
block.setType(itemStack.getType());
BlockData data = block.getBlockData();
if(data instanceof Rotatable)
((Rotatable) data).setRotation(e.getBlockFace().getOppositeFace());
if(data instanceof Directional)
((Directional)data).setFacingDirection(e.getBlockFace());
block.setBlockData(data, true);
if(e.getPlayer().getGameMode() != GameMode.CREATIVE)
itemStack.setAmount(itemStack.getAmount() - 1);```
But the block data is never actually applied
Any idea why?
Did you import teh correct Directional?
yes
BlockState.update(Boolean)
No, you are getting the BlockData from the block. So nothign is going to change
You changed the type, then got BlockData from it
so you are literally setting the exact same BlockData you just read
What is better? UTF-8 or UTF-16?
8 will suffice in the majority of cases, yeah
Plugin for Java 8 Spigot 1.8.8
then 8
Plugin for Java 8 Thermos 1.7.10 too?
If you are talking about file encoding then yes
thanks
Hello, i have this code but with op i can't execute the command, how can i solve it?