#help-development
1 messages ยท Page 949 of 1
And get the pdc from the egg's item
You're still getting the pdc from the egg entity
I think it's the same for eggs, after testing it proceeds to remove the spider and send the player the message
o_o
So then perhaps it's the same for all projectiles ๐
In fact I was talking about ender eyes, not ender pearls but same thing. I did notice it because it was still on there after picking up the eye again once it dropped
With protocol lib i can do for example just some players see an specfic effect?
What do you mean by an effect?
There are multiple ways of making it, and yes you can do it with protocol lib
Does anyone know if the KauriVPN plugin blocks CloudFlare WAP?
there is an way without protocol lib?
Please check #help-server
Making the glowing packet with NMS
It really depends on how familiar you are with it. If you're used to nms few minutes should do the trick
it's not possible to predict ahah
For reference the entitiy metadata packet have a byte 0x40 making the entity glow
https://wiki.vg/Entity_metadata#Entity
It might be easier with protocollib if you never done nms
Especially if it's for multiple versions
I will take a look, thanks!
Your welcome, feel free to ask help ๐
https://gyazo.com/5d44116cd7817ec0c5e3fda3872a993f
@agile anvil check this out haha
pets:
26a2e08c-5140-4270-8b8f-92514a3d9c54:
petType: WOLF
petName: Unnamed
petOwner: 7f9769f6-aa37-49a7-a0f3-d2a5295c29e5
location:
world: world
health: 20.0
7d986161-86bd-4ad8-8c23-751b52835b59:
petType: WOLF
petName: Bobbert
petOwner: 7f9769f6-aa37-49a7-a0f3-d2a5295c29e5
location:
world: world
health: 20.0
ea72a875-62bf-4cd5-8176-322a4771f11d:
petType: WOLF
petName: Bobbert
petOwner: 7f9769f6-aa37-49a7-a0f3-d2a5295c29e5
location:
world: world
health: 20.0
please
for the love of god
use a database
Maybe later
its not that hard ๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ๐ญ
Maybe later
Ahahah I love it! Did you use pdc or only saving to a flat file?
How do I set the durability of an Item? The API says ItemStack.setDurability is deprecated and now inside ItemMeta but ItemMeta has no method for durability
declaration: package: org.bukkit.inventory.meta, interface: Damageable
check if ItemMeta is instanceof Damageable, then cast it
ahh okay
He is doing it PermissionsEx
Bobbert
top tier name
Why thank you I thought it fit nice
is there any way to make a plugincommand without defining anything in the plugin.yml?
Injecting commands into the command map
That's the way I like to do it!
(I am not joking lol)
Yeah it's normal
i tried registering a command and then doing Plugin#getCommand() but it returned null
Ye, spigot adds commands to the command map according to the plugin.yml's that are loaded
getCommand just gets you a command from the command map
Iirc
Is there a way to change data in the spigot.yml config. I know you can get the values but when i try to change them and save them it doesn't work
Before i spam the channel with my code i would like to know if its possible so i don't waste anyones time
How fast is Bukkit.getOfflinePlayer(UUID)?
Never had issues with it, why would they include it in the api if it wasn't fast? ๐ฎ
ik im asking how fast
Well, not everything in the API is fast lol
If the player has already joined it will just get them from the offline player list, otherwise it will try to fetch the player afaik, but with uuids that's less of a problem ig
Ok thanks
its fast
dw
and what raydan described regards getOfflinePlayer(name)
not the uuid one
Unless you miss the cache
hmm
I'm creating 16384 ByteBufs async
but the server crashes nonetheless
Ofc, all of those are written with a lot of data
Why... are you creating 16k byte buffers
image to particle
particle images
my dream
You mean one bytebuffer with 16k bytes i hope then?
no
cuz
each minecraft packet needs to be sent

