#help-development
1 messages · Page 1133 of 1
😂 lol same
Is it python that uses ** for exponents
Either that or Lua
WAIT
One of the two
IS THE CHOCO OF THE FORUM?
Yes
Ah, Lua has ^ for exponentials in its math library
CHOCO ARE U THIS ONE? https://www.spigotmc.org/threads/armorstand-look-player.210095/
Without the math lib, it doesn't have an exponential operator, ^ is bitwise
Yeah that's me
YOO
U DEV AT HYPIXEL? DAMN
Java has Math#pow(), it doesn't need an exponent operator lol
Really should be an int overload for that though
what does ungrateful mean? sorry i don't speak very good english
Really, a lot of Math functions need int overloads
Not feeling or exhibiting gratitude, thanks, or appreciation.
mfw I find myself using Mojang's Mth more often 
It is kinda crazy we're on Java 23 and we still don't have a Math#floor() that yields A FUCKING INTEGER
THAT'S THE WHOLE PURPOSE OF THE METHOD (╯°□°)╯︵ ┻━┻
Is the cast not good enough for you
NO 
are you throwing a fit?
Just use floating point numbers for everything
YES 
Problem solved
Denied.
Template who what’s
C++ templates in Java, but I'm kidding
Basically, "primitive generics" (extremely oversimplifying that)
I see
Yo choco
Waiting for the Vector API to get its 9th incubator in Java 24!
Is it possible maybe with packets, make cooldowns in items?
We have Player#setCooldown(Material, int)
but not per material
Yeah you can't do it per-item, but you can in 1.21.2
Well .2 is in snapshots so
They're adding something called "cooldown groups" which is what you'll want to use
oh damn cool
Moar components
I'm going to admit something, In the 10 years ive been on minecraft, ive never logged into hypixel
imma guess
u no premium?
or u lying
Premium for 10 years.
hm
just never logged into it 🤷♂️
arkallic now
Yeah i dont remember that
but ya loggd in ¯_(ツ)_/¯
public Location location(Player player, String warpName) {
File warpFile = new File(warpDirectory, warpName + ".yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(warpFile);
String worldName = config.getString( "warps." + warpName + ".world");
Double x = config.getDouble( "warps." + warpName + ".x");
Double y = config.getDouble("warps." + warpName + ".y");
Double z = config.getDouble("warps." + warpName + ".z");
float yaw = (float) config.getDouble( "warps." + warpName + ".yaw");
float pitch = (float) config.getDouble( "warps." + warpName + ".pitch");
World world = Bukkit.getWorld(worldName);
return new Location(world,x,y,z,yaw,pitch);
}``` If im retrieving world name like this why would I be getting a null error?
Try.
public void onClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (player.hasMetadata("WarpGuiOpened")) {
event.setCancelled(true);
}
ItemStack clickedItem = event.getCurrentItem();
String warpName = clickedItem.getItemMeta().getItemName();
if (event.getCurrentItem().hasItemMeta()) {
if (!event.getCurrentItem().getItemMeta().getItemName().equalsIgnoreCase("")) {
player.teleport(location(player, warpName));
player.sendMessage("Attempted tp");
player.closeInventory();
} else {
player.sendMessage("Not detecting name");
}
}else {
player.sendMessage("No meta data found in clicked item");
}
}``` This is how im getting the warpname
Try it
I havnt really used the try function. I know i can print the ex but what would i try?? Would i try the whole location method? this is what i have for listener it may be the 2nd set of code
or would i try both the lines that are giving me the error
hmmf, can anybody spot the problem?
public ItemStack getIcon(Task task) {
ItemStack itemStack = new ItemStack(Objects.requireNonNull(Material.matchMaterial(task.getIcon())));
ItemMeta itemMeta = itemStack.getItemMeta();
for (TaskRewards taskRewards : task.getRewards()) {
itemMeta.setDisplayName(color("&e" + task.getName().replace("_", " ")));
lore.add(color("&7" + task.getDescription()));
lore.add(color("&aRewards:"));
lore.add(color("&7" + taskRewards.itemStack().getType().name()));
if (task.isRepeatable()) {
lore.add(color("&4NOT REPEATABLE"));
} else {
lore.add(color("&2REPEATABLE"));
}
lore.add(" ");
lore.add(color("&cLeft-click to start task!"));
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
}
return itemStack;
}```
What's the issue?
its not applying the meta
I think you're doing this wrong. Your item name and lore are being set on the item multiple times
public ItemStack getIcon(Task task) {
ItemStack itemStack = new ItemStack(Objects.requireNonNull(Material.matchMaterial(task.getIcon())));
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(color("&e" + task.getName().replace("_", " ")));
List<String> lore = new ArrayList<>();
lore.add(color("&7" + task.getDescription());
lore.add(color("&aRewards:"));
for (TaskRewards taskRewards : task.getRewards()) {
lore.add(color("&7" + taskRewards.itemStack().getType().name()));
if (task.isRepeatable()) {
lore.add(color("&4NOT REPEATABLE"));
} else {
lore.add(color("&2REPEATABLE"));
}
}
lore.add("");
lore.add(color("&cLeft-click to start task!"));
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
return itemStack;
}
Isn't this more what you want?
@EventHandler
public void onClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if (player.hasMetadata("WarpGuiOpened")) {
event.setCancelled(true);
}
ItemStack clickedItem = event.getCurrentItem();
String warpName = clickedItem.getItemMeta().getItemName();
if (event.getCurrentItem().hasItemMeta()) {
if (!event.getCurrentItem().getItemMeta().getItemName().equalsIgnoreCase("")) {
try {
player.teleport(location(player, warpName));
} catch (Exception e) {
e.printStackTrace();
}
player.sendMessage("Attempted tp");
player.closeInventory();
} else {
player.sendMessage("Not detecting name");
}
}else {
player.sendMessage("No meta data found in clicked item");
}
}
public Location location(Player player, String warpName) {
File warpFile = new File(warpDirectory, warpName + ".yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(warpFile);
String worldName = config.getString( "warps." + warpName + ".world");
Double x = config.getDouble( "warps." + warpName + ".x");
Double y = config.getDouble("warps." + warpName + ".y");
Double z = config.getDouble("warps." + warpName + ".z");
float yaw = (float) config.getDouble( "warps." + warpName + ".yaw");
float pitch = (float) config.getDouble( "warps." + warpName + ".pitch");
try {
World world = Bukkit.getWorld(worldName);
return new Location(world,x,y,z,yaw,pitch);
} catch (Exception e) {
e.printStackTrace();
player.sendMessage("error");
}
return null;
}
Does anyone know why I would be getting null for world. I get the error message sent when trying to warp
The world you have specified at warps.<warp>.world mustn't exist
I didn't even think of the loop 🤦♂️ just kept writing inside it like a dummy, Thank you.
I think you're probably looking for getDisplayName() though, not getItemName()
That's probably your mistake
File warpFile = new File(warpDirectoy, warpName + ".yml");
FileConfiguration config = YamlConfiguration.loadConfiguration(warpFile);
String path = "warps." + warpName;
config.set(path + ".world", location.getWorld().getName());
config.set(path + ".x", location.getX());
config.set(path + ".y", location.getY());
config.set(path + ".z", location.getZ());
config.set(path + ".yaw", location.getYaw());
config.set(path + ".pitch", location.getPitch());
config.set(path + ".admin", admin);
I just made the warp and this is how I got the world initially
I'm like 90% confident this is your issue
alright im fixing everything from item to display
I tried switching everything to set/getdisplayname and it still doesnt work
Basic java question: how is it possible for SQLite to throw a org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked) error? Isn't QueryTimeout normally set to infinite? Should it actually cause your thread to hang if it got locked?
I must sound stupid
but if anyone knows
i would greatly appreciate
😄
Well the best thing you can do is to start printing out some strings to your console (or to your player) and see if you can figure out exactly what you're pulling data from
You should be closing any connection you open. It's likely you left open a connection
Especially with SQLite because it only allows one read/write operation at a time
So if the read or write never terminates, you can't do any more
okay
but
sigh
sure
if anyone can answer my question, though, i would greatly appreciate it
well when i try to print the x y and z with the toString() it shows http://org.mopo.mopoWarps.WarpGuiListener@56304b9a0.0
? I did answer your question. You are opening a connection and not closing it lol
no
"Isn't QueryTimeout normally set to infinite? Should it actually cause your thread to hang if it got locked?"
Oh, sorry, I thought that was part of your exception
I think i found it I added worldname to print and nothing showed up
Unsure of SQLite's default configuration but if the query timeout is set to infinite, then yes, it's going to inevitably hang your server if you run it on the main thread
Well if the query is done asynchronously (as it should be), then it won't hang the server
It'll just complain that it's busy
it doesn't do that either
ugh i cant post pictures here
it throws a org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
(as it should)
but in my environment, the 'help' says be default it is unlimited
which means it should be hung
but it doesnt hang
and a quick ctrl shift f doesnt say it is set anywhere 😛
The query timeout just means it won't stop the query if it takes too long. Queries can take as long as they'd like and if they're run aside from the server thread, it can stay open as long as it would like and run for as long as it would like
If you set your timeout to 10 seconds, if the query takes longer than 10 seconds, it's going to nuke that query. If it's set to infinite, it won't ever kill the query, but the thread on which the query is running will be blocked until it finishes
is this normal or should it print out just a plain number
hm
If you just did toString() (ala System.out.println(toString())), then yes, you're just printing the toString() of the class you're in, which was your WarpGuiListener
its just not wanting to get my world
but i did the same exact thing to save and get it
Did you ever save your config?
yes
I copied and pasted the code i used for my /warp and that works fine but as soon as I try to put it into the gui button it fails
I mean there's some string somewhere that just isn't lining up with what's expected. It's just a matter of debugging, printing things until you identify your mistake
YamlConfiguration config = YamlConfiguration.loadConfiguration(warpFile);
String worldName = config.getString( "warps." + warpName + ".world");
This is me grabbing it
test:
world: world
x: -115.90222328577815
y: 80.0
z: -37.38933247662426
yaw: -72.09912
pitch: 22.072598
admin: false
``` And this is how it saves to the file
Worth noting that you've overcomplicated things just a little bit by saving also warps.test despite saving it in its own file
This is kinda my first project still learning so I kinda got to a point where i got stuck, put it into chat gpt and kinda followed along with that. I feel that just doing that i will eventually learn
figured it out....
I accidently messed up defining the directory
How does citizens make people execute command without it saying in console?
they probably execute it directly from the dispatcher
though I don't remember where exactly the command logging is intercepted
Huh
Because theres an issue, it doesnt work when you execute the command but works when u click an npc
What is it suppose to do?
Why isn't it working? Errors, .. ?
if you ever update to 1.21.2 when it comes out, that code won't quite be valid anymore as the resurrection feature of totems can be applied to any items now, so be aware of that in the future
oh does that also go for the animation?
animation's grabbed from the item model i think
any item can be a totem now? 
not yet lol
yep
package pl.creazy.goshopping.hologram;
import lombok.AllArgsConstructor;
import org.bukkit.Location;
import org.bukkit.entity.ItemDisplay;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Transformation;
import org.checkerframework.common.value.qual.ArrayLen;
import org.jetbrains.annotations.NotNull;
import org.joml.Quaternionf;
import org.joml.Vector3f;
@AllArgsConstructor
public class ChestShopProductHologram {
private final ItemStack product;
public void spawn(@NotNull Location location) {
var world = location.getWorld();
assert world != null;
var hologram = world.spawn(location, ItemDisplay.class);
var transform = hologram.getTransformation();
transform.getScale().set(100D);
hologram.setTransformation(transform);
}
}
@Args("test")
void test(@NotNull Player sender) {
var hologram = new ChestShopProductHologram(new ItemStack(Material.DIAMOND));
hologram.spawn(sender.getLocation());
Message.sendChat(sender, "Created hologgram");
}
why my hologram isn't displayed?
i think that it is becouse of scale but how to set sacle then?
What api do you use for command (because of your @Args Annotation)? Its just a question for my own interest🫡
Hi guys, do you know how to make to open an inventory with x item and when click an item do an action?
?gui
And specially using an anvil
just listen to the inventory click event
Ok, thanks to you all
I don't love this tutorial tbh
while I like the idea of teaching patterns instead of methodology, this is kind of a lot
though there aren't many formatting options in a forum thread so there isn't much that could be done about that
probably split it into pages so more information could be cramped and it is easily digestible
https://youtu.be/W6F1-Zjrhls?t=408 it is pretty dope ngl
Infinite chunk loaders.
24w47a: https://www.minecraft.net/en-us/article/minecraft-snapshot-24w37a
Merch: https://phoenixsc.store/
Cape: https://store.badlion.net/shop/PhoenixSC
This channel is powered by Shockbyte server hosting --
Receive a 25% discount on your first month ...
haha nice
snapshots keep getting better and better for devs
but this change also means its probably possible to send a packet to the player for that animation with just any item (or like their hold item)
A video title about ender pearls and the relevant part is literally 3 seconds at the end.
ah you had an index
video playes at 6+ minutes for me
yeah
it is already possible to do so, just not with any item
the animation is an entity effect
right that was the issue I had
wonder how they will handle that API-wise
who, spigot?
its probably just going to stay the same
i.e. it will use the model of the item you are holding if it has death protection, otherwise default totem model is used
I didn't check the source code for the snapshot yet, but if they changed how the animation is handled, it may not be an entity effect anymore but who knows
It'll still be an entity effect
ideally you would be able to send it like ,play the totem effect with this item, disregarding anything the player is holding
but I doubt that
there are entity effects that work on a context-basis so you're probably right
Yea I mean, them moving this to a data component has 0 effect on the network transmission and visuals.
Just insttead of the client only looking for a totem of undying, it'll instead look for an item with the death_protection data component
yeah exactly
I doubt it will change the way you play the effect
just the conditions needed to show an item by the client
why does this happen?
why does what happen?
[IMG]
a what
nono
I mean
this image was uploaded directly into spigot (does not count into the image limit of 10)
and it was shown
but after like a week
it no longer works
re-upload it
it'll just happen again
probably. There is probably some kind of internal process to clear out old uploads
so that its not infinitely using up space from all the various threads you know
it probably prunes old threads that haven't been touched in some time
Image might be too big
does discord allow image linking via other hosts?
it's working real slow
this is why I usually run my own servers for hosting files
this way I know there shouldn't be an issue lol
but it makes sense that discord wouldn't allow infinite linking to resources
or at the very least rate cap it
Velocity the proxy?
what does a proxy have to do with virtual worlds
and such a thing isn't possible anyway
you mean a limbo?
Yes
I need the player not to be redirected immediately to another server, but to stay on the proxy until he does something there and then redirect
How can i use a different sqlite driver version?
😦
hm? Wouldn't shading and relocating different one do?
you can't relocate SQLite natives
why not
its hard coded
well, I'll try it for myself to check
it will always look for the original location
it uses jni, so it'll look for the non-relocated class_method names
technically you can still use jni and allow for relocation, but that's on the library to support such setup
lol found md_5 while looking for the answer
if someone were to make a jdbc driver that uses the foreign function API instead of JNI
wonder if I could just fork the current driver, make the NativeDB class an interface and plop my impl that uses foreign function API to make it work
sqlite is the only jdbc driver i've used that uses native methods whatsoever simply because the whole of sqlite is a native library in general; but it could be ported directly to java without the need for any native bindings, it's just gonna be an absurd amount of work
yeah, hence why I don't want to do that lol
maintaining the driver without porting it already seems like a lot of effort seeing they're not even trying to add new features anymore but just keep up with new sqlite versions
i tried and it gives me the natives error
yeah, it doesn't seem to be possible without some tinkering on the driver itself
too lazy for that, just wanted to add support for 1.8 in my plugin but the 1.8 sqlite driver doesn't have the isValid method implemented
just do a method check with reflection to see if it exists, if it doesn't then use something else or smth
based
Sounds like you are trying to use HikariCP
There is an older version that does not use isValid
I chose the other route. No sqlite support on 1.8
yeah probably the best choice
Things everyone should do
why are people still trying to support a decade old version
bEtTeR pVp
Hello i want to recreate mario kart for a server, i think I can start with boat movement but it can't jumping slab, how to make it ?
Using code
Set velocity of boat when boat is on "jumping slab"
Hey 🙂
Is there a way to have custom mobs, or at least reskin existing mobs without ruining the original
I basically just want a custom texture for a mob, say a cow, and be able to spawn that in through commands / code but still have the normal cows wandering about as well
no u
this my code, it dosn't work
package fr.agentomg.guilevel.tygens;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Boat;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class TyGens extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getLogger().info("TyGens activé !");
getServer().getPluginManager().registerEvents(this, this);
this.getCommand("spawnboat").setExecutor(this);
}
@Override
public void onDisable() {
getLogger().info("TyGens désactivé !");
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if (event.getPlayer().getVehicle() instanceof Boat) {
Boat boat = (Boat) event.getPlayer().getVehicle();
Block blockAhead = boat.getLocation().add(boat.getVelocity().normalize()).getBlock();
Block blockBelow = blockAhead.getRelative(0, -1, 0);
if (blockBelow.getType() == Material.STONE_SLAB) {
Vector velocity = boat.getVelocity();
velocity.setY(0.5);
boat.setVelocity(velocity);
}
}
}
}
Well I mean, you have to actually move the boat up too
That’s just setting the velocity, but it’s still just going to run into the slab. You need to teleport them up
Can you please send the line you suggested I add?
No, not really
For items, there's CustomModelData but that doesn't exist for blocks or entities
You could make use of Item displays with CustomModelData and make your own body model using that but it's obviously gonna be a lot harder
i add this :
if (blockBelow.getType() == Material.STONE_SLAB) {
Vector velocity = boat.getVelocity();
velocity.setY(0.5);
boat.setVelocity(velocity);
Location newLocation = boat.getLocation();
newLocation.setY(newLocation.getY() + 0.5);
boat.teleport(newLocation);
}
After I hide an entity using Player#hideEntity, trying to show the entity again doesnt work
It just stays invisible
How are you showing it again
Player#showEntity
Show your code
Does the code get called
and do you have the right and valid entity instance
Storing a direct entity instance like that is just asking for bugs (and a memory leak)
well the first part works the hideEntity so the instance is correct
It might have been correct when hide was called
Is it still correct and valid when show is called
why wouldnt it be im not setting it again, just gets set once in the constrcutor
im checking if the code there even gets ran rq
doesnt matter, if u walk more than 5 blocks from it, it despawns
yes that code does get called
the reappear code
oh i think i know the problem
its just a logic problem i think
oh im so dumb yea
minecraft pvp in general is ass
can you utilise DataPacks to get what I want?
nope
I am
how
Datapacks don't allow for custom entity stuff
Same way you'd do it in a plugin
If I have say
Ghast (normal skin)
Custom Ghast
With a resource pack for that, as there is no CustomModelData is there no way to then use a datapack to get it to load that resource pack
Entities can have different names etc.
CustomModelData only exists for items
You'd make the original ghast invisible and then have a display entity as a passenger
Okay and you can't really make custom entities in plugins without touching the original model
^^
Well then you need to have several display entities if you want e.g. the head to move
^
Can't optifine change resouces depending on entity name?
It can
i can just do that then i guess
but that requires users to install optifine
Please don't use Optifine in this day and age
i dont want to 😂
There are fabric alternatives that can understand the optifine format
just trying to think of any hacky ways to achieve what i want but sounds like itll be far too compelx for a basic reskin. I will just destroy the orginal mob
How can i run something once every tick but for only 5 seconds
by using a scheduler
?scheduling
I wonder if there's a way to filter and sort as a single operation
🤔
like filterSort(maxDistance, (candidate) -> candidate.distance(target))
.filter.sort?
^^
you're gonna filter each element before it gets sorted, semantically it's the same
I doubt there is natively, but you can just make your own
but then I've gotta do for loop twice instead of once 😭
muh CPU cycles
though I'm pretty sure streams just apply all the operations at the end once
so like whats it matter
filters might run first before sort because you'd end up sorting less elements which helps with perf
How do i add this api to my project?
https://github.com/WesJD/AnvilGUI
Ive now tried to do it multiple times and it hasnt worked, am stuck with this:
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>anvilgui-1_20_R4</version>
<scope>provided</scope>
</dependency>```
Could not fin articat in repo
then ensure you type your filter first 💪
ohhh shit 1.20.6 I can't shill new API 😭
make sure you add their repository
then refresh your maven in intellij
or whatever IDE you use
Dr. Java
added their repository
MenuType.ANVIL.create >>> AnvilGUI
then refresh the project
wdum? like clean using lifecyle maven
its not giving me the button there usually is on the top right
just pop open the maven tab and click the refresh circle
otherwise invalidate caches
net.wesjd:anvilgui🫙anvilgui-1_20_R4 was not found in https://maven.enginehub.org/repo/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of sk89q-repo has elapsed or updates are forced
Try to run Maven import with -U flag (force update snapshots)
yeah maven is tripping
you either A. Don't have the Repository added or Maven has yet to recognize its there
- Refresh Maven
or - Invalidate Caches
<repository>
<id>codemc-snapshots</id>
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
</repository>
</repositories>
what is invalidate caches
share your pom
any other anvil gui api u might recommend?
?paste
If you update to latest you can just use the Spigot API
that's my favorite API personally
the latest?
meaning 1.20.1
your version is wrong
or whatever 1.21
did you not read their readme?
yeah was about to say
i did
just that this giant piece of LUMP in the bottom is giving me an headache
anvilgui-1_20_R4 this verison doesn't exist
i thought that was the "base" version that all other versions hook into
As a dependency
AnvilGUI requires the usage of Maven or a Maven compatible build system.
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.10.2-SNAPSHOT</version>
</dependency>
most projects don't use minecraft version scheme outside of spigot
that's their own project version
nice
Very few projects actually sync to minecraft unless it makes sense
it makes sense for spigot and paper but pretty much no where else
spigot users, should I downgrade to spigot? What are the consequences and can it arise with duplication and bugs?
||I use purpur||
😮
Most projects?
Does that mean that some follow Mc versioning?
downgrade to spigot???
im using purpur
I honestly can't think of a single one
i think i have an idea what they're gonna say
nope cu I don't keep track of whatever they all do
ask spigot or "everything will break" kekw probably, but like who tf knows,
this is one of those make a backup and hope nothing implodes
the reason i want to is because spigot minecraft nms is so easy, paper increases the difficulty
im trying to make a world async
(load)
im about to make the fork and I need advise
👀 uhm how does paper make NMS harder
adds more functions that impede on my work
lol
like changes
paper already did a lot of work for you with the Aync world stuff
you just gotta add, like, two lines to a gradle file and that's it
already did
Sounds like a folia thing?
Hello guys, I am new to this discord channel, and I need some guidance on my code for Minecraft plugin development
paper chunk loading is multithreaded already
that's nice
no it doesn't if you do what i said
Thread Death
return new WorldCreator(worldName)
.environment(environment)
.seed(seed)
.keepSpawnLoaded(TriState.FALSE)
.generateStructures(true)
.createWorld(); // not async
it's literally instant, it just creates a .dat file
i don't see you setting a fixed spawn location
oh should I do that in WorldInitEvent?
oh just extends
Where can I post my code to get help?
not implements
does a generator effect the enviorment?
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/WorldCreator.html#keepSpawnInMemory(boolean)
Has little performance benefit unless paired with a ChunkGenerator that overrides ChunkGenerator.getFixedSpawnLocation(World, Random).
not unless you override other things in the generator
ill try that 😉
i have a gf
ive been looking for so long
what if I told you I love you in a very weird way
🤓 - 🤓
😳
my eyes
Now look at it in light mode.
okay
Also, been meaning to ask, who is the CFO of nothing? Do you have an entire c suite?
The guy's name is "VOID"
My CFO is a guy called as "VOID"
@Override
public @Nullable Location getFixedSpawnLocation(@NotNull World world, @NotNull Random random) {
return new Location(world, 0, 300, 0);
}
}
how do I make this generate a normal world (from a enviorment.world)
oh uh i think you need to override the shouldGenerate* methods to return true for vanilla generation
got it
holy molly that was fast
what do I do about teleporting players into unloaded chunks
player.teleport(speedrun.getWorld(World.Environment.NORMAL).getSpawnLocation());
like is there a way to load chunks asynchronically
Is there a private one to one support ticket?
if im using an item with PDC data, would it be more efficient to build it from scratch every time or have one instance and clone it every time
it probably would be similar enough that it doesn't really matter if you dont do it en masse
and if I do
time it
?
also, how do leaderboards work without eating up 2 gb ram? I assume they don't save everyone in a list on ram right?
That just sounds like a mem leak
Or a REALLY badly optimised plugin
I haven't made anything yet
but as I imagine
storing 3k players in a list
and then sorting it on each update or every like minute
sounds like a pretty bad idea
3k players on one server?
sorted insertion + use UUIDs should deal with that
offline
sorted insertion?
theres some cursed structures in java
i dont remember how to do it
i just remember its possible
sounds like lots of fun
oh wait there was like some treemap or something
that input already sorted values
ye probs that
or something like that
but time complexity was like O(n)
and if u have 100 players only updating it every sec and 5k offline players
thats like O(500k)
no it aint#
no?
right, binary
oh yeah ur right actually
hmm
alright nice
could registering scoreboard teams mess with the TAB plugin?
Someone know how Plan api works? I need to implement the api for get the top 10 playtime / with their time afk and time played, on a bungeecord server. But the Plan's wiki its kinda weird... they say to get the play time from my MyPlugindatabse (in this case mysql) but mysql does not have a function named "getCompletedChallengeCount" for get it
Can someone help me? I want what when players swap the item that is on the config to their offhand, the event get cancelled but nothing happens, i already tried with get item in main hand but the same
@EventHandler
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
Player player = event.getPlayer();
FileConfiguration config = Main.getInstancia().getConfig();
String itemName = config.getString("menu.itemname");
Material itemMaterial = Material.valueOf(config.getString("menu.material"));
List<String> itemLore = config.getStringList("menu.itemlore");
if (event.getOffHandItem() != null && !event.getOffHandItem().getType().isAir()) {
ItemStack eventItem = event.getOffHandItem();
if (eventItem.getType().equals(itemMaterial)) {
ItemMeta meta = eventItem.getItemMeta();
if (meta != null && meta.hasLore() && meta.hasDisplayName()) {
if (meta.getLore().equals(itemLore) && meta.getDisplayName().equals(itemName)) {
event.setCancelled(true);
}
}
}
}
}
Are you sure the event is called and cancelled
yes*
-# * citation needed
-# * I made it up
yeah, parsign ALL text is a pain
let's go back to ascii only and sending patch files over mailing lists
yes please
Spigot mailing list when
all back to IRC
where were you when spigot irc died
had quit after the dmca
I was talking on discord 😭
I still have the port reserved for the irssiproxy for the spigot irc server
I remember joining irc once having no idea what I was doing
Not sure if I have the irssiproxy config for the spigot irc server still commented - I probably did delete it though
Ah nope, it's still there - I just disabled autojoin
-# HAHAHAHAHAHA
Hi there !
I've been struggling lately with one of my paper plugins, at first it seemed that I was unable to get voicechat-api to load but the logs said it was loaded, I digged a lot and long story short it's linked to that fact that my plugin uses load: STARTUP
I created a minimal plugin here
- As is, the plugin will compile and run well (it's mostly based on the example project given on the voicechat api repo and "Successfully registered example plugin" will display a few seconds after starting)
- If you uncomment
load: STARTUPin theplugin.ymlhowever,getServer().getServicesManager().load(BukkitVoicechatService.class);returns null and the console displays a "Failed to register example plugin"
It seems that in that case, the voicechat-api classes and my plugin classes are in different classloaders and cannot reference each others. I don't know why and I don't know how I could work this out
I need my plugin to be loaded on startup because I need to do some things before and during map creation
I currently use minecraft 1.19.4 with paper api 1.19.4-R0.1 and voicechat 2.5.0
Thanks for your help, tell me if you need any other info to help me. I hope I posted it in the right channel, my apologies if it's not the case
paper discord server
yml is silly.
wut
well bukkit.
hahaha
Saying "diamond" is a null material
yeah that wasnt the problem anyway lol. i have my material under a configuration section. i was using getString xD
XD
So yeah, it was indeed a null string
thats on the drop table?
idk but he js dropped it
it indeed is
never knew that
i didnt know zombie villagers spawned with tools?
strange
Question for yall.
I have an record TaskRewards
package me.arkallic.core.model.tasks;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nullable;
public record TaskRewards(@Nullable ItemStack itemStack, @Nullable String command) {
}```
In my yml file i have multiple things to add to one record.
```yml
Tasks:
Mine_diamonds:
Description: Mine 5 Diamond ore
Type: BLOCK_BREAK
Icon: diamond_ore
Repeatable: true
Requirements:
Mine:
Block: diamond_ore
Amount: 5
Rewards:
Items:
DIAMOND:
Count: 5
iron_ingot:
Count: 10
Commands:
home: "maxhomes add 1 [player]"
op: "op [player]"```
So the question is how would i go about this? I currently have
public void setRewards(Task task) {
ConfigurationSection rewardsSection = this.getConfig().getConfigurationSection(PlayerData.defaultData.TASKS + task.getName() + ".Rewards");
Set<TaskRewards> tempRewards = new HashSet<>();
ItemStack itemStack = null;
TaskRewards taskRewards = null;
if (rewardsSection == null) {
throw new NullPointerException("The Rewards Section is missing from: " + task.getName());
}
//Items
for (String i : rewardsSection.getConfigurationSection("Items").getKeys(false)) {
ConfigurationSection itemSection = rewardsSection.getConfigurationSection("Items");
Material material = Material.matchMaterial(itemSection.getConfigurationSection(i).getName());
if (material == null) {
throw new NullPointerException("The material in your task is invalid: " + i);
}
itemStack = new ItemStack(material, itemSection.getInt(i + ".Count"));
}
if (rewardsSection.contains("Commands")) {
for (String c : rewardsSection.getConfigurationSection("Commands").getKeys(false)) {
rewardsSection.getConfigurationSection("Commands").getString(c);
}
task.getRewards().add(taskRewards);
}
}
But obv that doesnt work
ive tried putting it all into 1 loop, making differen't sets for commands and items, etc
the issue is its duplicating when it saves
[18:17:25] [Server thread/INFO]: Mine_diamonds: Command{maxhomes add 1 [player]}
[18:17:25] [Server thread/INFO]: Mine_diamonds: ItemStack{IRON_INGOT x 10}
[18:17:25] [Server thread/INFO]: Mine_diamonds: Command{maxhomes add 1 [player]}
[18:17:25] [Server thread/INFO]: Mine_diamonds: ItemStack{DIAMOND x 5}
and that was with
public void setRewards(Task task) {
ConfigurationSection rewardsSection = this.getConfig().getConfigurationSection(PlayerData.defaultData.TASKS + task.getName() + ".Rewards");
Set<String> commands = new HashSet<>();
Set<ItemStack> items = new HashSet<>();
ItemStack itemStack = null;
TaskRewards taskRewards = null;
if (rewardsSection == null) {
throw new NullPointerException("The Rewards Section is missing from: " + task.getName());
}
//Items
for (String i : rewardsSection.getConfigurationSection("Items").getKeys(false)) {
ConfigurationSection itemSection = rewardsSection.getConfigurationSection("Items");
Material material = Material.matchMaterial(itemSection.getConfigurationSection(i).getName());
if (material == null) {
throw new NullPointerException("The material in your task is invalid: " + i);
}
itemStack = new ItemStack(material, itemSection.getInt(i + ".Count"));
items.add(itemStack);
}
if (rewardsSection.contains("Commands")) {
for (String c : rewardsSection.getConfigurationSection("Commands").getKeys(false)) {
commands.add(rewardsSection.getConfigurationSection("Commands").getString(c));
}
for (ItemStack i : items) {
for (String c : commands) {
taskRewards = new TaskRewards(i, c);
}
task.getRewards().add(taskRewards);
}
}
}```
it seems like you're not really checking if the rewards already exist
that's the only way you'd end up with duplication
based on what I'm seeing you just yolo it into the section and just hope and pray it doesn't already exist
I thought sets were immutable?
not at all
HashSets are very mutable
the only way you can make an immutable set is using Guava's ImmutableSet or Set.of
Maybe immutable isn't the word you're looking for
Unique?
Mutability = the ability to mutate data
Hmm.. How would you go about doing this? using guava?
If what you're wanting is uniqueness, a HashSet will ensure that
hashset doesnt allow multiple of the same sets correct?
Correct. All entries must be unique
so when im adding it to my TaskRewards HashSet why is it adding multiple?
public Set<TaskRewards> getRewards() {
return this.rewards;
}```
if (rewardsSection.contains("Commands")) {
for (String c : rewardsSection.getConfigurationSection("Commands").getKeys(false)) {
commands.add(rewardsSection.getConfigurationSection("Commands").getString(c));
}
for (ItemStack i : items) {
for (String c : commands) {
taskRewards = new TaskRewards(i, c);
}
task.getRewards().add(taskRewards);
}
}
This looks sketchy
Yeah looking at that currently.
at first i had it all in one loop
than i added Items and commands
sections
Any reason your TaskRewards doesn't take in a Collection<ItemStack> and a Collection<String>?
Why does it have just one of either?
I didn't know you can do this
Sure, I don't see why not
You kind of lose the immutable nature of records by using collections but you could make them immutable copies if you'd like
One sec
public record Example(Collection<String> commands) {
public Example {
commands = ImmutableList.copyOf(commands);
}
}
Weird syntax, I know, but this converts your commands arg into an immutable list
oh so it will get the item from the set?
Well I just mean to say that records are immutable in nature. They're meant to be data holders. But passing in a mutable collection tends to break that contract
So if you're passing in a collection, you can make it immutable by using the implicit constructor
public record TaskRewards(Collection<ItemStack> itemStacks, Collection<String> commands) {
public TaskRewards {
itemStacks = ImmutableList.copyOf(itemStacks);
commands = ImmutableList.copyOf(commands);
}```
Yes, then you would just have one TaskRewards object
Your list of items and commands are there in that record
so with that, i would make a for loop to get the items from that record?
aka
for (String command : taskRewards.commands()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command.replace("[player]", p.getName()));
}```
public ItemStack getItemReward(Task task) {
for (TaskRewards taskRewards : task.getRewards()) {
for (ItemStack i : taskRewards.itemStacks()) {
return i;
}
}
return null;
}```
or inside my record?
public ItemStack itemStack() {
for (ItemStack itemStack : itemStacks) {
return itemStack;
}
return null;
}
public String command() {
for (String command : commands) {
return command;
}
return null;
}```
The first snippet, but your Task should probably just have a single TaskRewards object, not a list of them
ugh i hate java sometimes
Be nice to Java
private Multimap<Class<? extends Event>, ScoreEvaluator<?>> scoreEvaluators = Multimaps.newListMultimap(new HashMap<>(), ArrayList::new);
public <E extends Event> Collection<ScoreEvaluator<E>> getScoreEvaluators(Class<E> clazz) {
Collection<ScoreEvaluator<E>> evaluators = this.scoreEvaluators.get(clazz);
}
like i know why i can't return evaluators
it'd be nice if i could tho
I need to return Collection<ScoreEvaluator<?>>
which is ugly
unchecked anyway
return (Collection)Collections.unmodifiableCollection(this.scoreEvaluators.get(event.getClass()));
💀
you're only saying that because you haven't seen my ListBackedSet impl
Oh dear
(ignore the fact that multisets exist as a data structure)
is a multiset just a Map<E, int>?
it's more so like a List but not ordered
But that’s just a set!
no
11
2
3
4
I was sleeping
tbh, I learned that it went out from your message this morning before I checked work lol
See I’m a great downtime notifier
No, it's a ListBackedSet
Maybe it’s a Let
I hate that
Or Sist
Guys what's wrong with my code, I disable when paper loaders, but it not work
public void onEnable() {
throw new UnsupportedOperationException("Paper is not supported")
}

I also try
public void onEnable() {
try {
Thread.sleep(Integer.MAX_VALUE)
}
catch (Exception e) {
// ignore paper no allowed
}
}
But it say syntacx error
syntax errcocr
so instead of a Set a
public TaskRewards getRewards() {
return this.rewards;
}
Yes 🙂
upload this to Hangar right now‼️
But how do i add the elements?
is a player's last location when leaving a World is stored anywhere in the API, and if so, how does one access this value?
it is not
you can store it yourself in the teleport event
missing the new File(".").deleteRecursively() to make sure there are no more paper users
eh kotlin stdlib has it
yea
but why
(also, maybe you can just try getting a class that only exists in paper, if it doesnt error, its probably paper)
oh and this'll only work on linux
Whgat
windows will cry because a proccess is using the files
so you'll just get an os error
True
Windows: "No you cant do that its used by nothing!"
Linux: starts ripping itself apart until death because you told it to
but not cry
rm -rf /
only thing itll do is prompt you if it was accidental and if you really want to continue
also, itll warn you
well no you can't do that nowadays
what????
you'd have to do rm -rf --no-preserve-root /
oh, well
now i actually wanna try that when i get home
throw a new ubuntu installation ontoy sd card and put it into my pi and just watch as it slowly rips itself apart
in linux, file locking is only advisory, so while it can behave the same way, given a sensible application is doing it, it doesn't necessarily have to
in windows there's just no way to go about deleting the root besides unmounting the disk and accessing it externally I believe
maybe from winRT screen but don't know
even externally its kinda hard
I mean, externally you can just delete the partition 
ooh, yea
yea TrustedInstaller is a bitch, it owns all the files
but there are ways to become TrustedInstaller
hi! can I set colored messages in a sign?
in the code just swap & for § -> e.setLine(0, "§6Stuff");
hex codes would need a conversion. using § was quick to accept color codes.
public static String hex(String message) {
Pattern pattern = Pattern.compile("(#[a-fA-F0-9]{6})");
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("&" + c);
}
message = message.replace(hexCode, builder.toString());
matcher = pattern.matcher(message);
}
return ChatColor.translateAlternateColorCodes('&', message).replace('&', '§');
}
``` `e.setLine(0, hex("� Stuff");` This is likely how it would go instead
fuck that is like infinitely nicer looking than the method i wrote for my spigot utils 💀
fine
I use this
what's the point of calling replace '&' '§' on the result of translateAlternateColorCodes?
gotta make sure they catch all of them
thank u so much for explaining, @wraith delta
What if you just don't call translateAlternateColorCodes and instead directly replace?
wait why do i accept hex formats as &#RRGGBB and <#RRGGBB> lolwtf
oh i think i was mimicking minimessage format
ah that might be why i wrote that fuck ass method then
wait no i could still have one shared regex
god i hate looking at old code
Because with translate, it only converts valid color codes and wont mistake anything. replace would only be fine for single color changes
hmm, I'm still not understanding anything
man just use components
Well, fastest example is &7Cookies & Cream. replace would remove the character in between even though it is not intended to be a color code
bro hit me estás jodiendo
que pregunta es esa
porque no intentas con § y listo en vez de preguntar
adskjjdsajdsajdsa
Vengo de usar componentes y el método está deprecado, es mucho más lógico de lo que crees
Y qué cojones andas ahí diciendo si tenias un método estático que le pasas un evento y manejas mal un switch dentro JAJSJAJAJAJA
Sí
Qué
Ok
El de mining ese
Qué
Qué
Ya ya ahora disimula xd
XD
english only
sorry
how to import worldedit 7.3.0 in my plugin?
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
changing it to 7.3.0 makes it red
Ctrl+Shift+O
and wait
btw i'm not very sure that 7.3.0-SNAPSHOT is a thing so ig ull have to search 4 dat
i searched and found nothing
ok
yeah it worked
cool
i didnt refresh it after changing it to 7.3.0
Ctrl+Shift+O it's to reload maven, if u have any problem like that, u can try Ctrl+Shift+O and sometimes it'll fix da problem
How to make a boat move with speed*3 out the water ?
I guess you want to move a boat in constant speed to a direction.
You must substract the boat location vector from the destination vector, and then multiply the resulting vector by something, normalize it and then apply that vector to the boat velocity
I don't remember if you have to normalize then multiply, or multiply and then normalize, so try both
normalize and then multiply
In a FoodLevelChangeEvent how do I detect if it's caused by sprinting / jumping (NOT REGENERATING) and cancel it
I arely try this but it dosn't work
Maybe by using Player#isSprinting() inside the FoodLevelChangeEvent... For the jump, looks a little bit more complex
Does damageable.damage() ignore armor?
Or should I use .setHealth to ignore armor?
setHealth will ignore armor
I think you can also damage with a damage type that ignores armor
Like void
what is the name of the function in inteliji that allows you to save pieces of code or classes inside and use them in other projects
this is like container inside inteliji
Snippets Live templates?
a class is just a longer piece of code?
If you’re using a class that much maybe make a library
it's difficult to update them on the process
If you are creating the library you don't have to download anything
it would be convenient if the classes were placed in folders after the hotkey combinations
i need update
adapting
for diff projects
too cumbersome if I only need a few classes
who know this is code support only for hex colors or old colors too? https://paste.md-5.net/abatebewuc.cs
Should support both
nice
how would i set an itemstack for a playerhead using the head value for a gui
so like i want the buttons to be a playerhead but i do have the url and value
(ping me please or send in dms)
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
thanks
lol someone just tried to purchase rights for one of my plugins from me
five mill
nah I'm way more reasonable I said 40k
dm me elon
if a player has a permission "party.size.24", how can I get if he has one starting with "party.size." and how do I get the 24?
how to get perm list?
player.getEffectivePermissions()?
how to detect if a player jump
yes
statistic increase event
Your best bet is the statistic increment event for now
what
what does it tell then
"im yeeting myself up by 1 block, trust the process"
why does paper have it 😭
cheating is more easy then no?
bcuz paper 🏳️🌈
you can reset y velocity in the statistic increase event to prevent jumping
yes
fr tho
weird
Making movement cheats for Minecraft is quite easy
hold up could you just tell the server you're moving 1 million blocks away
dosen't will it do false positive stairs and similar ?
which is?
You'll see the moved too quickly warning in the console
it dosen't rollback you
yeah ik
just saying that u moved too quickly 😂
I think it does sometimes
It does rollback you
check if on ground
cuz thats sent by client
and cant be spoofed
ez
i want to store a value when a player jump
🤔
lets be real
you dont want to count player jumps right
wdym
actually makes sense
Yeah after that it becomes the teleport packet
speed 100:
i don't get it
cant u just spoof with that
what dont u get
Doubt the server will accept that
Huh no the player movement packet is absolute
what you mean
forget it then
i don't get how can i check if a player jumped
statistic increase event
we already told you
^^
As of 1.20.6, checking for moving too fast is achieved like this (sic):
Each server tick, the player's current position is stored.
When the player moves, the offset from the stored position to the requested position is computed (Δx, Δy, Δz).
The requested movement distance squared is computed as Δx² + Δy² + Δz².
The baseline expected movement distance squared is computed based on the player's server-side velocity as Vx² + Vy² + Vz². The player's server-side velocity is a somewhat ill-defined quantity that includes among other things gravity, jump velocity and knockback, but not regular horizontal movement. A proper description would bring much of Minecraft's physics engine with it. It is accessible as the Motion NBT tag on the player entity.
The maximum permitted movement distance squared is computed as 100 (300 if the player is using an elytra), multiplied by the number of movement packets received since the last tick, including this one, unless that value is greater than 5, in which case no multiplier is applied.
If the requested movement distance squared minus the baseline distance squared is more than the maximum squared, the player is moving too fast.
If the player is moving too fast, it is logged that "<player> moved too quickly! " followed by the change in x, y, and z, and the player is teleported back to their current (before this packet) server-side position.
why can't i send pics ?
?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
?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
not verified
oh yeah but i don't instead what does it do
!verify
Usage: !verify <forums username>
technically there won't be either, it's more like "the player is currently jumping", but no actual "jumped" packet
!verify Zaidorox
This account is already verified!
Well you could check
Previous tick no jump held + this tick jump held = jump
yes but if you just hold you are gonna jump multiple times
but the action input packet is gonna be sent with the jump action once
since it was "toggled" once
holding jump is just a repeat action
rip in peace
so no way ?
seriously?
i just want to check it 1 time, if the player did it one time
no
i mean
u told me about
the static event
but i don't understand it
it fires every time the player jump statisic increases
when the player jumps, the jump statistic increases
so you listen to the statistic increase event
and check if it's the jump statistic
its pretty reliable
you could check the y velocity in conjunction to be certain
I believe 7smile wrote a littel code to check
hm, does the stat increase if you jump due to damage knockback?
it was smile or alex, I always forget which
they're basically the same person
then i should do some others checks since it can lead to false positives, like when getting out of water or else
never seen both of them in the same room at the same time
The place Paper calls their jump event is the same place the jump statistic is incremented
You're fine
oh okey
like this ?
@EventHandler
public void onStatisticIncrement(PlayerStatisticIncrementEvent event) {
if (manager.isChallengeDetectionActive() && event.getStatistic() == Statistic.JUMP) {
Player player = event.getPlayer();
if (player.getVelocity().getY() > 0) {
manager.setPlayerFailed(getName(), player.getUniqueId());
}
}
}```
The velocity check isn't necessary, but yeah
Okey, thanks ^^
On Spigot or CraftBukkit, this event is called through the {@link PlayerMoveEvent}.
looks inside
PlayerStatisticIncrementEvent
Someone can help me about unlinking my spigot acc with my old discord account ?
i don't think that is the good channel
choco can he is DYING to help you
😂
🦻
I'll fight you
Nah you have enough people ready to fight you
Specifically all the ones that are upset you removed DNS connections
he removed dns connections ?!! 😠
smartest skyblock player
Idk something like that
what are these
hi so basically there was a way to make ur ping more consistent/better no matter where u were by having custom dns settings
it lowered my ping by 20, and with my inconsistent internet, made it not spike every few minutes
this also worked for eu /asia/other players, making super high ping...
You're a shit snapshot wtf



