#help-development
1 messages · Page 408 of 1
Thats weird, I always have the same issue where it doesn't execute with no errors or messages.
Thanks
I have searched for a week now and I can't find any up to date information on how to generate Minecrafts Structures in my custom World Generation. I have tried using the Block Populator but I wasn't able to get it to work.
How can I get blocks swam with Statistic.SWIM_ONE_CM?
1 block = 1m
1m = 100 cm
Alright, wasn't so sure about the name. Thanks!
what packet are u unable to find?
I don't believe there is
oh man this naming is confusion, on mojang Clientbound refers to the fact thats its sent to the client, on minestom client refers to the fact it is received from the client 💀
which is the same thing?
sent to and received from is not the same thing
im not familiar with minestom, are u programming client side there then?
no
but the server sending it to the client and the client receiving it means the same thing to me
in both cases they go from server -> client
fair enough
how do i use percentage chance. e.g. 20% you get a diamond from a crate
you can use multiple approaches. for example ThreadLocalRandom to generate a random number
ok but how if i have multiple items does it work?
LearnSpigot provides a free web-based pastebin service for storing and sharing code snippets with anyone. Powered by hastebin.
for example this is my items.yml the chances will be changed ofc
well you would just generate a number for each item
huh? are there any public gits?
im not sure what u mean. its really simple.
for example ThreadLocalRandom.current().nextInt(100); this would generate a random number between 0(inclusive) & 100(exclusive)
i understand that part
okay. so whats the problem.
Struggling with weighting items? For crates?
but lets say i have a diamond = 10% and emerald = 20% do i just do if (int <= 20 && int > 10)??
right so u want a weight system
huh
you want to pick 1 item from that list of items?
depending on their chance?
yes
well then you'd want a weight system
last time i did that i did it like this. maybe it helps you. https://paste.md-5.net/maregumiri.cs
bassically what was sent above in the link
Maybe you looked at the same stack overflow page I sent lol
Looks like a similar solution
nah actually i did it myself and it happens to be very similar lmao
Why do I get this error: C:\Users\ursua\Development\Minecraft Server\plugins\BaseCreator/test.schematic [18:51:27] [Server thread/ERROR]: Error occurred while enabling BaseCreator v1 (Is it up to date?) java.lang.IllegalArgumentException: Plugin already initialized! at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:225) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:53) ~[spigot-api-1.19.2-R0.1-SNAPSHOT.jar:?] at me.xsenny_.basecreator.BaseCreator.<init>(BaseCreator.java:5) ~[?:?] at me.xsenny_.basecreator.BaseCreator.onEnable(BaseCreator.java:15) ~[?:?]?
java.lang.IllegalArgumentException: Plugin already initialized!
🤔
either a duplicate plugin in your plugin folder, you have multiple classes extending javaplugin, or you are creating another instance of your main class
idk which
ok and get weight will just be getting the chance correct?
But you should note that if you set the weight to 20 that does not mean that item has 20% chance of being picked
It depends on the amount of items and the weight of other items
ok so how do i make its have a 20% chance to be picked thats what my question was
Hello, can someone help me? i am "new" to spigot coding and what happen:
I have created a cmd where i am trying to target player by their name - Bukkit.getServer().getPlayerExact(playerName);
Everything works fine, but when sender of the command write player name, which is currently not online - not on the server, i want to send the sender some message, but it keep throwing me error.. sorry for my english
I tried to use World edit api to load and paste a schematic, all works well, but I get these messages in console, why?
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.followRange'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.followRange'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.followRange'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.maxHealth'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.knockbackResistance'
[18:59:16] [Server thread/WARN]: Ignoring unknown attribute 'generic.movementSpeed' . . .
Well for your application i would rlly advise against that
me?
ye
ehm, how? 😄 do you want me to send full cmd code?
Since your total chance would always have to add up to 100%
sent the relevant lines
check that before you call target.getLoc
if target were null your code already crashed
i have add the targetloc now, when it was not there, same problem
the targetloc is only to play sound
Plus its real easy to have your item be 20% with the weight system. For example if u have 4 items all set to weight 25 it would be 25%
even if a delete the targetloc, still error
recompile bruh
Hello ! I've a problem :
I want to write in a file the characteristics of players but i don't know how to do that
i only click run, it is not enough?
like player name, custom exp, ...
well, recompiled and nothing xd
if someone can help me
also need to replace plugin and restart server
yep, xd
i know this
do you want to send the error?
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.
this error appears only if i write the name of player who is not online
target is null as i said
And he also said to do a null check
does anyone knows the mojang name of this packet
yes, of course, but how to instead of error send the sender of the cmd message - sorry, but player xx is not online
here is my cmd code if you want: https://pastebin.com/QfmxDpyX
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.
this doesnt seem to hold much so idk if its this one
do the location call after the null check i said
not working
Prolly that one tho
man i saved a bunch of packet translations and i didnt save the file
can someone help me ? :)
?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!
?ask I've a problem :
I want to write in a file the characteristics of players like custom exp and name, but i don't know how to do that
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!
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
do you thing that i can just try to catch the exception and print message to sender?
learn how to do a null check
okey, i will try, thx for help
man i am checking a null.. by this : if (target == null) {...
i clearly dont have any of that shit
you are calling null.getLocation before
other mappings ig
Do you have an exemple code ?
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
ah ClientboundRecipePacket in mojang stuff
idk im working with that mcp-reborn stuff
Why MCP Reborn ?
even if i remove calling null.getLocation, still the error...
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.
?paste 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.
check it, i have no idea whats wrong
i have // the target location
Decompiled Minecraft based on the Forge toolchain
idk someone gave me it lol https://github.com/Hexeption/MCP-Reborn
Why is that event not working?
ChatLink.java:
package com.koner.the5utils.chat;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
public class ChatLink implements Listener {
@EventHandler
public void chatLink(AsyncPlayerChatEvent event) {
event.setMessage(event.getMessage().replaceAll("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))", ChatColor.BLUE + "$1"));
}
}
```In the Main.java:
```java
getServer().getPluginManager().registerEvents(new ChatLink(), this);
uh oh
wtf is that even supposed to do? replace ip addresses?
atlaest use a Pattern
i am calling target.xx, but when its null ofcourse there is no one to add the healths, thats caused the error... i think?
target.setHealth(20)
yes it should make domains blue
Doesn't it work that way?
but i am using if and else if..
it does but you are compiling a regex on every invocation
It does, but it recompiles it every time
ninjad you
And for an expression that large, that's expensive af
the code is there: https://pastebin.com/GLKAWUTm
If someone have time to check it
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.
thx so much
did you even replace the jar?
like that?
public class ChatLink implements Listener {
@EventHandler
public void chatLink(AsyncPlayerChatEvent event) {
Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
event.setMessage(event.getMessage().replaceAll(pattern.pattern(), ChatColor.BLUE + "$1"));
}
}
put it outside the method
me?
Private static final too
bruh cant you find Enum#values anymore?
i am so sorry, but i do not know if you are talking to me or not
Paying 100 usd to someone who makes me a spigot plugin for 1.19.3 that contains hungergames. Dm me
?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/
yk replaceAll compiles that pattern again
How to get a list of blocks that will be replaced by a schematic with worldedit api?
btw the problem was with getExactPlayer();
ask in their discord server ig
I asked 🙂
im banned there smh
banned where
enginehub
👀
What is the best approach to create case loot chance-drop system, u know like:
TOTEM: 10%
DIRT: 90%
BEACON: 1%
...
...
Player should always get something, not a chance to leave empty-handed.
you could just slap them all into an arraylist and shuffle it 😂
u mean 90 occurrences of dirt in arraylist hah ?
but it wouldn't really give you a percentage of randomness
I was timeouted just because I replied to a developer message
Works like a charm
i'll give it a try, tysm
i dont really do chances, i just Collections#shuffle
NotNull
ye, works like a charm
(Not null)
there are actually people that code like that
wait what does this output the string?
amazing this is just what i was looking for ty
like that?
public class ChatLink implements Listener {
Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
@EventHandler
public void chatLink(AsyncPlayerChatEvent event) {
event.setMessage(event.getMessage().replaceAll(pattern.pattern(), ChatColor.BLUE + "$1"));
}
}
```Because it's still not working \:C
regex 😵💫
player#spawnParticle
like that?
public class ChatLink implements Listener {
Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
@EventHandler
public void chatLink(AsyncPlayerChatEvent event) {
String url = pattern.matcher(event.getMessage()).group(1);
event.setMessage(event.getMessage().replaceAll(pattern.pattern(), ChatColor.BLUE + url));
}
}
Matcher#replaceAll?
Does anybody know what might have gone wrong? https://pastebin.com/Nb4M92X1
shaded it?
this is my pom.xml https://pastebin.com/Y5tCRFKR
it was working the last time I tested it
idk why it isn't working now
https://paste.md-5.net/lewipocuwo.rb anyone know what this means?
ItemHandler.java:17
you try to get a plugin instance in a static way
runs too early
I used a method, someone sent, but i'll look into yours as well ,ty
Hello, I want to change block that get burned on to another one, but I tried everything that came to my mind and after block get burned then he just disapear like normal, any idea?
Tried with BlockIgniteEvent and BlockBurnEvent
e.g
public class AshListener implements Listener {
private final Plugin plugin;
public AshListener(@NotNull Plugin plugin) {
this.plugin = plugin;
}
@EventHandler
public void OnBlockBurn(final BlockBurnEvent event) {
Block block = event.getBlock();
block.setType(Material.DIAMOND_BLOCK);
}
}
It won't be really accurate, since the generator is not truly random but pseudorandom, but you can generate a pseudorandom number between 0 and 1 (exclusive upper bound, so max 0.999), multiply by 100% to get a percentage between 0% and 99.9% and then figure out which item you will give based on that
oh i was hella scrolled up, jesus
ignore me
discord strikes again
And you're sure that the message looks as expected if you just print it through a call to sendMessage?
I think the component should have a very verbose toString implementation, try printing that real quick.
Damn that string is messed up, D:
It's messed up way before you pass it into the component, so the component has nothing to do with it
How did you accumulate so many color codes
The ö is also already not encoded properly
definitely, :D. To me, this is just a huge black box, and it wouldn't be that far fetched if it actually does that to the string. Can you try printing without ColorAPI.process once?
Oooh, the "§x§f§f§a§a§0§0" is supposed to be an encoded rgb color somehow, but I really wonder how that's supposed to work. If there's no other processor in the line that takes care of this notation, it'll end up as the latest color for the client, which is 0 - black.
And the ö is already messed up, seems like a file/config problem to me.
it should use UTF8 automatically, unless you do some weird things with Streams or Readers or Writers or sth without specifying the charset
What OS are you on? Can you check the file encoding somehow?
Your file is not UTF8 in yoru jar so it never gets saved as UTF8
new InputStreamReader(getResource(""), StandardCharsets.UTF_8);
Try adding that parameter
does it claim to be UTF-8 in your IDE?
Having this issue where im trying to send a packet to a craftPlayer but when doing the CraftPlayer.getHandle. then I dont get the playerConnection to send it in not sure if im doing something wrong but I have all the imports did something change from prev versions or am I doing something wrong.
Note: Its ok if my code doesnt work or im doing something wrong if you wanna give me a tip thats cool but im just starting to play around with packets and mining speed so im just doing some testing.
btw what's the purpose of loading, then saving the config?
why not just use saveResource() ?
no, it just overwrites your existing file with the included one
Haha :D, that's a whole other topic, xD.
i don't know
usually you want to load your included file through the stream, THEN additionally load the existing file, and THEN save it
here's how I do it: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/Config.java
Because the hex color lib is just straight up broken
basically you could just do it like this:
Config myConfig = new Config("messages.yml");
myConfig.save();
But great that utf-8 works now
no idea what you mean
if you have an old file that misses a new key, you load the old file, and get the default value for the new key from your included config. then you save it so it includes both, the old already changed keys, and they new default key
No matter what you do, if you only load the baked in resource and then save immediately, without any migration steps in between, you'll overwrite the user's changes.
yeah and that's pretty pointless
after rejoining my server my created npc isn't looking at me anymore. Has someone a advice for me to make that work again?
Player p = e.getPlayer();
Main.getInstance().getNpcs().stream()
.forEach(npc -> {
Main.getInstance().log("2");
//The location of the NPC
Location loc = npc.getBukkitEntity().getLocation();
Main.getInstance().log("3");
//Calculate a new direction by subtracting the location of the player vector from the location vector of the npc
loc.setDirection(p.getLocation().subtract(loc).toVector());
Main.getInstance().log("4");
//yaw and pitch used to calculate head movement
float yaw = loc.getYaw();
float pitch = loc.getPitch();
Main.getInstance().log("5");
//get the connection so we can send packets in NMS
ServerGamePacketListenerImpl ps = ((CraftPlayer) p).getHandle().connection;
Main.getInstance().log("6");
//used for horizontal head movement
ps.send(new ClientboundRotateHeadPacket(npc, (byte) ((yaw%360)*256/360)));
//used for body movement and vertical head movement
ps.send(new ClientboundMoveEntityPacket.Rot(npc.getBukkitEntity().getEntityId(), (byte) ((yaw%360.)*256/360), (byte) ((pitch%360.)*256/360), false));
});
You do understand why it's black tho, from the console log, right?
Just to maybe clear things up a bit: That implementation cannot work at all, as you can't format hex colors into a plain string. You'd need to set the color on the component itself, so if you're not using some sort of custom components and there is nothing else down the line which would pick this weird notation up and process it into the corresponding json field, it's not gonna work.
Wait, normal chat messages actually display as proper RGB?

I'm going to need to try something real quick on my local host, xDD
wdym with that?
Okay, forget that, I'll take that back. What the actual frick.
I'm trying to remove x amount of items of type from an inventory
I've tried ```java
player.getInventory().remove(new ItemStack(material, x));
you mean like this:
public class ChatLink implements Listener {
Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
@EventHandler
public void chatLink(AsyncPlayerChatEvent event) {
Matcher matcher = pattern.matcher(event.getMessage());
event.setMessage(matcher.replaceAll(ChatColor.BLUE + matcher.group(1)));
}
}
String message = colorPrefix + "■ " + ChatColor.RED + player.getDisplayName() + " §r» " + event.getMessage();
event.setFormat(message);```
Why does the red chat color not work on OP players but does for everyone else ? (the rest of the message formatting works)
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
essentials?
I'm actually weirded out beyond repair right now, lol. This "§x§f§f§0§0§0§0Hello, world!" turns into the component "{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"#FF0000","text":"Hello, world!"}],"text":""}", which is then sent to the client. How?! Is that standard notation? I really don't think so, does the server process this on not-already-"componentized" messages? That would explain why it doesn't work on the component.
not working as in being white instead of red
§x§f§f§0§0§0§0 cmon man
There's some magic going on behind the curtains for sure. Didn't even know that was a thing
Well, hex colors just aren't really native, that's what I'm working on fixing at the moment, btw, lol
But that project is way too experimental to be ready soon
saying minecraft uses components internally too 💀
Why doesn't this code make URLs blue?
public class ChatLink implements Listener {
Pattern pattern = Pattern.compile("((https?://)?(([\\w-@:%.+~#=]{2,63})\\.([a-zA-Z0-9]{2,63})|localhost)([\\w-()@:%+~#?/=&]*))");
@EventHandler
public void chatLink(AsyncPlayerChatEvent event) {
Matcher matcher = pattern.matcher(event.getMessage());
if (matcher.find()) {
event.setMessage(matcher.replaceAll(ChatColor.BLUE + matcher.group(1)));
}
}
}
IChatBaseComponent, xD
🥹
lemme guess, you used too much C#?
C# conventions are so bad
I'm planning on allowing custom notation along the lines of "§#RRGGBB" everyhere, no matter if tab, scoreboard, lore, name, chat, action-bar, etc. I'm also planning on auto-fallback colors for via backwards and the like, based on the client version.
ok
I actually also use this convention, even tho I don't like C#. That class is nms-native and has been there forever, btw
man used to java
this syntax makes me shiver every time
i just use #RRGGBB and it works fine when i translate it
wat
Yeah, but where do you translate it?
chat event
Valid lol?
what wat
I want to translate straight in the core.
sure?
It looks so wrong
Wait
list.add(list.new)
it's just instantiating an inner class.
The class: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/data/WeightedRandomList.java
The test where I'm using the "list.new Blabla()": https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/test/java/com/jeff_media/jefflib/tests/TestWeightedRandomList.java
Wouldn't it be new list.WeightedElement? Is that some compiler ambiguity stuff again? That kinda hurts
no, ofc not
check out the first class I sent
WeightedElement is an inner class of the "list"
hence one cannot just do new SomeClass.InnerClass(...) but one needs to do mySomeClass.new InnerClass(...)
the idea of exposing non static inner classes hurts me tho
because the inner class depends on the SomeClass instance
that's the only way to properly do what I'm doing here, though
everytime the WeightedElement's weight is changed, it must call a method of the outer class
I also wasn't proposing that. I was proposing new list.InnerClass, where list is the object, so it could just as well work out. It seems like that java chose it the other way around tho. I never did weird stuff like that.
oh yeah well it works the other way around, no clue why
oh I know why
because "list" could be another class
if one had a class called "list" and a variable called "list", one wouldn't know whether new list.InnerClass is actually an inner class of the already existing instance called "list", or whether it's a static inner class of the class called "list"
does spigot have smth like Recipe#getResult?
minestom doesnt have it 💀
Exactly what I guessed then. Thanks for clearing that up, didn't think of that case! I have no idea if I either missed out on something or if that's just an immensely rare situation to be in.
probably very rare but since java isn't kotlin, this syntax is needed lol
me messing with internal stuff
all those impl classes are mine 💀
just copying mojang code now lol
Can't you just add an abstract method getResult to this class? Are there some exceptions?
uhh ig not
i should make a fork then
and i have no clue how that would work with maven and stuff
like when i make a fork, can i still use a maven dependency?
if i dont have it hosted somewhere
mvn install installs it to your local repo
and how would i use it in my code then?
and how does maven know whether to pick the original dependency or my forked one?
if you mvn intall it with the same name and version as the original, only your forked version is in your repo
usually you'd add a classifier or change the version or group id for your fork
e.g. <artifactId>whatever-myfork</artifact>
I would just change the groupid from the official one to me.mfnalex or sth
yeah
lemme watch some tutorials, i dont want to break stuff again 💀
somehow have to get this code into ij now, just git clone ig
i dont like when the interface doesnt have stuff i need
also i dont understand why they made some stuff in recipes mutable
them writing getResult in every subclass but they couldve just put it in the interface
Okay so, I have this right here. As shown in the video, I've been trying to make them rotate faster after the first animation. My problem is they all clump together instead of rotating separately. (I have them all in a list)
Any help would be appreciated.
I've tried looping through the list and teleporting them that way, but that's when they clump together.
brr
What's that fancy tool called? It's auto-generating, right?
idk if its an ultimate feature
it is
ah yes
how do I use ProfilePublicKey?
as in new ProfilePublicKey()
it says var0
and .a
?xy
Asking about your attempted solution rather than your actual problem
ProfilePublicKey comes from Mojang for chat authentication
so just put it as null?
?xy
Asking about your attempted solution rather than your actual problem
?xy ProfilePublicKey
Asking about your attempted solution rather than your actual problem
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html#setVisibleByDefault(boolean)
can setVisibleByDefault be used in World#spawn(location, clazz, *function*)? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/RegionAccessor.html#spawn(org.bukkit.Location,java.lang.Class,org.bukkit.util.Consumer)
declaration: package: org.bukkit, interface: RegionAccessor
declaration: package: org.bukkit.entity, interface: Entity
It isnt possible to teleport a list of armorstands right?
he's saying why are you asking? for what reason
I assume so?
okay, I'll try it when I can
put ProfilePublicKey as null?
why do you need this variable
why do you want to create a key?
EntityPlayer
use more words
🥹
to create an NPC or what?
ye
That thing literally just crashed my preview app, lol
what the-
Clean enough, right? LOL
i dont even have a screen big enough to see all of it
same
then so long as you block any packets yes pass null
mojang recipes aint that bad, they are only confusing as hell
not related
alr
to click it you need to spawn it
man im still trying to get recipes working
deeping into the inner workings of the client cuz i cant seem to figure out what recipe variant is being used
well recipes work actually, only need the crafting
i cant even craft anything manually so cant confirm you that
i can confirm you that everything was red though
i seem desperate, but bump -.-
no cuz i havent implemented the clicking yet
?paste
This is what I have so far. It just clumps everything together which makes sense, but I cant figure out how I should do it. https://paste.md-5.net/enikuqoheb.cpp
like how would i be able to figure out if a player crafts sticks with wooden planks, spruce planks etc recipe_id will just be minecraft:sticks or smth
and some people have confirmed me that no packet is being sent when the item preview appears on the crafting grid
and i have no idea where to look how to client does it lol
I'd love to help, but I have never even used the preview feature, lol
idk what its called
i mean the items showing up whenever you click on a recipe
idk if that red is default behaviour
my idea was to detect what item is being shown and check if the player has enough items before clicking on the result slot
java.lang.ClassCastException: class me.placek.rdcakelib.listener.inventory.CakeInventoryClickListener cannot be cast to class java.util.EventListener (me.placek.rdcakelib.listener.inventory.CakeInventoryClickListener is in unnamed module of loader 'RDCakeLib.jar' @2c568683; java.util.EventListener is in module java.base of loader 'bootstrap')```
why am i getting this error
if(clazz.isAnnotationPresent(ListenerComponent.class)) {
EventListener listener = (EventListener) clazz.getDeclaredConstructor(plugin.getClass()).newInstance(plugin);
Bukkit.getPluginManager().registerEvents((Listener) listener, plugin);
}```
its not EventListener, its just Listener
CakeInventoryClickListener extends EventListener
java.util.EventListener is smth else then
use implements Listener
public abstract class EventListener<T extends JavaPlugin> implements Listener {
protected final T plugin;
protected final RDCakeLib rdCakeLib;
public EventListener(T plugin) {
this.plugin = plugin;
this.rdCakeLib = RDCakeLib.getPlugin(RDCakeLib.class);
}
public void register() {
Bukkit.getPluginManager().registerEvents(this, plugin);
}
}```
hmmm...
you only need the plugin for registering itself?
is that vanilla
minestom
no
ig so
more digging into mojang stuff ig
chatgpt is kinda useless for this one cuz it only agrees on what i say even thought its wrong
craft it manually 🤓
that stick adding thing is somthing i added myself though
Im trying to make mobs not drop any items
event.getDrops().removeAll(event.getDrops()); I did this but it doesn't work
anyone help?
it says 2, my item just stays there
aint doing anything as i said cuz the server has to handle the recipe request
when a user clicks on an item i get a packet that tells what recipe id the user wants to craft, no issues with that only figuring out what variant they want
uhh custom? ig so
depends what you mean with custom
everything is packet based
can someone help
the recipe manager just prepares a packet with all recipes that should be unlocked (set them all to true for testing) and it tells to client to unlock them in the crafting bench
if I give the mob other custom drops will it remove those?
I just want zombies to not drop rotten flesh
I gave them custom drops
dunno why 3 click window packets are being sent instead of 1 when i place a material in the grid tho
time to rewrite the recipe manager from the ground up
and the recipe classes cuz those are weird
Which one are we talking about? xD
` Wither wither = location.getWorld().spawn(location, Wither.class);
wither.setCustomName(ChatColor.DARK_RED + "Wither" + ChatColor.WHITE + " ( " + ChatColor.GREEN + "4000" + ChatColor.WHITE + " )");
wither.setCustomNameVisible(true);
Attributable witherAt = wither;
AttributeInstance damage = witherAt.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
AttributeInstance health = witherAt.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance speed = witherAt.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
speed.setBaseValue(10);
health.setBaseValue(4000);
wither.setHealth(4000);
damage.setBaseValue(100);`
I'm unable to change the health and damage of withers
I've done this for other mobs and it works but for withers it doesn't
Can any1 help?
what line lol
hi , i have this issuse while playing with packets xd
- lootbox spawn 100%
- rotation 100%
- click lootbox 1.8 done / 1.19.3 done (Need to do it for 1.16.5 , and other versions).
my problem is :
Unhandled exception occured in onPacketReceiving(PacketEvent) for SkyPvP
java.lang.ExceptionInInitializerError: null
at com.comphenix.protocol.events.AbstractStructure.getEnumEntityUseActions(AbstractStructure.java:614) ~[?:?]
at dev.skypvp.SkyPvP$1.onPacketReceiving(SkyPvP.java:166) ~[?:?]
code :
i clearly cant read
ofc the problem is for 1.16.5 spigot
Is it possible to teleport a list of armor stands without looping them?
Oh, right. I guess I'm too inexperienced with villagers, as I never ran into this problem. What behaviour would you expect from the GUI, if it's still in vanilla state and doesn't know about custom tags? Or do you mean that it strips of custom tags somehow, when sending interacted items back to the server? :-:
you probably dont ever want to sleep thread
BukkitScheduler
What in the actual is going on :/
Bukkit.getScheduler().runTask(JavaPlugin, () -> {
//code
});```
If you're in your own thread, sure.
?scheduling more explained here
any idea on how i can do this for : 1.16.5 ?
EnumWrappers.EntityUseAction action = event.getPacket().getEntityUseActions().read(0);
if (action == EnumWrappers.EntityUseAction.INTERACT_AT) {
using PacketType.Play.Client.USE_ENTITY / protocollib
nvm figured it out ..
Hello, did someone can help me with messages between Spigot and a velocity proxy ?
this is the code in Spigot:
`public void sendCreateServer(UUID owner, Player player, String gameType) {
// Création d'un flux de données pour envoyer les informations
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
try {
// Écriture des informations dans le flux
out.writeLong(owner.getMostSignificantBits());
out.writeLong(owner.getLeastSignificantBits());
out.writeUTF(player.getName());
out.writeUTF(gameType);
// Envoi du paquet de données sur le canal personnalisé
player.getServer().sendPluginMessage(INSTANCE, "bungeecord", stream.toByteArray());
} catch (IOException e) {
e.printStackTrace();
}
}`
and this in the Velocity proxy:
`@Subscribe
public void onPluginMessage(PluginMessageEvent event) {
if (event.getIdentifier().getId().equals("bungeecord")) {
ByteBuffer buffer = ByteBuffer.wrap(event.getData());
UUID owner = new UUID(buffer.getLong(), buffer.getLong());
String playerName = StandardCharsets.UTF_8.decode(buffer).toString();
String gameType = StandardCharsets.UTF_8.decode(buffer).toString();
PRX.get().getServerManager().createServer(PRX.get().getProxyServer(), GameType.getGameType(gameType), owner);
}
}`
?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!
how can I reset all dimensions and world without restarting my server? I've tried
- kicking all players
- unloading world
- delete world folder
but despite these steps the world still remains
I'm using 1.19.3 spigot
oops misread
isnt it obvious? youve tampered with the space-time continuum, and now youre witnessing the very fabrics of reality collapse in on itself.
Yeah i think my printer is about to explode too
Oh shit i forgot to take a walk with my tree too
That's pretty common tho. Printers seldomly do what they're actually supposed to.
i love my printer bc it never stays connected to the wifi
and u need to reboot the whole thing because it bricks up for no reason
but u actually need to unplug the power cable bc the power button is useless 99.99% of the time
laser printers usually always work fine
I think my Watermelon is about to commit sins
my loft about to eat his dinner
Found the issue but can't fix it -.- if I send it outside the loops it works fine. BUT they of course arent going at the same time...
new CraftCactus();
(real)
Ah yes, welcome to modern firmware. I keep mine plugged in over ethernet to avoid this trouble, xD. It still has this super stupid firmware bug where images sent from the phone are trying to access the second paper tray (why you need two is beyond me), while images sent from the computer work just fine with the main tray. Guess what, happened after I was trying to fix another bug with a firmware update, ;).
in reality the wifi issue isnt a problem with the printer in my case, bc it was a problem with our old one too, but its just so annoying
we cant move the printer either bc i think its connected to the phone line for faxing
and the router is across the house, also not moveable because of where our cable comes in
why do you fax stuff
Maybe because it's actually reliable and you know that the other party received it, xD. Not like "uh, I never got that mail, what are you talking about?"
my parents do
i rarely print anything
but i always have to unfuck the printer when something happens
that makes sense
Printer and router service 24/7 basically, right? xDD
it's the only usable "real-time" way to deliver documents in "written form", e.g. for legal documents etc
e-mail is just considered text form, not written form
true ig
Whats the easiest way to make custom durability for items
Is there a built in way to increase the durability of items?
also with fax you got proof that it actually got delivered. emails could just go to spam folder (gmail), not get accepted at all (t-online) or the recipient's email server answers with "yes, accepted" but never actually delivers the mail (microsoft)
"microsoft blackhole"
i am the tech support
gonna charge my family 99¢ everytime they need help with tech
Exactly what I was getting at! People talk down on fax way too much... If something depends on it, I'd fax it, instead of mailing it.
I'd be rich by now if that was the case, lol
same
anyone know of a decent language/translation lib that lets you define languages/auto determins what languages are supplied in X dir?
effort
it's literally 15 lines
only wanna do that if nothing exists
hey is there anyway i can use another plugin a in the server that doesnt have an api to use its functions
resourcebundle + locale from java std lib, no?
yeah
u can probably just do stuff thru the plugin's main class instance
how would i do this?
declaration: package: org.bukkit.plugin, interface: PluginManager
and cast it to that plugins class
ok and how do i get the plugin to work in intelij like so i can see the methods
add it as provided dependency ig
why would you decline my tp 😠
yo what helmet did you get
paper supporter
ah
Java has locales built in
using it for a plugin, that they get to choose language for. kinda dont want to force choose the language
well, u should use resource bundle api
ill check it out
You could also loop through all Locales available with the Locale class. You'd only have to format in an iso format or similar
Does anyone have a plugin where random players can make kits other players cant see the kits and just the player who made them can they can also claim the kits yk
No
😦
thankyou for posting in every channel
It's a sign of superiority. I wish I was that important
Is there a way to check if the player stopped a blockDamageEvent?
declaration: package: org.bukkit.event.block, class: BlockDamageAbortEvent
Thanks
How do I make use of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/material/PressureSensor.html
declaration: package: org.bukkit.material, interface: PressureSensor
It appears to be under material unlike the majority of BlockData instances that are data.type
At this point i'm about to eat 2 whole bananas... does anyone know why the hell its doing this? https://paste.md-5.net/idipokusoz.cpp
ooh it's dancing
i've seen a similar bug to this before
it's a rendering error that i don't believe can be fixed
I don't think so that it is, that sounds pretty odd
Yep but i seriously dont know why it should do it
Ive even tried adding delays on like 20 secs, but its the same speed lol
It's gonna be pretty much impossible for anybody else but yourself to spot the mistake as long as it's not locally reproducible. This could literally be a million different things.
I don't see another way to help you, :/. If I'm going to get side tracked again and implement this from scratch myself, it'll not only likely not fit into your system, but take quite some effort, xD
This is how it looks when i move the sendPacket out of the loop
Just my thoughts (AND I am a beginner and VERY new to java BUT...
Don't even know what loop you're talking about, with that little information, xD
What about putting where they come out in one function them where they rotate in another then just have it repeat the one where they rotate over and over?
Exactly how i have it.
if im understanding correcly.
oh ok. sorry.
any open to review my code to check my efficiency etc
In the paste i send. https://paste.md-5.net/idipokusoz.cpp here
there is a loop for every armorstand
The method is already out of the loop?
What's stand then even? Are you shadowing some stand variable in the loop?
Well the jumpy stuff happends when i put it in there..
Yeah, because you're using a whole other variable
I cannot help you without knowing what's above that
ill send 2 secs
It's very, very likely just a logic issue, rather than a rendering bug
Ugh, that hurts my head, :-: It's such a ratsnest, haha
Yeah, I think I know your issue, but I don't know how I would fix that
To be honest, it'd be faster just starting over with what you know now
Man, I don't even know how to put it into words, xD. You've made it so much more complicated than it needs to be... :/.
I also don't know what animation you want to play, but you need to think about each armor stand individually. Then, have each one do the circle at another point in time.
Really? i have no idea how to make it more simple :p
Probs the spawn part
I'd go insane with that, xD. And you will too, if you come back to it after a few weeks, lol
I'm really bad at communicating that, :/. I'd probably make up most of it on the way, but I'd try to have as many reusable medium-sized functions as possible to then compose the final animation as clean as humanly possible.
Yeah as you can see I tried using vectors instead, but couldn't get it to work. They wouldn't move at all. that is one way to make it simpler right? (Its at the bottom)
What do you want the animation to look like? They're in essence only moving on a circular path, just phase-shifted, right? So basically each with a delay.
Yep, then after I want it to rotate 360 degrees a bit faster, then remove all except the one above the chest. Then make some kind of particles, then a reward.
If that makes sense
You had the rotation tho, so I guess you want them to go back to the top before you despawn them, and that doesn't work?
Yeah, the first part. But after that I want to make it look like its choosing a random armor stand, which is the part where it goes around fast in a circle. This is the part that i can't get to work.
what would the best method to get all the files/resources in a folder in a plugins resources, eg i have
resources
-languages
--file.yml
--file2.yml
--etcetc
which method would be better to get the files
I don't think there's a way to do that without looking at your jar file at runtime.
How can I check if a block is a pressure plate that is powered? I have tried a couple things but have had no luck so far
Something like this, but you'd need to check that the name starts with "resources" and a file separator
Already have and it hasn't worked once. I am using instanceof and have tried that on both the deprecated PressurePlate and also PressureSensor neither of which have worked
?paste
share code
weighted pressure plate is different to pressure plate
🤯
weighted plates are AnaloguePowerable, as per javadocs
getPower > 0
forge and spigot be like
any open to review my code to check my efficiency etc
share and see?
just post it :P
not complete yet waiting for core
For nms Im really new to it and just playing around with it I know there is some sort of spigot version where they rename everything from the a b c d and so on is that a thing for 1.19 and how would I obtain the renamed version or am I thinking of something else because right now all I am seeing is letters and I wanna make sure I am doing the correct things
thank you
code seems ok, though not super java-y (eg lowercase classes)
also you never register your events yet
i dont think those are util classes, more of managers/handlers
nitpick but annotations should be above declaration not inline
it is registered just in the constructor
funky
yeah but the constructor method is never called in main class
fabric-dev and/or minecraft development intellij plugin would like to speak with you
Im trying to find out what PacketPlayOutBlockBreakAnimation was renamed to in the nms remapping and if you know the answer how would I go about finding out information like this in the future?
?jd
declaration: package: org.bukkit.entity, interface: Player
No packets needed sigh
Kind of reminds me... I need to add a new method there that accepts an Entity
sendBlockDamage(Location, float, Entity), or (Entity, Location, float)
More than one entity can damage a block at a time
So multiple overlapping damages basically
What for?
sending block changes to multiple entities
is that one float?
thought that was material data or something
Not sure what you mean
declaration: package: org.bukkit.entity, interface: Player
Yeah but like... why would it need an Entity?
my brain didnt think that far
unless path finding would change, so entities would need to fake see it
thank you that helps a lot xD
@dry yacht Kind of got it fixed, but there are still a few things to fix! And its ALOT simpler now.
Updated version turns out it had to be -45 degrees lol :p
Thanks!
Reminds me of hypixel's mystery vaults
How do they look?
That's so cool, I love it!
Incredible
Great job! :). I'm happy that you got the issue resolved. I really felt the suffering, :/
Why is ChatEvent#setMessage not working?
public class ChatLink implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void chatLink(AsyncPlayerChatEvent event) {
event.setMessage("test");
}
}
With that code my server outputs (first picture) ```java
public class ChatLink implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void chatLink(AsyncPlayerChatEvent event) {
event.setMessage("Not working!");
event.getPlayer().sendMessage(event.getMessage());
}
}
I don't understand
What part is not working
Message is the message, player name is part of the format
Javadocs explain
My message I sent still says "test" even after replacing it with "Not working!" event.setMessage("Not working!");
@echo basalt
I thought this might interest you as well. Check out how the size changes if I look into the sky, for example.
I totally underestimated how much reduction the PacketCompressor actually brings to the table. The map packets would usually be at around 16.5kB, where a really complex map is - after compression - at around 2.5kB-3kB. For UIs and the like, I think 2.5kB max is a safe assumption. My panel was 5x3, thus around 38kB per frame, and I ran roughly 20 fps. 760kB per second, which is ~6Mbit. Panels don't need to run at 20 fps most of the time tho, their refresh rate should be adaptive.
i am trying to send some data to the server the player switches from and to using bungeecord but it only likes to send it twice to the one that the player connects to, why does this happen?
@EventHandler
public void onServerChange(ServerSwitchEvent event) {
ProxiedPlayer player = event.getPlayer();
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("ServerSwitchEvent");
out.writeUTF(player.getName());
out.writeUTF(event.getFrom().getName());
out.writeUTF(player.getServer().getInfo().getName());
} catch (IOException e) {
e.printStackTrace();
}
player.getServer().sendData("BungeeCord", b.toByteArray());
event.getFrom().sendData("BungeeCord", b.toByteArray());
}
Check what getServer and getFr return
the world titles are correct at least. says switched from world other to world hub
they are certainly the different servers but the data only gets sent one
switched from BungeeServerInfo(name=other, socketAddress=localhost/127.0.0.1:25567, restricted=false) to BungeeServerInfo(name=hub, socketAddress=localhost/127.0.0.1:25566, restricted=false)
i tried with just the sendData to the getFrom but it still sends to the one they join
They might leave the other one too soon
ok i got an alt on to test just in case and now it sometimes works?
ah yea it might be a loading thing then
hey, im confused on how the plugin messaging works between bungeecord to spigot, the bungee plugin is reporting that the message is being sent, but there is no response on the spigot side
youre not using the right channel in sendmessage
its queuerestart:queuerestart not QueueRestart
also make sure its registered spigot side
How can I search for a structure or a biome in my plugin
Ok, thx. I'll see if I cand find anything
How can I get block drops from a Material?
?jd
Can’t
Damn
Can get from block and itemstack
How would I go about creating a custom loot table and inserting it into blocks?
ItemStack? So do I just create a new ItemStack with the Material and get the drops from there?
Needs a block in the world sadly
Dang
Currently that also only shows you the possible drops, not the actual drops you will get
BlockDropItemEvent tells you what IS dropping
So I'm like checking statistics to check if a player collected enough potatoes and take them from their inventory if that's the case
But you can't have Material.POTATOES in your inventory
Statistics will not tell you how many are in their inventory
I tried looking at loot.LootTable but that seems to only be for mobs and even then I can’t figure out how to make it work
I know. I'm checking if they collected enough. I still check if they have it in their inventory later on
in your Inventory you have only ItemStack
can someone explain me this behaviour?
internal fun setEnchantGlow(value: Boolean) {
val nmsi = asNMSCopy.invoke(null, itemstack) as net.minecraft.world.item.ItemStack
val compound = nmsi.getTag() ?: CompoundTag()
val enchantments = if (compound.contains("Enchantments")) compound.get("Enchantments") as ListTag else ListTag()
val enchantment = CompoundTag()
if (value) enchantment.putString("id", "null")
enchantments.add(enchantment)
compound.put("Enchantments", enchantments)
nmsi.setTag(compound)
Bukkit.getLogger().info(compound.toString()) // {Enchantments:[{id:"null"}],display:{Lore:['[{"translate":"language.region"}]'],Name:'[{"text":"You are from","color":"white","italic":false},{"text":" "},{"translate":"language.region"}]'}}
itemstack = asBukkitCopy.invoke(null, nmsi) as org.bukkit.inventory.ItemStack
val nmsi_0 = asNMSCopy.invoke(null, itemstack) as net.minecraft.world.item.ItemStack
Bukkit.getLogger().info(nmsi_0.getTag().toString()) // {Enchantments:[],display:{Lore:['[{"translate":"language.region"}]'],Name:'[{"text":"You are from","color":"white","italic":false},{"text":" "},{"translate":"language.region"}]'}}
}
but when i /data get entity @p SelectedItem.tag.Enchantments
[]
thats not even java lol
why are you using nms just to set a glow?
cause why not
because it's pointless and over teh top
also thats not my question - why is field set to empty array when i invoke asBukkitCopy
if you have a Spigot question we are all ears
bypass?
somewhere in the nms code there's a 2 left shift for setting biome metadata
like leaf color n stuff
i dont recall the exact code
is it possible to bypass that?
i was trying to get specific colors into cauldrons, not lakes lol
then mask rather than bitshift
does biome affect cauldron water? i never noticed that
wdym mask?
i only noticed cuz swamps are green and i found a witch hut
& 0xFF etc to select only the bits you want
oh hey wait Elgar while ur here
#help-server message u authored that class so i assume u wrote it, ur backup date format isnt compatible with Windows file naming, meaning u cant make backups with Towny on windows
How do I make a custom Loot Table and put it into a barrel?
it has my name on it
so I probably wrote it, 8 or so years ago
you need the loot event, when the barrel is first opened, and apply the loot table then instead of the default one
And I have to write a loot table and add it to my plugin resources?
Or how does that work
Sorry if I'm interrupeting, but I have a quick question. Can the player.getOpenInventory().getTopInventory(); method ever return null?
however I didn't write the queue system in there. I'm going to guess thats a change made after my time
I just checked my source, I guess I did
?paste
wheres the remapped list again?
like where it says what nms path maps to which remapped path
Can someone please help me with this. I do not understand why it does not work: https://paste.md-5.net/ayipametem.cs
uh
could my pom be malformed? I am depending on spigot and spigot-api
Yep I just checked, not my code
This statement works fine for me, lol
No idea what's wrong
pretty sure you should be using single quotes no?
Thanks!
show the code thats showing that
i just cached a chunk and tried to call getHandle
im trying to access the biome index but i cannot find it
invalidate caches if pom is correct
ah nice, whoever retouched the file changed the backup format and made write once run anywhere code... not able to run anywhere