!?
instead of sending 16k particle packets
I just send 16k bytebufs
but the thing is
that the server crashes while creating those
xD
With what exception
Sounds like you are blocking the main thread to me...
hmmm
this.asyncExecutor = new ForkJoinPool(parallelisms, ForkJoinPool.defaultForkJoinWorkerThreadFactory, (t, e) -> AlixCommonUtils.logException(e), false);
and then just doing executor.execute(this) on my own Future object
What type of parallelisms are you using?
min of 2 or equal to Runtime available processors
well I mean its not gonna fetch any mojang services
not sure what would it make it so slow
Is it not? If the player has never played before, then the name is fetched from mojang. Or has that changed.
And if he isnt in the cache, then there is at least some FileIO happening, looking if his file exists to load it, or create a new one.
only getOfflinePlayer(name) has to fetch mojang services due to a uuid by name lokup
name is nullable, uuid is not
but yeah, there could be some potential file io stuff going on
idr much of source tbh
since when is there such a method?
been there for quite some time, no?
At some point your name will be indecipherable
it's probably getting all offline players and searching by the getName method
lol
so file reading stuff
I assume they load the cache eagerly in some sort of multimap
i mean thatd be the logical way more or less
now what kind of animal is a Consphlere
does Open sources plugin have copyright? Nothing will happen if I make my own plugin based on another one, taking an idea and pointing it out?
there are licenses
it has licenses that you have to respect
yes
License has protection or just information?
i mean for what this need in open source
protection for the copyright holder and some for the end users
if someone can chance code or smth
yeah
GPL for example says that you as an end user should be able to get the source code of whatever program you use that is GPL
thatโs an example of protecting the user
some licenses require you to credit the author
thatโs protecting the author
you canโt copyright an idea itself, but generally speaking the less code you take, the harder it is to prove for plagiarism
name a concrete example and we can tell you how to follow the license
During the PlayerJoinEvent, will the player show up in the list of players from getOnlinePlayers() ?
And the same question about the PlayerQuitEvent.
it takes about a tick or so after the join event for them to show up
same for them leaving
Ah, that's what I thought. Was hoping it worked the opposite way.
mainly because putting them in the list is like one of the last things that gets executed same when they leave
OK, thanks.
Hey, thank you so much. I didn't take the time to understand this until now. I have a few questions, if you don't mind.
Firstly, what do you mean by polling for displaying? Do you mean polling for things to be displayed to the user?
Also, when I poll actions, are you implying that those that are polled will only be past actions because they take place prior to the current check interval and after the penultimate check interval?
Also, speaking of intervals, how would I go about determining a good interval? How fast would these intervals be able to be practically? A few hundred milliseconds, a second or a couple of seconds, maybe more than that? Some of the actions, like updating a timer shown to the user, take place at one second intervals, so would it be reasonable to have such an interval?
Whatever you can answer, Id greatly appreciate. :D.
Hi , thinking about making a skyblock plugin , any idea how the data would looks like?
the tables in the database?
island_id , uuid , name
island_id , x , y ,z , yaw , pitch , other data for the specfic island?
location should be a single column
what kind of data a island would have?
anything you want, ideally you just need to have 3 things though
name of theme?
like if i have a gui with multi island theme?
well, maybe 4
alr thanks
island_id, location of its center, owner, which island schematic is used(for regen purposes)
this is like the minimum that comes to mind, if you want to add more you can
if I were to add another column it would be a separate table that holds a blob column
and that would be to put the schematics
blob = binary large object
you can literally just stuff random binary stuff into mysql tables XD
Is that what those blob:// urls are?
can anyone tell me how can I get into my server's shell once im out of it?
then you would have another table for your players, and have the players table and the islands table be linked together
crawl back in?
surely you could just go back the way you came right? o.o
most likely
you can stream binary data so it would make sense
just joking, I assume you are using screen?
if not then there is no getting back to the MC console
im using ssh
that is the type of connection you are using to access the terminal
screen is a program that allows command line programs to continue running and get back to them
I personally use tmux, idk why
if you don't use something like that, then when you exit from the application there isn't a way to get back to said applicatio without force killing it
ssh, I have ubuntu server and im accessing its terminal using ssh on my windows
idk if im making any sense
so, either use screen or tmux and there is a third I think there was but can't think of its name
wait
try them out, find the one you like and use those to run the mc console inside of so you can get back to it later ๐
I cant post pictures here aaa
not necessary
literally telling you the solution
you are not the first to learn the hard way of this
at least you came to the right place however to be pointed in the right direction ๐
I came up with some weird ass idea, and not sure if it is even possible. To make it work I need to somehow make Spigot listen to two ports simultaneously
ok, well spigot is already capable of this
but do go on
How?
well it listens on the UDP port if you allow it
also listens for telnet as well, forget which port that is
Ehh... I don't get it
well the telnet thing is for remote commands
mainly implemented in MC if I am not mistaken though, same goes with the UDP port which is used to query the server
Why UDP and telnet, theoretically I want player to be able to join both via IP:port1 and IP:port2
thats doable
Yeah, how?
spigot can listen on more then one ip
just add another ip
to the file
multiple listen= lines
you can even put ipv6
yesss
Why do you need spigot specifically to listen on multiple ports
Your plugin can bind to any port, regardless of spigot
also can just share the port too
since it is the same application
and thus is not considered a new connection
might have to inject into the netty thought because it might swat those packets away ๐
but still lol
Yeah, but I want players to be able to join via this additional port specifically
why don't you use port redirection?
And be able to pick it up from inside the plugin, wether they joined via the main one or additional one
you do know you can redirect random ports of your choosing to just get routed to another port
Yeah, but spigot will see these connection as if they come from the same port
most likely yes, also bungee has the ability to use multiple domains btw
and do what you are wanting without the need for multiple ports
bungee will even inform you which domain or subdomain they joined from
thus removing the need for multiple ips and ports
just have to create relevant subdomains
Hmm
Do I really need bungee for that? Can't spigot fugire out what domain made a request by itself?
But yeah, that's interesting idea
it is the easiest option since bungee was implemented with that in mind. Spigot doesn't have such abilities
nor does it care about where a connection came from
I am pretty sure you could probably create a plugin to implement that functionality
but you will most likely have to inject into netty stuff to accomplish it
since you need to read the host connection info stuff
Hm, that sucks actually
how can I autorestart the server if power goes down?
is there any way to do that?
or do I have to start it again from the console
does anyone here know how to use quaternions?
math o.o
register a script as a service that will do this
haven'`t had that
I have one you can use to reference to make your own
Haven't heard of math?..
how?
I have no idea whether you're trying to anger me or are just this ignorant
what issue are you having that requires quarternions
Damn, chill
rotation
Here you go, angry boi https://www.youtube.com/watch?v=d4EgbgTm0Bg
How to think about this 4d number system in our 3d space.
Part 2: https://youtu.be/zjMuIxRvygQ
Interactive version of these visuals: https://eater.net/quaternions
Help fund future projects: https://www.patreon.com/3blue1brown
An equally valuable form of support is to simply share some of the videos.
Special thanks to these supporters: http://3b1...
am back
Probably the best math channel out there, I think his explanation in this video is very clear
I skidded some code for particle image generation
and I tried changing the values for rotation but nothing really changes

