#help-development
1 messages ยท Page 1792 of 1
But the way for send the titles is different between versions
That explains all..
why are you supporting legacy versions?
Why not?
Yeah i know
like, 1.7 clients simply do not know what titles are
so if you want to support till that version, you are pretty fucked
can u view an enderchest of an offline player or no
yes
yes
you basically will need to check if the version is 1.8 or higher
ok ty
and then send the title
I'm not going to support this version, all of my plugins works on all version but 1.7 is not supported and parts of the code may not work on different situations and I'm not going to provide fix
stop supporting < 1.16
0 downloads then
but if 1.7 isn't supported
lmao
and you are only supporting to 1.8
Ok that's not my problem
why can't you just use the method ?
cause so many plugins are latest
.
its not my problem then if u cant learn java and code...
for example that Objects.equals
If you are not supporting 1.7, you can literally just use the APIs sendTitle method
like wtf was that
I'm asking? Lol
If smth is the same as
I use that
@eternal night <#help-development message>
okay, I have no clue what you are asking then
But gives error because as someone said before, the function changed every version
๐
the internal representation changes
the API method should still be backwards compatible
This
Is my problem
If you want to help, then help, if not, then not, but saying stupid things aren't going to help me
Check this out https://www.spigotmc.org/threads/xseries-xmaterial-xparticle-xsound-xpotion-titles-actionbar-etc.378136/, I personally used this.
would this work?
FileConfiguration ret = YamlConfiguration.loadConfiguration(configFile);
InputStream defConfigStream = Echo.getEchoInstance().getResource(configFile.getName());
ret.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
File newCFGFile = new File(getDataFolder(), "newConfig.yml");
ret.save(newCfgFile);
I'll check, thanks!
declaration: package: org.bukkit.entity, interface: Player
Try
Block blockAt = world.getBlockAt(x, y, z);
Material typeAt = blockAt.getType();
if(typeAt == Material.FURNACE){
Furnace furnace3 = (Furnace) block.getState();
System.out.println("3"+furnace3.getBurnTime());
}```
Anyone having idea why the following code drops me that error:
```[17:25:10 WARN]: [LCCommands] Plugin LCCommands v1.0.0 generated an exception while executing task 1170
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState cannot be cast to class org.bukkit.block.Furnace (org.bukkit.craftbukkit.v1_17_R1.block.CraftBlockState and org.bukkit.block.Furnace are in unnamed module of loader 'app')
at lethalchief.listeners.player.TempListener.isCampfireNearby(TempListener.java:167) ~[LCCommands-1.0-SNAPSHOT.jar:?]
at lethalchief.listeners.player.TempListener.playerTemperatureTimer(TempListener.java:224) ~[LCCommands-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:101) ~[patched_1.17.1.jar:git-Paper-381]
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57) ~[patched_1.17.1.jar:git-Paper-381]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.17.1.jar:git-Paper-381]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) ~[?:?]
at java.lang.Thread.run(Thread.java:831) ~[?:?]
>
the Player#sendTitle(String, String) method has existed since 1.8
use pastebins for code/stack trace posts that're long to avoid flooding chat!
?paste
I made my own. 3 methods is better then 15+ lol
you are using blockAt for the material checks
and block to get the state
seems like two different blocks
OHHHHHHHHHHHHHHHHHHHHHHHHH
I haven't noticed that typo
Thank you for pointing it out
Sorry about it. Will do next time ^_^
no problem xD
๐
It's installed, now how I can play a simple title?
Simply Titles#sendTitle
You carefully read their documentation https://github.com/CryptoMorin/XSeries/wiki
tho I guess that doesn't have the title docs
Oh... Thanks!
adventu-... :p
Ty
no conclure, don't you dare suggesting anything modern
I having a NPE (Null pointer exception) that i think its caused because my client#publish() method its getting executed before the connection thread its started
Any recommendation?
have anyone tried to spawn shulkers with packets before
the blocks ?
entities
ah so shulkers
yes
He already say it ....
data.writeByte(19);
data.d(0);
data.writeByte(0);
im trying to set color for the shulker
via EntityMetadata packet
but it just defaults to the purple dye color (ID:10)
I'm constructing PlayOutEntityMetadata packet via PacketDataSerializer
although im sending the ID 0, which means the shulker should be white
nulinis in my native language literally means 0th
my native language is not english
and its correct to say that
0th or zeroth, an ordinal for the number zero.
i literally googled that
ye
ik its correct but i've never seen anyone use it so it looks/sounds funny. personally I use naught/nought, like the UK-lings use
never said it wasn't correct :)
how do i check an item's damage value
EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK
if (event.getCause() == EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK) {
// Do some stuff...
}
This is a section of my code that replaces a player's message with a custom one, and its not workng any ideas?
if(e.getMessage().toLowerCase().contains("ez")) {
for (Player online : Bukkit.getOnlinePlayers()) {
if (online.hasPermission("ez.replace"));
p.chat(color("&e&lI love playing on this server!"));
}
}```
they have the permission btw
is there an easy way to check if a player's held item is any helmet or any chestplate or any leggings or any boots or any sword or any pickaxe or any axe or any shovel or any hoe or bow or fishing rod or shears or do i have to make a LONG ASS line
thats not replacing. Thats making the player send a message
idk if this works in 1.8, but you check if the item meta is an instance of damageable, then cast, then get the damage. iirc the higher the number is, the more damage it has taken.
yeah how do i replace it
im having a brain block
#setMessage() in asyncplayerchatevent
i think
declaration: package: org.bukkit.event.player, class: AsyncPlayerChatEvent
any ideas?
Get the message -> replace the word -> set the message.
ok ty
Implicit super constructor PlayerEvent() is undefined for default constructor. Must define an explicit constructor?
are you trying to listen to playerevent?
I'm guessing his class name is PlayerEvent
i'm just learning to do the replace thing for the first time
im not that good at this
i just tried the default one and now i get how its meant to work
Maybe you could start with String#replace
Anyone have an idea how i can force start a Furnace to consume a Fuel and be lighten and be able to smelt items?
https://pastebin.com/fvPxbLXE - This is my current testing code. But i'm getting the following result
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
where?
Maybe this is helpful? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Furnace.html#setBurnTime(short)
Okay so setBurnTime does activate only the furnace being lit. But what would in such case turn on the burn thing?
since i'm using both
furnace.setBurnTime((short) 1600);
furnace.setCookTime((short) 1600);
Neither one of those adds the light in the GUI that allows items to be smelted
i have these two, should i create another one for the replace message class
it just runs the getMergedAmount method more than one
Hm- I'm trying to edit the players base health using attributes:
I have tried:
Double basehealth = e.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
e.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(basehealth+2);```
as well as
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).addModifier(new AttributeModifier("Vitality", bonus, Operation.ADD_NUMBER));```
Nothing seems to work
public class KickCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (p.hasPermission("punishments.kick")) {
if(args.length == 2) {
if (Bukkit.getPlayer(args[0]).isOnline()){
Player a = Bukkit.getPlayer(args[0]);
TextComponent KickMessage = new TextComponent();
KickMessage.setText("You Have been kicked");
a.kick(KickMessage);
} else {
p.sendMessage("Player is not online");
}```
Why this no work and give error
How do i use my colour utility in the msg replace? it says it doesnt support it, but i want to replace the entered message to a colored one.
import org.bukkit.ChatColor;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class MsgReplace extends JavaPlugin implements Listener {
public final String color(final String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
public void onChat(AsyncPlayerChatEvent event){
String msg = event.getMessage();
msg = msg.replace("ez", "testmessage");
event.setMessage(msg);
}
}
wait howd u syntax highlight lol
oop
^^^
what error do you get
ohhh ok
```java
//code
```
'kick(net.kyori.adventure.text.@org.jetbrains.annotations.Nullable Component)' in 'org.bukkit.entity.Player' cannot be applied to '(net.md_5.bungee.api.chat.TextComponent)'
@ancient plank
since they are depricating kickPlayer
is this using paper's api? ask in the paper discord
im not using papers api
kickplayer isn't being deprecated in spigot, and there's no #kick() method on spigot
only paper
this feature even supports x86 assembly code
i couldn't made that thing work
You need to shade it too
can you give me an example from how to send a title saying "hi" and subtitle "hello" per example
Titles.sendTitle("hi", "hello", fadeIn, stay, fadeOut)
Title API exists in spigot itself
that was more easy that i though, i was doing something wrong, thanks
why would you need separate api for that
multi-version plugin
player?
p.getPlayer()?
oh yeah, just follow the params
there are multiple method with the same name
use the one that suits you
Can someone help me with disabling the spectator menu teleportation?
I've been stuck on it for about a day now
Cancel PlayerTeleportEvent, with SPECTATE cause.
anyone got some free time and can help me make a plugin, ive already got the cmds, main java, and the plugin yml
yep, how i can add more time to the title?
I mean that works, but what I'm doing is disabling it while a player has a spectator target (left click an entity while spectating)
@summer scroll
because it just stay like 1 second
^^
20 ticks
put it more then
if I do that it just kicks me out of the spectator target
Try PlayerInteractEntityEvent or PlayerInteractAtEntityEvent
where? it gives me an error if i put , 1, 20, 20)
What would I put into it?
the stay, put 60 tick or something
@ivory sleet sorry for ping, do you know how to code something that when a player sends a message in chat, it will change the message to any one of a random list of strings, e.g. 'inputmsg' --> 'changemsg' --> 'outputmsg'
get the random list, get a member of the list at a random index using a random number, then change it gg ez
in english
im not very experienced
could you explain in more depth
list object full of random strings -> get a random member of the list using Random/ThreadLocalRandom (iirc threadlocalrandom is better to use(?)) -> then replace it with the random string you got
/papi ecloud download player
You need to invoke replace on the string which is returned from the config
huh
config.getString("path").replace(โฆ,โฆ);
thanks
if you're using placeholderapi
you saw the code?
When i send a message to an player, how can i center the text?
sorry i have a discord theme on and it blended in
you mean in chat?
or do you mean an actionbar
probably he means on chat but if you say how on action bar will be useful for me too
ok one second
ty
https://www.spigotmc.org/threads/tutorial-send-actionbar-messages-without-nms.257845/
not sure if this will work
how could i store balance of a player
a yml file is ideal
can u make a balance top with that
like a normal yml file
A yaml file is definitely not the idea storage form for this what
its the best I know of
for a top command you'd have to read the entire yaml file and parse everything into your memory
tho actually
alisa is also just starting, so maybe yaml might be it
lynx what would be a better way then
i don't want to use a db
yml is pretty fast in reading tbh and im not sure why I would use a database for it
because a single yaml file does not scale whatsoever
wdym
lets say you want to get the balance for a specific player
I dont think its gonna be for a server with thousands of players
oh
continue xD
Well, for any player you will have to read the entire file / keep it in your servers memory
yes then it is loaded and lives in your server memory
at which point, you are maintaining a map with an entry for every player that ever joined the server
for a small server thats probably enough
I mean the question isn't active players
oh
it is more, total players that will ever join the server
doesn't essentials use yml?
big servers use essentials
they have individual yaml files for each player
yea, most likely the better decision anyway
okay, ty
your balance top is going to be harder however
as you will either a) have to loop over all files or b) keep some form of cache for the top
a is easier
maybe have an extra file which contains all the values which you update periodically so its easier to read the top?
possible but again, less efficient, make sure to run it off the main thread (the file reading)
how do u use threads
i think runTaskAsynchronously() or something
ty
why the sound isn't playing?
this condition is on playerJoinEvent, every other condition on the same event is working but this, not
what is SoundName
you know SoundName has to be a valid sound too
it cant be just pig_oink
you know
it is, lol, its a string
Sound.Somesound is the proper thing you need
what is it set to currently?
unless he is dealing with resourcepack
ORB_PICKUP
specific sounds
im running 1.8 for test my plugin on that version
You have to add the
but its 1.13 api
oh i didnt see the sound.valueof() in front
i have no idea what is going on still tho. just 3 lines of code isnt going to help man
you don't need more
โ โ โ
honestly those lines of code look fine. if its not working the error is somewhere else
more lines won't help you on nothing, the next lines are another conditions on the same event working properly
i know they are good but is not playing for some reason
:thonk:
maybe cause im running XSeries? idk?
is the path for the config correct?
yep
- We don't know the value of SoundIsEnabled, your configuration file either. Only we can assume.
- Can you show me your configuration file
- Why are you reluctant to show your other code?
help me pls
because you don't need that
well its set to false
i just set now, when i joined it was on true
you just showed it above...
when you ask for help, provide necessary information. we could only assume from that code
i could just say its properly set and not send anything
it is
If it is, then that means it may work for some legacy version
but will not work for future versions
well if you don't know what im talking about then don't try to help
.
it's fixed
wasn't any config or sound problem
what was it then?
another string was using sound as name
you see, this is why 3 lines isnt going to help...
those string wasn't even on the event
I just lost a brain cell
just one? youre lucky
Yeah lmfao
I only had 2 to begin with
EntityDamageEvent
thanks
i have another question
i just saw a post on bukkit
to launch a firewall
i tried it and works on command but not on event
๐ค
This is on a command
and "onCommand" i have this
and works
works good
but
i have this on Main
and on player join event i have this
and is not throwing the firework and any error is shown
great use of casting
what?
the method for spawn using a .class not need the cast because already return the instance in this .class
you mean items currently in the world floating?
loop through the worlds and then loop through the entities in those worlds. check if they are instanceof Item
or if you just want to have the number of items, use the stream api
only need know only works for chunks loaded.. if the item in a unload chunk then the method not return this entity
he could save the entities in that chunk on unloading
ok what im going to say next is gonna be mind boggling:
Step 1.) learn java ?learnjava
Step 2.) after learning java, learn spigotmc api
Step 3.) success
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
why learn java when skript exists
i hate wiki.vg
how can i edit an error there
which made me suffer for 3+ hours
i don't want others to suffer
wtf is shield height
and the data in the table is incorrect
byte index of dye color for shulkers is 18 not 19
i've used protocollib to compare two different shulkers
well its not in the byte field 18
it could be 17 tho
lemme try
this data is really either outdated or incorrect
if has a account you can edit the article not?
ew
I never managed to send a packet right the first time
With protocol
And most of the times it took hours just to figure how it works
PacketDataSerializer and some Netty stackoverflow copy pasta taught me how to manipulate those bytes and how the minecraft's protocol works
I've started recently to learn how does it work
How can I check if a recipe is equal to my custom recipe? I've tried using
e.getRecipe().equals(Main.getHeartRecipe())``` but to no avail...
It seems that e.getRecipe() creates a new instance of recipe every time, so theres no real way to compare it
you can get the namespace and check this
Ok, thanks
Recipe doesn't seem to have a method that gets the namespace...
And the PrepareItemCraftEvent doesn't have anything like that either
You need to check and cast to keyed
Iirc all crafting recipes should be keyed
But stuff like merchant recipes are not
Oh, ok
That would look something like this?
if(!(e.getRecipe() instanceof Keyed)){
return;
}
Keyed recipe = (Keyed) e.getRecipe();
CraftingInventory inv = e.getInventory();
this.plugin.getLogger().info("Recipe result is: " + e.getRecipe().getResult().toString());
yโall think that using sb teams to edit a playerโs username wonโt mess up scoreboards?
why use pc when gameboy exists
Yes
alright
im surprised that it can open that far
and the most interesting part is that the hitbox is dynamic
that means you can create custom block hitboxes
by utilising shulkers
neat
who would've thought that mojang would put effort into something and give it a dynamic hitbox
meanwhile they make it so that when cats sit on a fucking chest, you can't open the chest
by utilising this trick you can make armorstand furniture have some sort of simple collision, since shulkers act as blocks (they're fully solid in terms of movement)
if i included the spigot api as adependency in a plugin
and then added that plugin as a dependency in another maven project
would the spigot api be added to that maven project? or would i have to do something different to include it
lemme check
I wanna make a shulker force field
Yoo smart. I'll see if I can get that in to CombatLogX
Wait are you the dev of combatlogx?
Or do u wanna make a pr
Maybe it's time to let it die
I'd have used them to do something similar for sure
hey i need help with nms
so basically
i find that PathfinderGoalNearestAttackableTarget
makes the EntityWolf get the red eyes
but when i looked at the PathfinderGoal all I see is the setGoalTarget
Can I put the lore of an item using getStringList?
but then I cant find anything that uses the .setAnger function
angreyBoi = true
๐
i want to set a target without making the wolf angry
is that possible
angreyBoi = false
2 blocks
Ow
um
that's not how it works xD
make it how it works then
like whenever i set it to 200 its lower than 160
theres a function in EntityWolf called .setAnger
just do it
It will still be super useful for blocking passable blocks like scaffholds
Is possible?
Yes
wdym
Thanks
wait a minute
you can change direction of a shulker too!
that means that the hitbox can go horizontally too
i want to automate a process
Process process = runtime.exec("mvn install:install-file -DgroupId=" + groupId + " -DartifactId=" + name + " -Dversion=" + version + " -Dfile=" + file.getAbsolutePath() + " -Dpackaging=jar -DlocalRepositoryPath=" + repository.getAbsolutePath() + " -DcreateChecksum=true -DgeneratePom=true");
process.waitFor();```
but it gives me this error: java.io.IOException: Cannot run program "mvn": CreateProcess error=2, O sistema nรฃo pode encontrar o arquivo especificado (The system cannot find the specified file)
if i included the spigot api as adependency in a plugin
and then added that plugin as a dependency in another maven project
would the spigot api be added to that maven project? or would i have to do something different to include it
probably added too
You would need to add spigot in the other project
Assuming you want to use spigot methods yes
that makes sense, thanks
Otherwise only lib needs it
what if u do smth like this
the dependency has a method like this:
public static ChatColor c(String cc){
return ChatColor.valueOf(cc);
}
and u use that method
will it work?
Ping me with results
sure
Idk then
Try to do it like buildtools
It downloads maven in to a folder and launches that
So the mvn part will be the full path to the installed maven folder
hmm
sadly this seems to be removed
16th byte index - Direction of shulker
17th byte index - Shield height of shulker
18th byte index - Color of the shulker (dye color)
Ah
DataWatcherItem[index=16, value=DOWN, dirty=true]
DataWatcherItem[index=17, value=160, dirty=true]
DataWatcherItem[index=18, value=16, dirty=true]]
^ output from protocollib debug
i will use what you said about downloading maven
Just one thing that would bother me
I have a custom path for .m2
That would be ignored
Guess it doesn't matter much
yep horizontal hitboxes would also work
and the magic is that the packet entities have no collision
so they can be pushed inside blocks
for example you can have invisible slabs
the only problem is that the invisible flag only persist for shulker shell only but not the mob inside it
Yeah
if i included the spigot api as adependency in a plugin
and then added that plugin as a dependency in another maven project
would the spigot api be added to that maven project? or would i have to do something different to include it
public class BanCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (p.hasPermission("punishments.ban")) {
if(args.length == 2) {
if (Bukkit.getPlayer(args[0]).isOnline()){
Player target = Bukkit.getPlayer(args[0]);
target.banPlayer("reason");
} else {
p.sendMessage(ChatColor.GREEN + "Player is not online");
}
} else if(args.length == 1){
p.sendMessage(ChatColor.GREEN + "Please provide a reason");
} else {
p.sendMessage(ChatColor.GREEN + "Please provide a player");
}
} else {
p.sendMessage("You do not have the required permission");
}
}
return true;
}
}```
This throws back the error
can someone help? this is urgent
Didn't I already awnser you
?paste please
im not sure if I understood that correctly but Spigot API is runtime provided, that means that in order for plugin to work correctly it requires implementation of Spigot API to run
u didn't reply, so i didnt see it
.
mk
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
or simply, no it wouldnt add spigot api inside another project
Thank you and sorry olivio ๐
Caused by: java.lang.NoSuchMethodError: 'org.bukkit.BanEntry org.bukkit.entity.Player.banPlayer(java.lang.String)'
check your spigot version
its 1.17.1
and the spigot api version?
banPlayer doesn't exist
1.17.1-R0.1-SNAPSHOT this is it right?
declaration: package: org.bukkit, interface: BanList
declaration: package: org.bukkit.entity, interface: Player
this doesnt have any methods
with the name banPlayer
Yeah Paper only API I'd assume
Any way to get a potion's base duration and base level?
declaration: package: org.bukkit, interface: OfflinePlayer
That's Paper not Spigot
yeah my bad
It doesn't exist in Spigot
me <- ๐คก
lol
bump
To string doesn't return NBT. I'm going to assume this is the issue
Then what does it return? when I printed the toString method it certainly looked like the NBT
also if that's true then how do I get the NBT of an ItemStack?
Nms
You would need NMS to get the raw NBT
If you don't know how to use NMS concider looking in to the adventure api
never heard of nms before
I'm pretty new to plugin development
noted
Is your server running Paper?
If you have any issues or question s, the dev is pretty fast to reply
If so use the adventure api it's already included
On his disc
Alright then NBTAPI it is
Yeah most would say so
Since you're on 1.8 you haven't seen the amount of api additions
Paper doesn't have pointless deprecations as far as I know
There's a good reason for things
I've also developed 1.16/17 plugins and i haven't seen many useful things tbf
breh
They deprecated lore methods and put some that are more annoying imo
Well yeah that's smart
that was for very good reasons tho
^
I like the components tho
so why are you complaining 
The forbidden ๐
Anyways i mainly prefer spigot for compatibility
So i try not to use paper stuff when i can


UwU
how i can get the item on the first hand?
because player#getItemInHand() is deprecated
UwU
ok ty
Believe it or not, in recent versions, aka the past 5 years, steve has had two hands
and alex has 5 hands
fun fact, in the oncommand method there's a string[] object of the arguments
Very fun
no way, how did they do that??
github down?
im so helpful today uwu, if my answer solved your question, please mark it with a โ reaction! UwU!
yup
Anything specific?
Time to decompile the jar and read
The most recent commit from last night
its nostalgic seeing this chat ngl
came here to ask the same lol
How would i get an item stack's base potion effects? (Not the custom ones. I know about PotionMeta#getCustomEffects.)
declaration: package: org.bukkit.inventory.meta, interface: PotionMeta
hmm i wonder if jenkins lets me view sources
Probably not
ayyy github back
Ah nice
ItemStack ItemToRename = p.getInventory().getItemInMainHand();
ItemMeta ItemToRenameMeta = ItemToRename.getItemMeta();
ItemToRenameMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', args[0]));
this isn't renaming the item
am doing well?
PD: no error on console
You forgot to set the meta again
nvm i was just lucky to load a page once and it was the wrong one
^
Also please lowerCamelCase your variable names
oop sorry for ping
No worries
pascal_case when Kappa
popularize snake-case
or actually wait is this snake_case
and this is kebab-case
idfk
Minecraft's protocol really makes me cringe
Lets_Just_All_Get_Along_here
cases-dont-make-sense
there's A FUCKING FIRE flag in inherited Entity CLASS
why would I want another flag
for no reason
but no
i need to extend the class
and reimplement this
shit
why?
and how i can set again the meta
I imagine a blaze could technically be on fire and then not on fire
I want the mojank emoji ;/
just like any other mob can
damage is controlled by the server
or this
Why not just one byte
with bitmasks
they do utilise bitmasks in other classes
but this madam is the exception
Can anyone tell me the depen won't load for me https://jitpack.io/#johnrengelman/shadow
Show your build.gradle
why there isn't a need?
Also github down
ah that's why then prob
I'm not able to load up the website
eta on it going back up?
sadness
Not yet
madam
If args[0] are null, then this happens, what is te if statement for disable this? if(args[0] === null) ?
i mean, if there is no args[0]
check length
check if the length is 0
args.length
not indices
github is down
i know, but that pony gives me the chills
yeah defo unicorn i was just too lazy to type it all out
i wish discord had tab completion features for texting
if(args.length = ?
Gboard gives me suggestions
what do you think hmm
If the length is 0 then there is no args[0]
length is always 1 higher than the max index if it isn't 0 (as 0 means there is no valid indices)
if(args.length = 0)
dym that?
if args.length == 1 args[0] is almost never null
An array can contain null values. The args won't though
How would I iterate through blocks at around a player
Sad boi
Do you guys know if you can use ShadowJar with maven?
Use the maven shade plugin
He's not making a plugin I'm afraid
^
And?
Oh no he's right Tony
is he though
you can just use the shade plugin, it's not just for spigot
I have no clue how to do that
Interwebs
Use Gradle 
also that
Make me a remapper then
Paperweight
You can already convert!
can I really though
idk if its any good
yall it took 8 hours and asking the plugin authors for a feature addon
But paperweight isnโt spigotttttt
But You can finally trade with Citizens2 npcs
Close enough ;/
:o github codespaces went down again
Im just lucky to view a page every few mins
But if I use paperweight I might accidentally use paper API methods
its easy to do with Component's
why not just make your own npcs
do click this after https://imgur.com/EIFUZW3
True but you could just check javadocs
Because effort, i would have to handle everything npc's do by default, and create my own data storage system
With NPC's i can just dump the villager trade data to the NPC and let minecraft handle the save data
Making your own NPCs take time
I mean tbf
Citizens makes it easy
Between havin to get Citizens fixed or making my own NPC
it would of taken about the same length of time
If the authors had the meta deta tag that allowed trading already i wouldnt of been through the whole shuffle xD
and yeah agreed, i would have to handle loading in and unloading the npcs, removing its ai and many more stuff
I wanted to make this whole plugin where i didnt need data files in my own plugin
how long does it normally take to learn java?
That varies greatly
^
without learning apis
if you have no previous programming knowledge, ide say more than a month for bare basics if you actually dedicate time to it
just java
^
Fast learning really is a huge factor, some people are just naturally good with java xD
burch how long have u been learning java?
๐ฎ I got it wokring
Ive been doing this BS for almost 4+ years now
when u say bs do u mean u dont like it anymore?
can i set lore with a single string and not a stringlist?
^
Collections::singletonList or List::of could suit you
yeah altho it creates an extra array
Then use the aforementioned methods
Collections.singletonList(ChatColor.translateAlternateColorCodes('&', args[0])));
the IDE suggested me that
looks good
Sure
great
just joking around haha
Thanks everybody
Machine learning is gonna replace us all
Soon it will code for us
The people who make programs that code more programs will be richer than those who own the worlds oil reserves
Github copilot ๐ณ
But your code is on github
Fuck gotta switch to stash
So it's not safe from being put in to the copilot
I wonder if an eclipse addon exists for it
if(p.getInventory().getItemInMainHand() == null) {
this condition is not working for some reason..
๐ฆ
Show entire code and what line is the error on
If it's on that line p is null
the problem is
it gives error on the line that change the lore, when the item is air
so the condition is not working
maybe i need to put return false;?
to stop executing code?
can you show the whole NullPointerException?
yes
Line 48: ItemToReloreMeta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', args[0])));
It only happens when the item in hand is air
i already did that but is not working
additionally, variables being with a lowercase letter
check if the item meta is null
if(p.getInventory().getItemInMainHand() == null) { p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(InvalidItem))); return false; } ItemStack ItemToRelore = p.getInventory().getItemInMainHand(); ItemMeta ItemToReloreMeta = ItemToRelore.getItemMeta(); ItemToReloreMeta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', args[0]))); ItemToRelore.setItemMeta(ItemToReloreMeta); p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(Relored)));
if(p.getInventory().getItemInMainHand() == null) { is not null checking the item meta
you are null checking the item
what are?
variables doesn't matter if they are on upper or lowercase
or at least i think
Yea but the conventions do not agree with you
While both do work following conventions is best
https://google.github.io/styleguide/javaguide.html this is googles java style guide
if you want to read through that
it doesnโt need to be followed but it is best
Making threads is okay right? (For discord, not the NMS threads)
Yes
Threads are good
Ah awesome
threads yummy :p
You want the opposite
no i don't (ig)
if null
sendmessage saying cant rename air and return false
?
How was I supposed to know what what below
ohh that makes sense
don't worry is not your fault
Dynamic listeners for classes?
Textures maybe
how
FallingBlock b = world.spawnFallingBlock(block.getLocation().add(0, 2, 0), block.getType(), block.getData());
b.setDropItem(false);
Core.i().getServer().getScheduler().runTaskLater(Core.i(), () -> b.setVelocity(new Vector(0, 1, 0)), 2L);```Anyone got a clue as to why my falling block isn't being launched upwards?
maybe itโs the 1 in the Y axis maybe it should be -1
The blocks spawn fine, i added 2 to the coordinates so I could see them fall down
and so it does, they just fall down & their velocity doesnt change to the one I set
why are you delaying applying the velocity?
Because since it didn't work when I didn't delay it, I thought maybe I had to delay it by a tick
Thought maybe it hadn't fully spawned yet or something
this works fine ```java
public class BlockCannon implements Listener{
@EventHandler
public void onLeftClickAir(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND
|| event.getAction() != Action.LEFT_CLICK_AIR
|| event.getItem() == null
|| !event.getItem().getType().isBlock()) return;
Player player = event.getPlayer();
Location loc = player.getLocation();
Vector direction = loc.getDirection();
Material item = event.getItem().getType();
FallingBlock entity = player.getWorld().spawnFallingBlock(loc.add(direction), Bukkit.createBlockData(item));
entity.setVelocity(direction.multiply(2));
}
}```
a block cannon
people have been telling me to use sql rather than just making a data.yml
can anyone point me in the direction on where to start on that?
learning sql would be utterly crucial
how i can get all items reparables from the player inv?
ye im realizing that
https://gyazo.com/6d088ad65b6f80e492e8f77c2a3bab76
for (int x = radius; x >= -radius; x--) {
for (int y = radius; y >= -radius; y--) {
for (int z = radius; z >= -radius; z--) {
Block block = bottomBlock.getRelative(x, y, z);
if (block.getRelative(0, 1, 0).getType() == Material.AIR) {
FallingBlock b = world.spawnFallingBlock(block.getLocation().add(0, 2, 0), block.getType(), block.getData());
b.setDropItem(false);
b.setVelocity(new Vector(0, 1, 0));
}
}
}
}```
once you've understood sql
go ahead and try to do something with sql using java
and ofc I'd suggest learning about concurrently dispatching code in Java
(async)
Yes, you are spawning multiple blocks and they are colliding with eachother
?
Doesnt async just mean like at the same time as smthng
fixed
even when spawning a single block it doesn't work though
Asynchronous -> things do not behave in a synchronized manner, can happen single threaded, the important part of asynchronous is that it disregards the linear code flow
Concurrent -> a bit more specific where things run on different threads
Parallel -> things can run on different threads, on top of that things might happen on different cores or cpus which means two things can be done truly at the same time
how i can get all items reparables from the player inv?
I'd guess you are spawning your first block inside the player, again collision
then attempt increasing yrou velocity. As you can see in teh code I provided it works perfectly
just add the class I gave you and register its listener. Its a clean example
The only thing that can stop your falling block is a collision or too weak a velocity
set x value to - 2
yeah it does, i'm really confused right now
how i can get all repairable items from a player inv?
Loop and check if their meta is repairable
example?
do a foreach with player's inventory contents
get meta
iirc you can check if the meta is instanceof Damageable
Correct
example pls
i tried 40 ways and can't found the correct way
for(int i = 0; i < p.getInventory().getSize(); i++) {
p.getInventory().getItem(i).setDurability((short) 0);
if(i == p.getInventory().getSize()) break;
}
this?
for(//player inventory contents){
if(item.getmeta instanceof Damageable){
isn't setdurability deprecated?
it is
then why do you use that
i told you
you need to check if the meta is instanceof Damageable
then cast the meta to Damageable
and use its methods
then how?
learn java
i learn when people that know teach me
too bad im not teaching you
im not just coping and pasting
There are resources for that
go google it
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
what you said is one of the most entitled sentences i've ever read
why do you expect someone to teach you java?
๐