That makes no difference
they mightve changed the code i was referring to earlier. It seems that biomes are internally linked with LevelChunkSection (PalletedContainer<Holder<Biome>>), but i cannot for the life of me figure out wtf palletedContainer does. Apparantly it has an internal class named Strategy, which gives the left shift by which a 'key' for the Holder<Biome> is determined?
It might be possible to provide a custom Strategy but i wouldnt bet on it. NMS is weird...
btw Elgar if ur interested in the paths, here they are
net.minecraft.world.level.chunk.ChunkAccess
net.minecraft.world.level.chunk.LevelChunkSection
net.minecraft.world.level.chunk.PalettedContainer
the shift is to strip lower/higher bytes so you can easily read the value you want
refer to my earlier statement, idfk what it does lol. if i remember correctly that shift is 2, so i have to set it to 0 to do 1x1 biomes i assume?
a shift of 2 means its stripping 2 bits
Location is the same, you can bit shift to get teh chunk
wait a goddamn second
that shift is to convert in-container coordinates into a single integer, the size variable gives how many bits the coordinate may have
teh size is how many bits to shift by, so stripping x bits
public int getIndex(int var0, int var1, int var2) {
return (var1 << this.sizeBits | var2) << this.sizeBits | var0;
}
its not stripping shit
its stuffing it into one int
ill revisit this when i have more braincells available
some idiot woke me up and now im running on 3 hrs of sleep
🙂
Hello! does anyone know how I could make a tempban cmd?
First learn Java
just a regular ban plugin but you store a timestamp additionally when the ban expires
So I would just for example parse a time given as an argument and provide it in the expiry?
Loop over all online players and check every looped player for said permission.
you can use Bukkit.getOnlinePlayers(); to get all online players and Player#hasPermission(String permission); to check for a specific permission.
Yep, exactly like that
You are welcome
Spigot has already api for that, Bukkit.broadcast(message,permission)
is there a way to find if/where i wrote an exact piece of code in an entire intellij project?
Shift+ f
shift + f does nothing
Or ctrl shift f
worked, thank you
I wrote using DecimalFormat in the past and been trying to find where it was to quick copy paste it
🤣 was about to re search about it
How can I make custom loot tables for chests?
dependencies 💀
howd u show that
its an ultimate thing people told me
that doesnt answer the question
ah
Guys, how do I check that there are 2 seconds left before the end of the potion effect?
I have runTaskTimer running, which checks periodically whether there is a certain effect on the player, I would like to know specifically about this moment
get the time left and compare?
Now I have such a check, but I doubt it works:
p.getPotionEffect(effect.getType()) != null && p.getPotionEffect(effect.getType()).getDuration() < 20
try and see
since duration is measured in ticks, I thought it should work like this: If the duration of the effect = 1 second, then the actions
And, I see, it was necessary to specify not 20, but 40 ticks. It works
Otherwise, the effect will end
ultimate feature
Does putting all my plugins into 1 plugin make it run faster
or is it better to have separate plugins
really depends on the plugins ur merging
you could for example benefit from having 1 player data wrapper for all playerdata
but on its own it would yield minimal performance increase. for not having to load each plugin
hi, my server don't start. when i start it after loading plugins is stop
https://pastebin.com/3qS3AYzA
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.
uhm... so I have a problem but its very hard to describe it. I've got a custom GUI-System. Whenever im closing the inventory, im obviously resetting it(With a HashMap im keeping track of it, key=player value=GUIInventory(Object also containing a Bukkit-Inventory). I am opening a clone of the original, so that the blueprint does not get overwritten. Whenever im reopening it tho, it somehow does NOT reset the items in it. Anybody knowing why?
your sql info is wrong in auth me
you don't know what exactly?
but when im reloading the plugin, its getting reset
check the config, it either cant connect or the mysql is rejecting the connection
How could I mute a player?
I pray you aren't resending the same frame multiple times
How can I make custom loot tables for chests?
whats that supposed to mean
cancel the AsyncPlayerChatEvent
ok
There are multiple ways of doing this. Do you want to use the vanilla loot tables or do you want to
have a more dynamic approach.
is it possible with packets to make a player mount into an entity and send a packet to other players informing the player is crouched?
without causing the player to leave the entity
Sure. So the player will see itself mounted on an entity and others see him crouching (not mounted)?
Should be possible. Might cause weird behavior.
Заплачу 1₽ за плагин
You try that every day until someone bans you?
Да
see him crouching,
I would also need to make him stand up too,
You cant crouch and stand up at the same time...
then you would probably ask me why I do this, it turns out that I need to create a system making players climb stairs (ladder) faster, similar to cs go
on differents states not at the same time lul
Why dont you just enhance their speed while on a ladder?
this dont work
and especially if i use player.setVelocity() because this would be stuck on the stairs
Does someone know how I would get mojang mappings for my NMS
Is it possible to immediately spawn an invisible armor stand? I just create an armor stand and it is visible for 1 second
Custom models
cem?
world.spawn(location, ArmorStand.class, stand -> {
stand.setVisible(false);
});
This applies any changes to the AS before it is being spawned.
https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-2-release.534760/
Scroll down to the NMS section.
?nms also on here
I do think I fixed it, thanks anyway? Quick question, is WorldServer a part of mojang mappings or is it just spigot?
WorldServer is old Spigot mappings iirc
I remember there was a website which has everything in both spigot and mojang mappings
so you could see what its called in the other one and vise versa
Do you know?
Not entirely sure what that means.
how can i damage mobs near the player? i wrote the code, but for some reason the entity does not have a damage() method
You can only damage LivingEntities
sorry, what did you mean?
public void damageNearbyPlayers(Player corePlayer, double damage) {
for (Entity entity : corePlayer.getNearbyEntities(1, 1, 1)) {
if (!(entity instanceof Player otherPlayer)) {
continue;
}
otherPlayer.damage(damage);
}
}
You cant damage Entities. Items for example are also entities. Or experience orbs.
But you cant damage those. You can only damage an entity if its an instance of LivingEntity.
Oh, thank you 😘
isnt there a getNearbyEntities that takes a Predicate<Entity>
For World, yes
ah
hmm i was wondering how smth internally worked but its probably implemented in the vanilla server
actually i should look more into how the server handles recipes
so I am making a small hologram system for my plugins, and I have a HologramManager, is there a like a java trick to force only the manager to be able to create new Holograms?
because right now I can just use new Hologram from anywhere if I have the right parameters
but then it doesnt get registered to the manager properly
right now I pass the manager as a parameter so there is no point to make them yourself, but I was wondering if there was a diferent/better way
no not really, however you can decouple by using an interface for instance
or one way is to have package private constructors
but that can lead to inflexibility
if I use an interface how do I create instances of it
like a class inside the hologram manager?
You would use an implementation of that interface
dammit
started happening when i began using minestom
im not going to use mods
why not
only slows down stuff
thats you
have you tried it
well yeah but then doesnt that just ignore the problem?
Fabric is rather light weight. You're not going to see any significant increases in load time lol
I launch almost exclusively in Fabric
i have
oh chcoo how does the veinminer client side stuff actually work to communicate with the server
I use fabric sometimes, but whenever a new version comes out I just download optifine since its faster to set up xD
i just dont update
and then never actually take time to make a fabric setup
first is Bukkit.getPluginManager().disablePlugin(JavaPlugin) 2nd is JavaPlugin.saveResource("file.yml", replaceBool)
Bukkit.getPluginManager().disablePlugin()saveResource()
i forgot .set does not do any io 🥹
I figured it out. I created a datapack in the world directory and put the loot table there.
any way to make this shorter: if (ingredient.items().stream().noneMatch(item -> Arrays.stream(inventoryContents).anyMatch(item::isSimilar)))
The plugin creates a datapack in the datapacks folder and adds the loot table json file there. plugin/data/namespace/loot_tables/loot.json
Yeah thats the plebian approach
?basics
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.
an instance of your java plugin, the 2nd is just either an instance of your java plugin or run it in your main class
ur basic
ur moms basic
The most effective way to cancel moving items from inventory to inventory will be InventoryClickEvent or InventoryMoveItemEvent, I discovered a bug in my plugin when u click with SHIFT on item, it gets to your Inventory and custom gui closes, so it's copying items. How do i prevent that the best way?
Wdym?
you can etiher use di or a static instance
😲 how dare you , my mother is a saint
dont make me tell alex about your other dog
And I'd really love to know what the other approaches are
If you dont know how to program then you edit the loot table json files
The InventoryMoveItemEvent is for hoppers. Don't forget to check the InventoryDragEvent
man I am so close to being able to work on my tower defense plugin again I can taste it
looking forward to that
lets say i have language.yml in my resources file in my ide and compile that, then if i called saveResource("language.yml", false) it would save that file to my plugins data folder, being called "language.yml"
you can also use that with sub folders and different file types
so call saveResource("language.yml", false) in your on enable method
Are you writing this plugin?
do you guys think I should be registering and detecting my custom enchantments through lore or should I be containing them in NBT tags
?pdc instead of nbt
forgot to mention, I meant in legacy versions. I do use pdc in the plugins i make in newer versions 1.16+
ah probably nbt then as pdc is an nbt wrapper
Hey I have a question, for example I have this in my .yml:
Value:
CoolValue:
CoolValue2:
How do I test if a String is One of this Values
ok, and?
that would be invalid yaml im pretty sure
like if(fileconfig.getString.all("Value") == String) {
that would be a configuration section
value:
value1: coolvalue
value2: coolvalue2
ConfigurationSection section = config.getConfigurationSection("value")
String value1 = section.getString("value1");
String value2 = section.getString("value2");
I mean I have this in my .yml:
Value:
Value1:
Hi: 'Lol'
Value2:
Hi: 'Lol'
... and much more...
and I want to check if my String Is one of the things under Value:
Like if my String is Value1, Then It checks Value1 and Value2 and all others... And if the String is one of them Then we are all happy
Hello o/
I'm here to ask question about spigot web API I use both 0.2V, and V2 and they just have very strange cache times 0.5 has 12 hours hard-coded in php, and V2 returns 30 minutes but data is actually still old even after the 30 minute mark
Sometimes 0.2 returns actually better data then V2
I use it for discord-bot to verify user
config sections, and configsection.get() instanceof if you just want it to be a string
I use both actually the PHP https://api.spigotmc.org/simple/0.2/index.php?action=getAuthor&id= and the new one https://api.spiget.org/v2/authors/{id}
Though new one seems to not really work
spiget is 3rd party
yeah
But it has really long cache
you can use spiget but here is the wrong place for support
why does this code only remove the item from the player's hand if the player is looking at a block - setting the health and the sound works fine either way
@EventHandler
public void clicc(PlayerInteractEvent event){
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK){
if (event.getItem() != null && event.getItem().getType() == Material.MUSHROOM_SOUP){
Player player = event.getPlayer();
if (player.getHealth() != 20){
player.setHealth(event.getPlayer().getHealth() + 7 > 20 ? 20 : event.getPlayer().getHealth() + 7);
player.getWorld().playSound(player.getLocation(), Sound.EAT, 1, 1);
player.setItemInHand(null);
are you running paper

