#help-development
1 messages · Page 1078 of 1
its such implicit language tbh with all that syntax sugar
Its not works
not matching
plugin.yml
you are excluding the plugin.yml from having it's variables expanded
just do filesMatching("plugin.yml") {
blah blah
}
why do you have to define the variables two times
and that's what i need since i want to register entries to registry at some point
in my case its perfect
but i fear that when i add something later
it would still become a class
lol 😄
kotlin is your savior
just admit it
its not works
respectfully, shut up, that has literally nothing to do with the presented topic
it is correct?
then the manager isn't immutable, why make it a record? and why make a separate class if you're gonna be able to access the underlying data (registry) directly? kinda defeats the point of a manager, it's meant to encapsulate things and hold invariants
i would still need to have access to register the enchantments somehow
and there's no reason to wrap it currently
or expose a register method and keep the registry internal
then you don't need that class altogether lol
maybe, but then i need to put the calculate method somewhere
And here is plugin.yml
and it doesnt fit anywhere else
But nothing changed
gradle won't change your source plugin.yml, it will change it when jaring your classes and resources
try removing **/
that shouldn't be the issue but you can give that a go
maybe perform a clean build, perhaps you're looking at an old cached version (although it also shouldn't be the case)
is this on github or something to maybe take a better look?
nothing changed
i can import plugin to github, wait a minute
lemme see
right
you are doing that in the root project's build.gradle.kts, you'd need to do that in the submodule (bukkit) build.gradle.kts, or move it inside the allprojects call
Why do I have a different result?
Do you have any plugins installed?
thanks
looking at the menu background they are not using 1.21 client, so probably viaversion which could be messing things up shrug
probably
hi, I have a certain stand with a diamond helmet on its head, using a texture pack I replace the helmet with a model of a prone player, but the problem is that I want to do a click test on this model, but the size of the helmet is much smaller than this body of a prone player player. How can I make the entire player body model clickable?
naaa noway
I've tried it. Its ok. You would have to use it everywhere tho.
For a reactive backend its nice, but for a performance critical infrastructure such as games its meh.
Newer jvms optimize it a lot, so the performance difference might even be negligible by now.
There is really a small group thats always here ^^
Optionals are aite but I feel like they're an afterthought
Having been introduced in java 8 they get as much usage as streams. Old timers don't like them and new guys don't see the pros using them as much
They're okay for return values but this would've been better solved using a different nullable approach, like Kotlin does
Where instead of making a class that wraps the concept of nullability, you revamp it entirely at a language level
i wonder how it's like in kotlin
You have the concept of "nullable" and "non-nullable" variables
And the "?" operator which lets you run certain actions if the value is nullable
While the "!!" operator converts a nullable to non-nullable, throwing an error if it's null
It works a little like this
ah okay
fun getMyValue(player: Player): MyValue? = player.whatever
fun test(player: Player): String {
return getMyValue(player)?.name ?: player.name
}
interesting
The "elvis operator" ( ?: ) runs an action if the value is null
And you can use it for input validation
fun provider = providers[key] ?: error("Invalid key: $key")
provider.doSomething() // This is never null
i can't find an event for a minecart becoming activated by an activator rail or something similar, i want to make my own minecart type which can be activated
can be more?
what are your guys opinions about this
lets say i have a factory that returns implementation object of the interface to not break binary compatibility
sure
and there's no name currently i cant think of that implementation
what would you guys do
I agree with the commenter
C# bros must be angry now
question from me is not whether the interface prefix is bad, i agree with that statement
but whether what to do when you cant think of name for the implementation
What's the name of your implementation
if i have one implementation of an interface currently
Enchantment interface
in implementation sense its a primitive wrapper around nms enchantments
for example
interface UserStorage {
User loadUser(Identifier id) throws IOException;
void saveUser(User user) throws IOException;
interface Factory {
UserStorage createStorage(...);
}
}
class SqlStorage implements UserStorage {
// ...
class Factory implements UserStorage.Factory {
public UserStorage createStorage(...) { return new SqlStorage(...); }
}
}
class FileBasedStorage implements UserStorage {
// ...
class Factory implements UserStorage.Factory {
public UserStorage createStorage(...) { return new FileBasedStorage(...); }
}
}
that would work fine if you can think of good names
good names for what
I like to go 1 level further for example SqlUserStorage
it entirely depends on what your types do, you can't just come up with an interface name and slap it wherever lmao
how would you name an implementation of interface which is primarily purpose is to hide away the implementation details from the user (factory construction)
that isn't really the way i use interfaces
i use interfaces for abstraction, not encapsulation
CraftBukkit for example prefixes the implementation classes of Bukkit API with Craft prefix usually
I use abstract classes more than interfaces
but it allows you to recompile only the implementation
sure
leaving other parts which use the interface intact
i don't really understand the point you are making
again, that entirely depends on what the classes and interfaces do
Impl suffix?
i just ask for an advice
Are you making an interface for something with 1 implementation?
ik there's no 1:1 solution for this
kinda, its purpose is to encapsulate the implementation behind factory method
that way i can create agnostic implementations of interfaces from outside the implementation
then the "prefix" or "suffix" of the class should derive from what the implementation does specifically within the bounds of the interface contract
for example
there is a user storage interface, it can load and save users, then you have specific implementations, one that is backed by SQL data store, one that is backed by a file data store (think json or yaml), another that is backed by some http backend through a rest api (RemoteRestUserStorage or something)
o/
C# will hurt you if you don’t prefix interfaces with I
hiii, is there a way to open a sign gui for a player that just asks them for input (like on hypixel !!) with just the spigot api? I would like to avoid using nms / protocollib :)
(i tried putting the sign really far away, but i got the error, that the player is trying to edit an uneditable sign :/)
Ngl that naming is a cancer from microsoft
microsoft always loved hungarian notation
It's an apple reference
another example, in a plugin of mine i have a PermissionInterface,, well, interface, i have a LuckPermsPermissionInterface that uses the LP API directly, a VaultPermissionInterface that uses Vault if it's installed, and a BukkitPermissionInterface if neither are installed; (the Interface suffix isn't because it's an interface, but because it interfaces with the separate permission storage)
there is no "interface vs class" prefix/suffix that you should use, it depends on what the itfc and the impl do
and, like i said, i use interfaces for abstraction, not encapsulation; even if i was using classes instead of interfaces i can still change the way it operates and works without users/callers having to recompile their code, so you can have encapsulation in a regular class just fine
Hey, I wanted to make BlackJack in Minecraft and don't know how to make a break between dealing the cards (1 sec).
I already tried it with BukkitRunnable runTaskLater and with Thread.sleep(1000) but it won't work.
public void start() {
this.setGameState(GameState.PLAYING);
deck = Card.createDeck();
playerList.forEach(player -> {
player.sendMessage(BlackJackManager.prefix + "§7Das Spiel beginnt!");
List<Card> deckP = new ArrayList<>();
this.playerDecks.put(player, deckP);
});
for (int i = 0; i < 2; i++) {
for (Player player : playerList) {
drawCard(player);
}
drawCardDealer();
}
}
public void drawCard(Player player) {
playerDecks.get(player).add(deck.peek());
Bukkit.dispatchCommand(Bukkit.getServer().getConsoleSender(), "give " + player.getName() + " minecraft:paper{display:{Name:'{\"text\":\"" + deck.peek().getCardName() + "\"}'}}");
deck.pop();
}
public void drawCardDealer() {
dealersDeck.add(deck.peek());
deck.pop();
}
Nothing to do with the rest sry :')
Hm
First thing I'd do is make the game state thing an abstract class
PLAYING is alright for an internal state enum when it comes to things like matchmaking
Anyways your solution is to use the bukkit scheduler
I'd probably have some sort of CardQueue class which is a wrapper or a Queue<PlayerCard> and a task that polls and gives that player a card
PlayerCard would be a data class of (Player, Card)
my server crashed. how do i see what caused the thread to stop?
read the logs
the logs, not just a choice bit you wanted to post
1.8 server running on java 22
Smells like a fork
Oh wait it straight up says PandaSpigot
so the crash started after installing the nameless plugin
probably this plugin
I want an actual LOG. Not part. The lead up to this thread dump is important
have players ips etc
ok I'm off to bed
wtf is a pandaspigot
“Updated” 1.8 fork
bruhhh
1 or 2?
prob 1
why that
then I could just use Any.toPrettyString() instead of Any?.toPrettyString()
but I would probs agree just #1
or #3
1
you mean this?
perfect
?
anybody knows how i can display a strenght potion?
at the display material
and at the material
looks like this in game
can't you simply set the appropriate PotionMeta stuff?
no clue about 1.8
It think it was just a damage value back then
POTION:#####
No idea what the number was, check the creative inventory
Yeah
like
See if the plugin accepts POTION:8201 or something
no
373 already is potion
try just POTION:8201
or
373:8201
8265
like POTION#373:8201?
still no
what mc version?
for armor i did with names
gui:
title: '&e&lGOLD SHOP'
size: 54
items:
Helmet:
display-material: DIAMOND_HELMET
material: DIAMOND_HELMET
display-amount: 1
amount: 1
data: 0
display-name: '&eHelmet'
name: '&eHelmet'
display-lore:
- ''
- '&fPrice: &e16 Gold'
lore: []
display-enchantments:
- Protection 4
- Unbreaking 3
enchantments:
- Protection 4
- Unbreaking 3
slot: 10
permission: shop.helmet
cost-material: GOLD_INGOT
cost: 16
discord fonts..
material names are not the same as item id's
and how i am supposed to type there>
?
are you making a plugin or configuring one?
configuring
then you are at the mercy of however that plugin was made
you are also in the development channel
i searched and i didn't found anything
i know but no one knows how to did that
again, its however that plugin was made
if you were making a plugin it would be different
yea
ah throwback to when I was a kid and didn't know how to spell "strength"
lol
i can give u the link with the source
maybe you will have an idea
lmao
im attempting to create a spigot 1.12.2 plugin and this appeared, not sure what's wrong
BukkitDiscordHook:main: Could not find org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT.pom
- https://jitpack.io/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/maven-metadata.xml
- https://jitpack.io/org/spigotmc/spigot-api/1.12.2-R0.1-SNAPSHOT/spigot-api-1.12.2-R0.1-SNAPSHOT.pom
plugins {
id("java")
}
group = "io.github.rephrasing.discordhook"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
}
dependencies {
compileOnly("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT")
}
this is my build script
that is not how repositories work
you're defining the same variable twice, which is url
basically overwriting your original spigotmc one with sonatype
just remove the sonatype url and it will work
ah i see
i kinda forgot how that worked lmao its been a while since i worked on plugins
Hi, I have a problem, I have a voucher plugin and I want to make that when I right click on a voucher I send a message, the method I am using is:
public Voucher findVoucherByDisplayName(String displayName) {
for (Voucher voucher : vouchers.values()) {
if (voucher.getDisplayName() != null && voucher.getDisplayName().equals(displayName)) {
return voucher;
}
}
return null;
}
but when I use it, it doesn't return the voucher, this is the listener code:
Voucher voucher = plugin.getInstance().getVoucherManager().findVoucherByDisplayName(itemDisplayName);
System.out.println(voucher.getName());
right on print, I get nullpointerexception returned
can anyone help me please?
debug your vouchers map
the vouchers themselves work, I use a method to search for them by their name to check if they already exist or not, what I don't know is why it returns null if I try to search for them by their displayname
debug your vouchers, print all current vouchers and itemDisplayName, then check if it exists and what is inside the vouchers list
So I want to keep track of all player stats in db, so it has to be extremely granular and will end up looking like
int coalMined
int ironMined
blah blah blah for like 100s of different stats,
would you guys split that up into different data classes/different tables on a db. I'm thinking having to load all that data all at once would be a bit excessive, what do you guys thing
As in have table for blockBreakStats, then one for enemiesKilledStats etc
You could split it between multiple tables and use joins. The advantage of splitting it up by category for the stats is you wouldnt obtain a mass amount of data all at once of you dont need all of it. I would implement an expiring cache for the data that automatically fetches data if not present.
I mean you can absolutely select and insert specific columns to avoid the mass data problem
If I'm being honest though, I think SQL is a poor choice for statistics. Something like Mongo sort of excels here imo. If you're dead-set on SQL however, then yeah, maybe breaking your stats into multiple tables would be a good idea, but still grouping related stats together in columns
Or depending on what you plan on doing with the data, a single table with a JSON blob of stats might work fine. You obviously can't lookup specific stats and you either get all or nothing, but again, depends on your needs.
I'm looking for a developer who can make an advanced Minecraft client
thanks I hate it
oooh
I just had a clever idea I think
ok it's like
a 7/10 on the clever scale
clever as in good idea or clever as in stupidly contrived
@Override
public void execute(CommandData commandData) {
ArenaCommands.openArenaMenu(commandData.getPlayerSender(), commandData.getStringArgument("arenaID"));
}
ok so it's not bad
it's not good either
but it's not bad
I think that's about as easy as I can come up with right now
the thing I added is the command data class that just gives an easy interface with the underlying advanced command class to get arguments and a shortcut to getting the sender as a player type
public class ArenaCommand extends AdvancedCommand {
public ArenaCommand() {
super(List.of("arena"));
addArgument("arenaID", new ArrayList<>());
setUsage("/em arena <arenaID>");
setPermission("elitemobs.event.start");
setDescription("Open the Arena menu.");
setSenderType(SenderType.PLAYER);
}
@Override
public void execute(CommandData commandData) {
ArenaCommands.openArenaMenu(commandData.getPlayerSender(), commandData.getStringArgument("arenaID"));
}
}
basically this is how a command gets registered and how the execution works out (and if you think it's unsafe, yeah kinda in many ways right now)
static method o_o
I cant remember if you can use this library, but this is a good example on this topic. https://github.com/Mojang/brigadier
yeah here's how I do mine
yeah it got recommended but I guess I also want to do some funky stuff with it
Its 100% worth it
I got in this mess in the first place because I was too lazy to write my own command system in 2017
at least if I write it I know it will behave the way I want it to
I use mine specifically for easier tab complete suggestions and to set arguments like /gamemode mode:creative target:player
yeah my code also does that
I still have to figure out a way to do command hints if it's even possible
also have a special value to list online players, just basic QOL stuff
hey guys im creating a bgm plugin and playSound is very work as well, but the problem the minecraft music is playing at the same time how can I disabled minecraft default music?
Pretty sure default music is client side
hmm I think it's possible with the resourcepack
you can just make a resourcepack that changes all minecraft music
oh so can I remove minecraft default music with the resourcepack ?
yes
actually Im using the Itemsadder is it possible too?
hmm
and add it to your server
got it thank you 🙂
do you guys nest interfaces
or you do you prefer flat interfaces separated in separate interface java files
are you talking about inner classes / interfaces?
but in that case namespace gets polluted when you have data classes that are only used within the root data class, lets say i have Block and BlockData. If it's only used to define Block's data why not nest them within the Block interface and have Block.Data syntax instead
The only acceptable case for making an inner interface are functional interfaces
Oh, should add this: imo
sure, its harder to implement such interfaces, but in the end it gives you cleaner syntax to work with a bit imo
but having separate files are easier to maintain
so i cant f*cking decide lol
you can have hybrid approach, define nested interface:
interface Foo {
interface Data {
...
}
}
and implement those interfaces like this:
public class SimpleFoo implements Foo {}
public class SimpleFooData implements Foo.Data {}
that way when you return Foo interface you can still access Data implementation object via Foo.Data, but for implementation details you use flat structure for easy maintainability
https://imgur.com/a/JW2TAyT if i want to move the entity (in runnable), do i have to get the entity instance by uuid or can i use armorstand variable?
https://imgur.com/a/RjqZj71 this teleports the entity correct?
no
just use Entity#teleport? changing coordinates of your location won't affect your armor stand in any way
i cant use the armorstand instance right?
i have get entity instance by uuid on runnable right'
to avoid problems (chunk unload etc)
well depends, if the armor stand may be gone while performing the runnable then yes, but otherwise I don't see any problems just using the same instance
in your case you may try to get it by uuid and then check if it's null (that means it was destroyed or no longer loaded)
if i use armorstand instance, could return isValid false if chunk was unloaded
yes isValid is what you want
but I still think it's best if you get it by uuid and check if it's null
really depends on your impl. tho
yes that's what I'm saying. if I get the armorstand instance I have no guarantee that isValid will return true because the chunk was unloaded and if the chunk is loaded again another armorstand instance will be created I believe
and isValid won't check for chunk unloads
and if I get the instance by uuid I am guaranteed that this is the instance the player is seeing
well yes
you get the instance by uuid, if the uuid doesn't exist, then the chunk is either not loaded or the entity was removed from the world
or it never existed
ok thx
What does a worldgenerator have to do to make structures actually generate? I have shouldGenerateStructures() overridden to true but locating and TPing to any structure reveals nothing ever generates, however the bounding box is there as evidenced by advancements being granted. I have ruled out any code I have written as a cause for the issue, as even a simple blank generator like so is enough to reproduce the issue:
public class TestGenerator extends ChunkGenerator {
public boolean shouldGenerateStructures() {
return true;
}
private static final List<BlockPopulator> populators = Lists.newArrayList(new SkyGridPopulator());
}
Hey Guys !
To make it short, I'm making a plugin that converts a .txt file into a written_book in minecraft.
I have a problem with Encoder because I red on the internet that this big boi doesn't like some characters. But actually, I made logs of my program and no wrong character was found...
Please, Can I have your help ?
Here is the logs that I talked about:
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
is he maybe not reading UTF-8?
We still need an actual question to answer
Now ask a question
My guess is that the implementation that actually applies the book's text to the written book's nbt/components is incorrect, since it's reading it just fine
What is the problem ?
never realized that the page is made by md5
I can already see what his issue is, but I'd like him to actually ask
It's not
It's a self host of hastebin
yeah it was familiar
it was probably made for people not to send random pastebin websites
I'm okay with that but that's strange, at the end of the program I print all the text and nothing seems wrong.
System.out.println("Here is what is in the pages:");
for (String t : pages) {
System.out.println(t);
}
That's not what I was saying at all
playerinteract is called when i place a block?
But if someone else evidently found the issue then I'm wrong anyways
No
he didn;t setAuthor
playerinteract is called on hand animation (or whenever a player interacts)
It's called before you place the block
Oh
While you're interacting with the block
BlockPlaceEvent is called as you place the block
And the block place immediately proceeds the event
Oh my ..
Thank you so much
Since my issue immediately got wall-of-texted out of view, I hope bumping it like this is okay
does your world gen override getDefaultWorldGenerator?
Of course. I wouldn't be able to generate a blank world using that code if it didn't
But you are correct in that it was an important clarification to make.
certain structures require Stone gen to be able to place
Strongholds do not; they can appear floating.
But if a structure failed to generate, then its bounding box would not generate either.
true
Yet we have a situation where only the bounding box generates
/locate a fortress using a generator like this. You'll get the Eye Spy advancement when you stand on a block at the stronghold
and blockplacevent is called afteR?
This is because the bounding box did actually appear; so we know there should be a structure there, but for one reason or another there simply isn't
for some reason the playerinteract event is being canceled if I interact with the air but if I click on a block, that is (blockplace) it is no longer canceled and I only have 1 plugin and this plugin I saw the whole code and it does not cancel the event wtf
Hey guys I have a problem. I want to create a precreated file.
This is my code:
private static final File RECIPEFILE = new File(BetterOres.getPlugin().getDataFolder(), "recipe.yml");
private static final FileConfiguration RECIPEONFIG = YamlConfiguration.loadConfiguration(RECIPEFILE);
public void saveRecipeFile() {
if(RECIPEFILE.exists()) return;
RECIPEFILE.getParentFile().mkdirs();
BetterOres.getPlugin().saveResource("recipe.yml", false);
YamlConfiguration.loadConfiguration(RECIPEFILE);
}
In older plugins is use this code too and it created everything
https://github.com/goncalodelima/ms-vip see the util/Configuration.java
No
You need to fix your code then.
You need to ask better questions. You usually have vague questions don't explain your problem and provide 0 relevant code
I only cancel the playerinteract in some cases but none of the cases are with redstone_block but ok. I have to use blockplaceevent too so it doesn't matter for now
this method not get the higher block?
yea that was it
Does anyone know how to resolve the problems with multiverse core and datapacks? I have a datapack which plays an animation with display_blocks using a function but this datapack only works on the main world and not the worlds created with multiverse core
https://paste.md-5.net/dolajobuki.csshould i check if armorstand1 is valid too? in runnable
did you see my code? Its the same
no but configuration.java works
i use configuration = new Configuration("barrel", "lang.yml", plugin); and configuration.savedefaultcnofig();
https://imgur.com/a/R6INsJE how i edit chest inv?
https://imgur.com/a/YrPnvVe idk what i use
More of a datapack issue than anything
Ask the creator
nope
public class Configuration {
private File file;
private String name;
private JavaPlugin javaPlugin;
private FileConfiguration configuration;
public Configuration(String name, JavaPlugin javaPlugin) {
this.name = name;
this.javaPlugin = javaPlugin;
}
public void saveFile() {
javaPlugin.saveResource(name, false);
file = new File(this.javaPlugin.getDataFolder() + File.separator + name);
configuration = YamlConfiguration.loadConfiguration(file);
}
}
private static BetterOres plugin;
private Configuration configuration = new Configuration("recipe.yml", this);
@Override
public void onEnable() {
plugin = this;
saveDefaultConfig();
configuration.saveFile();
}
Its the same error
https://paste.md-5.net/cuxuyiwebo.bash
How you use "("barrel", "lang.yml", plugin)" there is only one string needed.
savedefaultconfig(); save the config.yml and not a custom one
https://paste.md-5.net/tevibewibo.java
Why are there gaps between displays here?
anyone use intelIJ idea here? i need help
me but i'm lmao
whenever i compile my plugin it compiles with plugin name and version but i dont want it to compile with version in compiled plugin.jar
like this its HiderPlus-1.3/1.7 i dont want version in it
just rename it?
its annoying to rename it again and again
Then leave it with the version
ig
I don't see how the version in the plugins name is an issue lol
Yes
I use maven
what if they use maven
oh lol just as I said
ok ty
But with gradle you can just set the archivesName to whatever you want
I use a custom made compiler
based
Just use javac
No maven or gradle
i just run kotlinc
but I am learning plugins in Maven
does it make any difference?
not much

it's all java and all spigot
java you say? 😏
I will fuck your mom in kotlin
proof?
?
her back pain should be enough proof
Is playerjoinevent on the main thread?
Yes
All async events are labeled async in the name
except for the times where the async events are fired on the main thread
I've looked at this and I too can only get teh BB to spawn. Structures are locatable but no actual structures
I'm going to look at other worldgen plugins for 1.20.6 to see if the same issue occurs. Is this a Spigot bug?
I thought I may have been missing a step in my worldgen
I don't believe so as this has bene talked about for years
at least mentioned since 2017
I can locate structures and teleport to them, but no blocks
?stash
how can i fix the numbers? that's probably the problem
its possible to move shulker and still have the hitbox out of the grid?
wdym "fix"
numbers are not pretty
use decimal format
Do you want to round it or just cut decimals
^
public static void displayImage(Location location, String[] data, int width, int height) {
try {
float scalingFactor = 0.4f;
double imageCenterX = (width * scalingFactor) / 2.0;
double imageCenterY = (height * scalingFactor) / 2.0;
for (String str : data) {
if (str == null)
continue;
String[] split = str.split(",");
int px = Integer.parseInt(split[0]);
int py = Integer.parseInt(split[1]);
int red = Integer.parseInt(split[2]);
int green = Integer.parseInt(split[3]);
int blue = Integer.parseInt(split[4]);
double mx = px - imageCenterX;
double my = py - imageCenterY;
Location particleLoc = location.clone().add(mx, 0, my);
Color color = Color.fromRGB(red, green, blue);
Particle.DustOptions options = new Particle.DustOptions(color, 1f);
location.getWorld().spawnParticle(
Particle.REDSTONE,
particleLoc,
1,
0, 0, 0,
1,
options
);
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}```
this is getting the particleLoc really wrong
it literally draws the image hundreds of blocks away
and it's drawing it as a line in the x coordinate
to store it
as an csv
i don't want to be loading the image every tick when doing an animation
entity.getnearbyentities include the entity instance?
no
for (Entity entity : location.getWorld().getNearbyEntities(location, 30, 30, 30)) {
if (entity instanceof Player player) {
player.playSound(player.getLocation(), "note.supply", convertForSound((float) player.getLocation().distance(location)), 1);
}
}
and this include the entity on location instance?
I'm leaning towards an issue with having to use FLAT worldgen
Is that what Spigot uses internally for providing its worldgen tools?
But even FLAT worlds can have strongholds when structures are turned on. Nowhere in vanilla Minecraft does a structure fail to generate in a way where only the bb is present
yeah its odd
Even Mineshafts that generate exposed to light won't, there's actually a select few blocks that generate regardless of light level.
Either the whole structure including the bb fails to place, or you'll see at least some trace of the structure there.
why not update? hologram.getStands().get(1).setCustomName("§7Vanishes in: §f" + TimeUtil.formatTime(120000 - (counter / 4 * 1000L)));
public List<ArmorStand> getStands() {
return stands;
}
Storing a reference to an entity that way isn't recommended
It will lead to memory leaks unless you're very careful
Keep track of the entity uuids instead
thanks but that is not the cause of the problem
and how do you know it isn't
If you're looking for help don't ignore the advice given to you
why didn't I unloaded the chunk
but i ll test
so it doesn't make sense that a new armorstand instance was created along the way
yep
no updating yet
then we don't have enough information to help you
When is that code running
is it running
what happens
im debugging too
https://paste.md-5.net/ovisocahoy.cs
https://imgur.com/a/AG0ngFj time not updates
call or call1 is not appearing so it is some logic problem
is there key to show BB?
maybe armorstand1.remove is the cause of the probelm
No
MiniHUD can show them, I think you need to give it the server seed though.
I actually can;t get any structures to spawn in a custom worldgen
they exist through /locate
I can just tell they are there because /locate would stop showing it once you load the chunk and it realizes there's no structure there. Even if it thinks there would be one there.
So that's how we know the bounding boxes there. Another reason is, of course, advancements being granted.
You could also tell the bounding box is there if you allowed certain structures specific mobs to spawn.
yep I tp to teh locations shown by /locate, and do /locate again, it says 0 blocks away
but nothign is spawned
I even get an achievement for first entering a stronghold
soo
thats usign both FLAT and NORMAL worldgen
I'm beginning to agree this may be a bug. No clue if its vanilla or Spigot though
it spawns fine in vanilla
If the boolean was all I am supposed to need then this is probably a Spigot bug
I've overridden both and no structures spawn in a custom worldgen
I'm lazy in bed right now. I'll open an issue on their tracker later.
k
If you'd like to help me, you can also provide a compilation of information about what you've tried so I can add that to the issue as well.
I appreciate your tests
the only thing I did different in Spigot over vanilla is I used a FLAT single biome ChunkGenerator
in vanilla I used FLAT but random biomes
For me, I'm just applying it over normal world generators. So I have vanilla biome spread and everything. That works, but I don't get my structure still.
I'll strip my biome gen and test apples to apples
bump
why didnt i knew about service loader before
such a great way to separate your implementation from api, without involving having to create static factory methods inside interfaces
whoever told me about this class couple days ago, thank you ❤️
more abstraction 😄
?paste
Yello
What's the best way to stop hostile mobs from spawning in a certain radius?
I thought about despawning them immediately after they spawn or cancelling the spawn event, but I've found those two to be very laggy on the server
yoyo guys
im looking if someone knows about this thing
idk im not allowed to send a picture
?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
ahh thanks
alright
so basically i was wondering if anyone of you knows how to replicate this floating text when a player gets killed:
TextDisplay
it starts from the bottom and then goes up like 2 blocks high and disappears
I see, is there any plugin for this or I'd have to engage with a dev?
I'm using 1.8.9
theres probably some plugin to do it but no clue on 1.8
armorstands for 1.8
shit im cooked
why
nah its fine
ill just wont put it in my server
its just for aesthetics but that'd take more than what im capable of
Lookin for someone who can translate plugin files to other languages on a easy way.
i mean, its not that hard. you just start a task which runs every tick for 2 secs, spawn an armorstand, increase the height by 0.05 every tick and kill it once the task ends
hell naw im not into java at all, i was just looking if there a plugin for this, ive made my whole event-server with some plugins and some self-made skripts and it works just fine, rn I was just looking for the small things but it aint that deep yk?
ah gotcha, but its #help-server for you then
I will use that next time 🙂 thank you
is this good guys??
im making a custom minecraft server framework implementation
I mean, 51ms is kinda long
6.2ms per chunk
what?
hello, I really need help, I've been stuck on this for 4 days, I would like in my plugin, each player will have to spawn on their own map and have their own progress/progress. Can anyone help me please?
If you need more information/context like screens, video, no problem
https://paste.md-5.net/oduqeyojuw.java
you can also just use
?paste
what am i seeing here
there are 322 chunks, if it took 51 ms in total, it would be 0.15 ms per chunk 🤔
... yeah I forgot my calc has swapped , and .
anyways yeah you're right
that's fine
hopefully
bro what dark magic does rust do
on debug profile its 600ms, on release profile its 60ms
it's not dark magic
debug profiles in EVERY language are slow
they add a ton of extra things on top which are very slow
but provide you useful info
yeah debug symbols
so, pls someone can help me ???
Where should I learn to make simple minecraft plugins 1.21? I have python, javascript, skript experience
Is there guide here or website?
first off
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
you need to learn java
plugins are written in Java, so you know, you gotta learn it
secondly
?jd-s
that has every single class, method, description, etc
of all the spigot API
third off, you probably want to use the wiki
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
@cosmic ibex
oh ty
np
i rawdogged it lmao
no programming experience
we remember 😛
began programming at 11-12
no wait I'm high
I started programming at 8
and did plugins at 11-12
"_comment"
jason
Is it possible to know if an PlayerInteractEvent was called because of dropping an item from your inventory while holding an item in your mainhand?
The information I receive is identical to punching the air and when I tried checking if the player's inventory is open I found out it's always open. And InventoryClickEvent is called after PlayerInteractEvent.
on skibidi
😔
anything you say can and will be used against you in a court of law
Could someone give me a quick rundown on how to make a specific item stack to a number greater than 64?
yes

im using fastboard's api
if i join using lower versions, the scoreboard shows only half the text, its not wide enough
i've seen this before with scoreboard plugins
how to fix it
You cannot
There is a fixed length of scoreboards in older versions
well I mean there is ofc a limit in newer version too but it's much higher
Make your scoreboard text shorter
That includes color codes
- "&7- &bName: &a{name}"
- "&7- &bKills: &a{kills}"
- "&7- &bDeaths: &a{deaths}"
- "&7- &bKillStreak: &a{killstreak}"
- "&7- &bBestKillStreak: &a{best_killstreak}"
- "&7- &bCoins: &a{balance}"
- "&7- &bK/D: &a{kd}"
- "&7- &bELO: &a{elo}"
- "&7- &bCountdown: &a{cooldown}"
this is the default config, i know it looks bad
but
this doesn't look too long
i can see wider scoreboards in the same version
That does look a bit short
So I counted the letters
and that is indeed the 16 character limit of old versions
Including the color coding characters too
yes
Did those other scoreboards you saw also have so much color coding?
They're wasting 8 characters on colors and that initial -
So you just have 8 letters remaining for the key and value
pretty sure you can just remove the colour codes by using components no?
I'ts probably (for the sake of limitation) a good idea if you remove the &7- at the starts (4 characters) and limit color coding to either only coloring the text or the value (saves another 2 characters)
For old versions that is
They said old versions so I'm going to assume 1.8 support
where that's not an option
yeah but it's taken a while for them to be implemented everywhere
Hey, I'm playing my current FTB modpack on 1.7.10 - if you want to run a server on that version, you gotta make some plugins for that too eventually 😛
(even though you could make a mod instead)
Rad doesn't do that
hybrid 💀
He's a chad
I just wonder if people still argue that the old combat system is the reason for not going beyond 1.8 or if those servers have created a biotop around itself, that really doesn't support any upgrades
as myself i can confirm that this is factual
That is the argument lol
Every single one of them too I swear
Omg 💀
and the ONLY one too
literally
"there are several advantages" no there aren't
Just cancel the damage event and reimplement the old damage style. Boom.
the one exception to that is hypixel
but anybody ever trying to compare ANYTHING to hypixel is stupid
Yeah but hypixel is hypixel
There was a guy the other day asking about 1.7 plugins
💀
I kinda just laughed in his face
kat wanna join vc?
damn
rejected
The only valid reasons for that imo is if you run a modpack (like me) that is only compatible with 1.7.10
I'll compete with them, you just wait
i am expecting 100k players
I've been waiting since I got banned from hypixel actually
I think I might be the only person to have a genuine false ban off hypixel
100k? have fun staying poor
i'll get 20m AT LEAST
I'm building my mc server to be able to hold the entire human race, concurrently, on a single instance, twice over
people will be having kids just to have more people to play with in the server
doesnt work in 1.8
"It's not the old version bro, I just need better hardware"
"More ram bro"
"More shitty free gpt dev plugins bro"
I remember some guy saying he only uses gpt to write his code lmao
I don't know if I want to hit the gym in an hour and go there with a bad diet prep or hit the gym in 13.5 hours and go there tired
It's very funny to me, that I very quickly understood how GPT is a good tool for certain things, like cleaning up some messy code (not change any logic) or to just quickly give me the infos I need to write what needs to be written ... meanwhile the newer generations literally immediately went to:
"YOOOO, I can just use it to replace myself, so I don't need to do any work anymore!! YOOOOOOOOOOOOOOOOOOOO"
a minute of silence for the new generations
I like to use it for math since 4.0, it's gotten way better at least in that aspect
NEWGuy: GPT please order enough apples for one a day for a week.
GPT: Ordering seven apples...
NEWGuy: no I want one per day for a week.
We are heading there
Ok, thank you
imagine thinking a week has 7 days
loser behavior
my weeks objectively do not have 7 days
who needs to count past one
I'm not even joking
I started following magma's day cycle logic kek
One day is the amount of the time you grind + the amount of time you sleep
My weeks have 7 "normal" days during day time and 7 "actual days" where I'm productive during the night time 🙃
at 28 hours there's 168 hours in a week, divided by 28 that's 6 days
There is literally a cut to where I go onto my PC, with nothing else planned and can just focus on my stuff - and then go to bed, and I would count this as a completely seperate part of my time, so like its own day lol
so my weeks have 6 days
I like to read before I go to bed
I literally code or do similar things until my brain stops working and I nearly fall asleep on the PC - because then I can just go to bed and immediately fall asleep
Otherwise my brain will keep me awake with shit like "Oh, did you try this for Problem X yet?"
I do that too
https://paste.md-5.net/idupatunam.cs
this is getting the particleLoc really wrong
it literally draws the image hundreds of blocks away
and it's drawing it as a line in the x coordinate
Well, what do you input as location?
And what do you mean with "as a line in the x coordinate"? Screenshot?
Screenshot of how it looks in game
Ah okay
your string data is wrong then
public static ImageData readImage(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
ImageData.Pixel[] pixels = new ImageData.Pixel[width * height];
int i = 0;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
Color color = new Color(image.getRGB(x, y), true);
int alpha = color.getAlpha();
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
pixels[i] = new ImageData.Pixel(x, y, red, green, blue, alpha);
}
i++;
}
return new ImageData(pixels, width, height);
}```
this is how i read the image
Pixel is just a record
I was gonna say the same - or it only reads the first "pixel" of the data and the scaling is off or something
you are spawning particles on the x and z axis
i know that
so it shoudl be a flat plane, IF you account for new lines
so like
it should be similar to pixelart
idk if it's called that
where it's drawn on the ground
i love the part where you overwrite all entries on the same x
where?
pixels[i] = new ImageData.Pixel(x, y, red, green, blue, alpha);
}
i++;
Where do you convert the ImageData into a String array?
you only increase pixels at teh end of a line
am i not uspposed to do that?
so the inner loop is replacing the same pixel
public String[] convertToCSV() {
return Arrays.stream(pixels)
.filter(pixel -> pixel != null && pixel.alpha() == 255)
.map(pixel -> String.join(",",
Integer.toString(pixel.x()),
Integer.toString(pixel.y()),
Integer.toString(pixel.red()),
Integer.toString(pixel.green()),
Integer.toString(pixel.blue())))
.toArray(String[]::new);
}```
for all of the y pixels on the same x, you are putting them in the same i
oh
since you only increment i after the row
And that also
so i fucked up?
yes
wait so it should be incrementing i in the y loop
you shoudl be increasing I inside the inner loop
I wouldn't say "fucked up", just did the i++ in the wrong scope, one line too far down 😛
let's go
but uh
it's black and white
my code is on 40 years latency
i think i should divide by 255 since minecraft's /particle rgb is 0 - 1 not 0 - 255
not sure if it's the same for spigot
BufferedImage.getRGB returns ARGB
Color constructor takes RGBA
1.12.2
Integer.rotateLeft by 8 bits
a lot more
oh well it's the same
Are you sure you were on 1.12.2
because the limit is 16 characters
Integer.rotateLeft(image.getRGB(x, y), 8);?
I'm talking about when you were playing on the other servers
i mean isn't that just shift left, i could be wrong
well over 16
and that's on a 1.12.2 client?
yep
rotate will roll over, shift just drops
So I looked it up and it looks like you can abuse prefixes and suffixes of players to get longer lines
something that fastboard clearly doesn't do
yes
ok thanks
why is gamemode deprecated
if (player.getGameMode() == GameMode.CREATIVE) {
return;
}```
or wait its non existent
Update Intellij
how do i do that
yeah I was about to say it does have the code for it
Should be a little update icon in the top right
thanksss!
How many characters are allowed in a single "line"
i'm trying to make a double jump function haha
@chrome beacon it has adventure support, if i use it, will it work?
not on 1.12.2
the server runs on 1.19.4
so wait how are you testing with a 1.12.2 client
if you're using viabackwards you really should test on 1.12.2 without it
so older versions can join too
._.
help
Starting org.bukkit.craftbukkit.Main
Exception in thread "ServerMain" java.lang.UnsupportedClassVersionError: org/bukkit/craftbukkit/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:38)
at java.base/java.lang.Thread.run(Thread.java:833)
You're not using the correct java version
Doesn't mean your IDE automatically switched versions.
run java -version in cmd prompt or wtv and see if you're using j21
iirc 65 is j21 right?
Ye
java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
this shows up
Yeah you gotta change your java version to 21
how?
I'm trying to remember how to get there lol
uh oh
System settings -> advanced sys settings -> Environment variables -> find 'JAVA_HOME' and change the path to the new version of java
update-alternatives
thanks but how do i find the path for the newest java?
oh nvm found it
I think I forgot a step
iirc you have to edit the 'Path' variable as well, use the bin file of the java installation
After you do this, apply changes obv and run java -version again
to verify
public static ImageData readImage(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
ImageData.Pixel[] pixels = new ImageData.Pixel[width * height];
int i = 0;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int rgb = Integer.rotateLeft(image.getRGB(x, y), 8);
Color color = new Color(rgb, true);
int alpha = color.getAlpha();
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
pixels[i] = new ImageData.Pixel(x, y, red, green, blue, alpha);
i++;
}
}
return new ImageData(pixels, width, height);
}```
for some reason orange becomes purple, black doesn't pass in ``.filter(pixel -> pixel != null && pixel.alpha() == 255)``, white is graish
you are converting 255 to 1? or 0.9?
no
what are you trying to do here exactly?
isn't your original RGB?
does spigot accept 255? or 1?
?isspigotdown
i found this old code in an old thread
Particle.DustOptions dust = new Particle.DustOptions(
Color.fromRGB((int) r * 255, (int) g * 255, (int) b * 255), 1);```
so i'm guessing it's 255
looks like its 0-FF so 255
hm
Spigot is fine here in the UK
Works for me
cloud hosting
works for me 
a route may be bad for some
it works now (spigotmc.org)
anyways time to test code
it works
it's displaying my boo'iful orange
and it displays black
but it's just making a black circle and puts orange at the end
nvm it's just massive
I was going to say, shrink the scale of the particles
yes, pixels to particles is going to be BIG
scale by 0.1
scale more 🙂
until there are no spaces between the particles
I don;t know your code. So whichever moves teh particles closer together
Cloudflare for ya ✨
https://paste.md-5.net/ixufeyoquf.cs
it's still like 1000 blocks big at that scale
i think i'm doing something wrong
that's not a cloudflare issue though
oh shit
i removed that for testing
double mx = (px * scalingFactor) - imageCenterX;
double my = (py * scalingFactor) - imageCenterY;```?
hhelp
my pc
is
aa
You are taking the parsedInt coordinate from your data, which is still gonna be x = 1, 2, 3, 4 ... and so on and then you are only shifting THAT position by the offset from your imageCenter * scalingFactor and add it to the initial location after
it was just that im not scaling mx and my
also my pc didnt like 0.00000001 scalingFactor with proper scaling
Remember, if you are drawing a 512x512 pixel image, that you are creating 262.144 objects with draw calls at the same time
well
The problem is more the rendering here, rather than the amount of objects
Which is why your computer freezes on lower scale, as it needs to draw over 250k particles at the same time
i mean you could've just told me "you're drawing too much particles"
In one tick (as far as your code goes)
yeah it didn't like that
Either re-scale your image or skip every X amount of pixels (hard limiting the resolution)
Hello!
I am trying, for the first time, to create a cross-server plugin (my own project), and I am trying to do shared inventory between servers. But now I have a problem with serialising the inventory to save it inside the database.
But now I have a problem with serialising the inventory to save it inside the db.
So I created these methods:
public static String toBase64(Inventory inventory) throws IOException {
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream)) {
dataOutput.writeInt(inventory.getSize());
for (int i = 0; i < inventory.getSize(); i++) {
dataOutput.writeObject(inventory.getItem(i));
}
return Base64.getEncoder().encodeToString(outputStream.toByteArray());
}
}
public static Inventory fromBase64(String data) throws IOException {
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64.getDecoder().decode(data));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream)) {
/
int size = dataInput.readInt();
if (size % 9 != 0) {
size = ((size / 9) + 1) * 9;
}
if (size < 9) {
size = 9;
} else if (size > 54) {
size = 54;
}
Inventory inventory = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inventory.setItem(i, (ItemStack) dataInput.readObject());
}
return inventory;
} catch (ClassNotFoundException e) {
throw new IOException("Unable to decode class type.", e);
}
}
But im getting this error https://paste.md-5.net/ijuheraqes.md
can anyone help?
also why does my client not render particle that are far
That's just the engine not drawing particles which are too far away ... because why would it need to do that?
can't you just serialize an ItemStack array
they aren't really that far
I thought there was a way to force them to show but I'm only familiar with paper
and how should I save an inventory in a database?
by saving it as an itemstack array
you dont need to save the extra fancy stuff like holder
from this thread: https://gist.github.com/graywolf336/8153678