#help-development
1 messages Β· Page 1071 of 1
dont give goooler ideas
my favorite part of the jar shadowing process is when knuckles realizes sonic is pregnant with his child
now it compiles, thanks
5:34:32 PM: Executing ':shadowJar'...
Task :compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Task :processResources UP-TO-DATE
Task :classes
Task :shadowJar
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
INFO: Shadow cheated on Sonic with Knuckles.
BUILD SUCCESSFUL in 21s
3 actionable tasks: 2 executed, 1 up-to-date
5:34:54 PM: Execution finished ':shadowJar'.
anyone remember off the top of their dome what java version was required to run mc 1.19?
I want to say 17? Or was that for older versions
1.18 and 1.19 use java 17
sounds about right thanks
INFO: Shadow cheated on Sonic with Knuckles.
π€¨
ah damn I hate it when that happens
run gradle knows
must be a weird plugin I'm using on gradle
john is a bit silly
bump ^
wtf
yeah gradle is weird
I am pretty sure spigot has a sample gradle project, potentially even lower down in that page
You need to use a 3rd party gradle plugin
Is there one existing?
how i create WorldMap object in coordinates without players click on map. basically i want to create some maps when the server turns on
So I'm using a multi-module Gradle project
How can I make it so that it'll use the remapped jar instead of normal builded jar?
Or does it use the remapped jar by default?
Specify remapped
This
Remapping from remapped-mojang to remapped-obf
What is the new version of ChatColor.translateAlternateColorCodes?
how could I execute a function every 20 ticks?
nothing?
oh so now i can send directly the message with the color format done?
I mean
if you use text components sure
but I think you misunderstand that method you speak of though
Yea idk what you mean with "new". What is wrong with the current method
translate alternate color codes just allows you to specify what is the character to indicate the start of a color code instead of it being MC default character
since its not a character easily found on a keyboard. Handy when you are dealing with config files for example
I want to use the normal & char to color my text. What should i do?
I guess you don't read
I knew this one but it says that ChatColor is deprecated
so I have no interest in further helping those that are illiterate
sorry I didn't read that message. I will search how to use text components
deprecated does not mean it cannot be used
its not deprecated
its deprecated in paper
paper might have it deprecated but spigot does not
but you are in spigot server
therefore there is nothing they need to change
ChatColor.translateAlternateColorCodes if you want to use &
Ok, thanks you all. Sorry if I bothered you.πββοΈ
does anyone know how to execute a method every 20 ticks?
?scheduling
I've tried
Bukkit.getScheduler().runTaskTimer(this, this::load, 0L, 20L);
(load is my method) but it seems to mess with command blocks
or is it because load is taking a lot to compute?
?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.
public void load() {
Lmanager.diminuirTodos();
Map<UUID, GUI> map = guiManager.getMap();
for (UUID key : map.keySet() ) {
Player player = Bukkit.getPlayer(key);
assert player != null;
if (player.getOpenInventory().getTopInventory() == guiManager.getMap().get(key).getInv()) {
guiManager.update(player);
}
}
}
public void update(Player player) {
UUID uuid = player.getUniqueId();
GUI temp = map.get(uuid);
if (player.getOpenInventory().getTopInventory() != temp.getInv()) return;
int page = temp.getPage();
int sort = temp.getSort();
map.replace(uuid, new GUI(player, page, sort));
player.openInventory( map.get(uuid).getInv() );
}
public void diminuirTodos() {
leiloes.forEach(Leilao::diminuir);
leiloes.forEach(leilao -> {if (leilao.getDuration() < 0) {leilao.finalizar();}});
leiloes.removeIf(leilao -> (leilao.getDuration() < 0));
}
private Map<UUID, GUI> map = new HashMap<UUID, GUI>();
ChatGPT code by the looks
no, but a lot of people helped on doing it
and part of it is in portuguese (my language)
don;t use assert for live code
why are you updating an inventory for every player every second?
because the items of the inventory change
player.getOpenInventory() will always return an Inventory instance, even after they close an innventory
it will be their own inventory if they don't have one open
and the items are get from Lmanager's leiloes
are you creating new items every time you call Lmanager?
I've added == guiManager.getMap().get(key).getInv() to check if the inv is the GUI
wont this be null if the player inventory is used? player.getOpenInventory().getTopInventory()
I just create a new GUI when the contents of Lmanagers change
then it will return false when checked with == guiManager.getMap().get(key).getInv(), wouldn't it?
yeah I guess haha
yes
my bad
I guess there's prob a better way to do it
but what I'm trying to do is, call update() for every player that has the GUI open
and do that every 20 ticks
the items on that GUI are visual, the real ones are stored in Lmanager's leiloes
leiloes is an ArrayList of Leilao
Leilao stores price, duration, bid and owner
auction
and what is the issue again?
and every time the price, bid, or duration changes, it should affect for the items on the GUI, that should display the new time and all
using:```java
Bukkit.getScheduler().runTaskTimer(this, this::load, 0L, 20L);
load is responsible for updating the values on Lmanager, and calling update for all the gui's
where do you call this
I've put this on onEnable
and load() is on main too
here is load's code
ok first, don;t compare every player to every inventory
your key is the players UUID, so just get the player from teh UUID, get the inventory (Map value) and see if it is the player current open inventory
This is my attempt to make player glow with colors but the glow is just white even tho I set the team color to blue or something, what went wrong?
public static void setGlow(Player player, ChatColor color) {
// Get the team and set the color first
Team team = find(player);
team.setColor(color);
// Set the player to glowing
player.setGlowing(true);
// Set player to glow
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 0, false, false, false));
}
oh ignore me. I'nm not reading yrou code correctly
is there a way to remove UUID from the map once the inventory got closed?
yes, remove it on teh inventory close event
does it handle leaving from the game, dying and all?
i'd test and account for these situations, especially leaving the game
How can I get the craftbukkit version regex?
this
cuz on newer versions they removed it
paper moment
and there's always an issue whenever I try to get it
use Bukkit.get some version and map it
1.20.1-R0.1-SNAPSHOT is what Bukkit.getBukkitVersion returns for example
But I'm not sure what R1 is
In CVN we use this
/**
* Returns the old CraftBukkit location, no longer here after <b>Paper</b> 1.20.5
* @return Something like v1_20_R3 or null if it is not relocated
*/
public static @Nullable String getCBOldNotation(CVN plugin) {
if(isNewCBPackages(plugin)) return null;
String craftBukkitPackage = Bukkit.getServer().getClass().getPackage().getName();
try {
return craftBukkitPackage.substring(craftBukkitPackage.lastIndexOf('.') + 1);
} catch (IndexOutOfBoundsException e) {
return null;
}
}```
why have 2 different methods
Changes when the API changes on a patch version iirc
Bukkit.get some version existsed for ages so you just map it for all versions
mojang thing, basically changes when protocol compact changes
Btw that was written by @cinder abyss blame him
create a spawner item stack and use block state meta probably
does the noteblock physics update happen clientside? cancelling BlockPhysicsEvent seems to flash the noteblock for a tick
can someone help me i bought plugin
but its not for 1.21 only for 1.20.4 and idk when itll get update
cant i somehow update it myself
Player player = (Player) event.getWhoClicked();
Location x = plugin.getConfig().getLocation("location.test1.x");
Location y = plugin.getConfig().getLocation("location.test1.y");
Location z = plugin.getConfig().getLocation("location.test1.z");
Location location = new Location(player.getWorld(), x, y, z);
What im doing wrong?
those are doubles
so i need convert to doubles? in config.yml
prepare for trouble and make it double
config.set("path", Location);
location:
test1:
x: 10
y: 1000
z: 10
test2:
x: 1000
y: 10
z: 1000
```\
Oh
config.getLocation("path");
so i need to create location and then set the x y z from config?
ofc you can also do it yourelf if you don't need to save the world and pitch and yaw
ok i will try now thanks
How do you translate Hex codes(example: TCFB)?
private static final Pattern pattern = Pattern.compile("#[a-fA-F0-9]{6}");
public static String translate(String message) {
Matcher matcher = pattern.matcher(message);
while (matcher.find()) {
String hexCode = message.substring(matcher.start(), matcher.end());
String replaceSharp = hexCode.replace('#', 'x');
char[] ch = replaceSharp.toCharArray();
StringBuilder builder = new StringBuilder();
for (char c : ch) {
builder.append("&").append(c);
}
message = message.replace(hexCode, builder.toString());
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message);
}
ty
Not necessarily
hey guys I'm new here, one question do yall think it would be possible to make a plugin with the same idea this mod has, and if so it would probably be using packets which ones https://www.curseforge.com/minecraft/mc-mods/gravitychanger
@granite night
oh wow
I think I just used an abstract class correctly for the first time ever
they're pretty cool actually
I approve
neat, now I can do this for hundreds of these files
No key layers in MapLike[{}] pops up on my custom world loading
what is it caused by?
it won't work because it static
unless.. you init it for no reason
to load the static values
:D
which is incredibly cursed
mad hatters gonna hat
why am i in the world "world" when registering first time? at the second time i'm in register world, but for the first?????
code
lang is null so its being teleported to home.LappyTon not locations.register
or well other way round
whats the best performant way to check when a player has walked into a area and also exited?
home.Lappy is just login world.
Which also uses playermoveevent iirc
im not using worldguard
Player move event , but I think worldguard uses some sort of spanning tree to optimise getting area
first of all server checks if player have picked language, then password, so home.LappyTon basically dont make any usage
I still teleport to the "world" world
damnn this bug is so annoying
i dont use wg so ill try that
Hey. I'm sending a player remove packet, and when I go far away from the player that I removed and come back, I don't see that player anymore. For this, I listen to add entity packet, add the player again, then remove it. But the issue is if I do that, although I see the player, their skin is reset to one of the default skins instead of their previous skin. How can I fix it?
This is how I do it
Why are u using packets instead of Player#hideEntity
Because I don't want to completely hide the player
I just want to remove them from tab list
Since UPDATE_LISTED doesn't exist in old versions like 1.18.2 I have to do it like this
Here is the video of the situation: https://streamable.com/kczpk9
By the way, Steve is the custom skin I set here
And the other skin that appears when the player becomes visible to my test account is one of the default skins which I never wanted to use or specified in my code
Any ideas on what am I doing wrong?
where is the best place I can host my pack for free for the longest time
so I can use it in my server
host ur own http server
github
Host it urself
start paying me
???
exactly
I mean, setting up a lighttpd server or similar isn't witchcraft
You'll probably need to do it one day or the other anyways
This domain may be for sale!
nvm
kekw
why do you want to use plib
it sucks
i dont want to
but like 5 plugins i use
need it
or they dont work
and these 5 plugins are very essential to me
The latest dev build should work
jenkins
k
Sure
For instance, does this seem good?
If scheduling inside a running task you need to add +1 to the delay or it runs on the same tick.
So the delays would go up like 1, 2, 3 for each task in chain?
2,3,4
if you do 1 inside a running task it gets added to teh end of the queue and runs at teh end of the tick
Got it
Also the issue is if I do it like this it works, even if it runs in the same tick
But if I run all of them in the same task it doesn't work
yes it will work, but your first task runs in teh same tick as teh outer task
im new to java, can someone help me compile this code in eclipse?
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
// Define your spawn location and radius
Location spawnLoc = new Location(Bukkit.getWorld("world"), 14, 78, -22);
double spawnRadius = 700.0;
// Register the event listener
getServer().getPluginManager().registerEvents(new SpawnProtection(spawnLoc, spawnRadius), this);
}
}
packets

yo, can you remake that for a 32-bit integer?
well I guess I can just use it as is
but have you tested the performance of it compared to a normal concurrent hash map?
Well using the same algo means supporting 30-bit ints at most
mmm I guess I'll just go with this one
to me it just looks like
funky magic
that's just a spin loop
so you mean that it's much faster?
it's a NOP by default, but otherwise it will tell the scheduler "hey, I'm blocking - you can swap the currently active thread"
uh
The while ((ctrl = this.ctrl) < 0) loop basically waits until a resizing operation has completed. After that it will try to increase the amount of threads currently accessing the bucket
how does that work exactly?
I don't know but it's basically meant to stop a thread consuming too much CPU time in low-core systems even though it's blocking on other threads that aren't currently running.
wtf are those words
On systems with a lot of cores you can just use a generic NOP though. To be honest that line was a bit of a premature optimization from mine
if it made it faster
it's good
it's not some premature ejaculation
nor optimization
it's just good
I trust JIT to do it's job there. If JIT deems it to be superfluous then it can turn it in a NOP, otherwise it'll do a syscall to the OS which might not be exactly free
However benchmarking asynchronous resizing operations isn't exactly the easiest thing in the world
what's NOP tho?
no-operation - i.e. nothing
but how does that work?
swapping the currently active thread?
Threads β cores
Sometimes multiple threads are on a single core
So a single core has to do the work of multiple threads
I don't want to go through the messy details of java threads versus OS threads versus CPU threads
That tells the cpu that its doing nothing
So you can probably switch to another thread
how does that work tho?
I was wondering if anyone has had any problems with Inventory events for 1.21? It seems like they are completely broken. I've tested my entire codebase with 1.20 and everything works fine, but as soon as I depend on spigot-api:1.21-R0.1-SNAPSHOT this part of code breaks.
Even running something simple to test throws an exception:
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
System.out.println(event.getView().getTitle());
}
Error:
java.lang.IncompatibleClassChangeError: Found class org.bukkit.inventory.InventoryView, but interface was expected
at [REDACTED].onInventoryClose(InventoryEvents.java:126) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor8.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-794]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:624) ~[patched_1.16.5.jar:git-Paper-794]
at org.bukkit.craftbukkit.v1_16_R3.event.CraftEventFactory.handleInventoryCloseEvent(CraftEventFactory.java:1470) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerConnection.handleContainerClose(PlayerConnection.java:2483) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:2476) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PacketPlayInCloseWindow.a(PacketPlayInCloseWindow.java:20) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PacketPlayInCloseWindow.a(PacketPlayInCloseWindow.java:7) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:35) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1271) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1264) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.sleepForTick(MinecraftServer.java:1225) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1139) ~[patched_1.16.5.jar:git-Paper-794]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:291) ~[patched_1.16.5.jar:git-Paper-794]
at java.lang.Thread.run(Thread.java:831) [?:?]
Any suggestions? Or this is a genuine bug in the Spigot API?
Os magic
Thread#yield probably (albeit indirectly) sends a signal to the CPU to tell it to switch contexts.
sounds like your trying to extend inventory view
or implement it
I'm asking surface level
redacting the package name
See geol
my boy either works at hypixel or he thinks he's a spy agent
the exact error is your api version is 1.21 so you have an interface inventory view but your on 1.16.5
a) update b) dont extend/implement inventory view
It likely won't be much different compared to how try-catch blocks work (or other signals such as SIGKILL, etc.)
The plugin supports 1.16 - 1.20 fine. But implementing 1.21 seems to be troublesome
I implement Listener specifically. Has there been a major change in 1.21 that I'm not aware of?
do you use nms
You need to compile for the lowest version you support
Compiling for higher versions means it uses INVOKEINTERFACE instead of INVOKEVIRTUAL, which older versions of spigot will be super confused about.
For testing or for dependencies?
while (blah)
Thread.onSpinWait();
:3
do you phsyically interact with nms in the project
Hmm I see. So you'd suggest splitting the plugin into two, one for 1.16-1.20 and one for 1.21+?
Nope
Nothing uses nms imports. Everything relies on the Spigot API
That's the other thing I've been thinking about. Ultimately I lack the knowledge of these low-level specifics to know what is the better approach, although onSpinWait will probably be a bit more appropriate for spin wait loops :p
use the 1.16.5 spigot api and you dont have to interact with anything else
spigot is designed to be forward compat so you just have to write the plugin to the lowest version you support and bukkit handles the rest
what the hell is that
In most cases, no.
Hmm I see. So just change my dependency to use 1.16.5, and it will handle the rest?
yeah
kk I'll give that a try
yeahh I don't know either, I'm more weary of using yield and oSW lol, although it's not like I use those often either so, touche
A different kind of Thread#yield() which has a different connotation (while Thread#yield() is a definitive demand to yield the process time to another thread, onSpinWait is a bit more subtle)
but also, like, if you're doing spin wait loops, it sounds like you could/should be using conditions or some other locking & signaling mechanism
latches or phasers or what have you
but sometimes it's cheaper to not do that
these could even be cached for max performance
Neither are things I have ever used beforehand
Ok cool that seems to work! Thanks for the help
what being cached?
the big negation
~INT_62_BITS will get inlined by javac - no point in caching that
right?
ah okay
Must have been related to what geol mentioned with how higher versions handle invoking during build
from how I'm looking at it
this class seems to be some extra super fine optimized stuff
the resizing not being possible is a bit trouble but not something I can't manage
It resizes the buckets themselves, just not the amount of buckets as that would mean locking and rehasing the entire datastructure which would also mean more spin wait loops and thus quite a bit more performance waste if one already can anticipate the size of the collection
so it does support holding more elements than defined at construction time?
that's why I preallocate my hash maps with Integer.MAX_VALUE πͺπͺ
Yeah, read the javadocs - it documents some extremely important quirks with this structure
And shrinking the datastructure is pure stupidity (not even ConcurrentHashMap does that from what I know)
https://stianloader.org/jd/org.stianloader/stianloader-concurrent/0.1.0-a20240212/org/stianloader/concurrent/ConcurrentInt62Set.html being the javadocs if you prefer reading them that way
I was planning on holding like 1 << 20 buckets
that's a lot of buckets
I'm reading them rn
it's how much elements I expect
would that have any performance impacts?
like gc constantly checking for reachability of each of these
Well the iteration time would be absolutely wreck for one
generally speaking, I don't worry about the gc, more often than not they do far better work than you think they do
in the int62 class?
okay
trust em
Yeah, it's iterator would need to go through 16 Million longs if nothing is resized
worry not
I'm not iterating
just add, remove & contains
also not 16 mil
it's 1 mil
It stores no less than 16 elements iirc
each bucket?
The size of each bucket increases exponentially in factors of two with a starting size of 16 elements
damn
mmm
I see
isn't that
134 MB
of RAM
nice
Also just as a quick test before you use this datastructure: What is the most important quirk of this structure? That is, with which inputs would the performance of this structure be reduced to a minimum?
12
I probably should be bolding that line too - perhaps even have it be present in there more than once because I'm quite sure I made that mistake in one of my applications, too
Oh yep, I absolutely do.
How the fuck is it still faster than a synchronized LongOpenHashSet? I urgently need to redo my benchmarks there
I'm
Correct.
yeah but
does this just mean
that storing 30-bit
or lesser-bit numbers is more beneficial somehow?
You're surprised that your data structure is faster that an externally synced longopenhashset?
Oh, I didn't read the fine-print correctly. Good thing we have self-explanatory source code.
does anyone know how to get a vector direction based on the pose rotation of a armor stand pose?
Example:
pitch, yaw, roll
Vector3f pose = armorStand#setHeadPose(45, 90, 20);
pose -> vector direction
oh you want to do the reverse?
no idea
It means that if you have 16 buckets for example (albeit rather extreme):
0x0000
0x0010
0x0020
β¦
0xFFF0
all get stored in the same bucket (see https://github.com/stianloader/stianloader-concurrent/blob/main/src/main/java/org/stianloader/concurrent/ConcurrentInt62Set.java#L71-L73). So if you don't have enough entropy at the lower bits, all (or most) of your values could fall into the same bucket, resulting in the structure just being a fancy concurrent ArrayList
I mean I'll be saving pretty random 32-bit ints
each one will be unique
However, if your values are completely random (especially in the lower bits - though more bits will be used the more buckets you are making use of, so for 1 << 20 the 20 least significant bits are relevant) it's not too important
I might do 1 << 19 as that's still enough for me
i want get a vector direction from a armor stand body pose
/summon armor_stand ~ ~ ~ {Pose:{Head:[47f,37f,0f]}}
example
https://haselkern.com/Minecraft-ArmorStand/
Create poses for Minecraft armor stands in a breeze! Free, fast, open source.
I won't be using the most significant 32 bits
how does that sound to performance?
Probably good
aight ;]
this is how bukkit does it but without roll
what even is roll?
wait I guess I can imagine what it is
You should be doing more aviation :p
this wont work because it doesn't consider the z of the stand armor pose
Anyways, I'll sign off for the day. Cya tomorrow I guess?
cya
is using Dependency Injection recommended?
ive read through it but I still dont really get how DI works (dumb brain)
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Yes because that is how oop works or is done. However it does depend on the purpose of the class. Utility classes for example should not rely on outside objects and should be independent.
If the object is some kind of management object you probably dont want to use DI either
To put it simply, itβs just passing required classes (for instance main plugin class) through either the constructor or a method rather than getting it statically
when i have something that is always the same, for example the index of chest slots, should i store them in a final array or calculate them?
my case:
i want to know what slot indexes are in the first row of a chest (0-8). Should i just hardcode that or write a simple function calculating all these numbers?
I want to do double jump. But I couldn't code the double jump left, right and back except the front. vector etx. I added it but it didn't work, I added char to the W, A S and D keys and that didn't work either. Can anyone help?
what?
im not sure what u r doing, but you cant get user input like with a mod, when creating a spigot plugin
i want to double jump in every direction
easiest way would be just doing it with what way there looking
how can you look back and double jump backwards? Instead I want it to double jump while going backwards.
i tried hard but it didn't work :/
player.setVelocity(player.getVelocity().multiply(number of your choice));
u mean adding char right?
i wanna make a doublejump but work like this; when player clicking; w,a,s,d it will jump according to the keys you press
it won't matter where you look
ive sent the closest thing you can get to achieving that like 10 messages prior
.
can I get it up when it walks to the right or left?
no
behind?
well it'd be relative to what they're facing
so you could use trigonometry/linear algebra
aigt i will
Ideally youd have an immutable list
But something as simple as first row is fine to calculate
i thought of hard coding too, but then i remembered there are invs that have rows with 3 width
or some weird ones
like anvil
How would width and height work for an anvil?
anvil has height of 1 and width 3
I would just take inventory type
Because youd have to define the width and height of every inv anyway
alright, thanks
i need help with vaultapi
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
I made the integration of vaultapi in my plugin but when I start it, it does not find the plugin, I have maven configured, the plugin vault and essentials on the server.
when debugging I could only find this
[21:46:11 INFO]: [OnyxSpawners] Enabling OnyxSpawners v1.0-SNAPSHOT
[21:46:11 WARN]: [OnyxSpawners] An Economy service provider could not be found.
[21:46:11 ERROR]: [OnyxSpawners] Disabled due to no Vault dependency found!
[21:46:11 INFO]: [OnyxSpawners] Disabling OnyxSpawners v1.0-SNAPSHOT
which makes no sense because the plugins are loaded, vault as depend and essentials as softdepend so that it loads before my plugin.
?paste
Paste there please
What is your plugin set to load
if it tries to load before vault is registered, its going to cause issues
This is what my YML looked like for a Plugin using vault
Hello! can you not extend from entityType?
ah you right, just looked it up. thanks
np
What are you trying to achieve?
Making a simple pet plugin, just trying to modify data.
Why not just use an armorstand then
Extend the specific entity you want
please
srry
same thing :c
Do you have essentials on the server?
yep
then idk how to help ya
is there a way to add items to the inventory of a player that is currently offline?
how so?
Google invsee offline players
Might find a plugin that does it
Essentially loading up the players save file
You can use nbt api OR nms
is it wrong to have private final Core plugin = Core.getInstance(); in most things that i need to call my main class for?
I know a lot of people do private final Core plugin; and do public something(Core plugin) { this.plugin = plugin }
what is this reason to do the second way?
I've been programming for 4 years and still don't know
That's the reason I hate java
π
like all the open source plugins i saw uses the second method im just questioning myself
Half the code is design patterns and the other half is more design patterns to comply
Just use the first one
Works perfectly fine
Second way is proper oop. The first way should really only be used for utility classes, classes that need singleton or similar. When dealing with genericness or universal type setups.
In personal projects or super small plugins probably wont really matter which you use lol
ah ok
I want to make a schedule for the players, I want it to analyze their inventory all the time, what is the most βperformativeβ way to do this? Make a single scheduler and loop through all the players online or βattachβ a scheduler to each player?
one will be more performant
if you schedule multiple they're still gonna run synchronously in order so you're just adding more overhead between each iteration
not sure if this is just a minecraft thing or an argument im missing when spawning a particle, but how come when I spawn FLAME or SMALL_FLAME it just flies off in one direction as opposed to being stationary?
hello i am using magma to make a forge spigot server and i want to use the items for exampel a gun from the mod in my pluign
can any one pls help
how i can do so
Ask Magma
i thought you meant magmaguy and got confused lmfao
the website isnt loading up for me
i can only acces the blog
which i search but couldnt find anythign usefull
Hello,
I am using the spigot-1.19.4 api jar, but I cannot seem to find these imports:
import net.md_5.bungee.api.chat.TextComponent;
Anyone know if they have been removed? I know this is being pulled from bungee, so i'm assuming this has been removed?
I am upgrading from spigot-1.18 api jar to 1.19.4-api
is it alright to put everything into a Dependency Injector? or just the things that I will have to use alot of?
don't ask me
I have nothing to do with that
they stole my name, can you believe that
okay spigooters
thoughts on incremental ores?
im thinking of adding an enchant which breaks both layers
hmm
or maybe diamond+ pickaxes break both layers
that "current chat" widget looks exactly like mcci's lmao
yeah because i copied it

lmao
should really not show the block being broken
it would make more sense to tie is such that the block damage animation progresses far more slowly and the ore is slowly knocked out of the block as you mine it
its intended for an area where only the ores can be broken and once fulyl broken they turn into stone
then regenerate
so if players don't wait for them to fully regenerate, they get less overall coal
probably should've said that initially
my point still stands
I think it would look better without it getting removed for a tick
my plugin saves items when they in lava , cactus etc.
when i use my plugin on 1.20.4 with java 17 , i can see the items in lava or cactus
but when i use my plugin on 1.16.5 with java 11 or java 16 , yes plugin works, If I go to where the item is, it comes to my inventory
but i cant see the items. is this about java version or minecraft version
Player#openMerchant
without a villager actually existing
Yes, you can use that method.
that requires a villager / merchant object
You need to create a merchant and put the items.
Does Player#hidePlayer() remove player packets?
Yes
Use Bukkit#createMerchant
:0
there is no utility to do it with with a packet library so?
Likely the latter
if spigot allows you to do it, why use packets
for a vanish plugin, in some cases, it's better to use packets rather than hideplayer?
no..?
I see a lot of vanish plugin than use packets
hideplayer literally does what y'll do with packets
either bad plugins or was made before hidePlayer
hidePlayer literally limits teh packets sent
Bad plugins, hidePlayer is at least 10 years old
oh god
man I'm old
i didnt know it was that old
10 years really
didnt u say ur username was like 10 or 20 years old or something
does createMerchant spawn a merchant or just creates it
I remember when Magma first joined this discord
holy shit what
more like 12 years ago
Yeah February 2012
So 12.5 years
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffect.html#isInfinite()
mh, how to set a potion infinite? (there is no setter) pdc?
Is there smth like PDC for placed blocks?
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
That seems to be what I was looking for, ty!
pls help
- stop crossposting
- we are not magma
- that setup is 100% unsupported
- people have already told you we can't help you in spigot
What have you tried? What worked? What didn't?
do a /data on the item to see what meta it has
uh oh
I think I maybe have cooked a really spicy java meatball
reflections + shaded libraries
java ain't happy
What is the best way to code a command cooldown?
hashMap
is there any way to access the jdk.internal Unsafe class?
cuz this method isn't in the sun.misc Unsafe
why on earth do you need to allocate such an array?
just curious
I mean, if I override all of it's contents anyway
isn't this just a more performant way of doing so?
The JIT compiler exists and will assist you in that, there is no performance difference
Otherwise might as well use alloc + FFI
Especially the memory segment API might do what you intend to do here
nah, I just need a byte array
it's a fancy byte array
Plus everything will be inlined anyways as it's built for speed
Most likely because string concatenation is a process that isn't exactly linear and the compiler might struggle with it
I'd not be surprised to see it gone in a few years though
which more fast? switch with 100 cases or a map?
benchmark it
what would you do
time it
from what I researched map is O(1) and switch O(n)
switch isn't O(n), or atleast from what I know. If I recall correctly, switches use something similarly to a map, since all the values are already hardcoded.
switch is O(1), too
Switch should be faster as it does not make use of any buckets or similar (at least not directly) and thus does not need to distribute hashes evenly
However an enummap or similar will result in the same performance as a switch, if not even better performance
Most of the time you can just use if-statements, since the "compiler" will change them to switch statements if it can.
Switch statements just loop nicer often times if you are comparing enums imo
that's why my plugin is nothing but 7000 lines of nested if statements
Having that much trust in the JIT compiler is a bit dangerous, too lol
I'm having some issues with Player#setCooldown. Most items work but for some reason pearls dont and just ignore the cooldown
is there something special about them?
Well, when do you set the cooldown on them
on ProjectileLaunchEvent
Yea, I mean, ender pearls have thier own cooldown
so the server will apply a cooldown of 20 ticks after that event
so i wait a tick?
pretty much
AntiCooldown
when
what
Is there a way to make mobs can't see a player? (Invisibilty effect don't work, mobs see you)
EntityTargetLivingEntityEvent
it also work for zombie focus?
You can cancel it when the target is a player
whats the difference with EntityTargetEntityEvent?
there is no living entities?
doing support for over 6 hours straight, we love that
it's great because as soon as it's done I can go back to refactoring the core of all of my plugins, a truly blessed day
π
Which is preferred?```java
/**
-
command = new TestCommand().setCooldownDuration(Duration.ofSeconds(10));
*/
public class TestCommand extends CooldownCommand<TestCommand> {
@Override
protected TestCommand getThis() {
return this;
}@Override
protected boolean processCommand(CommandSender sender, Command cmd, String label, String[] args) {
return false;
}
}orjava
/** -
command = new TestCommand();
-
command.setCooldownDuration(Duration.ofSeconds(10));
*/
public class TestCommand extends CooldownCommand {
@Override
protected boolean processCommand(CommandSender sender, Command cmd, String label, String[] args) {
return false;
}
}```
i find A to be better since you can just do lots of chain calls with that
builder pattern my beloved
what is the better way to prevent ppl from decompile plugins ? like is there a way to prevent that ?
distribute your plugins in physical black boxes and rig them to blow up if decompiled
based
unless you have some ground breaking brand new technology theres not much point
Write terrible code so anyone that decompiles it has a heart attack
yes
lol i dont even need to try
coming next cloud hosted plugins
works 100% of the time
first are serverless minecraft servers
also can anyonne guide me to start learn how to make/add license keys on plugins ? i tried to search but to no avail (+8yrs ago videos).
those may run afoul of the spigot terms and conditions for premium plugins fyi
is your alias cmarco by any chance
i need clone an itemstack to call getInventory#addItem?
you don't
Is there a method to add an item to the inventory where the passed itemstack will be what is in the inventory?
@shadow night would know
adding backdoors is probably much easier than generating license keys πΏ
but the method adds an ItemStack to the inventory but if you take an itemstack in that same slot it will return another instance
I wanted it to return the same instance
it is just the same thing lol
i usually build bootleg API of brigadier but on bukkit api itself so i dont have to create manual processing myself
Although i havent done this before, but you can create this imo by:
- creating node.js/bun backend api server with express js or smth else (js frameworks are appearing day to day basis to account for that)
- creating spring boot web mvc backend api server
- creating php backend api server
the backend will check on HTTP POST request if license is valid (POST https://my-proprietary-plugin.com/api/license/check). it should return response (HTTP status 404 or 200) stating whether or not the license is valid. You can store validation keys in a database. This way you can further develop api further to revoke licenses, generate them, whatever you want.
from the plugin side it depends how proprietary you want it to be, you can use some advanced approaches which the plugin itself is not loaded by the plugin the maintainer provided to you, instead the plugin which was given to you downloads the real plugin from the same api, and loads it in memory only, thus if you want to pirate it, you need to dump its contents from memory, or reverse engineer the api which can be tricky.
or you can simply add some if statements that would disable the plugin if api check returned you a false response for a license. you do you.
from the plugin side it depends how proprietary you want it to be, you can use some advanced approaches which the plugin itself is not loaded by the plugin the maintainer provided to you, instead it downloads the plugin from the same api, and loads it in memory only, thus if you want to pirate it, you need to dump its contents from memory, or reverse engineer the api which can be tricky.
βοΈ I'm pretty sure this approach isn't available on spigotmc marketplace since it doesnt allow such DRM's (obfuscation only)
Making paid home plugin with this one
essentials, drm edition
costs an additional $40 on top of the regular price to maintain drm servers up
php π
js π
no rust mentioned smh
what's wrong with js
dude its just an api which returns HTTP response code
are you really willing to code os dependant binary executable just to run your web server which returns 404 or 200
that's a dumb question to be asking here
I've seen people do far more laborious things for much less gain
yes
need a sanity check, why would this be false
what's the code for the check
At some point of writing terrible code the compiler starts improving it
boundingBox.contains(player.location.toVector())
js is bad: proceeds to use vscode and discord client which is based on electron
hypocrisy
i don't use vscode kekw
Nobody here uses vscode
that status bar looks suspiciously like vscode's
that's fucking IJ
I've literally, unironically seen people abusing discord to use it for file hosting for their minecraft servers until they got spanked by discord
That's IJ dumbass
π
@shadow night opinions on this tho
what the fuck is thaz
allows me to use if (player in boundingBox) ...
weird shit
I have a fun question that I feel like may make me some enemies
go on
is there a way to listen for some event or packet being sent from a server regarding sending a resource pack and blocking that
client-side?
server-side
block other plugins from sending resource packs
PE probably does the job
ok I don't have much experience with that
think it would be cancellable or something akin to that?
π
I'm trying to change a player's skin on join but if I try to join while the server is opening the skin doesn't change although the game profile value changes
If I re-join it works
Here is the video of the situation: https://streamable.com/lbjxf4
im pretty sure you need to send some kind of funky packet in order to reload the skin
i dont remember which one
Possibly metadata packet?
not sure, try to look at skinsrestorer plugin source
maybe some kind of dimension packet
it basically fools client and it reloads the skin somehow
maybe my info is outdated now
but that's how iirc was done in 1.8 days
But the thing is it only happens when joining when server is opening
If I re-join after that it works
Hi, i made a fake player using EntityPlayer and player connection from CraftBukkit, now i have a problem, i don't know how to see if the player hits the fake player. This is because EntityDamageByEntity checks for damage and the fakePlayer isnt damagable, is there another way to see if the fakeplayer is hitted or to make the fakeplayer hittable?
By the way, the thing is it only happens if I send a player remove packet
Although I delay it it doesn't work
I delay it by 5 ticks
EntityPlayer bot = new EntityPlayer(((CraftServer) Bukkit.getServer()).getServer(), world, botProfile, new PlayerInteractManager(world)); way i made the bot
You need to listen to the packets on your own
i wouldnt suggest you create npc's like this
the classes are not designed for such functionality
use packet manipulation instead
unless you want the npc to tick
how i made it works, but i want it to make hittable
i want a way to see if a player hits it
also its is not a real "npc"
im pretty sure wiki.vg has a packet for hitting an entity
i mean, its not made for the purpose to be an npc
Interact packet is sent, you just have to get entity id
im not quite familiar with OBC so i cant really say for sure, but maybe is there a way to add damage from OBC itself
I got it
So, this can be solved with an entityinteract event?
its clientside
then use packets
then itβs not clientside
so it must be ticking, no?
It depends
^^
i should use other libs for that
what i dont like about this approach is that if player has the same name, server probably wouldnt allow for it to join if its ticking
playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, bot));
playerConnection.sendPacket(new PacketPlayOutNamedEntitySpawn(bot));
random name
you need to listen to interact packet
mh ok
tbh fake entities arent one size fits all solution, they're glitchy since they're not ticking, so if you unload the chunk or go to another dimension they they dissapear iirc
i'm using them for ac purpose
mk
Unsupported class file major version 64. maven give me this error but im using java 22.why?
what I can i do to make my command remove player's name from tablist
i used gpt it just makes my player disappear
what are you doing
also version 64 is java 20
not 22
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
idk make tjhis
packets
What's the most efficient way to execute a lot of tasks async? Let's say that even 3000 tasks per second to be scheduled
not waiting for anything, just purely executing on another thread
makes me question your design
I want my plugin to work on all versions from 1.8 to 1.21.
q1 : which java version should i select here
what kind of tasks
it depends on the nature of the tasks
q2: which minecraft version should i select here
8?
assuming mc 1.8 uses java 8
and which mc version should i select
i would just have modules per java version
i think i dont need to select 1.8
1.8 but supporting such a wide range is not easy
Runnable
lol
still doing so
downloading 3 GB file is a runnable, as is calculating the Fibonacci sequence
as is doing 2 + 3
mfw Runnable
ForkJoinTask 
basically
for example if i select java 11, 16,17 or 20 plugin won't work correctly in 1.8 . is it true
it will work but with a lot of issues
doing a few operations on a few maps
but it's on the netty threads
so I'm not sure whether it's best to just schedule it
(not on all packets tho)
analysis
of the connections of players
for bot attack detection
bro really doesn't like bots
if i want my plugin to work from 1.16.5 to 1.21 which java version should i use?
Why does NMS use Holders?
1.16.5 java
Whatever version 1.16.5 is
no idea, made me mad as well
online-mode=true is my favourite anti bot tool
what item meta do i need for a firework star? how do i create a firework star that has "small ball green"?
I need to replace a holder
but creating one is so much pain
this is precisely why I don't specify what I'm doing
like i dont even wanna replace the holder, just the thing it holds
lol
geol was right
I mean we were more so asking what the tasks have to do but sure lol
not all holders hold a value directly
.
FireworkMeta ?
but thats for firework rocket isnt it?
so the plugin works properly in Java versions above the Java version I have chosen, but it does not work properly in those below it. is it true?
yes
same with spigot
well bukkit
honestly, after talking here I think that making a thread for a few these might not be necessary
You code for the lowest version you plan to support
so same thing here version
yep
thanks.
In total there're like 6 concurrent hash map look-ups
(I meant a task)
Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
yow i fix
wrong java version
but i already compile this project with ajva 22
lemme just delete that
how o fix @tardy delta

I think I've already fixed it
cross posts in paper, does not read paper pings 
not is mine but i think i fixed
for some reason this error occurs if I use ArrayList.getFirst() instead of get(0) even when compiling with Java 22 (the IDE does not point out an error in the project, only this error when compiling)

probably not compiling with java 22, check java version in pom.xml/gradle thing
ArrayList#getFirst()?
sequenced collections!!!!!!
thing in newer versions
I forgot those existed now
yeah I definitely know what that is
.stream().findFirst()

iterator next
reversed
ah that
reversed is goated
reversed is truely goated

LGTM
LFG
changed all message logging logic, changed all configuration files
about to add some 50 classes or whatever since I'm removing cloudcommandframework and breaking up the commands
Speaking if looking good this magma guy
next step is to use kotlin
if
π
im in danger
Gonna die now
my condolences
have fun staying weak
agreed
I'll rack 300 on the leg press in your memory
you always lurking around?
Hope that is in kg 
of course
I'd do 400 but I've been on a cut for 6 months
That's a shit load of weight in kgs wtf
plus it's sets of 15
300 is fine β’οΈ
300 isn't that much
until you knee goes bye bye at a sport event
I was almost at 400 before I started cutting
Kekw wtf it's 5x my weight lo
wtf
it's 3x my bodyweight
well was
I'm down
originally I wanted to hit 450kg
but I'm definitely not doing that at 85kg and in sets of 15
I've never even done leg press I can't imagine I can do much more than my bodyweight
legs are your largest muscle
Given you probably are not dying when doing a weightless squat, you probably can lol
unless your knees are completely busted you probabably do more than bodyweight at some point in your day when getting up
My knees are beyond fucked up
cope and seethe, get better knees
I wish π let me play basketball again
Trust medicin, in 20 years we'll have cyberpunk knees
It's my tendons in my knees π
Damn I forget how small lbs are compared to kilograms
My squat is 135 but that's only 61kgs
magma gym shaming??
Well I do only weigh 58kgs and I'm short
Toxic community member spotted??
Lol
back in my day they called it pushing people to do better

I only really go to the gym once a month if I got daily my body starts to fall apart cuz of other stuff I got going on
6'1 90kg gym machine let's go