#help-development
1 messages · Page 841 of 1
net.minecraft.world.entity.EntityType<?> nmsType = net.minecraft.world.entity.EntityType.BEE;
ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(nmsType);
String path = resourceLocation.getPath();
EntityType bukkitType = EntityType.valueOf(path.toUpperCase());
oh thanks!!
it's harder than "just getting the name" x)
*If the enum names are matched
But there is probably a better way. I just eyeballed this from the src code.
if it doesn't match, I think it won't be the end of the world
maybe but I think no
starting getting big 💀
https://paste.md-5.net/eranunahov.java
Caching is key or your reflections will be very slow
any tutorial to caching?
caching literally just means to store your method params and their outputs in a map or something so its in memory
and to return that cached value if it exists
do you have any example?
so in this case you'd be making a
Map<net.minecraft.world.entity.EntityType<?>, EntityType> cache = new HashMap<>()
okay I see
so I just need to iterate through every EntityType nms?
and store them in this map?
idk how much I vibe with that
that conversion method does absolutely 0 reflection
in your method do
if (cache.containsKey(nmsType)) return cache.get(nmsType);
// do your thing
cache.put(nmsType, actualType);
return actualType;
you're just moving the store point in memory from one point to another
please organize your classes properly
public static EntityType getEntityTypeFromNms(net.minecraft.world.entity.EntityType<?> nmsType){
ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(nmsType);
String path = resourceLocation.getPath();
return EntityType.valueOf(path.toUpperCase());
}``` putting this method in your reflection class is heavily missleading
as the stunning lack of reflection it does
private static final Map<Class<?>, Map<String, Field>> FIELD_CACHE = new HashMap<>();
public static <T> Object getValue(T instance, String fieldName) throws NoSuchFieldException, IllegalAccessException {
Map<String, Field> fieldMap = FIELD_CACHE.computeIfAbsent(instance.getClass(), clazz -> new HashMap<>());
Field field = fieldMap.computeIfAbsent(fieldName, name -> {
try {
Field declared = instance.getClass().getDeclaredField(name);
declared.setAccessible(true);
return declared;
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
});
return field.get(instance);
}
This basically reduces the field reading to 2 map lookups for every reading after the first one.
okay thanks
It's not permanent
So I use this?
I wouldn't
not necessary no
do as 7smile7 suggested
okay thanks
Let's convert every method
like this?
https://paste.md-5.net/kubigoseja.java
@lost matrix
Field to the top pls. And make it less DRY. Im seeing a lot of code that can be extracted to a method.
okay thanks
(I switched directly after sending my message the field to the top)
new version
https://paste.md-5.net/utahoxokuk.java
How do i make a cooldown on 10 minutes, with this code:
private final Plugin6 plugin;
public SpawnCommand(Plugin6 plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
if (sender instanceof Player){
Player player = (Player) sender;
Location location = plugin.getConfig().getLocation("spawn");
if (location != null ){
player.teleport(location);
player.sendMessage(Colorize.color("&fDu blev &ekørt &ftil &espawn&f."));
player.playSound(player.getLocation(), Sound.BLOCK_BELL_USE, 10, 10);
// Lav cooldown(15 min)
// Gør så det koster penge
}else{
player.sendMessage(Colorize.color("&fLokationen er &cikke &fblevet sat. Kontakt en Admin"));
System.out.println("PLUGIN6: Der er intet spawnpoint sat.");
}
}```
And how do i do, so when you join the server, you spawn at the location i've made, in that code?
HashMaps and UNIX timestamps
Nice, how then?
Thats all you have to learn
what exactly are you trying to do?
is Hibernate used in combination with plugins and is it recommended if working with a database or should I look at smth else?
it can be used with plugins but id recommened doing something lighter
for example? also I use Hikari with PostgreSQL if thats important
manually writing the sql if you dont have too many things you store, or something like orm lite
ok thanks :D
Can someone help to setup a CraftBukkit development environment? I'm stuck at https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse#making-changes-to-minecraft point 3.
that repo is private
oh sorry, i corrected the link
ok what exactly do you mean with point 3?
Copy the selected file to the src/main/java/net/minecraft/server folder in CraftBukkit.
Do i have to copy only the server package or the complete net/minecraft into src folder?
you generally have to copy nothing unless you want to edit a class that does not yet have a patch
what nms class do you want to edit
I specifically want to propose a fix for this issue https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-7547?filter=allissues&orderby=created+DESC%2C+priority+DESC%2C+updated+DESC
But as i created a pr for fixing the docs. another option was suggested
Yea, but that is not in an NMS class
that is in a craftbukkit class
that is alreaddy there
the entire section "Making Changes to Minecraft" is only needed if you want to edit a class from the mojang server that has no current changes from craftbukkit
So is it normal that the whole project is errored aout in NetBeans?
did you apply patches
ahhh i forgot that
yea, that is the first step
I was thinking that those two sections dont depend on each other
package org.example;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
public class events implements Listener {
@EventHandler
public void onPostLogin(PostLoginEvent event) {
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
player.sendMessage(new TextComponent(event.getPlayer().getName() + " has joined the network."));
}
}
}
how can i make the server say it instead of the player? the "has joined " part
you need to send a plugin message to the server and then broadcast there
plugin messages are your own custom data proxy <-> server
i ment
in the console
the bungee console
is there a way i can do something with the output? like if the output mataches a string, it will do something
output of what
Thank you. That solved it.
the out put of the command
@remote swallow
like
if the output of the command == "https://google.com" it will kick the player
package org.example;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
public class events implements Listener {
@EventHandler
public void onPostLogin(PostLoginEvent event) {
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
player.sendMessage(new TextComponent(event.getPlayer().getName() + " has joined the network."));
String namses = event.getPlayer().getName();
String commandcheck = "domain " + namses;
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), commandcheck);
}
}
}
what
its running the command
/domain {user}
i want it so
if the commands response is https://google.com
it will kick the player
with reason
"this domain is not allowed"
uh
lmao
sure
ideally you wouldnt be wanting to check the result of a command like that
you would have a method the command just calls
are you talking about their host ip?
does said plugin have an api?
prolly not
what plugin is it
yes but that is most likely bad design
just tell me how to do it
run the command as console and listen to the logs
which you shouldnt have to do, almost ever
oh aight
the plugin has an api folder in its source
maybe i can get the response from there
name the plugin
its too sketchy
just say it
nvm the api folder has no mention of said domain
if you dont want to say it here dm it me and ill check if it has an api you can use
na its fine i dosent have one
somehow im doubting that
where is the method
so how do you expect me to know what it does
💀
what are you trying to copy
i just found some weird guide
in classes
is there documentation on it
no
i made it up
now
is there a website for documentation
for the different methods
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
?jd-bc
okay
so for the log file thing
i would make the plugin
open latest.log
and see if the last output
matches what i want
right
no you would probably want to read the print stream
why are you so scared of just saying the plugin name
just dm me the plugin name
you keep just making this an xy issue
lemme make a spigot thread
you confuse me so much
cant i do
String consoleOutput = dispatchCommandAndGetOutput(ProxyServer.getInstance().getConsole(), commandCheck);
and then check the varibles match
rip
you are making this so much harder bt just not saying the plugin name
dont even have to say it here
bro im gonna get banned
dm it me
its for cracked minecraft stuff
:(
yah anyways
it dosent have an api
for domain checker
so idk how i can get the output of the /domain command
and do something with it
damn
Hi, anyone got ideas on why when this is run the server gets lag spikes, despite the command being asyncronous? https://paste.md-5.net/puleyosixe.java
After further investigation this specific part is causing lag, but why? im just adding to a list and sending a message https://paste.md-5.net/nikubequle.cs
what does DiscordExecutor#executeDiscord do?
yikes this hurts to read
it causes discord
for the younger folk with a limited vocabulary
I regret looking
Legacy with text components too
nerd
Discord should be a issue
ye im making http request to craftatar.com
Io blocking
nvm im dumb
Are noSQL databases better than mySQL databases? Or what are the pros and cons of both?
Duplicate code fragment detected. Do you want to extract it to a function?
no because im looping different objects
no
for (Player online : Bukkit.getOnlinePlayers()) {
if (online.hasPermission("griefalert.use")) {
online.spigot().sendMessage(alertComp);
}
}
duplicate code fragment
Structured vs unstructured
I assume you mean mongo by nosql?
it hurts my eyes to even read that sh!t
I guess, im not that experienced
The big advantage with mysql is that u can query just a single field of data from a specific user
I guess data analysis can be easier with mysql, altho there are tools to do with mongo as well
May I ask, whats your favourite?
I don’t have a favorite
I believe all these database tools like mongo, postgre, cassandra, google spreadsheet (yes lol) and redis have different usecases
Isnt mongo better, if i dont want to create a new table for every single thing, because i huess you can just add data in an unorganized DB?
I mean if you only care about storing blobs of data for each user persistently, then yeah mongo prob is fine
Or for saving the bans of a player as everyone has a different amount of prior bans, with SQL you would need a new row each time?
you mean like logging previous bans?
I use Maven, and therefore, I built my own Spigot on version 1.20.2. However, I am unable to find any methods related to packets. My Maven configuration looks like this:
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.20.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>```
Yeah
Mongo is fine
That's because the spigot api has nothing related to packets
No no, i mean if this would be the ideal use case, as im interested in using both
How can I then work with Packets?
You either need a library or nms
Do you have any tutorials for me please?
?nms
as for packet libraries look at ProtocolLib or PacketEvents
Thank you
Hello, how can I check if there is grass between two entities?
You can rayTraceBlocks
okay thanks
which one?
The one you want to use / fits your use case
the one who enabled me to check if there is grass between two entities
both do
idk if I need to select one in bukkit world, or one in bukkit player...
Depends on what your goal is
I told you x)
to check if there is grass between two entities
a player and a LivingEntity
sigh
Why do you need to check if there's grass between two entities
to make the player attack the entity
Hello, how can I get player weapon damage and if the player is reloading his weapon?
wdym by reloading?
Are you talking about bows?
wdym by reloading then?
hm, im not sure about this one sorry
I want to create a EntityDamageEntityEvent
that is recharging the crit attack cooldown
ok
yes
There is an arm cooldown not sure if spigot has a method for it
So, according to 1.9+ pvp system, how can I make a method to deal damages to an entity based on player's weapon attack damage and attack cooldown? (if cooldown is charged, the player inflict the weapon damage (there isn't critical in this case) and if it isn't, the player inflict the damage when you spam (I think it's 0.5 PV?))
found!
There you go
so I need to get weapon damage
does someone know? please
I know I need to deal with attributesModifiers and Generic AttackDamage but idk how
Has someone an idea why i cant compile CraftBukkit from my development setup? The errors are from files i did not modify. The logs are here https://pastes.dev/kLtWhU5cQ1
Ok i got it myself. The Bukkit API was slightly outdated.
(perfectly working with Player#attack(Entity) so solved)
Enabled plugin with unregistered PluginClassLoader -> What does this mean? How to avoid that
128x128
does anyone know when doing player.removePassenger
i wanna throw the entity in a distance
Add some velocity to it a tick later
how do i make a normal java event a bukkit event
what are "normal java events"
unless you're talking about swing I don't believe any such things exist
Step 1. Listen to the event using Log4J's API
Step 2. Create a Bukkit Event that provides the relevant similar data
Step 3. Use the listener you created in Step 1 to call the event you created in Step 3.
Step 4. Profit
which listener
did a bit of research don't think you can/should use this class
doesn't seem like it does what you expect it to
ok what should i use then
idk I'm not an expert in the Log4j API
i just need a log event
I highly doubt they have some listenable event that triggers every time something is logged too
seems insanely resource intensive for little to no gain
why
i need a log event
why'
i want one
i literally just want a log event
how
this really screams xy problem
"i want one" is not a very good reason
a LogEvent in of itself seems pretty useless too
why should there be a reason
because if you want to do something like this there should be a reason you want to do it other than "eh i want to ig"
ok but why would you want to know
because it really seems like xyproblem
by knowing x its very likely you don't need to do y
i want a bukkit event that will be called when ever a log gets sent to the console
why that seems utterly useless
cuz i want it
No man, absolutely not 😭
So you want to log the log?
Just fyi you can always swap out the handler for log levels or register an additional handler etc
But you seem to be new so
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?bootloader
Import the Spigot artifact
Hmmm forgot the name
After running BuildTools
You cant just import directly anymore
1.16
In maven its ez
Is older than 1.17.1 it has no mojmaps (with Spigot)
Ah
Its not a maven issue that i was referring to
Ok
Can I use something from my mod, meaning, is there something similar when it comes to plugins in terms of custom entities? For example, there's a snake entity, and there's code to draw/animate snake tongue using OpenGL Can this be utilized in a plugin with some resource pack (which I want to create from the mod's assets folder)? However, I also understand that many things may not be supported.
So it is possible with nms?
No nms is server side
Yes just not easy and you need to get creative.
If you're drawing with pure OpenGL you can update to a newer version and use GLSL Shaders in a ResourcePack
But yeah it does require you to be creative
where is the buildtools artifact located I can't find the spigot-api folder in the spigot folder
Someone has a vid on youtube of importing Blender 3d objs in minecraft via JavaPlugin.
I think they did it with resource pack
and it just didn't end
Anyways hypixel makes their custom pets with resource pack
do I need exactly the artifact in the spigot-api folder to support nms?
Yes need to be exact version as your spigot
Idk what u mean by spigot-api folder. Just download the build tools version u need and run it lol
I have is the core right in the buildtools folder
is there a tutorial on this for 1.16.5(nms)?
No
try {
setArrowCountMethod.invoke(player, amount);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
}``` setArrowsOnEntity(entityPlayer, 20);
``` how to update the player state
at the moment, the arrows only appear when I shoot myself and yes I use nms
full code: https://pastebin.com/V63H8DEM
solved: solution is - ```DataWatcher dataWatcher = entityPlayer.getDataWatcher();
int arrowCountIndex = 9;
DataWatcherObject<Integer> arrowCountDataWatcherObject = new DataWatcherObject<>(arrowCountIndex, DataWatcherRegistry.b);
dataWatcher.set(arrowCountDataWatcherObject, 40);
PacketPlayOutEntityMetadata metadataPacket = new PacketPlayOutEntityMetadata(entityPlayer.getId(), dataWatcher, true);
new BukkitRunnable() {
@Override
public void run() {
((CraftPlayer) p).getHandle().playerConnection.sendPacket(metadataPacket);
}
}.runTaskTimer(SumeruBosses.plugin, 20, 20);```
declaration: package: org.bukkit.entity, interface: LivingEntity
is there an event for when a player has finished downloading the custom server rescource pack
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
GamePlayers1.remove(player.getUniqueId());
GameNames1.remove(player);
if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent nEvent = (EntityDamageByEntityEvent) event
.getEntity().getLastDamageCause();
if ((nEvent.getDamager() instanceof Player)) {
Player p = (Player) nEvent.getDamager();
p.sendMessage("Hai assassinato " + player.getName());
player.sendMessage("Sei stato assassinato da " + p.getName());
if(GamePlayers1.size()==1) {
p.sendMessage("Hai vinto il minigame!");
}
}
}
}```
why it isn't removing the value in the 2 List GamePlayers1 and GameNames1?
Did you check if this listener is actually called?
yes because that listener to the think without the using of the List
Yes, the resourcepack event fires multiple times with different states.
for example it send the messages to the 2 players without problems
What makes you think the player wasnt removed?
Im guessing that you create multiple instances of your Listener class.
because i make the command /jqueue and if the player is within that list it send a message and i'm getting that message
for clone a List from one to another it's like that right? GamePlayers1.addAll(QueuePlayers); Because i'm thinking the problem is here
This doesnt remove previous entries. So its not cloning. It simply adds all objects from ListA into ListB
but it add different objects right?
because i clear the old list after doing that action
Different from what?
like 1, 2, 3 etc and not 1 2 3 4 in only 1 object
Alright, now the command
Field and method names start with lower case characters pls.
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
im confused how do i change my xml
I cant make out the problem.
Check the player names before and after dying.
Btw: Every collection (Lists, Sets, Maps etc) should always be private, final and should have no getter or setter.
That is very important.
Text editor. Preferably an IDE.
Did you run BuildTools for 1.20.4 ?
Otherwise you have no access to nms.
Then check if your versioning is correct.
its 1.20.4-R0.1-SNAPSHOT right
Let me check
1.20.4-R0.1-SNAPSHOT
Yeah looks about right
Then invalidate caches and restart your IDE
basically my issue is im missing classes like CraftPlayer
@lost matrix ok i make the loop of all the player first and after killing a player and nothing changed from before and after the kill
that worked thank you
How did you check?
any way to change datapack priority either in server config or thru the api?
on the command /jqueue when he send the error send to me the UUIDS too
a done it before and after
Show the EnjoyingEvent#getQueueManager() method pls
Wait, show me your JavaPlugin class all together
the main class?
As predicted
All good. Btw a manager class should not be a listener.
You should separate your concerns there 👍
ok thx and sry for that stupid error
sry for ping you another time but now i'm thining on what you said erlyer about to make the List private but how can i reach in a diff class if i make the List private?
You add a mutator method with a proper name.
public void addPlayerToQueue(Player player) {
}
public boolean isInQueue(Player player) {
}
public int getQueueSize() {
}
And for bulk (read only) operations you can expose an immutable copy
public List<UUID> getAllQueuedPlayers() {
return List.copyOf(this.playerQueue);
}
oh ok now i understand thx
Fun random fact java has some weird queue class
It has a bunch of weird queue classes. And even some quite unknown gem queues for multithreading.
Oh really..!!
That's sounds cool
So I've been working on a custom map renderer, but I find that the renderer no longer affects the map once the map is scaled. Also map initialize event is not called when a map is scaled, even though it resets the exploration.
How do I detect when a map gets scaled so I can update the renderer?
anyone know how to fix this npc im using NPC Utils https://www.spigotmc.org/threads/advanced-npc-util-1-17-packets.512445/
here the error[12:54:56 WARN]: [DeathPro] Task #26 for DeathPro v1.0-SNAPSHOT generated an exception java.lang.NullPointerException: Cannot invoke "java.util.function.BiConsumer.accept(Object, Object)" because "callback" is null at io.github.danielthedev.npc.NPC.setASyncSkin(NPC.java:429) ~[DeathPro.jar:?] at io.github.danielthedev.npc.NPC.setASyncSkin(NPC.java:433) ~[DeathPro.jar:?] at io.github.danielthedev.npc.NPC.lambda$setASyncSkinByUsername$17(NPC.java:409) ~[DeathPro.jar:?] at io.github.danielthedev.npc.NPC$SkinTextures$1$1.run(NPC.java:1058) ~[DeathPro.jar:?] at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Pufferfish-22] at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1569) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:495) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1485) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1284) ~[patched_1.17.1.jar:git-Pufferfish-22] at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:321) ~[patched_1.17.1.jar:git-Pufferfish-22] at java.lang.Thread.run(Thread.java:840) ~[?:?]
java.lang.NoSuchMethodError: 'void net.minecraft.network.protocol.game.PacketPlayOutEntityDestroy.<init>(int)'
at io.github.danielthedev.npc.NPC.getEntityDestroyPacket(NPC.java:319) ~[DeathPro.jar:?]
at io.github.danielthedev.npc.NPC.destroyNPC(NPC.java:113) ~[DeathPro.jar:?]
at org.firestorm.deathpro.EventListener.DeadBody.lambda$onDeadBody$0(DeadBody.java:36) ~[DeathPro.jar:?]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Pufferfish-22]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:483) ~[patched_1.17.1.jar:git-Pufferfish-22]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1569) ~[patched_1.17.1.jar:git-Pufferfish-22]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:495) ~[patched_1.17.1.jar:git-Pufferfish-22]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1485) ~[patched_1.17.1.jar:git-Pufferfish-22]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1284) ~[patched_1.17.1.jar:git-Pufferfish-22]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:321) ~[patched_1.17.1.jar:git-Pufferfish-22]
at java.lang.Thread.run(Thread.java:840) ~[?:?]```
my code ```public class DeadBody implements Listener {
public DeathPro plugin;
public DelayedTask delayedTask;
public DeadBody(DeathPro plugin, DelayedTask delayedTask) {
this.plugin = plugin;
this.delayedTask = delayedTask;
}
@EventHandler
public void onDeadBody(PlayerDeathEvent e) {
Player p = e.getEntity();
NPC npc = new NPC(p.getLocation(), p.getDisplayName());
npc.removeFromTabList(p);
npc.setNameTagVisibility(p, false);
npc.setASyncSkinByUsername(plugin, p, p.getDisplayName());
npc.spawnNPC(p);
NPC.NPCMetaData metaData = npc.getMetadata();
metaData.setPose(NPC.Pose.SLEEPING);
npc.updateMetadata(p);
delayedTask.runTaskLater(() -> {
npc.destroyNPC(p);
}, 10 * 20L);
}
}```
can I somehow get the ProxiedPlayer from LoginEvent
send your code
No that event is fired too early. Use the PostLoginEvent
Anyone knows how to alter the attack speed of any monster, e.g. zombies ?
Can this only be done using nms?
Should I have a task timer at the desired speed to make it "manually" attack then? <= resource intensive
The attack speed does look hardcoded in to the mob AI
why doesnt bungeecord find the JSON (maven) when its on the server, I tried shading but still the same error https://paste.md-5.net/faqekuvura.cs, https://paste.md-5.net/caboheduto.java
Show us how you shaded it
and which jar did you use
shaded
Hello friends, I'm looking for a dev who knows how to program using JDA api, I know there's a specific area to hire devs, but I don't know where, can anyone lend a hand?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thanks bro
In the plugin yml can you only use x.x.x or can I do smth like 23w52a
For what?
version
Your version can be anything but I do recommend following semantic versioning
it is impossible to use GL11 drawing methods in spigot?
I have a tileentity in my forge mod that creates rotating nbt crystal around an entity and I want to make the same one in a spigot
Is there really no way?
you can summon an entity with nbt data and render it with the mod
but you can't in spigot
but then why do I find nbt And titleentity classes in nms
so I cant do something close to that?
... you can?
The server cannot render stuff
What part of "you can summon an entity with custom nbt data and render it with your mod" is unclear
Rendering happens on the client
^
for nms how can I do create a ClientInformation for an NPC thats my code so far```java
package eu.hylix;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.UUID;
public class CreateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if(sender instanceof Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle();
MinecraftServer server = sp.getServer();
ServerLevel level = sp.serverLevel().getLevel();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Billy Bob"),
ServerPlayer npc = new ServerPlayer(server, level, gameProfile, );
}
return false;
}
}
if there was something that would allow you to draw on the client side on spigot server
there isn't
it's literally not a thing
I mean I know how to do something similar
TexturePacks are called ResourcePacks now because they can contain more than just textures now
but uhhh... work secret ;-;
You can use shaders to draw stuff
shaders are created via glsl and that's it. I cant use java code in shaders to draw something
Yeah I'm aware
but they still don't contain what I need, yes?
They can contain shaders
If I rotate a DisplayEntity through the Transformation, 180 degrees (degrees to radians), it does in fact rotate 180 but the issue is that it also modifies the y translation.
How may I rotate any axis (x,y,z) without affecting translation?
but packets allow me to draw something on the client side?
or do I have a wrong understanding of this
No
Packets just send basic information like: There is a zombie at x,y,z
The client then renders a zombie at that location
Resourcepack models don't suffer this
public class CreateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if(sender instanceof Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle();
MinecraftServer server = sp.getServer();
ServerLevel level = sp.serverLevel().getLevel();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Billy Bob");
ClientInformation info = new ClientInformation("de", 1, ChatVisiblity.FULL, true, 2, HumanoidArm.RIGHT, true, true);
ServerPlayer npc = new ServerPlayer(server, level, gameProfile, info);
ServerGamePacketListener ps = sp.connection;
ps.
}
return false;
}
}
``` there was .send for ps but now no longer anybody know what it is now?
Look at Mojangs code
you got a link for me?
The Spigot tooling isn't great for that but you can probably guess
what would you recommend then
A modding environment will probably work better
Personally I just use my mod project to quickly view decomp sources
I'm writing a plugin for my own chat and would like to add PAPI support, how can this be implemented?
You could, however, virtually render it on server, useless, but possible
You'd use their API
check the documentation
indeed. Obviously I went to google before coming here
so my question is currently unanswered
The answer is yes, you can use nms or a bukkit task
it's up to you
Right well with nms, how would I do that? I can't seem to find any up to date 'documentation' or examples
nms is undocumented
Which is why it's more of an advanced topic
You need to be able to read the decompiled code and figure out what it does
In your case it really isn't that hard, just look at the attack goal and how it's stored in the entity
oh and when you're asking for help with nms it's very important that you specify the exact version you need help with
and the more details you can provide the better
Right thanks, I'll figure it out, thank you for your time
Because of obfuscation some methods and fields might be also different between versions, I usually check older versions and try to find references to find the new name
mojmaps 💪
Im trying to intercept the biome array from the map_chunk packet type in protocol lib in 1.19.2. Has anything changed in the library because there isnt an bytearray in the packet
Messing with chunk data is a pain to do
wiki vg should contain the protocol information you're looking for
im trying to make a custom item made with another custom item, this worked using glass porions instead of arrows, am i missing something? https://paste.md-5.net/ugujitafeh.cs
forgot to say the problem, my bad: It wont let me craft the new item
how do i hide player from playerlist? i tried:
player.setCustomName(null);
player.setPlayerListName(null);
player.setDisplayName(null);
and none of this is working
That requires some packet trickery
or if you want to hide the player entierly you can use the hidePlayer method
how do i do that?
thanksss
i dont have PacketPlayOutPlayerInfo what do i do to be able to use that?
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
exact choice doesn't work on spigot for shapeless recipes
it worked on a different item though
here is the other working code https://paste.md-5.net/uhidapeqah.cs
what is tpItem?
a custom item that also works
right, but do other items of the same type also work in its place?
tpItem is a netherstar, if thats what you mean
and no, others dont work
This server is running Paper version git-Paper-81 (MC: 1.19) (Implementing API version 1.19-R0.1-SNAPSHOT) (Git: 86f87ba)
You are running the latest version
._.
yeah, they work on paper, they don't work on spigot (which is why I italicized spigot earlier)
is there the same extension id("xyz.jpenilla.run-paper") only for the spigot, I just have the error com.destroystokyo.paper.exception.ServerInternalException: Attempted to place a tile entity (com.sumeru.bosses.tileentity.TileEntityBaseBeehive@a0b5175) at 0,0,0 (Block{minecraft:air}) where there was no entity tile! [20:50:19 WARN]: Chunk coordinates: -16,-240 [20:50:19 WARN]: although I am sure that it is not related to the paper but to an error in the code, but I want to fully use the spigot to get support here
Looks like you forced a tile entity where there shouldn't be one
code: ```package com.sumeru.bosses.tileentity;
import net.minecraft.server.v1_16_R3.Entity;
import net.minecraft.server.v1_16_R3.IBlockData;
import net.minecraft.server.v1_16_R3.TileEntityBeehive;
import java.util.List;
public class TileEntityBaseBeehive extends TileEntityBeehive {
public TileEntityBaseBeehive() {
}
@Override
public void addBee(Entity entity, boolean flag) {
super.addBee(entity, flag);
}
@Override
public List<Entity> releaseBees(IBlockData blockData, ReleaseStatus releaseStatus, boolean force) {
return super.releaseBees(blockData, releaseStatus, force);
}
}``` WorldServer nmsWorld = ((CraftWorld) world).getHandle();
nmsWorld.setTileEntity(Teleportation.getPlayerBlockPosition(player), new TileEntityBaseBeehive());
I do not know how it works as there are very few tutorials on this on the Internet
Hello, how can I get weapon attack speed? (directly from his modifiers, not from Material modifiers)
so I was right?
Not sure what you want me to do
but I'm creating a tile entity right on the player's coordinates to see what it is in general. I expect to see a beehive
so that you can tell me how to do it correctly
Location location = player.getLocation();
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
return new BlockPosition(x, y, z);
}```
what on earth are you trying to do with a custom tile entity?
air can not have the tile enity of a bee hive
only bee hive can be a bee hive
Just summon him and explore and then if I find a good tutorial to do something, although I have a very bad understanding of tile entity
yeah, tile entities can only exist at locations that have the correct block type
a chest tile entity can only exist at the location of a chest
get the attack speed attribute from the item meta
So how do I summon him correctly
Why are you making your own tile entity
But how else?
how else what
what are you trying to do
I have already said above
to understand what a tile entity is and what can be done with it, since I'm making a plugin for mobs and maybe it will come in handy somehow
a tile entity is a block that contains extra data
it doesn't work
I get an empty list
what data can it contain?
player.getInventory().getItemInMainHand().getItemMeta().getAttributeModifiers(EquipmentSlot.HAND).get(Attribute.GENERIC_ATTACK_SPEED);```
A chest for example has the items in it
that is, do I need to put items in a chest using the tile entity of chest
Spigot has api for that
https://paste.md-5.net/oyilokodiy.cs, https://paste.md-5.net/hezuwoxuno.java anyone know why it is null?
Why would it have a connection
It's not a real player
but how would I spawn it in then?
If you're just copy pasting npc code from the internet you might as well just use an NPC lib like Citizens
but sp is the real player so it shouldnt be null or am i stupid
ps.send(new ClientboundAddEntityPacket(sp)); thats line 40
I still want to experiment with this, if I set a tile entity of the hive where there is already a hive, will it work?
it does not have a connection
why you ask, because it's not a real player
so nothing is connected to it
you gotta fake a connection
I still don't understand in what position should I spawn it?
CraftPlayer craftPlayer = (CraftPlayer) player;
ServerPlayer sp = craftPlayer.getHandle(); but that means sp has a connection or not
try it and see
I don't know exactly how the tile entity check is implemented
That has nothing to do with the connection
?tryandsee
so what is the connection if not sp.connection?
that is the connection variable
yes but the Real player has a real connection or not?
it has
Every real player has a connection
so why are you telling me that real player doesnt have one
I haven't done that
what is the preferred way of parsing a time from command args?
like /command days hours minutes seconds
or just one arg in some specific format?
7d2h1m15s
thanks
npc.connection = ps; but this would give it a real connection or not
it would
but why would you do that
you need to emulate a fake connection
^^
npc.connection = new ServerGamePacketListenerImpl(server, new Connection(PacketFlow.SERVERBOUND), npc, CommonListenerCookie.createInitial(gameProfile)); does this look about right?
all of them have a notnullable
I guess that works
to all set them to null?
radical ok
What if
you just make a DummyServerPlayerConnection class
that implements the ServerPlayerConnection interface
but where do I need the ServerPlayerConnection like npc.connection takes ServerGamePacketListenerImpl
why does the interface exist
nah bro fr I dont get it rn
Yeah might want to use Citizens
ofc it's doable but there's no need to reinvent the wheel
it'll probably break api but you can just create the packet in another way and skip the connection entirely
do you guys know what this.n is? so maby i can trace it back and fix it
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
lmfao
Is it possible to cancel a task created via Bukkit.getScheduler().scheduleSyncRepeatingTask(...) from within the task? It seems like it loops endlessly if I structure my code like this:
private int taskId;
...
this.taskId = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> { ... Bukkit.getScheduler().cancelTask(taskId)}, 0, 5);
My guess is, that I made the usual mistake thinking that taskId is already given the value of the task but this is done after the task executes. Am I right with that?
Isnt there cancel()?
Not inside the lamda, no
declare your parameter
?scheduling
I think I already found a solution. Instead of Bukkit.getScheduler().scheduleSyncRepeatingTask() I can use Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {...}, 0,1)
In the BukkitRunnable I can use cancel()
That would be deprecated
True
Just read the wiki page ._.
Will do. Thank you.
Ive looked on there forever im just confused at how the packet structure works since i think the wiki is lying to me
It isn't
Do make sure you select the correct version of the wiki
also if you're using protocol lib it will wrap certain data for you
Hey, I was trying to run buildtools for 1.20.4, but I get that Exception: org.eclipse.jgit.api.errors.TransportException: Tag mismatch! I already whitelisted https://hub.spigotmc.org/ to my AV but nothing worked
send the full error and what command you ran
https://pastebin.com/cPEkJ57c I used: java -jar BuildTools.jar --rev 1.20.4
im needing a name
for my plugin
its utility, so
idk
how can i create ideas?
i tried with AI but nothing
EssentialsY 
Virus
sure
anvm
i thought of Flux
do i need to declare package on kotlin?
literally first kotlin project
What does that even mean?
you can have package-less classes, not recommended though
package org.bukkit.inventory lets say
Do you mean for imports or your own classes?
yea
I mean sure. Declare the package at the top as well.
anyone know how i could hid the paper but keep the text
Custom item model without a texture?
Is EntityPlaceEvent supposed to be called when you spawn an entity using an egg?
Nvm
Just read the javadoc
sigh not another one
why? its a problem?
I don't mean to be rude, I'm just tired
ok can some one help me with that using oraxen plugin
my dev quit on me with life stuff going on so i am trying to do this by my self
try the oraxen discord
What version are you making your plugin for
1.20.4
I'm guessing you're following an outdated guide
If you're trying to send a packet it's connection.connection
great naming by Mojang on that one
from what i understand i need to create a method call inject that use Channel and later send packets
but the problem is to get the Channel from PlayerConnecion
Are you trying to listen to packets?
yes in order to make NPCInteractEvent
Yeah then you need to inject in to the netty pipeline
Honestly though just use Citizens it'll save you a lot of time
well I tryed it and it works for my need ish like I want to set a diffrent skin then name with the api do you know how to do that
i want to learn not using other plugins
so how can i get the Channel?
There should be a skin trait you can use to change the skin
thanks
there is no somthing that can help me with NetworkManager
I hope you're not writing in unmapped
that would be a pain to do
?nms
yes i use that
Is it possible to use a local path for a resource pack on a server I do not want to depend on hosting sites that may go down
You can host the file yourself
can you explain me the map unmap thing?
i understood its something that very helpful
how would i do that would i set the path in the config to like
/home/user/resourcepack/resourcepack1.zip
would that work
Minecrafts code is obfuscated. Mojang provides obfuscation mappings that undos (maps) the obfuscation of method and fields
No
ok how would i do it
You'd run a local web server that can provide the file
and how do i use that?
?nms
thats annoying since i want to possibly upload the plugin
most users dont know how to do that
You can include a simple web server in your plugin
yes ofc
move it to the top-level or put it into a companion object
no in mapping
?
or the nms is already mapping?
If you've followed the guide then the mappings are applied
does the url box in the server.properties support localhost
No you'd need the public address
127.0.0.1?
The client needs to know where to download the resource pack from
public static Map<UUID, Channel> channels = new HashMap<>();
private int count = 0;
Channel channel;
private Channel getChannel(Player player) {
try {
PlayerConnection connection = ((CraftPlayer) player).getHandle().c;
Field GetNetworkManager = PlayerConnection.class.getDeclaredField("h");
GetNetworkManager.setAccessible(true);
NetworkManager networkManager = (NetworkManager) GetNetworkManager.get(connection);
// Get the Channel object from the NetworkManager object
return networkManager.n;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public void inject(Player player) {
CraftPlayer craftPlayer = (CraftPlayer) player;
//Entity Player playerconnection, playerConnection network manager, Network manager channel
channel = getChannel(player);
channels.put(player.getUniqueId(), channel);
System.out.println(player.getDisplayName() + " Added to pipeline");
if (channel.pipeline().get("PacketInjector") != null) {
return;
}
channel.pipeline().addAfter("decoder", "PacketInjector", new MessageToMessageDecoder<PacketPlayInUseEntity>() {
@Override
protected void decode(ChannelHandlerContext channel, PacketPlayInUseEntity packet, List<Object> arg) throws Exception {
arg.add(packet);
readPacket(player, packet);
}
});
}
this is the code for inject do i use mapping?
so people would have to enable port forwarding to even use it
So you're not using the mappings
?nms
import net.minecraft.network.NetworkManager;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.PacketPlayInUseEntity;
import net.minecraft.server.network.PlayerConnection;
how?
?nms
oh
._.
😅
I had to send you that 4 times for you to read it
This is why I sigh every time someone tries to make NPCs
It always happens that they ignore advice
no i thought its just a another meaningless message of a bot
i didnt read the message
you are right
How do i use a config path in a switch statement?
Im trying to make a kit plugin with 3 ranks, so if you have add to 1 you will see 1 when you use /kit and if you have 2 you will see 2 and so on..
But i want to make so the ranks name can be changed in the config
So why do you need to switch
i though i could switch it because i dont know how i should do it in 'if' statements becuase i think it is going to send the message 3 times if you have alle 3 ranks
That doesn't have to be the case
I mean how do i make this on a smarter way?
if(player.hasPermission(Kits.plugin.getConfig().getString("Vist"))){
}
if(player.hasPermission(Kits.plugin.getConfig().getString("Vista"))){
}
if(player.hasPermission(Kits.plugin.getConfig().getString("Vist+"))){
}
New name same old icon ig
Sorry but i dont understand how to make objects
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
there is a tutorial for Gradle and not maven?
There are unofficial plugins for Gradle
in gradle I' musing io.github.patrick.remapper, see here for example https://github.com/mfnalex/cesspool/blob/master/nms/versions/v1.20.1/build.gradle.kts#L3
Did you run BuildTools
*with --remapped flag
code:
plugins {
id 'java'
id("io.github.patrick.remapper") version "1.4.0"
}
group = 'me'
version = '1.0'
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
mavenCentral()
}
tasks {
remap {
version.set("1.20.4")
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT:remapped-mojang'
compileOnly 'org.spigotmc
1.20.4-R0.1-SNAPSHOT:remapped-mojang'
implementation files('D:/Projects Files/Plugins/IdeaProjects/Essential/build/libs/Essential-1.12.jar')
}
and i run the task for remap and i have an error:
Unsupported class file major version 65
my JDK is the problem?
Looks like somethings written in Java 21
?
other version of JDK
if you're depending on something written in Java 21 you need a JDK that understands Java 21
so yes
oh and try not to use file dependencies like that
If you only have a jar then install it in to your local maven repo
set your source and target compatibility version to a lower version, like here https://github.com/mfnalex/cesspool/blob/master/buildSrc/src/main/kotlin/cesspool-java-conventions.gradle.kts#L41
^ if you don't plan on using modern Java features
or set it to 17 if you want to be on the same version as 1.20.4
still the same error
then ?paste the full gradle log pls
oof i HATE NPC
idk
could I theoretically proxy networking so that I can run the main-server on one server but somehow send chunks from another server so that the main-server does not need the bandwidth to upload chunks to the players?
i think i did it. how can i know if its mapped? how do i write the code now?
net.minecraft.world.entity.monster.Zombie dummy = null;
compile, open with decompiler. If it's remapped, it should say net.minecraft.world.entity.monster.EntityZombie in the decompiled code
this explains how to find out the "new" method and class names
niceee
ok i will try now to create the NPC
wait so EntityPlayer doesnt exist now and i dont find the map of it
ServerPlayer
did you read my blog post?
because this tells you the name. just do it like explained in the blog post
quilt hashed mappings wtf
i searched like that and it didnt find EntityPlayer
did you set the search filter to "Spigot"?
oh now i see that thanks
np
the task of remap still doesnt work
Unsupported class file major version 65
and i use now JDK 11
def targetJavaVersion = 11
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
Use JDK 21
i used that before
or remove the library requiring it
ok so i made the item but do you know where i can find the id that i would put here
That’s ehm not rly valid
u either go with src compatibility and target compatibility or the toolchain
Idr even if you can use both, but iirc it should give errors
nvm its working the compile but now i have problem when i run it in my server it says it doesnt find ServerPlayer did i forgot something?
That happens when the remapper isn't working
and what could be the problem?
How can I cancel messages with bungeecord without getting kicked after sending a new message after
something in the compiler?
nvm i see now the remap still have the same error and im using JDK 21
Did you set this to 21
yes
def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
What Gradle version?
8.5
still, pretty sure you just go with the toolchain?
what is that?
Toolchain is less than ideal
Yeah but the other target compatibility and source compatibility is deprecated afaik
plugins {
id 'java'
id("io.github.patrick.remapper") version("1.4.0")
}
group = 'me'
version = '1.0'
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url = 'https://oss.sonatype.org/content/repositories/central' }
mavenLocal()
mavenCentral()
}
tasks {
remap {
version.set("1.20.4")
}
}
dependencies {
compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc
1.20.4-R0.1-SNAPSHOT:remapped-mojang'
implementation files('D:/Projects Files/Plugins/IdeaProjects/Essential/build/libs/Essential-1.12.jar')
}
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 {
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
}
}
and using both def isn’t the intention behind the design
this is the full code
Guess that's another reason to stick with maven
well whats wrong with toolchain?
It forces the compiler to use a certain Java version
Which means you can't depend on Spigot nms with a Java 8 plugin
I mean I’m pretty sure you can with some fiddling around the toolchain
there is something wrong?
Yeah actually looking at it again
You didn't follow the instructions of the remapping plugin
i will see again
For instance olivo, its possible to set the compiler on certain tasks if you need to override it (like specify java version etc)
hm? could you send the docs for that
Make sure you run the remap task or make build depend on it
ignore me then ig
i dont understand what did i miss
i add the remap
i build the buildtools with remap
I don't see how to use Java 17 JDK and compile with Java 8 target?
i did like him
Gradle always breaks for me so idk
java.toolchain.languageVersion.set(… 17 )
someCompilerTask {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
}
According to docs
Wouldn't that force it to use Java 8 JDK for compiling
Yeah they deprecate and change their api so quickly through all the versions
Isn’t that what u wanted?
which would break it depending on a Java 17 lib
Needs to be a Java 17 JDK so it can reference the lib correctly
if you shade that lib, then I’d assume maybe
Do you guys think logging left and right clicks in a database (including the player's held item) is gonna take up lots of storage? The reason is CoreProtect logs a lot of stuff, but it doesnt log everything. I plan on making a plugin that logs things that coreprotect doesnt.
I mean you have compile time dependence and runtime dependence
Which both break differently depending on what u do wrongly
Yeah the compiler doesn't like you referencing a class written in a newer java version
Isn’t the ABI conserved?
ABI?
Application binary interface, yk the binary compatibility
Cuz I know I’ve been doing fine with compiling down to lower versions while depending on libs with higher java versions
So it should be possible, well unless gradle broke recently
same im unsure
With a JDK higher or equal to the lib that's fine
I could see this happening if you shade the lib
Maybe its possible to manage with for instance shadowJar (tho in their case they don’t really have a use for shadowJar presumably)

Gradle is gradle after all 🥲

If some were smart they would do a runtime compile
Yeah but maybe gradle or whatever thing on gradle fallbacks on the other option :>
Well runtime compiling is something you have to implement yourself. Not sure if newer jdk versions have this yet
Basically you keep the sources that are version dependent in a separate jar or archive and compile at runtime for the version being used
Since jre and jdk are no longer separate this is more doable then previously
In the "aliases" part of my command in my plugin.yml do I need to include the /?
no
public void onEnable() {
getLogger().info("A");
}``` Is this correct?
or do I need to use getPlugin().getLogger() instead?
That’s fine
?paste
https://paste.md-5.net/aqehomutuw.sql because this error?
ok and if I want to use it in an external class? I cant seem to be able to use it in a static context
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Beacuse dont resolve dependencies?
i have resolved
whats the difference between these two?
the message you send
null
ah so not counting the message its the same?
this. is like a getInstance
yes
epic
yeah
I understand now
does anyone have any idea why the item changes after a rejoin?
i use this itembuilder: "dev.triumphteam:triumph-gui:3.1.2"
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Is there an event for when a player throws an ender pearl?
ProjectileLaunchEvent
And how could I determine if it was an ender pearl? I see there is a getEntity but is this for the player who launched it or the projectile itself?
