#help-development
1 messages · Page 1056 of 1
yeah
if I were you I'd make a custom recipe with a custom item instead of trying to require multiple pearls
you will have issues with Shift clicking to craft etc
You can compare event.getRecipe().getResult() with your enderpearl itemstack. your other check won't work because Recipe and ShapedRecipe are totally different
And if you listen to CraftItemEvent you can use event.setcancelled(true) which will glitch the items back if it's wrong
i change the check to this:
if (event.getRecipe().getResult().equals(ItemManager.getTeleportationWandRecipe().getResult()))
yes but be careful cause event.getRecipe is nullable
already did this:
if (event.getRecipe().equals(null)) {
return;
}
oh wait nvm getresult will obviously return the wand not the enderpearl
i'd do what elgarl said it's way easier
gl
thanks
Hello, what is the lightweight type for a PDC ?
hm?
how can I get which player group (permission)? Do I need to add the lp/another plugin?
your question seems incomplete
In my understanding, each player has a group (admin, default, player, ...), this can be easily configured in any plugin for controlling permissions.
so how can I find out which group a player belongs to?
why? Groups are not really any use to a plugin other than for applying chat modification
a Group is simply a collection of permissions
I just need the group name
and the config already contains, for example, the values of the multiplier, etc.
it depends on what perm plugin and how you are accessing it
does anyone know if acf is still supported for 1.20.6
Should work fine
alr ty
im having weird java versioning issues with it atm but i guess its a skill issue
What's the error?
hi, how can I check if player took specific item from chest?
how specific
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65 lol
thats java
my build.gradle is ```gradle
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
group = 'me.paradise'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = "papermc-repo"
url = "https://repo.papermc.io/repository/maven-public/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven { url = "https://repo.aikar.co/content/groups/aikar/" }
}
dependencies {
compileOnly "io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT"
compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'
testCompileOnly 'org.projectlombok:lombok:1.18.34'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.34'
implementation "co.aikar:acf-paper:0.5.1-SNAPSHOT"
}
def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
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
}
}
shadowJar {
relocate 'co.aikar.commands', 'me.paradise.community.acf'
relocate 'co.aikar.locales', 'me.paradise.community.locales'
}```
yeah but it only happens when i add acf lol
oh bro
Interesting stuff here
goooler back at it again
Goober
What am I working on today
upgrade your stuff to netcat instead of netty smh
Netcat uses tcp?
idk it works OOTB
does anyone by chance know how to push to origin in intellij, because my gitlab uses self-signed ceritificate and intellij doesn't allow it, where can I change it to allow non-trusted certificates?
I think I just need to learn a bit more about tcp first
nvm just set sslVerify to false
How do i get a specific type of Potion on 1.21, this was my old code for 1.20
|| https://i.gyazo.com/a696749d8f0c8f28e6e189da5e7e21ca.png ||
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous usernames, global display names, and server...
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
i cloned my own intellij project from github on another pc but i cant run it
the run button is greyed out saying the file in the editor is not runnable
Does your opened file have psvm method ?
If not, it's not runnable
It has to have the main method
If you want to compile a spigot plugin, you have to run the Gradle task or maven goal from the right side
yeah i just found out about that now
thx anyway
on my other pc i was compiling fine using the run button though
Is it possible to add my own native methods to my plugin?
Wdym by native methods
Smells like jni to me
I mean, sure?
Dont see much reason for jni in a spigot plugin
Maximum speeeeeeed
Have you forgotten?
I am the master optimizer
And I've reached the physical limits of java
I must ascend
I do not speak cpp or any language that isn't java
But I mean, how hard can it be?
(this was spoken in a satirical manner, please do not bully me)
Optimise me finding a girlfriend
:((((
But yes it’s possible
Just a pain
If you’ve reached the physical limits of java
And it’s still too slow
I have to wonder wtf you are doing
Coll creative enough to give me plugin ideas?
Anyone else is welcome to join too 😄
Nuclear missile
I feel like that violates some policy
North Korea in minecraft
Plus nuclear missle
https://youtu.be/i-tZhrTjkEI?si=_W3YoE_aNR4akVhC
I was about to recreate this, looks fun 🥳 the original code looks... Not good though
Hey there, in this video I'm showing you my prototype for a spell casting system in minecraft that doesn't require you to run a command. I've decided to go with this pattern-based drawing system since I thought this is an intuitive yet "realistic" (in the context of magic spells) way to cast a spell and I realy like the way how it turned out.
Th...
So basically any time a player's balance goes above 5000, it gets set back to 100 because yk support the country, 5% of the time they are stuck in their small little house with 7 different people, and 95% of the time they get to work, ie: mine iron, coal, diamonds, all the ores really and more. Finally when it's election time, we get to do nothing... because there is no election, this is dictatorship and I am the dictator. Everyone remains poor (.)
Oh god its hex casting
Afaik no, maybe if it was premium it would
ah
Oh lets not forget the players food is permanently stuck below 3 bars
Is there another project you found that's similar?
I'm not a huge fan of the complex spells, but I plan on doing simple shapes for some spells, and allow the player to select which spells for which shapes
Is it possible to display fonts in books?
I've already got a mana system which I'll hook into
Sure
Basically you get the raycast every tick and send it to the gnome is your pc which returns a pattern matcher value
Thought that was obvious
No not that
I mean my brain is too smol to use the mod effectively
You gotta like combo a bunch of shapes and then things go brrr
Yeah tbh I just like bonking things with a sword
That’s not a missile that’s an rpg
It’s also not very nuclear
anyone?
how do i hide these buttons?
and nuclear? i mean its even in your name
make radiation
left aligned for sure
will do ty ty
Hey guys, im creating freindship plugin, and I wanna create telpeort between cross server so I do my test code like this :
public FriendCommand(JavaPlugin plugin) {
PluginCommand command = plugin.getCommand("friendship");
this.plugin = plugin;
if (command != null) {
command.setExecutor(this);
}
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (args.length == 0) {
if (sender instanceof Player player) {
RelationRepository relationRepository = ShibaRing.getInstance().getRelationRepository();
RelationShip relationShip = relationRepository.getRelationShip(RingType.FRIENDSHIP, player.getUniqueId());
if (relationShip == null) {
player.sendMessage("§cYou have no friends");
return false;
}
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Subchannel");
out.writeUTF("Argument");
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
}
}
}
main :
@Override
protected void onRegister() {
instance = this;
relationRepository = new RelationRepositoryImpl();
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", this);
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
new FriendCommand(this);
registerEventListener(new RelationListener());
setupEconomy();
}
@Override
protected void onUnregister() {
this.getServer().getMessenger().unregisterIncomingPluginChannel(this, "BungeeCord", this);
this.getServer().getMessenger().unregisterOutgoingPluginChannel(this, "BungeeCord");
}
private void setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return;
}
economy = rsp.getProvider();
}
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
if (!channel.equals("BungeeCord")) {
return;
}
ByteArrayDataInput in = ByteStreams.newDataInput(message);
System.out.println(in);
String subchannel = in.readUTF();
if (subchannel.equals("SomeSubChannel")) {
// Use the code sample in the 'Response' sections below to read
// the data.
}
}
but every log in pluginMessageReceived event not work
hey, im trying to use an angry wolf to be a mob on my mmorpg but the wolf stops attacking after 4 hits, is this a spigot bug?
how can I changed player server with plugin Message?
are you overriding the pathfinding?
no it's literally just a wolf with the angry flag set to true
it attacks for 4 hits then stops attacking
yeah
yeah might be a bug, but I don't recall spigot overriding any default behaviour like that
you can always just occasionally set the target again
the wolf starts attacking again if the player moves
but it stops if you just stand still
might just be a 1.20.4 thing
it's not getting any more updates so you're better off moving to a newer version
is there even a stable version of anything beyond 20.4
Is there a way to obtain the TabComplete of a specific command before the player inputs the command?
anyone? 😭
Isnt it PotionMeta?
I may be lost, but for some reason intelliJ does not seem to think org.bukkit.Material exists and I cannot figure out why
has this been an issue others have ran into?
I see it in my dependencies and the decompiler can read it fine
Do you use maven or graddle?
maven
I did try making a project with gradle and had the same problem
Used the minecraft plugin for intelliJ to generate the project and was working on it fine until I needed to use Material for something lol
did you make a mod or a plugin
spigot plugin
are you sure its a plugin?
pretty confident I tried remaking the project 3 times, I can double check once I finish reinstalling the IDE lol
its fine I fixed it lol, reinstalling IDE worked
I was using a pretty old version of intelliJ and I was like 80% sure it was an IDE problem
In case the error was pretty random and you are not sure, here is a good tutorial to setup intellij and maven with spigot.
https://blog.jeff-media.com/how-to-create-your-first-minecraft-plugin-using-the-spigot-api-and-maven/
ty
i dont think so
Hi what is a packet warpper?
It's something we use to make packet manipulation easier
It's an abstraction of the packet to give you methods in order to do such manipulation
Packets are the way softwares communicate over the network. A wrapper is basically something that put a ear and a mouth in the middle of the pipeline Client <-> Server.
Principle and usage is described by NuclearKat
What is the best api packet ? Packetevents? Protocollib? (Nms is not necessary for my case)
Both of those are the common ones unless you wanted to put the time into making your own lib
Better is rather just preference
Read the doc of both and select the one that feels the more logical for you
I have heard that packet event have a packet warrper, protocole l no
Packet events uses packet wrappers for your manipulations, haven't messed with plib before so I am not sure how you use their api
I will take Plib I think
i find packetevent's api a lot more user friendly and a lot better designed than plib, but you do you
The wrappers do really help
with PE you have actual classes for each packet, with plib you just set a type and write payload onto the buffer
Some examples are here if you wanna get an idea:
https://github.com/retrooper/packetevents-example
Crazy how I'm getting netty lessons as well as an overview of his lib... from the man himself
ProtocolLib will feel closer to the actual mc protocol https://wiki.vg/Protocol but more tricky to handle when you're not sure of what to do
- free shitposts
wym?
you get free shitposts from him here
For my case I need to manage packet to change commands packet (commands list sended when a player join)
With that https://wiki.vg/Command_Data
I have already try with PLib but de need an array paf node and we should make a new structure node it seum complexe, with packetevent should I also make myslef structure ?
Oh well yeah I suppose I do
dyslexia much?
I accidently leaked the first bit of his book kek
anyways what ProtocolLib does is just create field wrappers for the nms classes
It's kinda like bukkit but for nms instead of aiming at a friendly developer interface
and i did read some of it lol
So what you do.. is look at the nms packet class, look at its fields and find the protocollib wrapper
well that was first draft soooo no harm
Then create an instance of that wrapper (or create the nms fields and set handle)
Man I don't even know what to do with packets but I need practice
I'd start with fake entities
what would the best way of creating a custom player nametag using a text display?
instead of teleporting it every tick
set it as a passenger
elaborate please 😄
My packet routine went a little like
Block cracking (no spigot wrapper) -> Fake entities -> Fake blocks -> Fake interactable blocks -> Hiding real entities -> making real collide with fake blocks
I did implement some misc features here and there
Like being able to click on a fake entity
Or moving fake entities somewhere
If you want to learn about nms you can also mess with entities and entity goals
Here's a relatively old video of mine
and it's a fucking mkv
ffmpeg my beloved
To be fair I just wanted to play around with packetevents before I have this next lesson
ffmpeg -i video.mkv video.mp4 my beloved
Do you mean fake entity as in an entity that's just sent to a particular client?
Yeah
that isn't registered anywhere
just found this video of a scripting system menu I made
o_o this is some atrocious stuff
That z is atrocious
is there a way to offset it?
since i want it to be a bit higher
translation on the transform
what does "Create a script" do?
It creates a new script
hmm thats not what the description says
that is wild
Man every time I tried to code in school I got yelled at
Oops sorry for the ping
is it possible to get the skin signature and value from an online player or do I have to query the url again?
I was in a programming course and had the freedom to always be on my laptop
Sometimes the teachers would yell but they were all aware that I was pretty much self-employed and didn't give two shits
oh its in property map i dumb nvm
The school I went to before I dropped out had personal assigned laptops and I ended up getting intelliJ installed on it so I'd always code at school and alt + tab any time a teacher walked by
The times I got yelled at were when I brought my own laptop and started working on it lol
Would anyone be able to help me?
I am trying to set up a discord bot running through a spigot plugin and every time I load up the bot, I get the error:
[01:01:41 ERROR]: Error occurred while enabling Survival v1.0-SNAPSHOT (Is it up to date?)
java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder
at Survival-1.0-SNAPSHOT-all.jar/lynxtrakker.survival.Survival.onEnable(Survival.java:54) ~[Survival-1.0-SNAPSHOT-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:288) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:202) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:109) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:520) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.CraftServer.enablePlugin(CraftServer.java:643) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:592) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:693) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:455) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:361) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1171) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:332) ~[purpur-1.21.jar:1.21-2250-797ce6b]
at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.dv8tion.jda.api.JDABuilder
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:197) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:164) ~[paper-mojangapi-1.21-R0.1-SNAPSHOT.jar:?]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
... 13 more
the main file that starts the discord bot up is:
public final class Survival extends JavaPlugin {
private Database database;
@Override
public void onEnable() {
// Plugin startup logic
Plugin plugin = this;
this.getConfig().options().copyDefaults(true); // Setting the config file to be correct
this.saveDefaultConfig(); // Setting the config file as the default config file
try {
this.database = new Database();
database.initializeDatabase();
} catch (SQLException e) {
System.out.println("URGENT: Unable to connect to database and create tables.");
throw new RuntimeException(e);
}
getServer().getPluginManager().registerEvents(new databaseListeners(this), this);
Objects.requireNonNull(this.getCommand("fly")).setExecutor(new fly());
Objects.requireNonNull(this.getCommand("show")).setExecutor(new show());
BukkitTask MySQLKeepAlive = new keepAlive(this).runTaskTimer(this, 20L, 12000L);
String discordToken = getConfig().getString("Discord.Token");
if (discordToken == null) {
getServer().getPluginManager().disablePlugin(this);
getLogger().severe("Discord token could not be found. Disabling plugin");
return;
}
JDABuilder jda = JDABuilder.createDefault(discordToken);
jda.enableIntents(
GatewayIntent.GUILD_PRESENCES,
GatewayIntent.MESSAGE_CONTENT
).enableCache(CacheFlag.ONLINE_STATUS);
}
@Override
public void onDisable() {
// Plugin shutdown logic
this.database.closeConnection();
}
public static Survival getPlugin() {
return Survival.getPlugin(Survival.class);
}
public Database getDatabase() {
return database;
}
}
also idk if this helps but this is the build.gradle.kts file:
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("com.github.johnrengelman.shadow") version "8.1.1"
id 'java'
}
group = 'lynxtrakker'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
name = "placeholderapi"
url = "https://repo.extendedclip.com/content/repositories/placeholderapi"
}
maven {
url = "https://repo.purpurmc.org/snapshots"
}
}
dependencies {
shadow localGroovy()
shadow gradleApi()
compileOnly "me.clip:placeholderapi:2.11.6"
compileOnly "org.purpurmc.purpur:purpur-api:1.21-R0.1-SNAPSHOT"
compileOnly("net.dv8tion:JDA:5.0.0")
compileOnly("com.google.code.gson:gson:2.11.0")
compileOnly("com.squareup.okhttp3:okhttp:4.12.0")
compileOnly("com.fasterxml.jackson.core:jackson-databind:2.17.0")
}
def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
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)
}
}
tasks.named('shadowJar', ShadowJar) {
enableRelocation true
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
"Caused by: java.lang.ClassNotFoundException". You have the shadow plugin but you are not shadowing JDA into your plugin. Change "compileOnly" jda to "shadowJar"
All of a sudden packet events isn't receiving my advancements open packet but it doesn on close
thmm
oh its an actual minecraft bug
Just because IDE recommends don't use it Objects.requireNonNull(...);
Im making a plugin and im trying to work out how i can listen for votes, and then respond to the event. I tried to see if it was possible with the nuvotifier API but i dont think it is
How do vote works? Commands/Chat/Items/...?
you are wanting to listen for votes external to your server?
or you wanting to listen for votes within the server?
Hello, should I better use PDC to do a boolean check on a lot of blocks or use a list then save it to a file ?
(I want to implement custom blocks using mushroom blockstates, and I need to identify the custom blocks and the natural mushroom blocks)
Hmm hmm
☕️🚬
I think yes
PDC would be better
you dont want too many IO operations
does anyone have a good tutorial on how to use the Brain AI stuff for pathfinding?
that's true, thanks
I'll put my code in #1100941063058894868 because I think it's really not optimized
XD
tell me about it lol
mega thread damn
supposedly brain is better than the old pathfinding system
what are you working on 😂
just a generic entity system
got pathfinding working, but the old system fucking sucks balls
same tbh
From what I found abduction is the absolute fastest method
I posted my rep here. If anyone finds me any optimizations/problems I'll be impressed
yeah change spigot to spigot-api
if you want spigot (aka spigot-api + nms) you need to use buildtools to locally build it
Hello, if I do a BlockPhysicsEvent when placing a mushroom block next to another mushroom block of the same type, which one will be BlockEvent#getBlock ?
The adjacent one iirc
so, not the one I placed ?
Wait I might be wrong
okay
Just print it out n see
pretty difficult on a BlockPhysicsEvent...
Plugins should also note that where possible this event may only called for the "root" block of physics updates in order to limit event spam. Physics updates that cause other blocks to change their state may not result in an event for each of those blocks (usually adjacent).
So just base block
I see
What version is the server
Just sounds like you havent run bt
It's either not 1.20.6 or it's outdated
You need to run bt to have the maven artifacts
This is not a maven artifact issue :p
Ah
Yes
yea
what the hell is this return 💀
the first "block" is probably a typo
I think
When you place a Block it has to be placed on/against another Block
^^ this
it just looked weird
I'm trying to use adventure in spigot but this error is happening, can someone help me?
private BukkitAudiences adventure;
public BukkitAudiences adventure() {
if (this.adventure == null) {
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
}
return this.adventure;
}
@Override
public void onEnable() {
// Plugin startup logic
this.adventure = BukkitAudiences.create(this);
you need to package adventure. it does not exist in spigot
Wdym with package?
shade
I don't think you just mean this right?
libraries:
- adventure```
hii does anyone know whats wrong with the args in my code? my commands only work when i add double arguments like /friend block block
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("friend")) {
if (sender instanceof Player) {
Player player = (Player) sender;
UUID playerUUID = player.getUniqueId();
if (args.length < 2) {
player.sendMessage(ChatColor.AQUA + "[Friends] " + "Please specify a player to block.");
return true;
}
String action = args[0];
if (action.equalsIgnoreCase("block")) {
String playerToBlockName = args[1];
Player playerToBlock = Bukkit.getPlayer(playerToBlockName);
if (playerToBlock == null) {
player.sendMessage("Player does not exist or is not online.");
} else {
UUID playerToBlockUUID = playerToBlock.getUniqueId();
if (blockPlayer(player, playerToBlockUUID)) {
player.sendMessage(ChatColor.AQUA + "[Friends] " + "You have blocked friend requests from " + playerToBlockName + ".");
return true;
} else {
player.sendMessage(ChatColor.AQUA + "[Friends] " + "You have already blocked friend requests from " + playerToBlockName + ".");
return false;
}
}
}
}
}
return false;
}```
like this?
same error happening
Using player#chat will cause the async event to trigger again. You are causing an infinite loop
cancel the message and send it yourself
Bukkit.getOnlinePlayers().forEach(
yes
It was the version... does adventure not support 1.16.5? (is working in 1.20)
oh, let me try
or add your own loader for pre
is this the way?
or I'm just drunk xd
well, it worked
in java is the best practice to make a connection then close it after you're done with a statement or is it better to have a connection thats always open
chatgpt says java's best practice is to grab a connection and close it after use
depends on what your connected to, but generally close after statement
alr
HikariCP ftw
i mean with hikari i still need to do ds.getConn
and i can still ds.close
so much extra effort
^
you only call ds.close() onDisable really
the HikariDataSource is not a connection in itself; you use the connections as normal (in a try-with-resources, closing them when you're done using them)
what's the best way to send a title when a player looks at a certain block?
I thought about sending it via PlayerMoveEvent, but the player needs to move to send it again.
Probably a scheduler
bababooe
Quick question, how do I make .setTarget() ignore players?
NAHH
Im trying to check whether or not player can go straight from loc A to loc B. Created BoundingBox with player's hitbox sizes, uses its rayTrace method. For some reason it been giving me hit position +-0.1 at loc A even though there was nothing even close to loc A. Went to read its code. Found out that it doesnt have any loop and doesnt call any methods that do. How is that even possible?
Hi, can anyone tell me why these are no longer in the 1.21 api or what they are called now?
Enchantment.LOOT_BONUS_MOBS
Enchantment.DIG_SPEED
Enchantment.DURABILITY
@EventHandler
private void onTarget(EntityTargetEvent event) {
if(event.getTarget() instanceof Player)
event.setCancelled(true);
}
ig
they now match there ingame equivilent
ok, can you tell me what they are called?
looting efficiency and unbreaking
How do I make it target only specific mobs though?
thx
do you mean like specific instances of mobs or types of mobs?
instanceof mobs
public static void targetSelect(Entity entity, Zombie target) {
if (entity instanceof Zombie) {
((Creature) entity).setTarget(target);
}
}```
?
can you also tell me how I can implement this?
valueOf does not work
mc1_8to1_20() ? Enchantment.valueOf("LOOT_BONUS_MOBS") : Enchantment.LOOTING
iirc it should automatically handle if you use LOOT_BONUS_MOBS in an old plugin
alternatively you can use XSeries
well
@EventHandler
private void onTarget(EntityTargetEvent event) {
Set<Entity> entities = Set.of(
...
);
Entity target = event.getTarget();
if(target != null && !entities.contains(target))
event.setCancelled(true);
}
^^
if use have those entities as objects
and just do XEnchantment.LOOTING.getEnchant() iirc
if you dont, well you need to get them probably
i think you need to specify the api version for that?
no clue tbh
What exactly do you mean?
i can't combine it like this, i need both in one plugin because i want to support 1.8 - 1.21
i can't downgrade the api to 1.8 because i use some other things from 1.13 and 1.16 as well
so you cant support 1.8
if you use nms its an extra step that can be avoided by just not supporting that version
World world = pos1.getWorld();
Location vertex1 = vertexes.get(i);
Location vertex2 = vertexes.get(j);
BoundingBox hitbox = BoundingBox.of(
vertex1.clone().add(-0.2, -0.4, -0.2),
vertex1.clone().add(0.2, 1.2, 0.2)
);
Vector dir = vertex2.clone().subtract(vertex1.clone()).toVector().normalize();
RayTraceResult result = hitbox.rayTrace(
vertex1.clone().add(0, 0.5f, 0).toVector(),
dir, vertex1.distance(vertex2)
);
if(result != null) continue;
the code in case somebody decides to help
Why can't I get an Enchantment valueOf from a string?
you should be able to its just very pointless
well, in that case its not very pointless
its pointless becuse you can just update and not have to do that
xseries is a library to make multiversion support easier
you have a feet fetish or what?
Hi,
I want to confirm if my solution is correct.
I am creating a plugin for guilds, and I want players to have tags like [GUILD_SHORTCUT] NICKNAME, where GUILD_SHORTCUT is 4 or 5 characters long. For players in the same guild, the entire tag should be green. For players from different guilds or without a guild, the tag should be red.
I am already using Teams with the API to display ranks as prefixes in tags. My idea is to use packets to handle the guild-specific colors and tags without registering a team on the server.
Does this make sense? I don't think I can achieve this without using packets since players in the same guild can have different ranks, resulting in different teams and colors.
does this have to run as a separate plugin or do i compile it into the plugin?
You can include it in your plugin
ok, nice thx
does Bukkit#getPlayer do lookups for player UUIDs if they've never played before
or does it just return null
getPlayer cannot return a player that's never played before
Since the player has to be online for the method to work?
hm interesting
my memory was leaving me and olivo ninjad me
well getofflineplayer also didnt work
getOfflinePlayer will return a player if they joined or not
even though im quite sure you can obtain player skins/data like username off of the UUID
You can
so i thought one of the two methods did such
is there another api feature for this-
yeah rn ive got java PlayerProfile player = Bukkit.createProfile(community.getOwnerUuid()); and it returns null
good shit
does it not auto update
lol
no actually its just null
sigh
Is it for a head or for a skin that you're looking for?
PlayerProfile player = Bukkit.createProfile(community.getOwnerUuid());
player.update();
System.out.println("name" + player.getName()); // null``` with UUID `d0f9a8dd-4050-416a-a5f5-3750269f92f6`
well im trying to make a player head
idk how ima even do that if setOwningPlayer is not gonna work on a playerprofile but i figured the first step would be to get a playerprofile
update returns a future with the new profile
public ItemBuilder skullTexture(String texture) {
return modify(SkullMeta.class, meta -> {
PlayerProfile profile = Bukkit.createPlayerProfile(UUID.nameUUIDFromBytes(texture.getBytes()));
PlayerTextures textures = profile.getTextures();
try {
textures.setSkin(new URL(TEXTURE_URL + texture));
} catch (MalformedURLException ignored) {
return;
}
profile.setTextures(textures);
((SkullMeta) this.meta).setOwnerProfile(profile);
});
of course it does
profile name/ids are effectively immutable
If I recall with one of my plugins, it uses the name of the player and not a uuid
what's the TEXTURE_URL?
oh wait
i didnt think shit like getSkin would be an url
interesting
so what smth like this? java PlayerProfile profile = Bukkit.createPlayerProfile(community.getOwnerUuid()); PlayerTextures textures = profile.getTextures(); try { textures.setSkin(new URL(textures.getSkin() + texture)); } catch (MalformedURLException ignored) { Bukkit.getLogger().severe("Failed to set texture"); }
declaration: package: org.bukkit.inventory.meta, interface: SkullMeta
oh
well earlier I had ```java
public static ItemStack getCommunityItem(PlayerCommunity community) {
ItemStack item = new ItemStack(Material.PLAYER_HEAD, 1);
PlayerProfile player = Bukkit.createProfile(community.getOwnerUuid());
System.out.println("name" + player.getName());
SkullMeta skull = (SkullMeta) item.getItemMeta();
skull.setDisplayName(community.getName());
//skull.setOwningPlayer(player); <-- impossible?
item.setItemMeta(skull);
return item;
}```
but like everything about player was null so
I think I was just lazy and did offline player = Bukkit.getofflineplayer(name)
What do you have then?
a uuid
How do you have a uuid but not a name?
Bukkit.getOfflinePlayer(uuid)
its from a database
I was only using the heads for the MHF skins
yeah well basically
didnt work 💀
1 sec
wait i think
i forgot to update my jar
rofl
java moment
🤣
Is the database players that have played on your server?
OfflinePlayer player = Bukkit.getOfflinePlayer(community.getOwnerUuid());
System.out.println("name" + player.getName()); //null```
😈
no
well technically yes however i have 1 uuid that has never played
I was thinking of a paper method anyway dw
!past
i mean that would work too ill use any method 💀
anyone know if its possible to get a resource pack image into a url from the resource pack? just want it for an embed in discord from my plugin.
so for example, if item has model data 1, I want that image in the url somehow >.<
an url from the resourcepack?
?paste
Thanks my Discord was having a hissy fit
Hi, Does anyone know how to set the NPC to have a nickname above their head as an icon and have the NPC walk around and not just have the icon? Please disc message. https://ibb.co/vQTKBNT
yes, because if the player has never played, the name is not stored
the only lookup being done is when entering the name
Set the icon as a passenger?
you can just give him a special character as his name and change it with a resource pack
or am i understanding something wrong?
Well, like icons to keep above his head. -
Is the icon a display entity?
How?
Yes
wdym by icon first
I don't know how, What would I command?
Is this a plugin you're making?
Itemsadder and citizens
So im having a weird issue.
So im making it so when player mines it puts it straight in their invin but when they mine a block with say
a torch on top it breaks the torch and dont drop it but when I add Nature break it drops it but wont put the blocks in
the players invin anymore. so Basicly breaks it.
any one got anyidea how to fix it so it drops the torch.
isnt the torch contained in the drops of the block?
thanks guys i figured it out (im no longer supporting uuids of players that never played before)
ah nvm there isnt even a droplist cool
then you would have to check each blockface if there is anything on it
or you use the blockphysicsevent
Fellers got a darn tootin' fancy hat
IM not 100% to be honest
Hello, I'm trying to solve a problem I have, the falling block and get despawn after a while or become invisible, I'm trying to create a plugin that needs fallingsblocks and to test it I use spigot 1.16.5, anyone know why it is?
maybe out of render distance? no idea what you mean tbh
looks so cool, is hat some entity metadata or how do u dress him up so nice?
so you made a game where you can be a pervert
I'm not even disappointed, this seems about right
Just a model using blockbench
quick q is there a way for world generators to provide a custom biome string to other plugins via the spigot api? I know custom biomes just fall under CUSTOM in the api, just wondering if there's some kind of metadata that can be obtained somehow
yeah that's what I thought
cool iris' discord invite is dead
which are the biggest world generation plugins again
iris was one of them right
not sure I know what you mean, a world generates differently on any update with a change to terrain generation
if you have a server generating a world on a different version, the world will be different right?
also the chunk gen api did change a few years ago
1.16 was a few years ago so it could have been on the edge
i think 1.17 drastically changed overworld terrain gen iirc
or 1.18 not sure
Please, how to change to username spigotMC? Because of discord, I have a different name, so I can't put a verify account on itemsadder LoneDevs.
?changename
Name changes on the forums are granted to those who have donated to the project. Donations are processed manually and generally take up to 24 hours. The donation widget can be found on the home page of SpigotMC at: https://www.spigotmc.org/.
10$
tbh there has to be a better way of verifying than just having the same discord name as spigot name??
You should ask them about that
hello, how can I check if block is interactable?
Material #isInteractable() is deprecated
shit you're telling me I gotta pay $10 to not be BananaRobot?
didn't it use to be $5? 💀
as long as ive been here its been 10
Not deprecated in Spigot
Also read the deprecation note as to why it's been deprecated
hey, i am coding in Intellij Idea and have multiple commandexecutors, but now when i want to create new one, it doesnt know what CommandExecutor is...? whats the problem?
here it knows it normal
are you sure you are in the right package?
try to manually import it
Intelij, clear caches
or invalidate caches
it is just like Thanos snap... it was okey the whole time, now when i want to create new command, i cant xd
yeah intellij can be trolling sometimes
restart ide
^
^
and copy import from other file where it is working
already tried it
how? like what do you mean
fartcommand lol
xd just ignore it lol :d
like just copy the import from where it is working and paste it
yeah, the copy is working just fine
doesnt work
what build tool are you using
maven? if u mean this
yeah, then try to run mvn clean install -U
update intellij
mvn is not recognized as the name of cmdlet, function, script,...
okey, updating, but just some plugins are about to be updated
you need to set it as an environment variable
but you can also create a new maven configuration and run it there
like it doesnt even know the CommandExecutor lol 😄
could be that your maven cache is fucked, so clean install and it should be working
check your intellij version, im guessing its outdated still
its most likely a java 21 class it cant recognize
updating, will try it if update doesnt work
commandexecutor aint java 21
it stopped working from minute to minute
doubt that
otherwise it wouldnt work in the other classes as well
looks like intellij got its periodt again to me
lol update doesnt work, is it possible then i push some keybuttons that run something?
the weird part is that it stopped working in only 1 place
crazy
just delete the file and remake it again
i cant create any new commands, every one i try to create tells me the same problem
did this work?
maybe try repair IDe
doesnt help
-U
I doubt you have tried everything you have been told. You've not had time to reindex or anything
maybe he's on a NASA computer
clean install -U
Compare what you wrote and what you have been told
i see small "u" at first, already edited it to "U"
but it doesnt solve the problem
then you're fucked
try to delete your maven caches, invalidate caches of intellij again, otherwise try to checkout your workspace again in a different directory and last but not least, if nothing of that worked, reinstall intellij
i even try to create new project and still RIP
what api version
so even the java version he's using is fine
i think that it will doesnt solve it, it stopped working from minute to minute..
restart computer ¯_(ツ)_/¯
i will try it.. see u soon 😄
its probably something stupidly simple we just cant think of
can you show the imports for both a ile that works and that doesnt?
isnt problem with bukkit?
working in this picture
if i import it manually, it is working
the org.bukkit.command.CommandExecutor
has spigot 1.21 released yet
yes
no like
almost a month
but there are still changes planned
release not unstable
month in 3 days
what isnt stable about it
like it would be considered latest on buildtools
its not set as latest yet
yeah thats cuz its missing some new api things
well if there are new builds pumping out then its not released
there is always new builds pumping out
and also then nothing is ever released
even after its stable
oh
it only doesnt know CommandExecutor..
idk, just use manual import and move on xD
where can I find buildtools latest
thats too sad for me 😄
can someone help me with a good structure for my plugin? I am making menus but I am working on a custom resource pack, but I want this to be optional. I need some way to separate my menu logic from what it looks like (and from the inventory I am changing ig), like changing items etc if i have a textured version. would anyone have ideas as to how to structure that?
like right now my menu manager knows what kind of menus it should use, but for every menu that has a textured variant idk how to exactly do it without literally copy-pasting the code from the normal menu and changing a few things to make it work for the textured version, but this is very much undesired
how can i upload a ressorce on spigot
im inspecting the spigot source code (at least i think it is the correct repo) and i cant figure out how and where the events are emitted
im trying to figure out when and how the PlayerMoveEvent is instantiated but i cant
It'd be in the patches
Of CraftBukkit
you probably want to look at the craftbukkit source
It's honestly much easier to run BuildTools then apply patches from work
Then you can just loonat the NMS
im trying to recreate it in fabric but nobody on there knows how to do that
and i have experience with spigot and now for a fact that event exists and it works
im not talking about an event system
i mean firing the event
i already made the event system
well do you mean how the events work in general or just when the player move event is fired in particular
the player move event
ive made a lot of events but this one is giving me a headache
Pretty much
i found this lol
With a bit of filtering
what is the issue you are running into
im using Mixins but idk which nms class i have to inject to
i tried a few of them but i couldnt cancel the event
mixins sound like th true final boss of pain in java
What cursed thing are you trying to do
im making a lib mod to make developing serverside fabric mods easy
so it feels a bit more bukkit-like
ive made a few so far
and the implementation looks very much like bukkit
good job there
thanks ^^
PlayerMoveEvent
ive mixed in ServerPlayNetworkHandler#onPlayerMove to no luck
also Entity#onMove
it looks like it has a lot to do with vehicle motion
When working with 1.21, is there really no way of having something else like locaizedname? Because, when the displayname changes, that would cause it to no longer be detected as that item right?
true, thats a good idea
i was just reeeally wondering if we were forced to do it by displayname now
but i forgot about pdc
how do I store API keys in my code?
I meant like
how do I store my API keys so that they can't be reverse-engineered
I can just not upload my API key
but my compiled jar file can be opened
and the API key can be found somewhere
even if I encrypt it
I mean thats kind of everything in the world
Is it possible that with PersistentDataContainer I can store a custom object value?
yes
serialize that bitch
and store as string
Env variable or config file
so you mean the user needs to input their own API key?
np
Yes ? Why would you distribute your API key with your jar
cuz I'll be using a lot of providers
such as?
can't expect the user of my plugin to make an account on every single website
unnecessary info
well then you would need to make your own user login probably, and save api keys on a server somewhere
That is the kinda way it works, if you don't want that, there is really no way to hide your key, everything can be reverse engineered
or something
There is also a way to use oauth2 if your provider support that
how does that work tho?
For example if your provider is Paypal, you would redirect then first time to Paypal login page and when they login save oauth token
Hi, i have found a bug in the spigot api, where do i report it?
But imo the best way is to just let the user enter the API key
jira
?jira
my tickets shall block out the sun
lol? why the API doesnt change? yes, i have reload maven
Change it in your plugin.yml
yeah, thx
thank you very much! first time reporting a bug in general
https://blog.jeff-media.com/creating-custom-heads-in-spigot-1-18-1/
does anyone know why the same random UUID is reused?
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
to save flooding the player cache
oh alright
because i converted my code to get a skull by the uuid so i wasnt sure if i should instead use that uuid or the random one
i need a spigot test server but i cant run spigot 1.16.5 because my java version is too high
any way to still run it?
Get an older java version?
i need my current java version to run 1.21
you can have multiple java versions installed. just use teh full path to javaw.exe
oh ok
probably want the java exe
yep
override fun isFactoryResultant(item: ItemStack): Boolean {
val meta = TileUtils.getMetaNoClone(item) ?: return false
return meta.persistentDataContainer.has(KEY, PersistentDataType.BOOLEAN)
}```
fuck yeah i love code with no context
@young knoll like my getMetaNoClone method??
private static final MethodHandle ITEM_META = ReflectionUtils.getFieldAsGetter(ItemStack.class, "meta");
@Nullable
public static ItemMeta getMetaNoClone(@NotNull final ItemStack stack) {
return (ItemMeta) ReflectionUtils.safeInvoke(ITEM_META.bindTo(stack));
}```
Oof ow my reflection
I ain't about to clone item meta to check PDC
@eternal night I don't need your PR upstream 😡🖕
I'm a strong independent developer
What could be the reason why a plugin can't call custom events
you're going to need to give an actual error
0
plus you've given 0 code
wait a sec
CraftItemStack in shambles
pfff who tf cares
Now benchmark it!
🤓 MethodHandles are actually as fast as native method calls when dealing with MethodHandle constants
Now benchmark it!
nah
that's a lotta work
idk how you'd even use JMH with minecraft
Literally it's a plugin relation problem
Skidded class from other plugins, the problem is that the event dispatch isn't working or else a plugin can't listen somehow to this event
Either make no sense
did you have a HandlerList
hey... perchance are you using paper
I've tried many ways and I've started doubting of stupid things
Actually is a spigot problem, or a bukkit one we can say
why is it cancellable but doesnt check if its cancelled
I don't think its a spigot bug, custom events work fine for everyone else
If it was a spigot bug it would have been reported by now, especially with such a commonly used feature
As I said it's a relation plugin problem
i don't know what a relation plugin is so I can't tell you
That's why I'm asking if there could be a reason why a custom event isn't fired
the code that its called within is not running
Nope, the prints are called
does the other plugin load after yours and subsribe to the event like a normal bukkit listener
The event is mine
I'm firing my own plugin event
And that make no sense for several reasons
do you listen to the event in your own plugin
No I did an addon
does the addon load after your plugin
Of course
And even if the problem whas related on my plugin that fires event, what could be the problem
Yep
Event is registered too
No ideas
(The problem is the custom event plugin that somehow "can't fire events")
The only case is if your listener is not registered
the internal code pretty much just runs a loop over all registered listeners
well I'm looking at the internals, and I don't know what to tell you
it seems to not be a spigot bug
I did too
custom events work fine
check your jars are updated, and check they load in the correct order
I mean it should
If they are not as so, they would spam exception
At least it's a positive thing
But at this point the solution should be ricreating the project and adding class by class
Since as I said, the problem is on my plugin that fires the event
why do you have a lombok getter annotation on your event class?
smart look
The original class was even cleaner
I've removed that too doubting it
Imma send the original one
Update: printing the registered listeners on that event result on an empty array, in other words, the event isn't registered from the addon
but only for this specific plugin that creates the custom event
@eternal night @river oracle says he hates ur pdc api
🥰
(it works)
quick question, how do i get a specific type of potion to use in recipes and how do i spawn a primed tnt
this worked in 1.20 but i updated to 1.21 and now im confused
|| https://i.gyazo.com/83082fea761c476498dc2cd69a8e215c.png ||
|| https://i.gyazo.com/a1f62cbcbcdc119af10b31e14e619965.png ||
i need to use NMS, how do i go about building a mojang mapped build of spigot NMS with build tools so i can toss that into my dependancies?
do i literally just click "Generate Remapped Jars" under options?
anyone have an issue with maven throwing "cannot access net.minecraft.core.component.DataComponents" even after following the nms pom file example?
What's with the all the spoilers?
Show your pom
it works for the 1.18->1.20.4 but once the data components are involved it's like nah
Why are you using codemc repos
you think the repo will make the difference?
lemme try the other one
Use the spigot repo
Yeah
does just nobody know how to fix this?
hmm yeah rerunning buildtools also gives same output
What's up with BuildTools?
.
Is this an error with BuildTools or with your project compilation?
project compilation stated above
was rerunning buildtools to attempt to resolve it without luck
Then it's likely an issue with your pom.
Is the link you sent earlier still up to date?
minus the fact I switched to the spigot repo as recommended, yes
that's where the master pom is
since I had to move the spigot stuff into a different directory to keep it organized away from the main code that supports translations/components(i.e. paper)
Did you replace both repositories or just the codemc one?
would be easier to not have to use NMS, but alas no way to set JSON text for signs in spigot
xD
Is this a valid packaging format? Or are you using some maven plugin that does this?
maven plugin, and both codemc repos
the weird thing is, same setup for pre-data component NMS works fine
Can you paste your current pom?
And, just to confirm, you ran BuildTools for 1.21 with the --remapped flag?
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
Repository needs to be spigot-repo not just spigot
changed repo to spigot-repo and same issue
Can you provide more info around the error message?
Also, can you confirm that ~/.m2/repository/org/spigotmc/spigot/1.21-R0.1-SNAPSHOT exists?
that's the error it gives, anything with NMS is "cannot access" when code inspection is fine with it
"cannot find symbol
symbol: variable DataComponents"
Maybe try removing the <optional> tag and see if it recognizes it then?
hmm, removed and still same
What if you run the maven command again with -v?
There's gotta be more to the error than just that.
sometimes the NMS errors occur if spigot is patching incorrectly
I don't think this is really a BT issue
hmm alright
I'll just remove it for now, the paper stuff has translation component support which is good enough
only 107/1335 servers are not on paper anyways
hello
hello
gradle jdk configuration invalid, its set to java 21?
Can you show the project java configuration ?
In case everything is setup correctly try to delete those files:
.idea/gradle.xml
.idea/workspace.xml
where can i find that? i havent used intellij for months
File>Settings>Build, Execution, Deployment> Build Tools> Maven
im using gradle
click gradle then
the second image
Settings > Project Structure > Project
Little sync button just above your mouse
Can you show the build.gradle file?
(where am i)
Did you create the project directly on IDEA ? Or did you import some existing project?
ussually its gradle groovy, but i have it gradle kotlin
That shouldn,t pose such issue
yeah
i have a build of the plugin
thats working
but that error came out of nowhere
Unfortunately I cannot help you more in here, I'm not a big user of gradle :/
how work packets on server switch? For the client is just a world change? Handshake is initalized with the new server?
For the client it's a world change.
The client itself will not do another handshake.
However I don't really know what do the backend servers get once a player switch
Yes because on the new server playerjoin are called
Maybe when you enable bungeecord in seetings, the server don't wait handshake/serverconnection
Yeah maybe bungee transfer some internal data between the server
Yes maybe bungee initialize himself the hankdhake (but server can't send connection packet to proxy because it make it also sended to the client and generate an unknow packets I think)