#help-development
1 messages · Page 950 of 1
No?
lmao
So, then just don't use guis if you're gna bitch about performance
if u do it right. they are fine
Let everybody use there way
My point is there is more then one way to do something
Ain't yo problem
Dosent mean the other persons way is bad or wrong
The performance issue isn't a thing. The issue, as described in the thread, is that when the inventory is clicked -> all NBT items are checked (including those in the player's inventory) -> this done multiple times decreases server performances fairly significantly
I do agree with Shurikennnen tho, using the name is objectively bad
I think people should generally write scalable code, but beginners should be given the benefit of the doubt. I mentioned to him that there is a better way of doing it for that reason. If I was a beginner here, I would feel pretty overwhelmed.
hello. how would I go about making a 1.20 plugin ive made compatable with 1.16 pixelmon ?
But you should also do it correctly the first time, or you're gna stick to short cuts
Pixelmon is a mod, not a plugin right?
I was boutta say
I disagree. In creating early, simple, plugins I used inventory name. I no longer use inventory names.
Short cuts aren't inherently bad if they are single use and wont cause any issues on the server in question.
Fyi you dont
there is no hardcoded nms, its just a simple commands plugin
Then it is compatible
^
that fact that you did it this way doesn't mean its right. in any case trying to make a small menu framework like described in the post ive sent is only going to help you learn good code sooner
It'll help you learn good code, sure, but it's important to acknowledge that you shouldn't force that on new coders immediately. Show them something simple, and if they have the courage or even need, they have the ability to evolve past it.
sure. yet again in my opinion you should know the languages fundementals before you dive into a library.
I disagree. I had little if any java knowledge before going into spigot. You don't need a full understanding, and if it's your first library, even a mediocre understanding will still bring some confusion. Everyone has to start somewhere
imagine going to an english comedy show before you know english
doesnt make much sense does it?
and i didnt say full understanding. i said fundementals
How do people learn foreign languages, again? Exposure or brute memorization?
Honestly it's both
Even with a basic understanding of java, if spigot's your first library, you will still be a bit confused at some of the stuff. If someone doesn't know how to cancel inventory events, it's safe to assume they are fairly new to it. Therefore, give a simple solution, and inform them that there are better ways of doing it.
And why exactly are you fighting about this?
I don't think it's fighting, honestly. It's just sharing different perspectives about strategies for beginner learning. Everyone has different experiences and there's no one-size-fits-all answer
yea i dont think its fighting at all. we both just have a different perspective
and thats fine
mhm
That's true, while I agree with you on that you don't need to know alot of Java, everybody should have a base understanding before jumping into something like a library/api
at the end of the day we both gave the anwers we believed were correct, and that's the utility of support discords; he was given two different perspectives
This channel is for plugin development, please ask in #help-server
oh sorry
hi, i have this code but for some reason it doesn't register the command
List<CommandData> commands = new ArrayList<>();
commands.add(Commands.slash("suggestions", "Post suggestions embed")
.addOption(OptionType.CHANNEL, "channel", "The channel for the embed", true));
event.getGuild().updateCommands().addCommands(commands).queue();```
i have the class registered but it doesn't work
no console errors
The reason it is important you learn and understand the basics of a language is so that you are not making mistakes or having issues with basics. Then coming here asking how to do some basic thing which for us seasoned or veteran coders is generally a waste of our time to help with such issues.
You are correct there is a point you need to just make it and not fuss over some things but this does not excuse not learning the basics
i added bukkit logger to it for debugging and it doesn't log
just use a command library like ACF
pretty sure thats actually JDA
im using jda
not spigot
i couldn't find a server for jda helping
ooh alr
help :)
lol i was gonna say
same lmfao
thx
Would anyone be able to help me answer these questios? If so, I would appreciate it.
Can you do a short summary of the previous messages ? ><
I guess you're trying to make a Game, and multiple game features require a timer with different update frequencies?
My Minecraft Server keeps shutting down for no reason so I looked in the logs and this is what I found.
[23:37:35] [ServerMain/WARN]: COM exception querying Win32_Processor, which might not be on your system. Will not attempt to query it again. Error was -2147023781: A system shutdown is in progress.(HRESULT: 8007045b)
Is this the only line of error?
Can you please share the exact version of your build?
Please share the logs
[23:37:35] [ServerMain/WARN]: COM exception querying Win32_Processor, which might not be on your system. Will not attempt to query it again. Error was -2147023781: A system shutdown is in progress.(HRESULT: 8007045b)
[23:37:35] [ServerMain/WARN]: COM exception querying Win32_VideoController, which might not be on your system. Will not attempt to query it again. Error was -2147023781: A system shutdown is in progress.(HRESULT: 8007045b)
[23:37:35] [ServerMain/WARN]: COM exception querying Win32_PhysicalMemory, which might not be on your system. Will not attempt to query it again. Error was -2147023781: A system shutdown is in progress.(HRESULT: 8007045b) ```
That’s the whole log
one more 👉 👈
https://i.imgur.com/H21pF8n.png
Getting a cast exception. tried using the converter in the Vector3F class. Still getting issues
thats a thing for #help-server
since youre not developing a plugin
Does anyone know if it’s possible to add new mobs and items to old versions of Minecraft through mods
anything is possible with mods
Would it be was or very difficult tho. Since you would have to remodel everything etc. or is there a way to just copy in newer versions code etc somehow
There are mods that do that
hi, why when i update my config.yml from the code it doesn't update in the plugin folder, i'll have to delete the folder then start server so it creates it again to update it
how can i fix that
Can you send me a link or should I just look it up
I saw people do that with config file versions
Just look it up
whats that?
Actually, I think one mod was called et futurem or something like thaz
update it or add values?
i want it to add the edits auto without deleting the plugin folder
edits as in... overriding the values there already? or adding values that dont exist in the config in the plugin folder
adding values don't exist
if(!config.contains("foo.bar")){
config.set("foo.bar", true);
saveConfig();
}
is there another way so i don't have to hardcode each one
you can compare each value in ur resource file in the plugin jar
I have an idea on how this could be done, but I'm too lazy to explain
:|
Thanks
Is it possible to give a block any blast resistance? or will this at least be possible in 1.21
It gives the effects even if there is no block underneath however the messages are not and so I don't understand how to solve the control to have the effects only when there is the gold block underneath
Basically, you just save your current config to a Map<String, Object>, then delete the config, save the new default config, loop through all the values in the new config and if they exist in the old Map<String, Object>, set them to whatever it was. And to make sure you don't do this every server start, add a config-version field to your config to check whether the existing config is older than the one in jar. Dunno how good this is, but I would do it like that
cancel the specific block break event and break it when you decide its time to break. or use NMS
so it's not possible, thanks
it sure is
I'm not looking to make a block indestructable, I'm specifically trying to give a block functionality of another block
Would I also be able to give any block an inventory that works with a hopper underneath it using NMS?
just use interact event, get block that clicked, block face down = hopper
open a inventory
yeah i got that, how would I make the hopper suck the items out without having to update the inventory all the time cause the hopper already does it
hm, i think you would get the inventory of the hooper and add items to it and remove them from ur inventory
get the blockstate of the block (hopper) and cast it to Hopper
iirc u can call hopper.getInventory
oh yeah I tried somethign like that but i got 100 dupes but I guess I gotta try harder if I can't just make a hopper take blocks and handle the updating from a custom inventory
but thanks for helping
declaration: package: org.bukkit.event.inventory, class: HopperInventorySearchEvent
i dont think that will work with custom inventories
Not 100% sure if this is fired when the hopper has no BlockInventoryHolders nearby in the first place.
But worth a try.
smile, ever work with protocollib?
Sure
any idea how i can assign a vector to a data watcher 💀
iv been going at it for 2 hours now xD
data watchers are old. They dont exist anymore.
even smth like this?
PacketContainer metaData = Holograms.plugin.protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
metaData.getIntegers().write(0, entityId);
List<WrappedDataValue> dataValues = List.of(
// new WrappedDataValue(8, WrappedDataWatcher.Registry.get(Integer.class), 1),
// new WrappedDataValue(9, WrappedDataWatcher.Registry.get(Integer.class), 1),
// new WrappedDataValue(10, WrappedDataWatcher.Registry.get(Integer.class), 1),
new WrappedDataValue(13, WrappedDataWatcher.Registry.getVectorSerializer(), new Vector3F(2,2,2)),
new WrappedDataValue(15, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0),
new WrappedDataValue(23, WrappedDataWatcher.Registry.getChatComponentSerializer(), WrappedChatComponent.fromText("test").getHandle())
);
metaData.getDataValueCollectionModifier().write(0, dataValues);
Holograms.plugin.protocolManager.sendServerPacket(p, metaData);
No this is the up to date approach
getting a class cast exception however
Yes, that's correct. It was recommended to me by 7smile7 to use timestamps and store the actions in a PriorityQueue and keep polling until I find an action that is in the future. I was wondering if this was to be done at a certain interval, and if so, how long of an interval was practical. I figured one second might do and asked about that.
i even tried minecrafts vector class
standby
Internal Exception: io.netty.handler.codec.EncoderException: java.lang.ClassCastException: class com.comphenix.protocol.wrappers.Vector3F cannot be cast to class net.minecraft.core.Vector3f (com.comphenix.protocol.wrappers.Vector3F is in unnamed module of loader 'ProtocolLib.jar' @55bb4665; net.minecraft.core.Vector3f is in unnamed module of loader java.net.URLClassLoader @25f38edc)
Object nmsVec = Vector3F.getConverter().getGeneric(new Vector3F(0, 0, 0));
Pass this instead of the wrapper
ok this work, thank you
however the second i apply the scale (index 12) it just doesnt even show it
ill tweak around with it. thx tho
text display's ^^^
whats the most effiecent way to fix placeholders of plugin? like
%placeholder% gets replaced with [value]
this but better
Do you want to do it yourself or use PlaceholderAPI for it?
use a switch and parse the string once
pick up all the placeholders
that is if you want to do it yourself
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
public class MenuListener implements Listener {
@EventHandler
public void onClick(InventoryClickEvent e) {
if (ChatColor.translateAlternateColorCodes('&', e.getView().getTitle()).equals(ChatColor.GOLD.toString() + ChatColor.BOLD + "Bet Area")
&& e.getCurrentItem() != null) {
e.setCancelled(true);
Player player = (Player) e.getWhoClicked();
switch(e.getRawSlot()) {
case 0:
break;
case 34: // opens new gui
break;
default:
return;
}
player.closeInventory();
}
}
}```
so i've made this code but for some reason the blocks in gui still are moveable can someone help me and sorry i was told to ask here hope its the right place
You represent the String you want to replace values in as a char[] and iterate it.
Create a new StringBuilder and append your characters one by one to it.
When you hit your placeholder token '%' then you start buffering everything that comes after it untill you hit another placeholder token '%'.
During this buffering your obvsly dont add the tokens and buffered characters to your StringBuilder.
The buffer is now your key, which can be looked up in a map.
The map contains Strings as keys and Function<Player, String> as values.
Alternatively you might also create your own interface instead of using Function.
dont check for inventory title
Is there a good tutorial on how to use NMS for game profiles and npcs?
i've made a whole Text compiler that does something similar 😄
wdym sorry if i am asking i am still learning about plugin making
check if the clicked inventory is the inventory object of the inventory you created
ohhh okie
dont be sorry btw we all started somewhere
alright thanks and another thing i couldn't find much about it but how can i make it so when i press the item it changes the gui i couldn't find much about it
u can either open another gui or reset the items
how is that possible to open another one?
p.openInventory
is there a tutorial you know of somewhere that can give me examples
that link i sent ya
7smile7 has a good one iirc
ohh the link right
this one @quaint mantle
this is a good tutorial, but i haven't gotten it to work yet for some reason lmao
idek why, maybe i should just restart with implementing it lol
oh thanks guys ^^
Np!
i'll def make sure to ask when i need help
Is 7 still here?
Oh right, one thing: i currently have my server inside my project folder.
I plan on making the plugin open source eventually tho.
I know there are some copyright problems with having servers on github, does this only refer to the .jar file needed to run the server?
Yes
bc then i'll just .gitignore it
This one is only for experienced developers. Beginners will be confused by a lot of it.
was gonna say, the wiki one is nice and simple
@ivory sleet stop changing your name. I almost thought this was you.
i like your discord name 7, lmao
Kraut spotted
Anyways im out. I should be studying. Apparently i forgot how bayes theorem works 
well anyone here know well about economy plugin making?
well i kinda made one but it doesn't seem to be able to see or make an account
for the player
using essentials? or trying to fully make ur own?
actually my own i want to push myself to understand you know
should i send screenshots?
im gonna goto work but im sure the ppls here will help you
Oh I missed 7 again XD
yeah but its hard if u wna do it well
well let me show you what i got so far
well thats just vault but yea
yeah followed him but had to like constantly update the code
well nvm i can't send screenshots
keep adding onto stuff that u have already
I mean the basic problem is that u just encapsulate a double/long/BigDecimal/BigInteger per player
and then save and load that adequately
well the issue is right now it says there is no account for the player
even though i watched the video a thousand times i am unsure what i did wrong
i never used vault. made my own so i cant tell ya what part of the api "makes a player account"
anyways work time adios!
cya
well idk if i can send it all of it as code should i?
imgur can help (just saying)
is it possible to send text to a users action bar in the bungee api
or would i need to send packets
Well you can send action bar messages w Player.Spigot interface from spigot, which uses the bungee chat api if thats what you mean?
no like bungee pluhin
Yea that should be possible
i'm still weirded out that there's no bukkit way to do that
paper does have it though
ProxiedPlayer @maiden olive has that method iirc
Ended up working without dupes (I hope) so thank you 🤝
I mean spigots way is just Player#spigot()#sendMessage()
there's no Player#sendActionbar i thought
Oh yeah
So, I got this code:
if (hasToolAbility(localizedName)) {
List<ToolAbilities> toolAbilities = getTool(localizedName).getToolAbilities();
for (ToolAbilities toolAbility : toolAbilities) {
switch (toolAbility) {
case NONE:
player.sendMessage("[DEBUG] Broke block with tool (ability.none)");
case DEBUG:
player.sendMessage("[DEBUG] Broke block with tool (ability.debug)");
}
}
}
}```
Basically, everything functions, except for one thing, and that's going over all abilities the tool has. Even when the tool only has the ability 'DEBUG' (getToolAbilities also only returns ability 'DEBUG') the case 'NONE' still gets executed.
Anyone knows why this might happen?
thanks
try adding break; at the end of your switch statement e.g.
case FOO:
// code
break;
Today we learn about fall through
totally overlooked that, thx guys 😂
had 3 other members of our team look at it and we all missed it i guess xd
is it possible to simulate a player being on the server using nms?
Is there a method to get the plugin folder as a File?
Sorry I was meaning the /plugins folder as opposed to the plugin specific folder
For context, I am trying to get the update folder but Bukkit#getUpdateFolder only gets the name of the folder itself
new File("plugins")? Or getDataFolder().getParent()?
Well that would work in the same way then, no? I haven't tested that yet but you could do that using:
File pluginsFolder = new File(plugin.getDataFolder().getParent())
Yeahh that's what I am currently doing
Just wanted to check whether there was a method I had overlooked
ignore this tbh this is dumb
LOL
do you mean in tab or npcs or something else?
i was gonna write something else then i realized getParent exists
i guess somewhat npcs?
Like an actual Player-object
probably not
Sadge
?xy
fair enough.
my idea was to be able to test stuff that needs a player from the console in the case i'm at a machine without having minecraft installed/which it would be... unwise to install minecraft on
tf is carpetmod
ah i get it
yeah no i won't be mixing spigot and mods. i had funky stuff happen when i made a spigot+modded server lmao
yeah no don't do that
lolll
but hey, i finally found out how to make use of game profiles so maybe i can finally finish my /nick command
ooooh, i should also be able to change the skin with that, no?
btw how exactly does the use of nms work for the end user?
is it no different from a non-nms plugin? since you have to like install the remapped server jar and stuff?
no, the plugin should get obfuscated automatically if you setup everything correctly
when you compile it compiles it back to the obfuscated version
the only downside is that your code is depending a specific vesion
so either u need to make implementations for multiple versions or it will only work on the one version
in some cases you can use reflection to make it multi-version compatible tho
ew reflection
if it works ¯_(ツ)_/¯
Guys I'm creating a horror game and I'm curious if it's possible to create screen shake effects and fog and a biome that's scary and dark af?
for 1.20.4
Sounds like you need core shaders for this
Why would you?
And unless there your exceptions I don't think so
You can only catch them if you're running the code, then surround the throwing thing with try catch
You can catch those
but idk were this can be
If you're the one making them happens with your code
You can't catch exceptions from other plugins if that's what you're asking
I mean why would I do this when I can listen
How?
I don’t know yet, but I think it’s possible
Afaik exceptions don't fire events
You can read the console, and check if it has an exception string, but that would still be wildly ineffective
I wanted to make some kind of logs with errors, but service logs remotely
You can read the latest.log file, and upload the stacktraces to a DB, and add the timestamp thrown?
Hello!! I am trying to compile someone elses code, and it cant find a lot of minecraft packages, and IDK how to add it. Compiling gives me cannot find symbol Any help is greatly appreceated
hm this better
Okay..
Maybe show some code?
Does getPluginManager().getPlugin(this).disable() unload the plugin from memory completely?
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.ChatFormatting;
``` cannot be found
Lemme read the wiki
Did you run BuildTools and build the required version(s) for that plugin
It wont let me add files
yes
not really, it just makes it red in /plugins
(with remapping on if required)
Hmm
uhhh...... whats remapping?
?nms
What version of nms does that plugin require
Okay, my problem: the plugin only does something on startup and then just wastes memory while doing absolutely nothing till the server restarts
that might help...
I think I can probably optimize it by unloading it as soon as it is not needed
a plugin that's empty doesn't consume much
sounds like you're micro optimizing. A few classes don't take that much RAM
unless it does more than the startup part
It actually allocates quite a much of memory while doing this startup thing, and I clean it via assigning all objects to null and make the garbage collector deal with it
then it's fine
But I just had suspision that Spigot might have some build in way to unload the plugin
it's nothing special ^
just clean up the plugin properly and let the garbage collector do its thing
how can i do that if i click on an slot at my gui the guis closes and the chat opens i have to write smth in the chat wehen i wrote it the gui opens with the lore of the message
like at the excelent crates plugin if you know it
it's not gonna hurt you for now
pls help
It's easier to use than the regular ByteBuf
player.closeinventory
send message to look in chat
and have a hashmap or something to mark the player so the next message he says will be handled by you
okay ty
Conversation API
Ik it's possible to make screen shake effect with a damage packet but about fog and biome idk if it's possible
whats the event when some1 send a message
conversation api or via normal message?
You can do a custom biome
public void onmessage()
if it's via normal message it's AsyncPlayerChatEvent
ty but waht does async mean
I think you can maybe change the fog distance by gaslighting the client about the render distance
async means that the code is run from another thread, other than the main thread
if you plan to modify something you might wanna use bukkit get scheduler runtask
i have another question. i have this variabel how can i change it from other classes:
public class PublicVariablen {
public static Boolean title;
public static Boolean getTitle(){
return title;
}
}
I get that, is it possible to make the sky red?
yeah
Hack the biome registry, insert a custom biome, set the area to that biome
first of all, you might wanna not use statics for this
what i have to use
not static
yes but what instat of static
do players then need to restart the game to load the chunks or can I manually reload the chunks of players?
not static
Set it before they join
Just objects
Or just use the fancy new packet for it
learn the following: getter and setters, objects, method/constructor injection
.
public class PublicVariablen {
public Boolean title;
public Boolean getTitle(){
return title;
}
}
like this?
yeah
and use boolean instead of Boolean
and then have this somewhere in your main class
or do you really need it to be nullable
new publicVariablen();
and a setter
or if you don't need it in your main class have it in the needed common class
i dont understand i have a normal class now:
public class PublicVariablen {
public boolean title;
public boolean getTitle(){
return title;
}
}
and want to change it from other classes the variable title how can i do it
im very new so sorry for the many questions
public void setTitle(boolean title) {
this.title = title;
}
okay
I'm trying to understand 7's inventory guide (https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/).
I think I understand everything except the advanced InventoryButton part.
How exactly do Functions and Consumers work? -> e.g. how does the plugin know which ItemStack to set when using the Function approach?
is there a reverse of Material.matchMaterial()? like to get the value that would be passed to matchMaterial from a material
thanks
when you create a button u add a function that takes a player and returns an ItemStack
not sure what exactly you dont understand about that
?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!
pretty sure he does not show this in the resource itself. but he changes his "decorate" method to also take a Player after which you can use it to call these functions to get the itemstack
if you go to the github repo the code will show it.
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
that makes a lot of sense
thank you :D
why tf does InventoryOpenEvent#getPlayer return HumanEntity? lmaoooo
yeah, i figured
What is the difference anyway?
What is a HumanEntity when it's NOT a Player?
npc?
aren't npcs just entities?
pretty sure it could technically be an npc as well
but those arent ever gonna click in a menu
its documented as such at least
i haven't done anything with npcs yet so idk but i thought of that
oh
okay LOL
i should learn to read
lmao
AnimalTamer as well, are there other things but players that can tame animals? lol
how would i store all item data (enchantments, name, lore, etc) into a string or something that can be stored in SQL and put back into an item later?
Hello Chat! I'm looking for an event that detects right-clicking on an interaction block. Does anyone know anything?
you mean when a player right clicks on a block?
yea
PlayerInteractEvent
yea the action is RIGHT_CLICK_BLOCK
I tried this, but strangely nothing appears in the print statement.
whats your code
@EventHandler
fun onInteractionEvent(event: PlayerInteractEvent) {
println(event)
}
Did you forget to register the listener
lol
hehe i don't forget this.
wait i post you with video
here
this is try video
It detects hitting, but strangely it doesn't detect right-clicking.
You're right clicking the entity not a block
You should use the PlayerInteractAtEntityEvent
i working this!!
thx Olivo!!
I try to remove just Cobblestone and Deepslate on explosion but it removes all blpcks anyways
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
List<Block> blocks = event.blockList();
for (Block block : blocks) {
// Check if the block is a certain type that you want to keep intact
if (block.getType() != Material.COBBLESTONE && block.getType() != Material.DEEPSLATE) {
// Remove the block from the list of affected blocks
blocks.remove(block);
}
}
}```
Make sure to handle BlockExplodeEvent too
the BlockExplodeEvent doesnt fire when I use tnt
More concise way btw
event.blockList().removeIf(b -> b.getType() != Material.COBBLESTONE && b.getType() != Material.DEEPSTALE);
thx I'll try that. But shouldnt make a difference right?
yeah
Using maven?
using gradle
Well same thing. Add an import of ‘spigot’ instead of ‘spigot-api’
i try this, but this is not working me
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>Version-goes-here</version>
</dependency>
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm'
id 'io.freefair.lombok' version '8.3'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'xyz.jpenilla.run-paper' version '2.1.0'
}
group = 'org.server'
version = '1.0-SNAPSHOT'
ConfigurableFileTree libs = fileTree(dir: 'libs', include: ['*.jar'])
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
maven {
url = 'https://mvnrepository.com/artifact/org.projectlombok/lombok'
}
maven {
url = 'https://repo.oraxen.com/releases'
}
maven {
url = 'https://jitpack.io'
}
maven {
url = 'https://papermc.io/repo/repository/maven-public/'
}
maven { url "https://repo.dmulloy2.net/repository/public/" }
}
runServer {
minecraftVersion("1.20.1")
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
//compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
compileOnly "net.kyori:adventure-platform-bukkit:4.3.2"
compileOnly "net.kyori:adventure-text-minimessage:4.14.0"
compileOnly 'com.google.code.gson:gson:2.10.1'
compileOnly 'com.google.guava:guava:33.0.0-jre'
compileOnly 'org.apache.commons:commons-lang3:3.14.0'
compileOnly 'com.github.LoneDev6:API-ItemsAdder:3.6.2-beta-r3-b'
compileOnly 'org.projectlombok:lombok:1.18.28'
annotationProcessor 'org.projectlombok:lombok:1.18.28'
compileOnly 'com.comphenix.protocol:ProtocolLib:5.1.0'
compileOnly libs
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
kotlin {
jvmToolchain(17)
}
shadowJar {
setArchiveClassifier("")
mkdir("$projectDir/builds")
doLast {
copy {
from archiveFile.get().asFile
into file("$projectDir/builds")
into file("/Users/hong-inseong/Desktop/Coding/server/Sleepground Skin Server/plugins")
}
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
project.tasks {
copy {
from libsDirectory
into file("$projectDir/builds")
}
build {
dependsOn shadowJar
}
}
From spigot google search
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>Version-goes-here</version>
</dependency>
this is my gradle code
yea
?nms
Perfect
You need to use Patrick rrmapper instead of the maven plugin tho
I already tried changing it, but it wasn't added to external libraries and there was a problem with the existing code not working.
You need to run BuildTools with --remapped first for 1.20.1
Read the guide above and switch everything into gradle and use the Patrick Chloe remapper
Oh I See
Thanks
i tryed that
Execution failed for task ':remap'.
> Could not resolve all files for configuration ':detachedConfiguration5'.
> Could not resolve org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT.
Required by:
project :
> Could not resolve org.spigotmc:minecraft-server:1.20.1-R0.1-SNAPSHOT.
> Unable to load Maven meta-data from https://mvnrepository.com/artifact/org.projectlombok/lombok/org/spigotmc/minecraft-server/1.20.1-R0.1-SNAPSHOT/maven-metadata.xml.
> Could not GET 'https://mvnrepository.com/artifact/org.projectlombok/lombok/org/spigotmc/minecraft-server/1.20.1-R0.1-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 13s
1 actionable task: 1 executed
How..
You can use PDC
?pdc
Can I save multiple things in the same PDC with the same key if the PersistentDataType is different?
Use different keys
aight
It might be possible, but I don't see why you'd want that
You can always give it a try
ye ik, I just came back since like 1.8
or 1.12
i think
thx tho
woah, this is genius.
Because the game was never designed for that
wdym
Movement is done client side and thus it's hard to force the client state
so setSwimming won't work
so actually I need to use a workaround
Are you trying to force the player to crawl?
it's GSit skid time..
yep
You'd need to place some invisible block above the player
That should force them to crawl
bump
holy help me
so even removing it after the packet is sent should do it?
send your build gradle in a paste
?paste
or like I need to keep sending packets of invisible block on the top of the player
keep sending I believe
ok gsit combines setSwimming + a ticking block packet
Quick question: Can i detect between the 3 different levels of achievements?
How do I use inventoryclickevent for offhanding, like lets say I put my cursor at the top left most slot in my player inventory, and press F, how do I get both slots (or both items that changed positions)
hey is there a page with more information on setting/replacing villager trades? ive tried to do it myself but the villager just has a lack of trades at all and shakes its head at me
Does anyone know what the rate limit is for the spigot api (or the spiget api)?
Hi, so in a CraftItemEvent, when I do event.getRecipe().getResult().getAmount() it returns the amount of one recipe, for example for torches, 4. However if I craft multiple things, such as 2 sticks and 2 coal at the same time (output: 8 torches) it still says 4. What could I use to get the correct number?
My scheduler just
stopped working
never postComplete is executed
I guess it completed exceptionally?
well that's simple
you're getting the recipe
now the actual crafted items
the recipe is constant
and will always return the same amount
Ik, im asking how do I get the correct amount
brah
?
ok so getInventory().getResult()? Thanks I'll try it
just remember to always check stuff like that
if it won't work use InventoryClickEvent
that's a sure-fire solution
?paste
when right clicking air the Action.RIGHT_CLIC_AIR does not fire
why
im having a compass in my main hand
Hello!
do someone know how to get the display name of a Material ? Like Material.STONE -> "Stone" or Material.LAVA_BUCKET -> "Lava Bucket" ? 🙏
not possible directly
what you can do is
get the material, remove the underscore and place the capitals manually
iirc
nitro expired
hmm I see
paypal is buggin rn
cowoconcluwube are you about to gift
that happened to y2k
The best way is to not get the display name at all and use translatable components instead
keeps asking me for my bank credentials on every purchase even though they are linked
and it worked for the last 2 years
and suddenly
no
you cant buy shit anymore
Hello, does anyone know why it returns me "Please wait 0 seconds before using this ability" after 4 usages? I tried a lot of things but I don't find a way to fix that...
https://paste.md-5.net/aledaremem.java
probably because the timeleft is between 0 and 1 second
you can add 1 to the timeleft
so it says 1 when its 0.5
"Please wait " + (timeLeft.getSeconds()+1) + " seconds before using this ability!"
okay thanks
Hey Guys,
I wrote a GUI with an Exit Button as a barrier. My problem is that the barrier can be obtained by the player by pressing a number (so it gets in the hotbar) or by shift-clicking.
e.setCancelled(true);
if (slot == 18) {player.closeInventory();}
I already cancelled the event before and it works on all other items in the GUI but when i want to close it i can get the item. Any ideas?
Sincerely,
Nykolos
They're both part of InventoryClickEvent, so make sure you're not doing any filtering of that event
You can always debug your event code to see why it's not getting where you want it to (and confirm it is being called)
Everything is in an onInventoryClick method and everything in this method works perfectly exept the barrier
Does anyone know what is wrong with
FriendlyByteBuf buffer = new FriendlyByteBuf(Unpooled.copiedBuffer(message));
it gives me the following error
[14:49:42 WARN]: [Female-Gender-Mod-Plugin] Plugin Female-Gender-Mod-Plugin v1.1 generated an exception whilst handling plugin message
java.lang.NoClassDefFoundError: net/minecraft/network/FriendlyByteBuf
at dbrighthd.wildfiregendermodplugin.GenderPlugin.onPluginMessageReceived(GenderPlugin.java:48) ~[FGM-Plugin-test.jar:?]
at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455) ~[purpur-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.handleCustomPayload(ServerCommonPacketListenerImpl.java:183) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.handle(ServerboundCustomPayloadPacket.java:46) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:12) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:54) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1498) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:194) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1475) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1398) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1376) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1265) ~[purpur-1.20.4.jar:git-Purpur-2165]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:323) ~[purpur-1.20.4.jar:git-Purpur-2165]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.network.FriendlyByteBuf
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:199) ~[purpur-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:166) ~[purpur-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
... 19 more
?whereami
do you know a solution?
^
how?
updated error:
16:24:05 WARN]: [Female-Gender-Mod-Plugin] Plugin Female-Gender-Mod-Plugin v1.1 generated an exception whilst handling plugin message
java.lang.NoSuchMethodError: 'net.kyori.adventure.text.Component org.bukkit.entity.Player.displayName()'
at dbrighthd.wildfiregendermodplugin.GenderPlugin.onPluginMessageReceived(GenderPlugin.java:45) ~[?:?]
at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.a(ServerCommonPacketListenerImpl.java:138) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:46) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:33) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.bu(SourceFile:115) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1146) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1060) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
There isn't a method called displayName() do you mean getDisplayName()?
In the Player class
intelliJ says that is deprecated
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
what is the repo for spigot?
for the pom.xml
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getDisplayName()
Spigot Docs say there is none, only the getDisplayName() and setDisplayName(), use one of them
kk
nvm... found it
👍
there we go
now I have a spigot error
[16:33:33 WARN]: [Female-Gender-Mod-Plugin] Plugin Female-Gender-Mod-Plugin v1.1 generated an exception whilst handling plugin message
java.lang.NoClassDefFoundError: net/minecraft/network/FriendlyByteBuf
at dbrighthd.wildfiregendermodplugin.GenderPlugin.onPluginMessageReceived(GenderPlugin.java:48) ~[?:?]
at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.a(ServerCommonPacketListenerImpl.java:138) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:46) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:33) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.bu(SourceFile:115) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1146) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1060) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.network.FriendlyByteBuf
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:160) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:112) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:526) ~[?:?]
... 19 more
FriendlyByteBuff is a class in the Forge libary
And he can't find it on a spigot server
I just downloaded the remap thingy
and updated the maven to fit
how can i make an api for my plugin? so i can use it in other plugins coding
has anybody ever run into this
its aserver for card access, but i updated the firmware and now i cant skip the cert warning
used to could proceed
You want a Libary not a api
is it self-signed cert ?
if so, you have to add your authority as trusted one
The Event gets called and if i remove the closeInventory() part, the event gets Cancelled, i think it closes the Inventory before the barrier gets back into the inventory
I cant drop it
But shift klick and pressing a number moves it into my inventory
e.setCancelled(true);
if (e.getRawSlot() == 18) {e.getWhoClicked().closeInventory();}
Doesn't work like it should
does anyone happen to know an alternative for the player.openBook method for 1.8.8 spigot?
Okay... it seems to be working sometimes, and other times, it gives errors
Does spectate target not work correctly?
When I have the player spectate the armor stand, nothing happens. When I remove the entity, the player gets teleported to where it last was. Any ideas?
Looks like this issue
https://github.com/PaperMC/Paper/issues/10249#issuecomment-1945294976
Looks like this too, reading into it
Anyone has a working exit button for a gui?
close the inventory a tick after you cancel
it should be, i don't know why it wouldn't
real
minecraft probably wont even support that
But how can i implement this?
?scheduling
Does anyone have an idea on how I can check when a player's fishing hook hits water?
Does the EntityKnockbackByEntity event detect minecarts?
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
public class MenuListener implements Listener {
@EventHandler
public void onClick(InventoryClickEvent e) {
if (ChatColor.translateAlternateColorCodes('&', e.getView().getTitle()).equals(ChatColor.GOLD.toString() + ChatColor.BOLD + "Bet Area")
&& e.getCurrentItem() != null) {
e.setCancelled(true);
Player player = (Player) e.getWhoClicked();
switch(e.getRawSlot()) {
case 0:
break;
case 34: // opens new gui
break;
default:
return;
}
player.closeInventory();
}
}
}```
can someone help figure out why my blocks still move around in the gui despite me cancelling that
are you in creative?
let me check uhh yes why?
try it in survival
can i make it be unable to move in creative as well?
well unfortunately still doesn't work
nvm... the error is back
[17:29:50 WARN]: [Female-Gender-Mod-Plugin] Plugin Female-Gender-Mod-Plugin v1.1 generated an exception whilst handling plugin message
java.lang.NoClassDefFoundError: net/minecraft/network/FriendlyByteBuf
at dbrighthd.wildfiregendermodplugin.GenderPlugin.onPluginMessageReceived(GenderPlugin.java:48) ~[?:?]
at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(StandardMessenger.java:455) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerCommonPacketListenerImpl.a(ServerCommonPacketListenerImpl.java:138) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:46) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket.a(ServerboundCustomPayloadPacket.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:33) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1191) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.bl(MinecraftServer.java:1170) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1163) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.w_(MinecraftServer.java:1147) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1060) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.4-R0.1-SNAPSHOT.jar:4077-Spigot-e9ec548-dfaa89b]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.network.FriendlyByteBuf
... 19 more
you don't convert back your code to spigot
make sure to follow ?nms closely
?nms
Is there a way to stop horses from bucking randomly?
make sure you use the correct jar then
i think there's a foo-remapped.jar
don't use that
it should be foo.jar
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dbrighthd</groupId>
<artifactId>Female-Gender-Mod-Plugin</artifactId>
<version>1.1</version>
<packaging>jar</packaging>
<name>Female-Gender-Mod-Plugin</name>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.20.4-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.20.4-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.20.4-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.107.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>SpecialSource</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
<classifier>remapped-mojang</classifier>
</dependency>
</dependencies>
</project>
you dont need a special source dependency
im pretty sure im using the correct jar
(check pom.xml above)
looks fine
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.5</version>
i've upgraded my version
seems that even after updating, im still getting the same error in the console
maybe consider checking which jar you're taking with you from target
upgrade this
delete compiler plugin
and use
to set your version
question uhh is maven shade plugin supposed be giving me errors
can i see the errors?
its too big i will sendd it short formats
?im
- META-INF/maven/com.google.errorprone/error_prone_annotations/pom.xml
FactionsUUID-1.6.9.5-U0.6.39-b341.jar, NuVotifier-2.7.3.jar, SimpleClans-2.19.3-SNAPSHOT-418.jar define 2 overlapping resources:
- META-INF/maven/com.google.code.gson/gson/pom.properties
- META-INF/maven/com.google.code.gson/gson/pom.xml
SimpleClans-2.19.3-SNAPSHOT-418.jar, mcMMO-2.1.231.jar define 48 overlapping resources:
- META-INF/maven/co.aikar/acf-bukkit/pom.properties
- META-INF/maven/co.aikar/acf-bukkit/pom.xml
- META-INF/maven/co.aikar/acf-core/pom.properties
- META-INF/maven/co.aikar/acf-core/pom.xml
- META-INF/maven/co.aikar/locales/pom.properties
- META-INF/maven/co.aikar/locales/pom.xml
- acf-core_bg.properties
- acf-core_cs.properties
- acf-core_de.properties
- acf-core_en.properties
- 38 more...```
i don't see any problems here
- META-INF/maven/co.aikar/minecraft-timings/pom.properties
- META-INF/maven/co.aikar/minecraft-timings/pom.xml
- META-INF/maven/net.jodah/expiringmap/pom.properties
- META-INF/maven/net.jodah/expiringmap/pom.xml
MultiverseCore-4.3.12.jar, WorldEdit-7.3.0.jar, WorldGuard-7.0.9.jar define 1 overlapping resource:
- defaults/config.yml
MultiverseCore-4.3.12.jar, MythicMobs-5.6.1.jar define 25 overlapping classes:
- org.intellij.lang.annotations.Flow
- org.intellij.lang.annotations.Identifier
- org.intellij.lang.annotations.JdkConstants
- org.intellij.lang.annotations.JdkConstants$AdjustableOrientation
- org.intellij.lang.annotations.JdkConstants$BoxLayoutAxis
- org.intellij.lang.annotations.JdkConstants$CalendarMonth
- org.intellij.lang.annotations.JdkConstants$CursorType
- org.intellij.lang.annotations.JdkConstants$FlowLayoutAlignment
- org.intellij.lang.annotations.JdkConstants$FontStyle
- org.intellij.lang.annotations.JdkConstants$HorizontalAlignment
- 15 more...
MythicMobs-5.6.1.jar, WorldGuard-7.0.9.jar define 1 overlapping resource:
- META-INF/README.txt
MythicMobs-5.6.1.jar, Vault-1.7.3.jar define 2 overlapping resources:
- META-INF/maven/org.bstats/bstats-bukkit/pom.properties
- META-INF/maven/org.bstats/bstats-bukkit/pom.xml```
?paste
oh overlapping
overlapping?
meaning you're shading plugins with conflicting resources
you can pretty much ignore those
are you sure you want to shade in vault and mythic mobs?
you might wanna go through dependencies and use <scope> provided
on them
so they're not included into your jar
well vault is now somewhat working better i can finally have an account i am just trying to find out why the gui i made still is able to messed with
i don't understand what you mean, do you mean players can modify the slot items?
you need to cancel on inventory click event
isn't this the command
e.setCancelled(true);```
yes
still doesn't work
but it looks like you're having a condition above
with it
that will most likely be the problem
?paste the full listener
oh okie
use a print by the set cancelled to see if it even reaches there
and one at the beginning
https://paste.md-5.net/izuzibopal.java
here's the full listener
different prints so you know if the event even is called
dont identify inventories by the title
^
have an inventory reference that you can check by
and this ChatColor.translateAlternateColorCodes('&', e.getView().getTitle())
doesn't event do a thing
it should be already colored, meaning it uses the mojang symbol
its saying altchatcolor
it is already translated
read this and modify yor code to be similar
i am ready it just taking me a while to fully understand it ^^
Simple question, can't find an answer somehow
What's the method or event I can cancel for when a spawned chicken egg spawns a baby chicken
EntitySpawnEvent
Non-player spawned
does the EntityKnockbackByEntity event detect minecarts?
?tas
never tested it, test it for us and let us know too 😄
that didnt do anything...
Like lets say I added a metadata key to the egg, and didn't want to stop all egg spawning
Does the key persist from the egg onto the chicken
that's very weird, i don't know what it's wrong then
no
i dont think the issue is in the pom.xml
So I'm forced to stop all chicken spawns from eggs
i see this event PlayerEggThrowEvent
Yeah, but that's player thrown
maybe there's an EntityEggThrowEvent
Not that I see
well, did you try to look if what you use from target is correct?
how do you get the jar file?
do a clean and then a package and get the jar with the shortest name
tested it, doesnt work :(
sad
i might just have to use the VehicleMoveEvent to detect knockback i guess
sounds like it yea
IntelliJ artifact
intellij artifact is not maven
I clean every time I re-build
^^
if you want to use maven you have to compile with maven
right side of your screen is either an M or maven tab
but it uses maven to build
no it doesnt
open it, open lifecylces then find package
then go into your main project
and you'll have something like this
no artifacts needed
wrong java version
maybe it's because of the properties i gave you
replace 17 with that placeholder from compiler plugin you had @real ridge
trying to just java 21 on a lower version of java
${java.version}
i dont have java 17
show the full error message
i thought you kept the properties from my previous help attempt
I would, but I cant upload images
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
the first one has all we needed
im gonna take a wild guess and say special source doesnt support java 21 yet
?java17
Install Java 17 at https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot
Why does theplayer.setCooldown() not work on the chorus ?
More details please
Noob question here. Would it be advisable to throw exceptions on say, BlockBreakEvent handler, or other events, commands, etc? Would Spigot still output the exception details?
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
try {
this.someProcess();
this.otherProcess();
} catch (SomeException exception) {
this.handleSomeException();
} catch (OtherException exception) {
throw new OtherException(exception); // Is this advisable? Would Spigot still output the exception details?
}
}
I didn't realize I didn't edit the Paper to Spigot haha. Wanted to check what are the thought process here too.
Thanks, i'll check Thread.printstacktrace!
It'll catch it, add it's own message and print the error
So it's better to have control and use thread print
You shoudl only throw exceptions if you want some other plugin/app to handle them, or to stop execution due to an error.
nah throwing wouldnt be good practice
controlling flow through exceptions is poor design
unless you have some global error handler like in spring, you're just throwing an error that will never be handled
hm when I get chunks via code (and generate them) they wont get unloaded, so its an increasing memory heap, why is that? or what can I do to prevent it
Alright, I guess I'm on the right track then.. I only throw when I want to interrupt or stop the "process". Other times, I'd just handle the exceptions gracefully.
exceptions arent always the answer
you should be coding in a way that handles all edgecases, rather than throwing an exception
and compiling in java 17 fixed it all -_-
Nice
can we see your code?
shouldnt be the case
you can manually unload them iirc
But say, I've handled all edgecases, it would still be okay to throw an exception for an unexpected error, yes? Then, later on, after that is discovered, handle the unexpected error on the next release?
yeah but that leads to a huge performance problem because chunk saving takes so long even though im not saving?!? everything broken ngl
Like any object, do not hold a reference beyond its scope.
hey fellas. What would be the best way to sort ammo per gun per player? I'm thinking of a HashMap, but I wanted to hear your thoughts...
oh yeah, thats fine. Just out of curiosity what edgecases would these be?
I cant see much scenarios where throwing would be beneficial
TreeMap if you want to sort
tbh, not that I know of too. Its more of a hypothetical question, I've been thinking.
i mean, yeah thats fine. Just not the norm but it works
I see. Alright, thanks for the thoughts. Really helpful!
Seems interesting, but I don't think I'll need to sort in the near future, so I guess HashMap it is... Thanks! ^^
okay nevermind I don't get the chunk flood anymore, but is it normal that getting a chunk takes like 150ms when not generated?
depends on the machine i guess?
hm, how many generation threads are used per default?
I can't guarantee this is correct but since everything is done sync I'd assume it is a single thread, the main thread. Chunks are loaded after each other
No it's Async but each chunk can only use one thread
PS: I noticed afterwards that the file that had the code on it was put outside the server folder around the PC and not in the server so I was still using the old version 🤣
anybody know how i can cancel a minecarts knockback?
well after trying 10+ methods for some reason i can't make the items not be moved by player in the gui
Did you cancel both the drag and click events?
https://paste.md-5.net/izuzibopal.java
well i've done this and it says it shoul dwork
?gui
Make them proper
so then my handler doesn't work
so i've been seeing people use .getTitle for the guis is there an alternative to it cause i don't have it in 1.20 making
I hope you're not planning on detecting inventories by their name
.
.
Don’t pull a vulkan
is that a bad thing?
yes
that does make sense
As Coll mention Vulkan anticheat for example had that problem
allowing people to gain op just by renaming chests
its just i've been on this gui thing for a day now and i can't figure out how to do it right
.
Follow the guide
i am reading it
whats the event that gets used when you switch from item A to item B in your hotbar?
the offhand swap or the number key?
number key
PlayerHeldItemEvent something like that
Because this was before main hand and offhands were a thing
If you want to get the slot at any point it's PlayerInventory#getHeldItemSlot
ty !!!
How can I detect if player is trying to pickup item from ground with full inventory? EntityPickupItemEvent is not called in that case
boolean isInventoryFull = e.getPlayer().getInventory().firstEmpty() == -1
That not helpfull at all, Im listening to EntityPickupItemEvent and its not called.
It has
Nop
at least for me... I put sout in listener and is nothing in console if I walk true items on the ground
I don't think players can pick it up when inventory is full, so 🤷♂️
I know that, thats why I need to check method how can I check if player is walking tru item or not. I want to added to virtual inventory
Probably I can listen to move event or check every tick if there si some dropen item need player, but trying to find better way
There's a pickup attempt event
rip it's paper only
PlayerAttemptPickupItemEvent
One of these days people will learn how to use the search on the javadocs
its not showing up for me, mby that get removed?
as I said it's paper only
Listen for item spawn or drop events. Track the location of the item until it dies then just have to listen for player move event compare locations
Just make sure you dont use floats for the location
or use getNearbyEntities
why not? item location will be float as well wouldn´t be?
Because the odds the float from item matches player is basically 0
So use whole numbers aka ints
yeah, thats true
I was thinking about this and just look for nearby items and just pick them up and ofc remove entity from the ground. What is default range player can pickup an item?
Its like 3 blocks
Nvm
Its less
1 block or less
Or if you intersect with the collision box of the item. But i dont think we have large item entities so doubt you will have to worry about it bein larger then a block lol
so I will probably listen to PlayerMovmentEvent and just look for items nearby with getNearbyEntities, that will be probably best 🤔
I'd rather have a scheduler run every tick
Players can pickup items without moving
or that, I dont think saving all items droped is need
yea but getNearbyEntities should not return that entity if its picked up
Wasnt there some kind of performance issue with getnearbyentities if you used it excessivley?
🤷♂️
Pretty sure someone here found out about something with it. All well guess we find out again at some point
but there is lot of entities drooped in the world anyway so... it will be kinda big list as well and should maybe be hungry for performance as well
or am I wrong?
Unless you running into the millions you shouldnt really have an issue. Major concern if anything is CME's
That is adding and removing from a list at the same time
but I will still need to find out if the entity is exiting or not? or just schedule task for removing entity from list after Item#getPickupDelay will hit 0
Im stupid...
ItemDespawnEvent I can use this to remove it from list
Doesnt get called if item is picked up
I will listend to pickup event as well
That is for if the world kills it because it lived too long
Wounder if clearlagg kills it or some plugin like that if will be called or not
Possibly not. Just use a concurrent hash map and a task
Every so often check the uuid if it still exists in the world
Listen for chunk unload and load events so you can record as needed since unloaded chunks cause entities to not exist
yeah, probably best... just use hashmap<UUID, Entity> and one hashmap<Location, Entity> to pickup with full inv
can any one pls help me i have downloaded the graves plugin. the plugin is in my server but the grave thing doesnt work for me
but entity will be there again when chunk will be loaded hmm, but yea, I can remove entities from map when chunk will unload, they cant be picked up, but that will be done with task as well bcs it will not return any entity so probably I dont need to be woried about
You will be adding, removing, and reading from that hashmap constantly and so it would be a hassle to code your methods in such a way to not cause concurrent modification exception. Therefore easier to use an object designed to handle that and not worry about all that extra code lol
thats why I want only task to removing the non existing entities lol or I didn´t get it what u mean
That's a #help-server question
You only need a single task and two listeners or so removing from the map. Check the map for corresponding location from player when they move. You will only ever obtain valid items even if items that dont exist are still in there. Over time your task and 2-3 listeners will remove the invalids
So I need to listen to pickup and movent event and not despawn event (that will be removed with task)? So not valid items will be removed with listener what will check (probably every tick) if entity still exist? That´s what are u trying to say?
wait... if player will be closed to entity and I will pick that up with move event I need to cancel pickup event or just prevent that to not be called as well
Thought you were just concerned if they couldnt pick the item up
Actually to test something I ran that quite excessively to test something (radius of 300 every second tick) and it went smoothly
hi , uh i have a question i saw a nice feature on a pvp server , where when 2 player's are in pvp , it will spawn with packets only for this 2 player's a wall of glass blocks , it will block access to lobby or spawn
how would this works , and what packets i should use?
and when they are out of pvp , it will despwan the blocks ofc
i want to do it efficent as possible , how i should spawn the blocks? async , sync? i mean with packets?
Spigot has sendBlockChange and sendBlockChanges methods in the API
I thought Im but... loooks like Im not lol, I mean... they can still pick up item if they have full inventory and they dont have full stack of it... fuk, this will be more complicated than I thought it will be
is that using packets?
internally yes
now you might need to do some world checks sync if you only want to replace air
well only sepcfic regions
or maybe I can jut cancel pcikup event all the time lol
What event gets called when a zombie attacks a player?
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
how would i get the damagee though?
Use instanceof to check if entity is a player. If it is cast entity to player
Or use the api methods to get a player object using entities uuid
so getEntity() gets the damagee?
Should yes
Wouldnt make sense for getdamager and getentity to get the same entity with no way to obtain the entity that was damaged
Can I cast the attacker to a Mob if they are a zombie or a skeleton?
If so, how do i do that because its not working for me atm
For skeletons the attacker will be a projectile (the arrow), you'll have to get the shooter from the projectile in order to get the actual skeleton
And yes you should be able to simply cast as long as you check for either the EntityType or the class before (instanceof).
What have you tried? What's "not working"?
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) {
if (event.getDamager().getType() == EntityType.ZOMBIE && event.getEntity().getType() == EntityType.PLAYER) {
Zombie zombie = (Zombie) event.getDamager();
zombie.setCanBreakDoors(true); // example on what to do with the zombie
}
}
something along those lines should work, obviously you should split the if statement if you wanna differ between skeletons and zombies and only want to consider players.
?nms
so anyone got any hacks for printing cool ascii image in console? mine doesnt line up correctly :D
i only know tab and space
i was just wondering if there was some "easier" way to do this than line-by-line and tweaking based on print
minecraft font isn't monospaced
guess im rip in pieces then with my cool ascii art :D
hmm
look at the MinecraftFont and MapFont classes
you might be able to use the data from there to line up your characters
i've got this. feel like it doesnt always look the greatest. but feel free to give it a shot https://paste.md-5.net/okapaxekic.java
thanks for suggestions! i'll defo check these
how can i make a library for my plugin so i can use its classes from other codes
omg i finally fully understand the 7's modern approach to inventory guis. (eh okay fine almost. i'll have to read up on Consumer<T> and Function<T, R> LOL)
yay
what does this mean https://paste.md-5.net/yaxasukaya.css
it says event can only be triggered synchronously
Maven and shade
If you want a jar, just make the library and use its maven description as a dependency