#help-development
1 messages · Page 945 of 1
In that case you should store custom data in your ItemStack, and check if the interaction ItemStack has this custom data.
?pdc
Dont store ItemStacks and check for .equals() or .isSimilar()
It will often times be messed up by small differences like durability or the name.
ok
plus mutability might give you weird bugs somewhere in the code
What version was e.getEntity().getItem() added to ExpBottleEvent
I ask for backwards compatibility
like what go to each version of java docks?
yeah
lol
or just lower your maven version till it stops working
is there no any logs or something were we could check when was something added
probably on the repository
does anyone know how I do this? https://www.spigotmc.org/threads/how-to-build-a-gradle-project.592728/ I need to build from a plugin's gradle
Like anyone to specify in detail
and what program I need to use
If ./gradlew build isnt enough to compile it, then you should not touch it
sorry to ask this but where do I run the command?
@Override
public void onEnable() {
ItemStack pooScraper = new ItemStack(Material.WOODEN_SWORD,1);
ItemMeta pooScraperMeta = pooScraper.getItemMeta();
pooScraperMeta.setDisplayName("§6Poo Scraper");
pooScraperMeta.setLore(List.of("The legendary weapon of old"));
pooScraper.setItemMeta(pooScraperMeta);
ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "Scraper"), pooScraper);
recipe.shape("CCC","CXC","CCC");
recipe.setIngredient('X', Material.WOODEN_SWORD);
recipe.setIngredient('C', Material.COCOA_BEANS);
Bukkit.addRecipe(recipe);
}
Hey learning how to mess with custom recipies rn
how do I specifically make it use a full durability wooden sword for the recipe
pooScraper? 😂
Cause I dont want them to be recrafting the same sword over n over
baldurs gate reference shush
RecipeChoice.ExactChoice is the best you can do right now.
But this limits the choice to exactly the ItemStack you put in.
Could I extend ExpBottleEvent and make custom one
im very new to plugins and I don't want to waste anyones time
but I dont know where to put the command
Run the command in your terminal while being in the projects root folder.
Shift + right click -> open terminal here
in the core folder?
I dont want to discourage you, but compiling this plugin wont help you getting started with development.
This plugin is open source to help other developers. If you are a user, then you should consider just buying the plugin and supporting the devs work.
yeah I was afraid I'd get this response
ItemStack plainWoodenSword = new ItemStack(Material.WOODEN_SWORD, 1);
RecipeChoice.ExactChoice woodenSwordChoice = new RecipeChoice.ExactChoice(plainWoodenSword);
recipe.setIngredient('X', woodenSwordChoice);
@lost matrix so something like this?
Yes, but keep in mind: This will also block out any modifications like lore, enchantments, name etc
could you please tell me which one is the projects root folder
bassically the one where you see all the files from gradle.
hmm right okay so if its renamed it doesn't work still got it
has to be the super exact one
Here are some things to search for:
- How to install git
- How to clone a github repository to my computer
- How to compile a gradle project
Research away
thanks
Im currently contemplating on a more granular system for 1.20.5 when the components are introduced.
It might allow for better predicates.
cket
oh so you run the command in the git?
Everything went well except I can't find the gradle.git
There is none. gradle.git is not a thing.
so what file do I need to clone using git?
I wont give any more specific steps for this.
Tell me what you researched and what you need help with. Ill gladly answer general programming questions.
Like most Spring Getting Started guides, you can start from scratch and complete each step or you can bypass basic setup steps that are already familiar to you. Either way, you end up with working code.
To start from scratch, move on to Set up the project.
To skip the basics, do the following:
Download and unzip the source repository for this guide, or clone it using Git: git clone https://github.com/spring-guides/gs-gradle.git
cd into gs-gradle/initial
Jump ahead to Install Gradle.
``` I can't find a similar file in the plotsquared similar to this https://github.com/spring-guides/gs-gradle.git
Who could come to the phone to give me a bug that I don't know how to solve?
no
isn't this as simple as cloning the repo on intellij and pressing build 
Could be that the version is invalid
or maven cache issues
thanks
what jar
that's a damn old version of authlib iirc
now that I have copied it, what is the next step that I need to research?
how to compile it
so I compile it in the git?
probs from 1.5.2 lol
yea in the main directory
solid chance yeah
it says I just put the command" gradlew.bat build" into the git? but it doesn't work
i did send an authlib but i deleted them
😦
./gradlew build
anyway use system scope and set the systemPath to the path to authlib jar
nono its fixed
am I tripping or is crafty compiling without an ide
aight
no directory found it says. also is the main directory in the git command thing
i think they are yea
or just don't use a 10 year old version of authlib?
that works too
i mean it works
so I put the command in my ide?
do u have intellij?
yea
open the project in intellij
the clone?
jup
where is the clone in my computer
just pay for the project
I opened the whole files in intellij including the other files(every file that was in the hub)
then u should be able to double tap ctrl, a "run anything" prompt should come up, where u can input ./gradlew build
works but how do I get it into a jar?
it made one
gradle bin zip I got
jesus this is a 5 second thing
??
click here, paste the git url and it'll open the project for you
Then on the far right click on gradle and run build
that's it
I dont have a spigot folder :/
yours will be called Bukkit
the only thing in it is the src
and build.gradle.kts
cant find tasks folder
then it has not compiled successfully
gradle my beloved
2 minutes!
what is gradle daemon lol
wait
I think I got it
thanks for the help but the plugin doesn't work :/
but I am really thankful for the time you guys spent helping me
is that normal for gradle?
it likes to build caches
Usually the first build of the day takes minutes and any following ones take seconds
Thnx, adding a wait of 20 ticks fixed it, it was just that the server was shutting down before the player gets transferred to another server
does anyone know how rotate the head of an armor stand based on 2 vectors, one for direction and one for inclination ?
you mean pitch and yaw?
not necesarilly, those blue and green line are diferrents vectors, let me show a video
why do you have two vectors?
you will understand in the video
well, do you want to sum the 2 vectors and make the head look in the direction the vector is pointing if the head is the origin?
Why no one uses artifacts builder?
oh so one vector is for roll?
Maven>>>Gradle
why
oh
basically it is a cube that rotates, and one has a steering phase and the other an inclination phase
you can transform the vectors into blockfaces and then apply rotations based on the blockfaces
the magnitude can be transformed into the initial rotation speed
I have no idea what that video was showing
wtf is youtube recommending me
basically it is a physics cube that rotates, one has a vector on one side and the other side of the face which involves the orientation and direction
basically it's a physics cube that rotates, one has a vector on one side and the other side of the face that involves orientation and direction, irrelevant, think about the cube, I want to make the head of the armor stand have a block and that its rotation would fit inside this cube
bro left his mic on
i always forget to turn my music off when making a vid
Cuz maven doesn't suck
throwback to when I worked at one specific prison server and one of the devs kept sending vids with the most banger rave music
Better than .gradle
LoL
something something you suck at gradle
i send vids with metal on the background
could be ¯_(ツ)_/¯
does anyone have an idea what I can do?
Which way is preferred for registering a listener in another class https://paste.md-5.net/yanabimoma.java
ah
i would always register the listener in the class that created it. a listener instance shouldnt be responsible to register itself imho
i have an idea of phisics in mind but it's not that same as yours so i can't really help
I like the self registering, but it's not the correct way
listener shouldnt be aware of its surroundings
aah alright ty :>
I would just need to know if somehow I could fit those 2 vectors with a rotation in vector3f
Ez make all listeners in one class lol
what does the vector 3f in an armor stand stand for?
3 floats
aka
if it's x, y, z rotation then you should have a good idea about how you can fit your vectors
3 floating people
you just need a formula to see how much of the vector can rotate your cube
setHeadPose
i think i worked with it, i think it's in radians?
is there anything you struggle with? is it the formula to convert a vector into one of the vector 3f coordonate?
the direction vector does not convert easily into a head rotation
you can only infer based on the direction how the head rotates
i also assume when your objects collide you'll want to change the head rotation
there's more creativity involved into minecraft physics than realism
hello guys
how to remove the original minecraft enchantment lore from the item?
im trying to make "custom" lores
my code:
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("picareta")) {
if (!(sender instanceof Player)) {
sender.sendMessage("Esse comando só pode ser executado por jogadores.");
return true;
}
Player player = (Player) sender;
// Criar a picareta de diamante
ItemStack pickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
ItemMeta meta = pickaxe.getItemMeta();
meta.setDisplayName("§rPicareta de Diamante"); // Nome do item
// Remover completamente a lore original
meta.setLore(new ArrayList<String>());
// Adicionar a nova lore personalizada
List<String> lore = new ArrayList<>();
lore.add("§7Eficiência 10");
meta.setLore(lore);
// Definir a meta no item
pickaxe.setItemMeta(meta);
// Adicionar o encantamento de eficiência 10
pickaxe.addUnsafeEnchantment(Enchantment.DIG_SPEED, 10);
// Dar a picareta para o jogador
player.getInventory().addItem(pickaxe);
player.sendMessage("Você recebeu uma picareta de diamante com eficiência 10!");
return true;
}
return false;
}```
spigot version: 1.8.8
fuck
gottem
the class is "addItemFlags" ?
sorry, im a python guy
public class Whatever {
private final int whatever;
public void doWhatever() {}
public int getWhatever() {
return this.whatever;
}
}
The class is Whatever
It has a field named whatever of type int
bad example you never initialized the final int meaning their will be a compile time error 
It has a method named doWhatever of return type void
It has a method named getWhatever of return type int
im gonna print this and save for life
xD
thanks ❤️
Here, let me give you a better example
pastes if-else-if-else 4 million line chess
^^
its only extra bloat
{
"Is this compact and readable": {
"possible answers": ["yes", "no"],
"correct answer": "yes"
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<Is_this_compact_and_readable>
<possible_answers>
<item>yes</item>
<item>no</item>
</possible_answers>
<correct_answer>wtf</correct_answer>
</Is_this_compact_and_readable>
nah I like my config files as a spreadsheet
real time validation
.txt best config format, dont change my mind
if your input is invalid the entire spreadsheet changes to red
and all text colors change to the background color
so you can see it's invalid
also if you type "clear" in any of the fields it clears the whole config
lol
what do I need to enter in Damageable#setDamage. Does it mean how much durability or how much is left? or does it damage the item for that number?
setDamage, sets the damage on the item.
damage on an item means that it is damaged for that amount.
thanks
*for now
How can i make "event.setTotalCookTime(1)" also cook or consume the charcoal properly? because, for example, 64 iron and 64 coal consume 1 carbon for every 1 iron ore? @EventHandler
public void onFurnaceStartSmelt(FurnaceStartSmeltEvent event) {
if (autoSmeltEnabled && event.getBlock().getState() instanceof Furnace) {
event.setTotalCookTime(1);
}
}
This is basically a property of the ItemStack which is put into the Furnace.
Those values are currently hard coded.
Something something fuel value
What... try allocating a String variable and see if this changes the warning
?
are you using @PrintFormat annotation?
what is the symbol on the left?
?
probably shouldn't use that
since you can't guarantee it not being null
and you are saying its not null
well given you don't check
so if I add NotNull it will also throw an error
no, but if it that section is in fact null, using that annotation will hide the problem that is the case
and misleads you on the issue because it starts throwing trap errors
now your annoation is useless if you do that, anyways the purpose of such annotations is mostly for api's where you are saying this thing here is not null and should never be null and if it is we have big problems 😛
shame the IntelliJ tries to get everyone to use it without knowing its purpose
but anyways, your unsubstituted expression is happening because of a string
"Unsubstituted expression" means that IntelliLang isn't able to analyze the string being passed/assigned to a variable because it's neither compile time constant nor annotated with an @Subst annotation. There's also an option in the inspection configuration (Settings -> Errors -> Pattern Validation -> Validate Annotated Patterns | "Flag non compile-time constants expressions") that allows to exclude such expressions from static checks.
this also relates to @PrintFormat annoation as well if something were to pass something to it
and then how can I do it
: (
Hm, either you wait for 1.20.5 to come around or use nms
can someone redirect me to the documention for commands? i know that i can inherit some command base class to create a new instance and register the command at runtime
which allows for fancy things like auto completion
but its like 3years ago i did it and i lost my old projects
why does the client give shitty exceptions
gives you only the first line ;-;
gives me nothing to go off of
This is for completions:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/TabCompleter.html
declaration: package: org.bukkit.command, interface: TabCompleter
What's the procedure for specifying a custom directory such as "mod/config/errors.yml" instead of just putting it in its default directory(/mod/errors.yml)
customConfigFile = new File(getDataFolder(), "custom.yml");
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
saveResource("custom.yml", false);
}
customConfig = new YamlConfiguration();
try {
customConfig.load(customConfigFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}```
If you want to keep using saveResource() then simply recreate the subdirectory structure in your jar
Oh
when PlayerFishEvent is called? Because when I'm trying to figure it out i can't
or what is the best event to do some actions when player uses fishing rod and bobber is on the ground
For all of those cases
Out of curiosity, is there a more efficient/better way of handing custom config files
ini file
Its all a preference. I personally completely dropped the idea of including config files in my plugins.
They are all generated from classes.
But you should be completely fine with using the default spigot configuration api like that.
it is working my bad sorry for problem
So you hardcode everything, or leave it customizable ingame?
Let me find an example
how can i make a custom potion item?
Cast ItemMeta to PotionMeta and then look through here:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/PotionMeta.html
ty
The config class i use:
The generated config:
Im using a library called Ambrosia for this
Which i wrote 
Damn, okay
Not a fan of that style of config
Which part bothers you? 🙂
The fact it hides code flow
I hate anything that does runtime generation or reflection-based hackery
I worked for a server where every command and listener was initialized automagically
Serialization without reflections is an absolute nightmare
Codec 🗿
I dont use reflections or code generation for anything else than serialization
My codec uses marshalling. Which is perfectly viable imo
Im past my days of gsoning out entire pojos and praying the database knows how it works
And then crapping the bed because it faced an abstract class
Im past my days of writing my entire code twice. Once for the object itself and once to manually searilze each field.
My serializer can serialize interfaces and abstract classes
guys i tried finding if i can do brewing stand custom recipes but i cant find anything, can i make brewing stand recipes?
BrewingStands work in a unique way. iirc there are no recipes for them.
So technically it is possible it is just really hard?
I think you just tinker with the brew events
It's too advanced for me im trying to make wine
i think i will just use a crafting table recipe
Another idea:
Use barrels to ferment berries and sugar 🙂
so i put the berries inside and wait?
this public?
Pretty much. Add a hologram on top to show progress.
And spawn some particles.
Create a custom recipe for a brewing barrel.
Only those can be used for brewing then.
ok thanks for the help
https://www.spigotmc.org/threads/ambrosia-easy-to-use-storage-library-for-mongodb-files-pdc-and-redis.640405/
https://github.com/Flo0/Ambrosia
in 1.0.2 im releasing the yml and config api.
The public branch doesnt have it currently.
It can only be used for general serialization to files etc.
Btw this is quite advanced.
Maybe consider brewing stands for now.
dont worry i think i will be fine
the holograms are the only thing i dont know how to do
thanks!
sus
Show your code
Could you give me an example, I'm losing my mind
paper
@lost matrix It doesn't let me pass ItemStacks as an ingredient for a recipe...
You need to pass a RecipeChoice
An ExactChoice if you want it to be NBT aware (full match needed).
Or a MaterialChoice if it just needs to match the material.
You are not developing a plugin so this is the wrong channel
where do i specify the recipechoice
You just declare a variable and initialize it with a new instance
Te make the lingo clear:
Declaring a variable:
int x;
Initializing a variable:
x = 10;
Defining a variable: (Declaring + Initialization)
int x = 10;
Creating an instance of a class (often synonymous to Object)
new SomeObj();
Declaring a variable and initializing it with a new instance of a class:
SomeObj something = new SomeObj();
ty, im new to java i only know python and c#
Nevermind, I stopped being incompetent
it's way harder
@lost matrix do you know how i can make a berry bush that when it grows it gives me grapes?
best way to naturally spawn entities would be to increase spawn rate and replace the entity in an entityspawnevent given a certain chance right?
but only when a grape bush grows not all berry bushes
Thats quite hard to do. I would just use sweet berries for now.
?pdc
what event is used when i right click a block?
Uhhhh
Don't quote me, but I believe you have to derive that from playerInteractEvent
PlayerInteractEvent
and the one that happends when an inventory pops up?
cause i want to cancel that for the brewing barrel
InventoryOpenEvent
ty
btw, spigot api in google will give you the answers to "what event does what", just try searching for (action)Event
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryOpenEvent.html
This documentation specifically
declaration: package: org.bukkit.event.inventory, class: InventoryOpenEvent
how can i find out from the InventoryOpenEvent if i clicked on a brewing barrel and not any barrel?
Again don't quote me, but I think you check the inventory type
Then you're probably gonna have to get into block states
Unless I'm just wrong ofc
You need to get the holder and check if its an instance of BlockInventoryHolder.
I would honestly just cancel the PlayerInteractEvent and open my own inventory instead.
*if you want a custom inventory for that
no, i want to right click once with a berry and once with a sugar, no gui needed
Why use the open event then
I'm trying to get the item clicked from a menu which is a head, above 1.13 works fine but when I'm in a lower version and try to click that item and check if it is the same than the item in a hashmap (Which is the same) it says that the hashmap is null I already have a method that detects the version and sets "PLAYER_HEAD" or "SKULL_ITEM" so the error only happens when the item is the SKULL_ITEM id from 1.12 and less, does someone know why this happen?
Just use the interact event
^ , but he also needs to specify the inventory being a brewing barrel
to cancel it
how would i use the interact event?
Cancel that
Check that the interaction is with your brewing barrel, cancel the vanilla action(s), and proceed with whatever logic you want
i cant do the checking for the barrel i cant find a block name or anything to identify the brewing barrel
The interaction event should be enough to return what block was interacted with
event.getClickedBlock() gives me a block but i doesnt have a name
should i compare this to the brewing barrel itemstack?
Right you're not checking for a name
you should be checking for a block/block type I believe
do i need to make a custom block for this to work?
do you mean casting?
Uh no, you just check if the block is a brewing barrel
then proceed down the line
like this?
A Block object will never be equal to a String object
how can I iterate this values from config?
Now you should just be able to check for the block
i only have an itemstack of a brewing barrel should i cast it to a block and check?
Yk I don't even know what a brewing barrel is...
Mmmm
You should add PDC to it when placed
So it's a custom block, when clicked with sugar / berry it does something?
.
ok
It seems you are trying to make a custom / interactive BLOCK, so just continue with what you're doing now, when it's placed add pdc to the block as to maintain the fact it's a custom block
also make sure to note that these are two different functions so keep your concerns separated
is there maybe some event like TridentThrowEvent? or i just must use PlayerInteractEvent? what would be the best event to check when player throw trident?
ProjectileLaunchEvent
thanks
but I need to get from event player, this event doesn't have any method that returns player
is there any other event?
I need event that is called when player throw trident
ProjectileLaunchEvent#getEntity()#getShooter
You can get the ProjectileSource from the Projectile and check if its an instance of Player
thank you very much guys!!
if i want to write my commands myself without using the plugin.yml for it to create and register them at runtime, should i work with the BukkitCommand class or the CommandExecutor interface and why?
You would have to inject your commands directly into the command map.
I would probably just use an existing command api.
so the plugin.yml?
there are methods to register the commands without injecting them with reflection though
from the docs i assume that BukkitCommand calls its superclass Command which registers them to the map already?
by name
If you have questions regarding adventure, then the paper discord is probably a better place to ask
guys can i add pdc to blocks?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Sharpie
If its a TileState (Like a Furnace, Chest, Barrel etc), then they automatically have a PDC.
You just need to get their BlockState and cast it to TileState.
ok
apparently i do need to get the map via reflection
should i then register it using the plugin.yml and set this commands executor instead?
You dont need the plugin.yml at all if you just throw your commands into the command map.
yes
but im using reflection rn
isnt that discouraged?
how to get nms entity from bukkit entity
is there an event for when the server is fully initialized and players are able to join?
1 tick after your onEnable finishes
ServerLoadEvent
thanks
i wanted to set a mob's target to a random entity from a list of nearby entities that i get at a specific range
declaration: package: org.bukkit.entity, interface: Mob
^
yeah, i got it
List<Player> nearbyPlayers = getNearbyPlayers(entity.getBukkitEntity().getLocation(), range);
if (!nearbyPlayers.isEmpty()) {
Player randomPlayer = nearbyPlayers.get(new Random().nextInt(nearbyPlayers.size()));
bossEntity.setTarget(((CraftPlayer) randomPlayer).getHandle());
}
i hope this is right
getNearbyPlayers returns a List of players
Write an aggro system. Attack the player that does the most damage and let it cool down a bit every tick 🙂
Ooh, interesting idea
Map<UUID, Double> should be enough to track damage dealt
call of duty zombies style where it just attacks the nearest player
That’s just normal mob behaviour
does anyone know why setTongueTarget on Frog doesn't work? i expected it to stick its tongue out at the specified mob; but its not doing anything
not sure if im misusing the method or something
how do i get the port and host of my minecraft server? (with the api)
as in spigot api?
yes, i guess?
Bukkit.getServer().getAddress(); but doesn't really mean much if you are behind a proxy or rerouting the port
why do you need to get it through the api?
dynamic proxy
i dont want to have it all in the config
do you know the event for when the server is disabled? is there something called after ondisable?
if its dynamic you would probably benefit more by having some orchestrator
pretty sure onDisable is the last event called
Btw this prints the IP specified in the server.properties iirc
(which might be absent)
if you use docker or kubernetes you can have all servers on 25565 then just use that api instead
Yeah
yeah it does, there wont be any solid methods that give public ip
unless you ping an outside server
even still, a proxy or router could reroute the port to another external port, making any port thats given through api useless (unless everything is on the same LAN)
I have a very important question
which fornite dance would play best with a mc model
serious answers only
fucked if I know, I never saw any media about it
I just want to meme with my new custom model plugin
alright as per requested by md5 I'll make a flossing animation for a showcase
md5 can I put a quote on there with you saying this dance is lit af?
This dance is lit af
Instructions unclear, dentists pleased with tooth hygiene
damn
I paid that guy 2k to quote you 8k
he ripped me off!
is it possible to get the file.yml node from the key of it?
why is file.yml a node?
no i mean like
something: 'id'
```, i want to be able to get the 'something' from the 'id'
a node from file.yml
its not a section
in yml everything is a section
if you are in the root just do config.getkeys(false)
i mean
i have the key, but i don't have the node.. how can i get the node from the key? each node has its special key
and then get the section ^
i assume node = section
can i get the list of sections, and check if section's key = the key i have?
yeah, it all depends but in bukkit they go by sections
man it's not easy to make a steve model floss
3d
for(String section : config.getConfigurationSection("linked").getKeys(false)) { is the section here the path? because not really interested to test it out xd
hm?
you'll get
linked:
test1: a
test2: b
you'll get test1 and testb as strings
oh nice
public static Object getSection(YamlConfiguration config, Object key) {
for(String section : config.getConfigurationSection("linked").getKeys(false)) {
if(config.get(section) == key) {
return section;
}
}
return null;
}``` i got this so far
not sure if its good
assuming the key is alright it should be good
can i ask JDA related things here?
if i want to get a discord member from his id, should i use User or Member
and whats difference
you can look into what methods each provide
i'm sure one is for some tasks while the other is for others
both will return the same thing
they just have different info as one relates to the user as a whole and one relates to then as a member in the discord
The JDA documentation is amazing I highly suggest reading it
is the member for a member in the dc server or the whole thing?
i just realised i can up the source compiler version to the highest while keeping the target as java 17
that's nice
i haven't tested it yet
can anyone help me solve problem with my plugin code its a mess
it depends on how long the mess is
i tried to get another plugin classes into my plugin
is there anyway i can send the code files and you see it tell me what i did wrong
that might be a problem, you can shade them into your plugin
unless you manually copied them into your plugin
i manually copied
i don't know if i can help, it might sound like trouble from the original developer
i made both plugins
you can just copy the source code into your new plugin
or have a common library and use it in either
i already tried to solve errors with other classes so its all connected with problems
there's no magic button to fix incompatibility issues
can i send you the code tell me whats wrong
sure
how can i send the project file
verify then i guess you can zip it and send it, altho if it's large i don't think i'll be able to help you much
public static String randomString(int length) {
String[] chars = new String[]{"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"};
chars = String.valueOf(chars).split("");
StringBuilder builder = new StringBuilder();
for(int i = 1; i < length; i++) {
builder.append(new Random().nextInt(chars.length));
}
return builder.toString();
}``` is this a proper way to get a random string?
You can optimize it a little bit
Let's start by not creating a random for each iteration
That's expensive
We can also use random.nextBytes to generate a bunch of bytes in one go
public static String createRandomString(int length) {
Random random = ThreadLocalRandom.current();
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
byte[] bytes = new byte[length];
random.nextBytes(bytes);
// transform into char[], no need for StringBuilder
char[] chars = new char[length];
for (int index = 0; index < length; index++) {
// clamp the byte to 0-255, then mod it to the charset length so that it doesn't go out of bounds,
// and just wraps around
chars[index] = characters.charAt((bytes[index] & 0xFF) % characters.length());
}
return new String(chars);
}
Sure it'll pick some characters more than others
Because uh
the mod
i have this
static final char[] STRING_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890".toCharArray();
along with this
that's so nice actually
does it help performance that much?
Not really
it worked, thx
You can fix the "some characters are more likely than others" by either making your alphabet length a multiple of 2, or just skipping the byte[] generation part entirely and generating an int for each iteration
oh
no clue why I mod the byte it's never gonna go past its own limit
so it has issues, i guess i'll stick to new int per each
Yea
Gotta do a full random utf 16 character each time
good luck displaying that in most contexts
when i think utf-16 i imagine looking at this
avg resourcepack
Minecraft uses unifont stuffs now so it can display most of them
can't wait for minecraft 1.21 to release
change logs:
- added native kubernetes support
- rewrote the whole game in cpp
- minestom's the native server now
actually that's 1.20.6
Sure
minecraft used to only have glyphs for <= U+FFFF
plane 0, BMP
the unifont update brought Unifont's plane 1 glyphs
10000 .. 1FFFF
Not even all of those worked
no, the unifont support back then was also limited upstream
I remember miscellaneous symbols and pictographs never worked
only some of it
well, misc symbols & pict is plane 1
you may be thinking of Misc Symbols
2600 26ff
Miscellaneous Symbols is a Unicode block (U+2600–U+26FF) containing glyphs representing concepts from a variety of categories: astrological, astronomical, chess, dice, musical notation, political symbols, recycling, religious symbols, trigrams, warning signs, and weather, among others.
Is 2600-26ff not < ffff
it is < ffff
but misc symbols and misc symbols & pict are not the same block
the former is plane 0, the latter is plane 1
the latter has a lot of emojis
only some of dingbats
upstream unifont at the time was not complete
Yeah makes sense
It’s nice having the expanded character set, even if I don’t need nearly that many
meh, I made my own font
-with these characters, before minecraft imported unifont 15
I just don't really have a name for said font.
the first name was EUCF
extended unicode character font
and then it was EXTD, EXTenDed
now I'm trying on Rhos but I'll likely renege
Tbf hypizel only has the 6400 private use characters
But that should still be plenty so
I don't think so
?
Why can't hypixel use plane 15?
I don’t think you could address those back then, even with the surrogate pair stuff
Could be wrong tho
I don't think that's correct
UTF-16 works on surrogate pairs.
that's how it exists
by using surrogates to encode points > FFFF
all UTF encodings are lossless
UTF-16 can encode all 10FFFF
Yeah but Minecraft just didn’t support it
why not
Or at least I never saw it used before like, 1.18
Well, custom fonts only existed really in 1.13+
so it wasn't very relevant
since you couldn't retexture
but I think you could still send the actual character, it should just show as tofu
Tofu
yes
Noto is a font family comprising over 100 individual computer fonts, which are together designed to cover all the scripts encoded in the Unicode standard. As of October 2016, Noto fonts cover all 93 scripts defined in Unicode version 6.1 (April 2012), although fewer than 30,000 of the nearly 75,000 CJK unified ideographs in version 6.0 are cover...
notdef is another name
[]
I think I'll stick to EXTD
@sullen marlin I hope you're happy with your request for the best fornite dance
now speed it up
where sound
can it teach me how to dougie
Can I somehow dettect if item was taken after CraftItemEvent? Im modifying results of event if item is not taken Im modifying that modified item again and I dont want to show that modified item in results slots it it is not takne. I want show modified item when is not taken as restuls to player inventory. I want to display not modified item.
@remote swallow @rough ibex
the kids are having fun
no i want swish swish bish
buddy I ain't an animator, I make the systems that let you animate
this already took way longer than it should've
r u creating emotes in minecraft?
no
ok
this is just to showcase FMM
looks good, nice work
well let's see how it looks in-game
Hi, I have a question. Is there any plugin for skyblock where can I make my own style of island and then people who just write /island create or something for creating, it would just make them the one I made?
I think it's a bit too fast for it to cope lol
this is interesting, I wonder if there's a value leaking somewhere
yeah, it's a bit too fast
it's weird too because it supposedly resets all the data every time
but it's clearly rounding something in here
I kinda want to see what it would look like with mine
it's an accurate recreation of the exact mc model, just adding a segment for the arms and another for the legs
not my fault mc is the flattest 3d game ever made
true
He’s not looking so good
it looks like the arms are glitching on the out push
Is he ill and has lepra?
I think he has more than that
I think it might be the way it's supposed to loop the animation but it's kinda weird
the loop shouldn't be cumulative
probably a stupid question but does anyone know how I can get NMS? I need to use the ServerLevel class but I don't seem to have it all
ServerLevel is WorldServer
They're using Mojang mappings where you're not
WorldServer is CB mappings, ServerLevel is Mojmaps, but they're the same class
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
I mean not quite what I was looking for, but a useful resource nonetheless lol
oh I forgot to use them
I built them with buildtools but I haven't put them in all my projects yet
I think ur thinking of switchmappings
works much better, thank you
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setTabCompleter(org.bukkit.command.TabCompleter)" because the return value of "org.bukkit.Bukkit.getPluginCommand(String)" is null
at me.snowyjs.minehuttracker.MinehutTracker.lambda$onEnable$1(MinehutTracker.java:39) ~[MinehutPlus-1.2_03.jar:?]
at java.util.Arrays$ArrayList.forEach(Unknown Source) ~[?:?]
at me.snowyjs.minehuttracker.MinehutTracker.onEnable(MinehutTracker.java:39) ~[MinehutPlus-1.2_03.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:190) ~[paper-1.20.2.jar:git-Paper-318]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.2.jar:git-Paper-318]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.enablePlugin(CraftServer.java:646) ~[paper-1.20.2.jar:git-Paper-318]
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.enablePlugins(CraftServer.java:557) ~[paper-1.20.2.jar:git-Paper-318]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:627) ~[paper-1.20.2.jar:git-Paper-318]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:424) ~[paper-1.20.2.jar:git-Paper-318]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.2.jar:git-Paper-318]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1086) ~[paper-1.20.2.jar:git-Paper-318]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.20.2.jar:git-Paper-318]
at java.lang.Thread.run(Unknown Source) ~[?:?]```getting this error?
Command isn't on plugin.yml
oh im using extend command
oh the tab completions?
and now I seem to be missing ClientInformation in the same package, is it a class that was removed?
?whereami
I giggled really hard
ClientInformation is the same between CB and Mojmaps so unsure why you would be unable to find it
explain
I've been having these odd problems all the time
nms 😭
getPluginCommand returns null because the command isn't registered
If you have it on your plugin.yml you should use Plugin#getCommand
how do i put it in the cmd map
If you want to register your own without putting it in the plugin.yml you gotta grab the CommandMap from the bukkit server and register stuff
like this isnt a thing
lmao
I'm gonna try rebuilding spigot 1.20.1 with mojmaps
You can remove tab completions with the normal command system?
Just return Collections.emptyList()
oh my god I love the gui
Wut
Idk man, sounds too logical
Is the 1.8.8 documentation currently down?
We don't have 1.8 documentation
about time
1.8>>
Oh, via Maven lol
not even via maven
Sorry, Nexus*
via abusing nexus
Yeah that's not how you're supposed to use Nexus
the actual maven URLs still work
If that url was ever browsable I'd be impressed
I know the jar download was, I did not know you could get inside the jars
That feels sketchy tbh
Sonatype Nexus Repository
What
So what was I using as a reference then
I'm so confused
some url that google picked up that no one knew existed
which now doesnt exist
you should use maven https://www.spigotmc.org/wiki/spigot-maven/
even after rebuilding it with buildtools, it isn't there
failing that, download the javadoc jar you want I guess https://hub.spigotmc.org/nexus/repository/snapshots/org/spigotmc/spigot-api/1.8.8-R0.1-SNAPSHOT/spigot-api-1.8.8-R0.1-20160221.082514-43-javadoc.jar
Hey guys, I'm still trying to spawn a Custom Zombie. I try it like that:
public class CustomZombie extends Zombie {
public CustomZombie() {
super(EntityType.ZOMBIE, ((CraftWorld)Bukkit.getWorld("roguelike")).getHandle());
this.setPos(0,0,0);
}
}
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
CustomZombie zombie = new CustomZombie();
return true;
}
but I just get an error in minecraft: An internal error occurred while attempting to perform this command and the console doesnt give me any feedback. Any ideas how to tackle this?
So then it'
it's been up for years
And and goes missing now
yep, because nexus got upgraded
That message usually occurs when an error is thrown
I'm surprised the console has nothing
That's really unfortunate timing I guess
hmmm okay I'll try this, thx! but so weird that my console is just empty tho
still nothing happens. Any Ideas how to fix this no error issue?
just empty
but you still get startup logs right?
like I also get sout logs
mh
well yh waht imllusion said was correct thouhg
about adding the entity to the world
yea I tried that. But I think it doesnt work bc of the error I make somewhere else
well it seems ClientInformation was added after 1.20.1 because I built and used 1.20.4 with mojang mappings and now it's there
yo md quick question given you're already here
what's the job of bungee's InitialHandler?
I need to port some stuff to velocity 
it handles logging in the player before they are joined to any servers
Is it bound to a specific protocol phase or does it do handshake, login and play?
it wouldn't do play, but it probably does all the rest at some point
hm
if you're talking to me, I'm trying to use OpenInv's method of loading an offline player to access data like their inventory
Hello, I would like to install the NMS for Spigot so that I can use it. I already have the spigot-1.20.1.jar file, but I don't know how I can use the whole thing in inellij. Can someone help me with that?
if you built spigot with the buildtools then you already have it
also it depends on whether you're using gradle or maven to build your plugin
I use maven
?nms
then what Gamernic sent is what you want
what gamernic sent isn't even a good approach anymore
why
use Mojmaps obfuscated now adays is like shooting yourself in the foot for no good reason
bro no way its the kid from cosmic reach again 💀
oh yeah I didn't notice remapped-mojang wasn't there
I have like 60,000 messages here why are you surprised

fr
I don't know how this translates to maven but you need to use the remapped-mojang
imo, cosmicreach>>
blogpost goes over it <3 thank god for mfnalex
yup
I got 66k get rekt
I do too
lol
you have like 100 more messages than me
you've been around for less time than me nvm you joined the day of apparently :P I Joined late april
so consider me impressed
okay even if I do and out of bounds error it doesnt show up in the logs:
int[] arr = {0, 0};
System.out.println(arr[-1]);
``` So it doesnt seem nms related. What else can I try?
is the code even running
this doesn't provide much context that code 100% of the time will trigger an index out of bounds
yea the code is running. Like when I change the onCommand like a sout it works.
What context do you need?
bro prob has a trycatch ignore
is there a sound for firework launch?
where do I define something likethat?
?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! 🎉
To save ItemStack object in mysql db, Is serializing the best way?
I already had a java course, but it didnt covered something like no errors gets printed out
?
system.out.println takes an object as a value, this might be COMPLETLY wrong but there's a slight chance arr[-1] is returning null and system.out.println prints nothing cuz null is well, null
it's supposed to throw an exception tho
yea like in minecraft I get the an error. But it doesnt specify what error it is. Just that there is one
and the console is just empty
send the error
In minecraft I just get An internal error occurred while attempting to perform this command what perfectly makes sense cause there is an out of bounds error. But the server isnt giving me any feedback. I assume there is a problem how I setup the server
@dawn flower are you not listening
he said theres no consle error
like 5 times now
mhm
try this
try {
int[] arr = {0, 0};
System.out.println(arr[-1]);
} catch (Exception ex) {
ex.printStackTrace();
}```
if it doesn't print it then there's a problem with ur server
okay there was some weird issue with the server and not with java. I did setup a new spigot server and now I'm getting errors again :) so back to my zombie problem. I try to spawn a custom Zombie:
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
CustomZombie zombie = new CustomZombie();
return true;
}
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.monster.Zombie;
import net.minecraft.world.level.Level;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
public class CustomZombie extends Zombie {
public CustomZombie() {
super(EntityType.ZOMBIE, ((CraftWorld) Bukkit.getWorld("roguelike")).getHandle());
Level level = ((CraftWorld) Bukkit.getWorld("roguelike")).getHandle();
this.setPos(0, -57, 0);
level.addFreshEntity(this);
}
}
and I get an java.lang.ClassNotFoundException: net.minecraft.world.entity.monster.Zombie am I using the wrong Zombie class?
did you remap your plugin
yea I think so. I run buildtools and extended my pom.xml like in this tutorial: https://blog.jeff-media.com/nms-use-mojang-mappings-for-your-spigot-plugins/
Hi, I have a question. Is there any plugin for skyblock where can I make my own style of island and then people who just write /island create or something for creating, it would just make them the one I made?
Thank you, it works
You need to use the maven to compile not intellij
You can't build artifacts you must mvn package
Or whatever
Question, how can I dynamically register commands in Spigot> Currently I'm using this hacky way, hovever it only works inside onEnable method. When server is running commands are not longer registered properly (I can not see them in minecraft)
public class CommandCreator {
public static void Create(String name) {
FluentLogger.LOGGER.info("Creating command,", name);
registerBukkitCommand(new TestCommandClass(name));
FluentLogger.LOGGER.info("cmd created", name);
}
private static boolean registerBukkitCommand(TestCommandClass simpleCommand) {
try {
var commandMap = (SimpleCommandMap) ObjectUtility.getPrivateField(Bukkit.getServer(), "commandMap");
return simpleCommand.register(commandMap);
} catch (Exception e) {
FluentLogger.LOGGER.error("Unable to register command " + simpleCommand.getName(), e);
return false;
}
}
public static class TestCommandClass extends Command {
protected TestCommandClass(@NotNull String name) {
super(name);
}
@Override
public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, @NotNull String[] args) {
FluentLogger.LOGGER.info("Siema tutaj commenda " + this.getName());
return false;
}
}
}
If you register commands after the server's enabling you need to resync them
There's a method for that
provided by API, or I need to use reflections?
If you use the exe, activate this under Options in BuildTools:
This is how it worked for me
inside what type?
SimpleCommandMap
I updated the pom and then used maven compile
yea I checked that one
hmm what version of spigot are you using? I can not see it at 1.19.4
Hm, might be new
or paper-specific, go figure
In that case for existing players there's a method to resend commands
the command api is icky as hell
okey, thanks for help
can u hide a player WITHOUT invisibility for a specific player without hiding him from the tablist
you need reflection
I'm still trying to figure out what is wrong with my project that I get the class not found error. Maybe there is something wrong with my pom.xml, maybe someone can have a look at it: https://pastebin.com/Yy15LKqq
<outputFile>C:\Users\user\OneDrive\Desktop\PluginTestServer\plugins\RoguelikeSpigot.jar
</outputFile>
its your shade config
delete that
just that line? and how do I export my jar then?
copy it from the target folder
oh that worked,thx!
ok the syncCommands method is not inside SimpleCommandMap but CraftServer , anyway thanks for help it works 😄
I'm writing a map data packet like this
but the client disconnects on 1.16.5 with "ArrayIndexOutOfBounds"
on wiki.vg I found this to be the only difference in protocol on 1.19 and 1.19.2
so it shouldn't change
and it works on 1.20.1
consider looking in the nms as well
I did
it just writes false
this is 1.19.2+ /\
this is 1.19 and below
hmm I guess there is a difference
yeah, here
as far as i know minecraft uses special byte manipulation in some areas
the array is not optional here
what about ?
you might wanna look what mojang does different to this
mojang has a friendly byte buffer that extends what you're using
ye
netty-provided bytebufs are just as fine to use
also, I can't even use the FriendlyByteBuf class
👍
i know, but it does something different when it extends
so you might wanna make sure it matches