basically the code
I will watch the vid
am just explaining my issue
You do not need quaternions to rotate 2d image
o.O
thats a lot better lmao
quarternions are only needed when you want to rotate based on some other thing. Bit hard to explain
but in most cases for rotating stuff, you don't need it. An example would be like if you wanted a model to jump in space, rotate around another model while dodging another object
you have to account for all those vectors which have velocities and directions etc
and that is where quarternions come in for that
Yeah, but for simpler cases some linear algebra and trigonometry will suffice
^
Also, in your code
You rotate and scale the image (in minecraft, I suspect?), but it does not guarantee that these pixels will align with the minecrafts block grid, you need to do rasterization in order for this to work
ra what
Is there a way to tell if an OfflinePlayer is permbanned, but not tempbanned?
Blah. Was hoping I could tell from OfflinePlayer, given that the ban method has expiration/duration parameters.
What about BanEntry#getExpiration() and comparing it to null?
declaration: package: org.bukkit, interface: BanEntry
getExpiration will be null if they are perm banned
BaseCommand extends Command, PluginCommand#setExecutor() throws a npe
?paste
I assume you're trying to create commands without registering them in plugin.yml
Get command is returning null, check your get command function
yeah
I can help with that
no need
private static Map<String, Command> getKnownCommands() {
try {
Method m = getCommandMap().getClass().getMethod("getKnownCommands");
return (Map<String, Command>) m.invoke(commandMap);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
}
private static CommandMap getCommandMap() {
Server s = Bukkit.getServer();
Field f = getFieldFromTypeAssignable(s.getClass(), CommandMap.class);
try {
return (CommandMap) f.get(s);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
}
public static Field getFieldFromTypeAssignable(Class<?> from, Class<?> fieldType) {
for (Field field : from.getDeclaredFields()) {
field.setAccessible(true);
if (fieldType.isAssignableFrom(field.getType())) return field;
}
//AlixUtils.debug(from.getDeclaredFields());
throw new ExceptionInInitializerError("getFieldFromType with class " + from.getSimpleName() + " and field type " + fieldType.getSimpleName()
+ " had no declared fields!");
}
create a ```java
public static final Map<String, Command> serverKnownCommands = getKnownCommands();
and just modify the map as you please
i need to give the command a commandexecutor
and if you want this to be shown to players invoke this ```java
public static void reloadCommands() {
Server s = Bukkit.getServer();
try {
Method method = s.getClass().getDeclaredMethod("syncCommands");
method.setAccessible(true);
method.invoke(s);
} catch (Exception e) {
throw new InternalError(e);
}
}
yep
this is what I do
does everything work @orchid trout ?
without any of my code?
i already had most of it in my project
Trying to use tab plugin for my cross platform mc server (both java and bedrock) based on java tho. And for the scoreboard nothing appears for bedrock players
But things to show for the java players
is there a way of checking if the item is an armor without using craftbukkit? I'm seeing people using nms for that
using my method, yes
Dont creating a command which has the same name as your namespace would be a good first step...
Check if its ItemMeta is an instance of ArmorMeta
hi
why ```java
public void linkPlayer(Player player, Member member) {
String path = "linking." + String.valueOf(player.getUniqueId());
String dc = String.valueOf(member.getIdLong());
String code = Common.getMapKey(linking, player).toString();
FileConfiguration config = getConfig();
linking.remove(code);
config.set(path, dc);
Bukkit.getLogger().info(player.getName() + " has been linked with " + member.getEffectiveName());
try {
config.save(getFile());
} catch (IOException ex) {
ex.printStackTrace();
}
Bukkit.getLogger().info("Saved the linking.yml file");
player.sendMessage(Common.colorize("&7Your &aMinecraft &7account has been linked to discord"));
player.sendMessage(Common.colorize("&7Account: &3" + member.getEffectiveName()));``` doesn't seem to be saving correctly, it logs the saved and linked things
but it doesn't do the file things
wdym the same namespace
my plugin is named bitenet
that happens with all commands
How are you registering your commands?
I am writing a command ./verify Binvix
And it writes to me -> Command not found.
Why is it already verified on the forum
Did you add the command to your plugin.yml?
Did you check if you registered the command executor?
Did you check if your plugin loads without any errors?
bump :D
probably talking about the discord command
No, I'm not talking about Minecraft for verification in Discord itself
?verify
Yes
?
bump :D
So you can convert any object to a byte array and back, its that simple? https://paste.md-5.net/dobixucovi.cs
Only if it's serializable iirc
hm? how do I know if my object is serializable
When it implements Serializable, usually
Rip mine doesnt
RaydanOMG
I'm unsure, but last time I did something like that it worked like this
done, do I need anything else?
should just work now
33
ZBLL
Print out path and dc
issue, object contains an ItemStack, and I cant really modify that. Any solution?
ยฏ_(ใ)_/ยฏ
ok ill just convert it to b64 and back
ok 1 sec
You can convert an ItemStack into a byte[]
In several ways
Easiest is BukkitObjectOutputStream
chest.getBlockInventory().removeItem(shop.getProduct());
player.getInventory().addItem(shop.getProduct());
player.getInventory().removeItem(shop.getCost());
chest.update();``` Anyone know why the chest contents dont update at all?
this is what chest is equal to btw public static Chest getShopChest(Block block) { if(block.getRelative(((WallSign) block.getBlockData()).getFacing().getOppositeFace()).getState() instanceof Chest chest) { return chest; } return null; }
hi, so for a weird reason i can't figure out,
// This does not work
public Member getLinkedMember(UUID uuid) {
String path = "linking." + uuid.toString();
FileConfiguration config = getConfig(uuid);
return BotManager.getGuildById(BotManager.guildId).getMemberById(Long.parseLong(Objects.requireNonNull(config.getString(path))));
}
// This works
public String getWarningReason(UUID uuid, int id) {
FileConfiguration config = getPlayerConfig(uuid);
String path = "warnings." + id + ".reason";
return config.getString(path);
}```
each one is in a different class, both classes got very same logic
just changed the methods to fit with it
the first method stops working when server restarts, it starts returning null always, the second one got no problems
working one: https://paste.md-5.net/fazagolugo.cpp
broken one: https://paste.md-5.net/asologepev.java
split up the code and debug it and remove and ignore the IDEA when it says the Objects.requireNonNull stuff. supress it.
wait wait
i think
the problem is from JDA
because i made it return the id instead of member and it works
bro finally
i've been suffering of that for days, i tried 100 ways for that
hi
is JDA broken with spigot or what? why the getMemberById() method breaks if i restart my server
I don't have that problem, but I use User over Member in my plugin
hmm
may use it
i'll test it
um
there is no getuser method
should i get a member and cast it?
anyone know of a method to create a custom event based on when a player enters or exits your render distance? I was thinking on tracking player movement, join and quit and mapping out players who are relevant to each other
Imo, I would say you could track locations of all players and every 10 seconds or something you update those locations -> any player comes within idk 100 blocks or something -> do something
render distance itself is a client setting and the server knows nothing about that afaik
^
the server receives the render distance in this packet: https://wiki.vg/Protocol#Client_Information_.28play.29
interesting
If you wanna get dirty with packets for sure, otherwise if you track player locations I mean it should still be applicable in that way
I've been trying to code simple line when a player for example hits a pig then the plugin just kills the player but for some reason that I can't really find the solution to it gives me this message.
public class whenHit extends JavaPlugin{
public class pigHit implements Listener{
@EventHandler
public void wheAttack(EntityDamageByEntityEvent event) {
Player player = (Player)event.getPlayer();
if(event.getEntity().equals(EntityType.PIG)) {
if(player != null) {
player.setHealth(0);
}
}
}
}
}
oh i cant post images
;/
Learnjava moment
Player player = (Player)event.getPlayer();
๐คก april fools
alr I git rid off the addicional class but i'm trying to fix The method getPlayer() is undefined for the type EntityDamageByEntityEvent
I cant really understand this one
getEntity()
Send it to me and I can put it here
show the code again?
Donโt players render separately to this, in my testing it was 50 blocks then the player disappears, and entities it was 65 blocks
public User getLinkedMember(UUID uuid) {
String path = "linking." + uuid.toString();
// return Long.parseLong(Objects.requireNonNull(config.getString(path)));
return (User) BotManager.getGuildById(BotManager.guildId).getMemberById(config.getString(path));
}```
@orchid furnace
your code in general seems odd. ill check mine
could it be because of the BotManager.guildId?
this is the class https://paste.md-5.net/tusodidede.java
why not just do public User getUser(String userID) { return jda.getUserById(userID); }
yep that fixed the problem sorry for trouble.
You are trying to cast a Member to a User
what should jda be
try {
jda = JDABuilder.createDefault(token)
.setActivity(Activity.watching("Your behaviour"))
.enableIntents(Arrays.asList(GatewayIntent.values()))
.build()
.awaitReady();
} catch (InterruptedException e) {
disable("Could not summon the discord bot because: " + e.getMessage());
}```
Those are different things. A user is the user itself, independent from the server environment and server profile. A member is the exact opposite, so a member of a server, having a server profile
@worthy star
oh
ok this
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener
i tried to use protocollib in my plugin but i get this error if i tried to load my plugin
ProtocolLib not on your server
isn't the id a long?
you most likely do not need to use shardmanager here'
it is
i removed it
I store the UUID and ID together. so I jsut pull the ID from there.
Hello, how do servers have cutscenes, do they constantly teleport a player and restrict all movement?
they spectate an entity
@young knoll wake up nerd
Cutscenes are kinda goofy, mimic a players movement -> relay movement on a separate entity... though that's just what I assume the process consists of
Perhaps display entities that are forcibly spectated when the scene needs to be played
tysm the problem is solved now
after like 5 days of suffering
same, just a different problem ๐
but i still don't get why it did that
also make sure you depend
on it
in your plugin.yml
add
depend:
- ProtocolLib
so that your plugin loads after protocollib
wat
read up
how do I get the value of an attribute
Registry.ATTRIBUTE.get()
nvm
Player#getAttribute
I got a performance question:
So, when I have a list containg an enum (the enum has many entries), the list most of the time only consisting of one element, would it be faster to do it with a for-loop and switch-statements or just go with an if-statement for each check instead? I'd guess for-loop and switch but I'm not sure
that would be with the if-statements, as i need to execute different pieces of code indivdual to what enum constant there is
I mean for a cutscene you can just move the player along a line
If you want to stop movement then stick them in spectator mode and attach them to an entity
What about recording a cutscene
In the sense of mapping a players movements and relaying it anytime the scene needs to be played
I'd probably just record keyframes and then interpolate between them
Does that take head movements into consideration?
It does if you make it
ah gotcha
honestly i would create a helper tool to create a cutscene which then exports it to those movements
mhm
oh thx i try it out
If an item has no meta data it also means it has no nbt data?
why the leather armor doesn't turn green? must i set a packet?
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
protocolManager.addPacketListener(new PacketAdapter(this,
PacketType.Play.Server.ENTITY_EQUIPMENT) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
if(packet.getItemModifier().size()==0){return;}
ItemStack stack = packet.getItemModifier().read(0);
if (stack != null && stack.getType().name().contains("LEATHER")) {
packet = event.getPacket().deepClone();
event.setPacket(packet);
stack = packet.getItemModifier().read(0);
// Color that depends on the player's name
String recieverName = event.getPlayer().getName();
// Update the color
LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
meta.setColor(Color.fromRGB(0,255,0));
stack.setItemMeta(meta);
}
}
});
some level of nbt is required otherwise the server wouldn't know how to process it
Items are just all NBT data
Grab a basic item and run /data get entity @s SelectedItem
i think air is an exception
Well yes because that isn't a real item
is the error important?
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.updater.Updater.isChecking()" because "this.updater" is null
at com.comphenix.protocol.ProtocolLib.checkUpdates(ProtocolLib.java:540)
Maybe you didn't init ProtocolLib correctly
i don't think protocollib is a library to have nullpointers like these
ProtocolLib is a Plugin. Don;t shade it
oh yeah, don't shade protocollib
is this worth extracting?
i considered making the for loop and the check a method but then checking on null makes it look the same
TogglerView togglerView = getTogglerView(id);
if (togglerView != null
i guess it does make the code more inline
anyway, this looks so much better than what i had
probably changed name
a cool way is to look into which class uses ClientboundBlockUpdatePacket
then look in 1.20.4 in the class that used to use that and see what it does instead
if the arguments are very different it's not the same
ClientboundBlockUpdatePacket still exists
net.minecraft.network.protocol.game.ClientboundBlockUpdatePacket
intellij has some issues sometimes
try putting it manually and see if it's red
try invalidating cache
or rebuild in buildtools
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
version: 1.20.4, hash: 9d269f2531
ye
oh wow
can you look in the intellij to see if your jar is complete?
yeah in your dependency tree
this is for me
not sure if for the unmapped version it's the same
it might have the spigot naming
amazing
prapare for slower buildtimes
what did you mean?
correct
is there a documentation?
depend:
- ProtocolLib
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.8.0</version>
<scope>provided</scope>
</dependency>
how to create tab list in 1.19.2?
how do i wait 5 seconds before doing the broadcast?
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
String name = event.getPlayer().getDisplayName();
Bukkit.getServer().broadcastMessage("welcome " + name + "!");
}```
by scheduling the code
?scheduling
should i use BukkitSheduler or BukkitRunnable?
Bukkit.getScheduler().runTaskLater(plugin, () -> {//yourcode here}, ticksTillExecute);
oh it's here
are you going to ssh into his pc and write it for him as well? ๐
if i'm asked nicely sure
fair
sorry im new to spigot, what should i be putting instead of "plugin" just the main class?
yes
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
an instance more precisely as coll said
new MainClass();
You can't stop me!
old MainClass();
slightlyUsed MainClass();
Can you tell me how to give pvp mode when archery?
?
i cant take a clown seriously
they're gone
i got scammed by the lootboxes
i opend them and got my clown thingy but
it disapeared
instantly
lรถol
Hey, I need help with a TexturePack. I have a custom Tablist which works fine in the lobby, but when I go to a specific Server (in a bungeecord network) ir doesn't show. Here are some screenshots: https://drive.google.com/drive/folders/1y-HdBuxRyuwJ764Waq3PGKhfKpxVr09y?usp=sharing
On other BungeeCord Servers there aren't any issues.
I have binded it in in the default.json as a unicode "\uE03B"
and the .json is valid..
is kotlin good
yes and no
I mean it has a lot of ergonomical features
but eh, whenever I read kotlin code I always have a harder time understanding what is actually happening
you have stuff like first class higher ordered functions, and then operator overloading and infix inline extension functions etc
@ivory sleet wanna come eat pizza with us
I find it annoying when people wildly mix java and kotlin within the same project
What if you throw in some scala too
Don't forget Groovy
and maybe some clojure?
i wanna save how many players ever played a gamemode. How could i track that the best? Create a long list? Wouldnt that take up large amounts of memory/create Lag
Depends on how much you want to scale. What amount of players will you expect to ever play on this server?
well thats the thing
i want this to be scaleable in the future. If possible make this safe until 10k players max. I cant really say how many players this server will get, depends on how much hype its gonna enjoy
A UUID is 16bytes + 8 bytes obj header.
So 10k players would in result in 240kb in object size. Thats <0.25MB.
For that estimate i would literally just throw them in a Set<UUID> played = new HashSet<>(); and call it a day.
why a hashset, not a list?
Because .contains() on a List will scale with O(n) and on a HashSet it scales O(1)
Meaning a list would take 1ms for 100 players, then 10ms for 1000 players and 100ms for 10k players.
A Set takes 1ms for 10, 100 or a million players.
And you dont even have to check with .contains() on a Set.
Just always add the UUID. If its a duplicate entry then it wont be added anyways.
do u recommend any resources to learn that, because ive only been familiar with lists and hashmaps xD
I go a bit into detail in this guide. Otherwise just random sources online.
Won't the hashset have a big consumption given all the object headers on the map nodes?
it's still like 2mb of ram but eh
https://bukkit.org/threads/save-load-a-hashset.253660/ google search away from finding this @silent slate
ez
16bytes for the longlong and 8 bytes for the obj header = 24bytes.
I already calculated that in ^^
I'm not talking about the object header itself
I'm talking about the map node object
So Hashset to list -> List to String -> String to textfile
Yy
Still doesnt matter. 10k players is a high estimate. 99.9% of servers never see that in their lifetime.
just want to futureproof
i know that i will be incredible lucky to ever archieve that
IDeally under infinite load you want to minimize the pressure points
If you want it futureproof then you should use a database and store your data there
what kind of database
we have a gameserver rn and want to upgrade to a vps once we have enough players to afford it
amazing
agree
o foshure
it's only missing O(sqrt(n)) in the graph
but it's not really found in algorithms anyway
if I hit a mob that has isInvulnerable, is the EntitytDamageEvent considered cancelled?
Events are only cancelled by plugins
Rip
uh yes and no
While events only get cancelled by plugins, there are certain events that still fire even if the expected outcome doesn't happen
For example, InventoryClickEvent gets fired on beacons even if you aren't holding an item accepted by the slot
O(2) when

How much should the JUMP potion effect's amplifier be so that you can't jump?
infinity is not a number. Its a concept. You cant evaluate an expression with it.
-1 is making it infinite but i need it to make them not be able to jump
256
the amplifier should be able to do that i think?
BigAssInteger.MAX_VALUE = infinity;
-.-
ty :>

his name in german is bratwurst xD
ah i tried it but i can still jump, heres my code:
@CatchUnknown
public void onFreeze(Player p, OnlinePlayer targetPlayer) {
Player target = targetPlayer.getPlayer();
target.setWalkSpeed(0);
target.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, -1, 256));
target.sendMessage("You have been frozen");
}```
Set it to a very high number i guess
Integer.MAX_VALUE ๐
wait, i have a piece of code that works somewhere ^
set it to something between 128 and 250
idk why but that works for me in 1.20
alright ill try
eyy it works, thank you :>
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 210, 250, false, false, false));
nice ๐
i was too slow
i actually got tired of canceling their move event if they're in a Set because thats probably not good, so i came up with the idea of setting their move speed to 0 and giving them a specific jump amplifier so they cant jump
client cheats will be able to bypass this ^
haha yeah but if someone froze you and you just bypass it infront of them you're getting insta banned
not wrong
actually you reminded me to hide the particles by setting the boolean to false, thanks :D
why is that for?
selling our data
can someone Help me my Server isnt Starting with my Plugin and i dont Know how i should fix it
they can extrapolate our personality based on our minecraft skin
oh no
i can help
we need a pastebin on why
import org.bukkit.plugin.java.JavaPlugin;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class UltraLicens extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
String key = getConfig().getString("Key");
try {
if (validateKey(key)) {
getLogger().info("Enabled");
} else {
getLogger().info("Invalid Key");
getServer().getPluginManager().disablePlugin(this);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private boolean validateKey(String key) throws Exception {
URL url = new URL("." + key);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
return "true".equals(content.toString());
}
}
Thats the Code
At least format bro ๐ญ
sike
yes
How
URLConnection connection;
connection.setConnectTimeout(1000);
connection.setReadTimeout(1000);
yay
if(!mob.hasAI()) any1 know why this returns true that the mob has AI, despite the fact that it doesnt
I made a spawner with nerf-mob-spawners: true and spawned some chickens
that doesn't disable their AI in that way
Rip, what does it do then
I think it just removes certain AI goals
Rip
You can make a proper NoAI spawner tho
whats the most proper way to execute commands from console
Bukkit.dispatchCommand
this?
yeah
ight
Will only work on teh local machine. will not go through bungee
i don't use bungee
but why i get this error https://paste.md-5.net/ahoregehol.css?
wait
let me try something
this looks ugly somehow
i mean you could do it programmatically but that is most readable tbh
i don't think it's worth using a loop right?
nvm
i get this error now https://paste.md-5.net/cizizuhegu.css
i use this code to reward the playerjava public void reward(Player player) { int size = RelaxDc.getInstance().getConfig().getConfigurationSection("linking-rewards").getKeys(false).size(); for(int i = 1; i <= size; i++) { String cmd = RelaxDc.getInstance().getConfig().getString("linking-rewards." + i); cmd = PlaceholderAPI.setPlaceholders(player, cmd); CommandUtils.execute(cmd); } }
i have a linking-rewards configuration section with 1: 'cmd', 2: 'cmd'..
but i get that error when i call the method.
the for loop?
Bukkit.getScheduler.runTask
ok thx
so this java ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); BukkitScheduler scheduler = Bukkit.getScheduler(); scheduler.runTask(RelaxDc.getInstance(), () -> { Bukkit.dispatchCommand(console, cmd); });
good job
ayy
icky
it worked tysm
at least i'm getting the sweet log n right?
brr
that's nice
god
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Looking for a minecraft project leader that wants to help Victora Kingdoms to the next level.
You will take charge over the settings, Plugins and balancing of the server.
Ofc you will get paid each month.
Let me know if u have interessed
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thx
Working with protocollib, looking to see if anyone would help. mostly @echo basalt i saw ur post here: https://gist.github.com/IllusionTheDev/8b0761be3b699fcfc0c082b753e6f063
Im trying to work with Text Displays.
I got this:
PacketContainer metaData = Holograms.plugin.protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
metaData.getIntegers().write(0, entityId);
List<WrappedDataValue> dataValues = List.of(
new WrappedDataValue(23, WrappedDataWatcher.Registry.getChatComponentSerializer(), WrappedChatComponent.fromText("test"))
);
metaData.getDataValueCollectionModifier().write(0, dataValues);
TextComponent is called for index 23. Not sure if im doing that right?
I get
class com.comphenix.protocol.wrappers.WrappedChatComponent cannot be cast to class net.minecraft.network.chat.IChatBaseComponent
Any help is appreciated.
my verified tag not here still ๐
I've seen it countless times don't worry about it
ProtocolLib should wrap this but sometimes things are flaky
ye, the versions i use as well also is funky
i use a dev build from 2 weeks ago, cant spawn entities
i use a latest one. works
Plib is kinda dying
is packetevents the new and improved
i should be using it, as im an admin in the vulcan discord ๐
the disrespect is real
isnt that right @alpine urchin
Well you aren't verified here so might as well be a nobody
verify will not work ๐ฏ๏ธ
rejoin
i did twice ๐ฟ
Are you able to save multiple lists (of different types) to the items PDC?
i think there is a plugin that lets u add lists to pdc
There's API for it
wdym
Bukkit API for it
yeah
but that doesnt rly answer my question
im asking a yes or no question
with the same key, can i save multiple lists?
1 key can only have 1 value
OHHH
You would have to store a container type which contains two lists with their own individual keys
tysm
this whole time i thought 1 key can store infinite values
๐ญ
i gotta rewrite my stats system now
it can, you can have a List<List<?>>
Nah. Think of it like an overglorified Map
I don't think NBT supports lists of lists
Does it?
im not sure
but dont do it like that Lists in Lists arent generally a good idea
Right. Generally indicates a design flaw
your lists are supposed to have different values right?
if so your list would be List<List<?>> the ? means you dont know what the value is therefore you gonna work with object and need to cast
you know but at some point you add something that isnt expected your code breaks and you need to recode the casting
if i only add strings into the ?, there wont be an issue right?
if you know it will always be string you dont need the list to be ?
it can be String then
in this case i guess its fine
alright, thank you so so so much <33
np
hey quick question
when saving List<List<String>>
is there any reason not to just use List<String> instead because its basically the same thing?
Thatโs a a list of a list of a list of strings
but you wouldnt be able to save multiple list<string> in a list right?
im trying to have a list that has two lists, one with a list of doubles and one with strings
but right now im just trying to figure out how two lists in a list look like
Does the string correlate to the double
Have you tried a hashmap?
What is pdc
PersistentDataContainer
?pdc
yup
which one?
I don't think that's very necessary right now
ah i gotcha
i'd like to keep all of my code made by myself though
Yeha Iโm sure there is someone here who can help you
Im not familiar with PDC syntax
Pdc is spigot api so imo itโd be easier to just use pdc
I am trying to save data (or item stats) to an item. For example; ["Power" = 0.3],["FishingSpeed" = 100.0]. I am using personal data containers because saving every piece of data outside Minecraft will prove difficult, if not costly. To save such data, I have to turn all my data into lists since PDC do not support any sory of arrays other than Lists. To do this, I am trying to figure out if I can store multiple types of Lists in one single list. (list list<list<string>, list<double>>)
Correct, can be very difficult to do when making a plugin across different versions of spigot
I mean unless youโre going pre 1.14 itโs not hard
in my case I was
Since Iโm pretty sure 1.14 is when pdc was introduced
Somewhere between 1.13 and 1.14 idk
wait, do you guys reckon I can just make a custom PersistentDataType so I can use that isntead of the given list option?
ugh u should have said that in the first placeeeee ๐ก
I just got here
nu uh
The pdc link has an example of a class implementing persistent data type, in order to store non primitive data
Can you not just store the key=value?
as in
very stupid mockup
[pluginPDCKey]["Power"] = (PDC.FLOAT) 0.3```
so youre storing your data under your plugin's PDC map
i could, thats what i just realized, so im trying to add a map to my PDT
im not gonna lie
i have no clue on how to make a map data type for PDC
serialization
ah yes that singular word expands my inferior knowlege of Java to a much greater one, I appreciate it
If you can do it on your own Iโd be looking into an api but makes it simple
is there anywhere I can learn to do this?
i literally have no clue what 50% of the stuff on the example does or means
can u send item lore update to the player (PLAYER ONLY)
that reverts when the player rejoins
Can anyone help me figure out where I went wrong because it gives the effects even though there is no gold block under the beacon
@EventHandler
public void onPlace(BlockPlaceEvent event){
Player player = event.getPlayer();
Block block = event.getBlockPlaced();
Location location = block.getLocation();
if (event.getBlockPlaced().getType() == Material.BEACON && event.getBlockPlaced().getRelative(BlockFace.DOWN).getType() == Material.GOLD_BLOCK) {
location.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, location.getBlockX() + 0.5, location.getBlockY() + 0.5, location.getBlockZ() + 0.5, 50);
location.getWorld().playSound(location, Sound.ENTITY_GHAST_SHOOT, 100, 2);
}
}
@brave lynx you want me to do it for you or show you?
either or could work, as long as I end up understanding how making persistentdatatypes works
Two choices:
- listen to packet when the item packet is send to the player and change the lore there
- listen to every event (PlayerJoin, drop, inventory..) and change accordingly here). Please note that for this case if the player put it in a public chest players will all see the lore or the player won't see it.
The first is the easier I think. You have to wrap the packets
alr
Can you try making some debug messages to check the relative block down etc?
It's not as difficult as you think, wait a minute
I tried this way but it doesn't send me messages
@EventHandler
public void onPlace(BlockPlaceEvent event){
Player player = event.getPlayer();
Block block = event.getBlockPlaced();
Location location = block.getLocation();
if (event.getBlockPlaced().getType() == Material.BEACON && event.getBlockPlaced().getRelative(BlockFace.DOWN).getType() == Material.GOLD_BLOCK) {
location.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, location.getBlockX() + 0.5, location.getBlockY() + 0.5, location.getBlockZ() + 0.5, 50);
location.getWorld().playSound(location, Sound.ENTITY_GHAST_SHOOT, 100, 2);
}
if (event.getBlockPlaced().getRelative(BlockFace.DOWN).getType() == Material.GOLD_BLOCK) {
player.sendMessage(MessagesUtils.getColorMessage("&cBlock is gold!"));
} else {
player.sendMessage(MessagesUtils.getColorMessage("&cBlock is not gold!"));
}
}```
Do this
Player.sendMessage(event.getBlockPlaced().getRelative(BlockFace.DOWN).getType().name());
Put it before the first if statement
Let us know how you go with that
is the event being called at all?
I'm trying to make a plugin that can be boiled down into a player clicking on a something, it disappearing, and then reappearing a few seconds later.
So, my question is: Would it be inefficient to use bukkit runnables to control how long the object the player clicked on takes to come back? More so if there can be hundreds of objects gone at one time?
If it's hundreds going on and off use a single task. Add each to a queue with it's respawn delay.
It'd be hundreds with a different waiting period, e.g. one would be 30s and another 60s
one task repeating is better than 100 tasks being created then destroyed.
we have a discord
idc what u use
@grave vigil use a single runnable
How would I use a single runnable for several different tasks?
it would have to be short, like once every 1-5 seconds. This wouldn't cause any server issues?
I'm creating an inventory, but when another player opens it, items can be picked up from the menu that was open, how do I fix it?
public void openInventory(Player player) {
inventory = Bukkit.createInventory(null, 27, "Editor de estilo");
createItems(player);
player.openInventory(inventory);
}```
No your better off having 1 task that executes every 1 second. Then having 100 tasks
@candid plover how are you stopping players from taking items
You need to create a listener for InventoryInteractEvent and check to see if the inventory name == the name of the inventory that you want to stop players from picking up items in. If the name is correct, true, just do event.SetCancelled(true) and it'll stop it.
There are better ways of doing it, but that's the easiest way that shouldn't really cause problems.
please dont use the inventory name to check for custom inventories
?gui
this is an excellent way to get started ^
Hello, is there any way of making custom packets with nms (i would like it to not be dependant on protocol lib)?
The client will have the packet registered via fabric mod.
yes I know, I said that thee was a better way but he's clearly new and that's general beginner advice
thats what I was told when I started
i feel like ur best off learning how to do it right. straight away
idk if I fully agree with that, personally. I like gradual learning. Learn the simplest way to do something, and then learn the more complicated ways of doing it. Understand the use cases of both. It can feel overwhelming to just start learning something, and be swarmed with a whole bunch of vocab that you've never heard of; being thrown into the deep end.
if ur programming using spigot you should be aware of basic java concepts & vocab
@tall dragon why not check against name?
because its bad practise, for example people can rename chests and pass your name check
Thatโs very watchable
Patchable
Wonโt a map take up unnecessary space?
Not arguing; just genuinely curious
Just use color codes. Normal players can't rename chests with color codes, so it's normally not an issue.
Some people started programming using spigot, like myself. It's perfectly fine to want to learn spigot and java at the same time
but why torture urself when u can implement an actual proper system.
Your listening to more events
Your doing the same job in more code
Not less
Opposite of optimisation
Not really torture if it works. I agree that a better system is more clean and preferred. It is arguably more difficult, and that should be acknowledge and imo not shoved in the face of a beginner
but honestly at that point just use an inventory framework
so you are saying abstracting your code (so its easier to create more menu's) (the entire fuking point of java bassically) is worse?
It's literally designed to identify inventories
no its not
I understand what you are saying
Yes it is?
it was never designed to be used by plugins
But in the case you a making a single gui
It is not โbad practiceโ
It is not required
so?
On create of your inventory, it asks for an inventory holder
doesnt mean its intended to be used to identify inventories
Why not use it
well we disagree on that then
it just results in your code being extremely messy
and hard to maintain
/ update
But an inventory isn't a tile entity if it isn't attached to one
it's not really that messy if it's just one GUI. I've used a quick inventory name check for a simple confirm GUI. Nothing really that crazy tbh
well every time you click something, it gets the holder, which can decrease server performance
^
yea i mean you can. but i still disagree. you should always be writing scalable code
but checking name is only bad practice because people may, depending on the server, be able to replicate the inventory through a chest. This can be gotten around by using color codes and disallowing players to add color codes to items (which is most servers, I rarely see the feature).
So?, Every time I get the players location it also can decrease performance