#help-development
1 messages ยท Page 1695 of 1
Time to make a plugin ๐
ok, good and bad news, good news: my give commands work, bad news: none of my events work
check if you set up curly braces correctly
mandatory DiD yOu ReGiStEr yOuR eVeNtS
You're missing your @EventHandler annotation
good old days when i also did so big rookie mistakes
and still do
Everyone is ๐คทโโ๏ธ
I'm not stupid, and I have my @EventHandler lol https://paste.md-5.net/nalegaduho.cs
thats the same thing as assuming there is a person https://www.youtube.com/watch?v=nC_14l9cdXw
You have on one of the listeners
Did you register the listener though?
"im not stupid"
[i] for even
class blah blah blah implements Listener
you can just use this
true true. am i lazy? yes. am i just finding excuses? yes!
wassup mate
hi
hi
so what my issue
sorry, I'm allergic to everyone yelling at me for doing something stupid and not actually telling me whats wrong
beginner
?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.
you gotta add @EventHandler
I did
NOOOO
yes im also bad at java
@fresh temple
SORRY
We need you even
on both methods
^
On the bottom method
you have to put on both methods
ooh
not only one
k
?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.
I missed one god
rude
Redundant if else ๐ข
ok then, i can do sysout
wait nvm
@solid cargo, this link is very useful for you!
?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.
that command was made for me!
k, now everything works except my "Admin Wand"
Oh no, not the admin wand ๐ข
what does the wand do? is it abusive? if yes then abort it, if no, then continue fixing it!
sorry dude
its not
it does a ton of damage thats all
it doesn't kick or ban or anything like that
https://sky.shiiyu.moe/stats/Plancke/Blueberry#Armor go look at this player's armor
it kinda counts as abusive of my opinion
whats that?
whatever
@solid cargo wrong channel
its my plugin for me and my friends, its not going public or anything
#general for offtopic stuff
its for dev stuff?
- nobody cares about hypixel skyblock
?
well i do, anyways, as you said, wrong channel
can u please continue helping me? my arrow isn't working at all
it isn't spawning anything
you will have better luck in making this with visualbukkit
what is that
^
sorry
better to understand for beginners
oh sorry i will shut my fucking mouth
sorry
i apologize for causing trouble
I wasn't even talking to u lol
anyways, people want to help you. if they ask you to learn java, learn it!
out of curiosity
and yes, im bad at java stop screaming at me about saying stuff that applies to me
how many people came here trying to make their first plugin and got the "learn java" card pulled on them
pretty sure that's a majority
ALL OF THEM
INCLUDING ME
?learnjava whats the best one
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.
and that's ok
oops wrong chat
depends on which style of learning you prefer
I like doing
say obscene words
more
please
russian
say obscene words
who knows obscene words in Russian?
wrong channel
Short question:
I try to add values in my Database with my plugin. and i created the following Class for it:
https://hastebin.com/zasecupifo.java
inmy main class i call
private MySQLMethoden mySQLMethoden;
public void onEnable() {
mySQLMethoden = new MySQLMethoden(this);
but i get the following error, when the respective methods are executed via the server.
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
at de.straussfalke.straussfalkeplugin.MySQL.MySQLMethods.addPlayer(MySQLMethods.java:22)
the error leads back to the line
stmt.execute();
can anyone help me with this by any chance?
how can I make one stick get into my hand when I click a stick?
if you take it in the left hand, 1 stick will be taken from the left hand, if you take it in the right hand, 1 stick will be taken, if you take it in 2 hands, the left and right hands are used.
how can this be done normally?
what
I need to take the object out of my hand
PlayerInteractEvent.getHand() == EquipmentSlot.HAND
^^^^
if the click is in the right hand, pick up from the right
if the click is in the left, pick up from the left
if the click is in the left and in the right, pick up from the right
I gave you all the code yesterday to reduce a stack size. You just need to apply that to which ever hand you are using.
if(PlayerInteractEvent.getHand() == EqupmentSlot.HAND)
player.getItemInMainHand().setAmount(<>)
else
player.getItemInOffHand().setAmount(<>)
thanks
I will try
you have to account for a couple of things such as if the hand is filled
how?
figure it out ๐คท๐ฟโโ๏ธ
I can't do it in any way
Actually could just do
ItemStack item = PlayerInteractEvent.getHand() == EquipmentSlot.HAND ? player.getItemInMainHand() : player.getItemInOffHand();
item.setAmount(<>);
yeah but you have to switch the item to the other hand
that ternary shoots itself in the leg
he didn't ask that
^^
I can, if I take 2 blocks in my hands and stand at point-blank range
no you can't
How about I record a video and send it?
You will see both placed, but its TWO events
yes
2
left, right hands
@quaint mantle
how can this be done?
cancel the event
if the other hand isnt a stick or is full
return
take it from the hand
give it to the other
I didn't understand. I use a translator it's bad
can you write the code please?
๐ฅ
?
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
what?
Yeah that command didn't really fit there
event.setCancelled(true);
ItemStack item;
ItemStack alternate;
if event.getHand() == HAND {
item = event.getPlayer().getItemInMainHand();
alternate = event.getPlayer().getItemInOffHand();
}
else if (event.getHand() == OFF_HAND) {
item = event.getPlayer().getItemInOffHand();
alternate = event.getPlayer().getItemInMainHand();
}
else {
return;
}
if (item != STICK || alternate != STICK || alternate.getAmount() == 64) {
return;
}
item.setAmount(item.getAmount() - 1);
alternate.setAmount(alternate.getAmount() + 1);
now dont you dare just copy and paste this
okay
thanks
thats why i made the code not work syntatically or whatever the word is
I'll try
CTRL+C
))
e.setCancelled(true);
ItemStack item;
ItemStack alternate;
if (e.getHand() == EquipmentSlot.HAND) {
item = e.getPlayer().getInventory().getItemInMainHand();
alternate = e.getPlayer().getInventory().getItemInOffHand();
}
else if (e.getHand() == EquipmentSlot.OFF_HAND) {
item = e.getPlayer().getInventory().getItemInOffHand();
alternate = e.getPlayer().getInventory().getItemInMainHand();
}
else {
return;
}
if (item != ItemUtil.item(Material.STICK, null) || alternate != ItemUtil.item(Material.STICK, null) || alternate.getAmount() == 64) {
return;
}
item.setAmount(item.getAmount() - 1);
alternate.setAmount(alternate.getAmount() + 1);
}
not working
He did say it would not work if your copy/paste it
read it, learn from it and do it.
okay
I copied it and changed it
worked
thanks
@quaint mantle
np
if you take the sticks in 2 hands, writes HAND and OFF_HAND
how to fix it?
?
sticks
?paste
I need that if the sticks are in two hands, I climb with my right hand until I run out of sticks
ItemUtil.item(Material.STICK, null) what even is this
one sec
thats so useless??
just check if the type is a stick
actually
private final ItemStack stick = new ItemStack(Material.STICK);
why create an item everytime you click it?
tnt
I need to pick up 1 dynamite after triggering
What
lol, I have no idea what he's doing, sticks in hands lets you climb, sticks change hands depending on how you click, now you get tnt using sticks?
Maybe their plugin is worshiping stick gods 
Lets build a house, with sticks
Just hope there's no wolf
๐บ
๐ฌ๏ธ
if you take the stick in your left hand and the event is getItemInHand, nothing will happenั
I need to pick up one stick when clicking on it
whaaaa
did i not give you the solution?
๐คจ
,
?
public class ChunkListener implements Listener {
Random random = new Random();
int amount = Main.instance.getConfig().getInt("amount");
@EventHandler
public void onChunkPopulate(ChunkPopulateEvent e) {
for (int i = 0; i < amount; i++) {
int x = random.nextInt(16);
int z = random.nextInt(16);
Block b = e.getChunk().getBlock(x, 0, z);
int y = e.getWorld().getHighestBlockYAt(b.getLocation());
e.getChunk().getBlock(x, y + 1, z).setType(Material.FIRE);
}
}
}
How do I improve that? I am getting some rubber banding when using that so is there a way to not stop all server activity while changing the blocks?
this is a great tutorial
@quaint mantle
help me please
Thanks Ill try
i would if i could
but i have no idea what you're trying to do
How about I take a video and send it?
im having some issues with my server. it keep saying "Unable to register Log4j shutdown hook because JVM is shutting down. Using SimpleLogger" and then getting in a restart loop
?paste I have an item and when I right click it doesn't do anything, here is my event
show the full event
also - why not just use the pdc
?pdc instead of checking the meta
You could also use launchProjectile
I'm dumb
@shadow tide check your pings
and I've never heard of launchProjectile
cool
can I just copy and paste my meta? or do I need to make it again?
?
can I use the same meta
ye
k
its just a tutorial on how to better manage your items
cool
yes conclure, im adding a pdc page
good
everything was perfect until I saw
if () {
}
else {
Shut
its supposed to be }else{ ๐
if () { } else
{
}
wtf
if (asdsd) {
something();
} else {
other();
}
if (asdsd) {
something();
}
else {
other();
}
^ its just so much better
former, former, former

My item manager has EVERY item in it
so its an item repository then or item registry
but yes using separate classes is probably good if you're looking to make your code more reusable
I prefer the former
but in this situation I'm more prone to doing a
if (asdsd) something();
else other();
or sometimes
if (asdsd)
something();
else other();
(but that's only really if asdsd has a longer name)
if (x) if (y) o(); else p(); else a();
inline ifs are only really used for null checks or validation calls
I prefer removing redundant information over "readability" for other people
this is awful though
condition = True
print("true" if condition else "false")
oh yeah why the fuck does Python use True instead of true?
I dont know
i hate it
i think its because its not a keyword, its just a constant
atleast it doesnt use nil
you see now one of the reasons I dislike Python
stylization
it is such a mixed language in terms of its style
// Cancel the event. This prevents the player from interacting with the item. does this mean that they won't be able to right click?
Yes
k
googleโs stylesheet does not agree with you
I made a plugin you can shout water sources with. But if there are exactly 5, 7, 9, 11,.... Blocks between me and the target its not getting hit. That means the water is not being placed on every block on the vector between me and the target. How can I fix that?
https://gist.github.com/ItzJustNico/0de94ce7dce1c64294a278a875fbc9e4
if()
{
}
else
{
}
``` anyone?
I cant find enum constant for dye, can anyone tell me how to get dye
getting this error while compiling for 1.17 and JDK 16 with Maven (I can't seem to find a solution on the forums:
Unsupported class file major version 60
stupid question, I want to organize my plugin, can you use onEnable in a class other than the main?
you cannot
k
The class has to extend JavaPlugin to use onEnable, and you can only have 1 class do that. Technically you could have onEnable call another method in another class and do all the work in there
You're not using Java 16 to run
bump
What version
I should be where can I check if I do? I'm on IntelliJ
1.8.8
@quaint mantle private final ItemStack wand; this is unused
?
in your tutorial thing
what
you did private final ItemStack vanisherItem;
pls help
Open project settings and see the target jdk
okay?
it says its unused, is it even necessary
It is used
when?
public ItemStack getItemStack() {
return vanisherItem;
}
also when you're checking the item
Yep
pls
help him
I'm using Maven and building by clicking package
thanks for the pdc tutorial, these are going to be very helpful and whenever I need something I'm going to look here https://github.com/ImajinDevon/SpigotCamp before asking at this discord server
๐๐ฟ
Does the error come when building or running server?
When building
Hm
Since you're building with Intellij it should use the correct jdk
What you could do is just fix your path to jdk16 in case it doesn use the right one
@quaint mantle,
as should not be:
https://youtu.be/sRphrWhaY7A
how it should be:
https://youtu.be/gYfj0EAqQtA
Oh I see, and how would I do that?
one more thing, if you have time can you make an entityPDC tutorial, right now I know how but I can see myself forgetting
Are you on Windows?
yeah sure
yep
please write if you are here
do you have any use cases
a ton
Alright want to continue in DMs so we don't flood the chat here?
Sure
or a thread
Oh yeah threads exist
make a thread
lol
Forgot about them
lmfao fair enough
other people can join in and help with a thread
Unsupported class file major version 60
@imaginedev,
as should not be:
https://youtu.be/sRphrWhaY7A
how it should be:
https://youtu.be/gYfj0EAqQtA
Please, stop pinging me. If i were able to help you i would've
somebody will help you when they can
literally didnt ping you idk what you are on about imajin
he did before
okay
lol
i am not anyone's personal help assistant, i will help you if i can
can you help me 
Ok
List<String> strings = Arrays.stream(FillType.values()).map(Object::toString).collect(Collectors.toList());
im not familiar with streams
how could i filter out
any that are "AIR"
(that ^^^ may be a terrible way to do it - i haven't used them before)
List<String> strings = Arrays.stream(FillType.values())
.filter(m -> !m.isAir())
.map(Material::toString)
.collect(Collectors.toList());
might wanna use Material::name
what are they
just strings
instead of using two if statements is there a way to use some sort of or here? java if(event.getAction() == Action.RIGHT_CLICK_AIR)
i just wanna shove them in a dropdown
(not spigot at all)
i just thought i had seen you talking about streams b4
and i am going caveman brain on this
yeah i know about streams i just dont know what you're doing
In java, || is for 'or'
is filltype an enum?
k
I knew that I just forgot don't you dare learnjava me
List<String> values = Arrays.stream(FillType.values())
.map(FillType::name)
.collect(Collectors.toList());
@quaint mantle, can you help me?
why are there wierd circumstances
where you do this
SomeClass someclass = SomeClass.create("thing");
instead of like
SomeClassclient someclass = new SomeClass("thing");
SomeClass.create would be a utility constructor
new SomeClass(things), things would be all the required info
for example i could create a person
new Person("A", "B", 25, parentA, parentB)
i could make a utility method to generate a random person
public static Person randomBaby(Parent a, Parent b) {
return new Person(NameUtil.random(), NameUtil.random(), 0, a, b);
}
you also see this in UUID.randomUuid
omg how much better is this https://paste.md-5.net/culugeguge.java instead of this https://paste.md-5.net/itosemivog.cs, THANK YOU SO MUCH @quaint mantle
instead of making a random one on constructor, it has a method for that
haha nice ๐๐ฟ
thanks for the explanation
imaginedev
can you help me?
ask
as should not be:
https://youtu.be/sRphrWhaY7A
how it should be:
https://youtu.be/gYfj0EAqQtA
can people learn their lesson? https://dontasktoask.com
@paper viper
main?
if ()
if ()
๐ค๐ฟ if ()
@quaint mantle please actually click on the link and read it
use returns instead of nesting a bunch of if statements
Lol
programming discord HOF images
it doesn't work
lol
} else {
return;
}
your ide should be telling you that this is redundant
its a bunch of tabs, so i assume its not a good one
JUST USE ECLIPSE, ITS SOOOOOOO EASY
Intellij ๐ช๐ฟ
either are cool
just not some random one you found in a "Top 10 Progamming IDEs, Number 1 on our list is Microsoft Notepad!"
You should be using BlockPlaceEvent if you want auto-igniting TNT. That would get rid of the double tnt and placing it when you can't actually put it somewhere.
then it will not work in places where it is impossible to put blocks
You can still listen to cancelled events
bUt ItS cANcEllEd
@quaint mantle is it ok if this is public? private final ItemStack wand;
its just a getter
public ItemStack getWand() {
return wand;
}
Ewwwwww
its eclipse!
eclipse uses tabs ๐คฎ
๐คฎ
c'mon, eclipse is fine
The bestest evar!
people can have opinions, just not if they are blatantly stupid lol
Wand.getWand() this gives me an error because my getter isn't static but it can't be static
so make an instance
oh, ye me dumb
remeber
@Override
public void onEnable(){
VanisherItem vanisherItem = new VanisherItem();
// Register the item events.
this.getServer().getPluginManager().registerEvents(vanisherItem, this);
}
you can change it.
But better than intelliJ decompiler which uses 3 spaces for indentation
pretty sure you can change that too
Yes, of course. But having 3 spaces for indentation by default is a bit cruel
Either tabs or 2/4 spaces. But not 3
can you make a tutorial for commands lol, right now I'm using a command manager copied from a bad startup youtube channel and compared to my item it looks all f*cked up
Any ideas on how i'd create a plugin like votifier. Just trying to see how i'd listen for a vote through a website.
How to open this??
are you banned
@quaint mantle
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
what exactly do you want to open?
I am trying to make an npc to test my plugin on and i thought it would be as simple as making a new player and setting their location to me in game but it doesnt seem like it can anybody help me?
all i did was: Player testPlayer = new Player; testPlayer.teleport(sender);
thats not even valid java
You can't just create a new player anyway
^ its an interface
oh how would i do it then?
Google it
While technically possible, given that you ask this question, no
your IDE should have been screaming at you
Not possible, at all
yeah i did get an error from my ide thats why i was confused
i didnt test it yet
i wouldnt be able to anyway
And don't bother googling it, creating fake players is far beyond your knowledge
?
Is it possible to set custom item meta for recipe ingredients?
Its a complex task of diving down to core minecraft code and other wizardry
There are libraries that will aid you, but they won't abstract out everything
With just a shapedrecipe
Take a look at RecipeChoice.ExactChoice
Thanks
how can I prohibit the left hand if the click was in the right hand?
does it give an error if you add a command to the plugin.yml that doesn't exist? because idk if I can add future commands to it.
so what?
So you can't add a command to the plugin.yml that doesn't exist
k
ProtocolLib
how can I prohibit the left hand if the click was in the right hand?
you mean
list.size() == 2
?
Left hand gets called first
It's weird but PlayerInteractEvent gets called twice
Java has a queue interface
Once for each hand
Some lists are part of that though
if (e.getHand() == EquipmentSlot.HAND) {
yeah whatever
how to cancel the left hand?
how?
Just return
how?
return
if (e.getHand() == EquipmentSlot.OFF_HAND)
return;
?
how can I prohibit the left hand if the click was in the right hand?
hi i need help with the plugin goldencrates in minehut
ok
Is there a way to access the yaw and pitch of a player (ie the facing information in the F3 menu for clients). Location#getYaw provides the yaw for the body not the head
getEyeLocation's yaw and pitch are identical to getLocation
I'm trying to spawn an arrow and someone told me about the launchprojectile method, how do I use it, or more specifically where do I use it?
hello?
I mean, its not like I'm interrupting a question, soooo
any1 home?
seems like they all left
declaration: package: org.bukkit.projectiles, interface: ProjectileSource
the javadocs are rather straight forward
ik, I need to know where to put it
whenever you want to spawn the arrow ?
Ik its spoonfeeding but its one small question, so can you tell me the syntax please
@eternal night
it is a normal java method ?
wdym where? Clearly its a method for the projectile. So you call it on the projectilesource in whatever trigger you're using, whether its an eventhandler or what
no
you call it on an entity that can launch a projectile
e.g. basically every entity
if you just want to spawn a arrow without a shooter, use the normal spawn methods on the world
thank u
got it
sorry if it look like i'm being stupid but would this work? java Projectile entity = player.launchProjectile(Arrow.class, velocity); ((AbstractArrow) entity).setDamage(999999);
the method should return you an arrow instance
you can just store that in a variable instead of casting it like this
instead of casting it randomly like this you can just: ```java
final Arrow arrow = player.launchProjectile(Arrow.class, velocity);
arrow.setDamage(1);
you cannot change the variable reference after assigning it
e.g. ```java
final String a = "hi";
a = "bye";
does it have any cases where it is needed?
I don't think there is a need for a specific final variable in java.
there is implicit final variables
which are required to use a variable inside a lambda
I literally have no idea what lambda means lol
yea then don't worry about it xD
I wish there was a way to reload the plugins in a minecraft server without restarting it
./reload?
does that reload everything in the plugin?
Hey guys does CraftItemStack class not exist anymore?
It calls onDisable & onEnable again, and I think it clears all your Lists and Maps
Im playing around with 1.17 spigot api, cant find the import
k
@eternal night it isn't spawning anything
here is my item and event https://paste.md-5.net/qakesowacu.java
yes
validate that the respective code is executed
no just validate that your code is actually called in that event
? wdym
e.g. that the wand.isSimilar check is not messing you up
craftbukkit & nms are not included in the api, you need the full spigot jar as a dependency
I don't think it is, in another item it is basically copied and pasted but with a few meta and event changes and it works
Loop it and use getName
@eternal night
idk what to tell you xD
the method works
whatever else you throw around it is on you
yes I have entire jar as dependency. i found it it was just eclipse being stupid.
One question however, is net.minecraft.world.item.ItemStack the proper nms itemstack?
IntelliJ is not letting me import, how do i fix? if i dont it simply says "cannot find symbol"
whats the best way to display particles on an entity, while it's alive
should i just do as my question states
while(!Entity#isDead()){
particle stuff
}
?
or nah
use that and also a boolean to enable it too and stuff
okayyy
so that while() shouldnt cause much lag, right
if its just like 10-20 entities?
i would still recommend like a 1 second delay per check or something tick related
and def make it async
so ok
wait
so i should..
check for the creation of that entity, check conds to make sure its the right entity
make a while(), add a bukkitrunnable?
and display particles there?
what hell does conds mean
conditions
Oh
I mean are there any conditions you are checking?
to see if it has scoreboard tags
specifically, "UFO", and "CUSTOM"
"UFO" for the type of entity it is (a custom one)
and "CUSTOM" because,, its custom
imagine using scoreboard tags smh
yeah
i mean
PDC
doesnt that take memory though
as does scoreboard tags
but doesnt that take like, a lot of memory
its a map vs list
Entity#getScoreboardTags().contains("") ??
i prefer the scoreboard tags, personally
PDCs are superior in every way
I mean, scoreboard tags literally use a hash set that is just a hash map anyway
so memory wise the exact same as pdc
just obviously different things you store
while statement is a pretty useless solution for this
check for entity, create while(), bukkitrunnable?
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
im not sure i really want a scheduler that gets every entity, and compares
well the async version of this is submitted to a thread pool anyway
ah
not much difference to just spawning a new thread yourself and while looping
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
question obviously also is, does a thread/timer per entity actually make sense
true
hey man
how are u doing
I know u smart so got qustion for you xd
if I click on diamond on left it will add one diamond ore to enchanted one
so doop all
nbt data
so if soem one has key it could abouse it
by turning regular diamond block to one with nbt
any way to prevent that
Would getItemInMainHand().equals(ItemStack) check if there is also the same amount of the held item?
yes
isSimilar ignores amount
Oh
Thanks
Also, will remove/removeItem remove every instance of that ItemStack?
I only want to remove one
hi imagine
remove will, removeItem removes the amount of the item
hallo
actually correction
#remove removes all of the matching amount
removeItem removes the amount of the item
you can be lazy and set the amount of a copy to like 63936
then use removeItem, or loop and do it yourself
i would do the second
iam getting this error
its been 3 hours .. iam trying to fix i did everything i can
As in removeItem since I only want to remove one of the item?
The ItemStack is already set to one if that changes anything
inv.removeItem(item); // Remove as much as possible with the item's amount
inv.remove(item); // Amount-sensitive remove
how do i set the player's impostor status to true
im jk
im wonderingggg a few things actually i need to think of them
Ask away
ikr lmaooo ?ask
ok so
how should i get entities, fairly lag-free
i should just add them to a map, yes?
Hey I am a bit confused, so sending Packet through a Socket using ObjectOutputStreams works fine, but when sending a Packet when a Player connects causes this:
[00:28:37 WARN]: at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1710)
[00:28:37 WARN]: at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:493)
[00:28:37 WARN]: at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
[00:28:37 WARN]: at eu.sentinal.heliosclient.utils.DataManager.readObject(DataManager.java:81)
[00:28:37 WARN]: at eu.sentinal.heliosclient.listeners.DataHandler.listen(DataHandler.java:18)
[00:28:37 WARN]: at eu.sentinal.heliosclient.utils.DataManager.lambda$initManager$0(DataManager.java:38)
[00:28:37 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[00:28:37 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[00:28:37 WARN]: at java.base/java.lang.Thread.run(Thread.java:834)```
the Method I use to write Objects is the same as in every other part
Hey everyone, I'm running into a outofbounds exception for an item that pulls up a furnace interface. The strange thing is that everything works but it spams console with an exception as long as a player is looking at the menu. Can I just suppress the warning with @SuppressWarnings("IndexOutOfBoundsException") or will that not work?
Yeah that's my instinct too. But I've gone through all the lines that the error marks and I can't find the error. The strange thing is that it works exactly as expeceted other than the exception spam in console
does any1 know why nothing happens when I right click with this item? https://paste.md-5.net/fefagayagu.java
also it might help so my main https://paste.md-5.net/nocitavoqa.java
private final ItemStack wand;
yes
^ use the variable instead of calling a getter
k
show the adminwand command class
AdminWand adminWandItem = new AdminWand();
@SuppressWarnings("unused")
private final AdminWand adminWand;
what is this
๐คจ
wdym
you're creating two for no reason
they are different
no they arent
they're the exact same, thats why nothing happens when you only register one
k
AdminWand adminWandItem = new AdminWand(); // command class
delete this
that suppresswarnings is actually telling you whats wrong
listen to the errors dont ignore them
umm, even without this java AdminWand adminWandItem = new AdminWand(); it still shows the warning lol
and i bet there's errors
listen to me
create item
give item to class 1
give item to class 2
you're doing
create item
give item to class 1, even though its useless and wont be registered as a listener
also look at this
https://github.com/ImajinDevon/SpigotCamp/blob/master/ItemPDC.md better secure your item
sorry, I get it now
np
wait this
thats the answer
lol
What was the enchantment that made items have the enchanted glint but show no enchantment in the lore?
There isn't one by default
you can assign an empty nbt tag or just give it unbreaking 1 and set the itemflags to HIDE_ENCHANTS
The unbreaking trick only works if you don't want any other enchantments to show
ye
u can use luck
@shadow tide tip
instead of
List<String> lore = new ArrayList<>();
lore.add("A very, very powerful weapon.");
meta.setLore(lore);
use
meta.setLore(Collections.singletonList("A very, very powerful weapon."));
That should only add the glint?
Okay
I use mine bc I understand it, if you want to explain that to me I will happily use it
List.of?
immutable
Why would it need to be mutable
Idk
?
meta.setLore(List.of("A very, very powerful weapon."));
k
List.of("whatever"); creates a new list containing just one string "whatever"
Wat
still gonna use Collections.singletonList myself
Collections::singletonList is also immutable
new ArrayList<String>() {{add("A very, very powerful weapon.")}}```
that is so unbearably ugly
lmao
Yeah imagine tho wouldnโt be surprised if List::of might just delegate to Collections::singletonList
Vice versa?
No?
I think it would be singletonList -> list.of
Nope
This is how you get the center of a screen right sr.getScaledWidth() - (width / 2)
singletonList actually is its own thing
And it instantiates a class called SingletonList
An internal one
^
but why
i mean tf would it even do ๐
So maybe it's still there just for backwards compatibility
deprecate it !
lol
wtf is that formatting
Only thing that drives me nuts with these private internal implementations is that it breaks liskov substitution principle.
lol
Decompiled
Immutable list just throws UOE on add
Yeah
Java dev bad at java?
It's decompiled
Which breaks the List::add method promise of the interface
who even thought of creating a singleton list class
Itโs not that bad?
yeah i just dont know why it would exist
wait, where?
in my commands class
you say getWand() instead of wand
in your adminwand class
nowhere except creating the getter
Well yeah now when List::of exists itโs probably quite useless
I used ctrl + f
and seems like ImmutableList should be its own inteface
like you said, breaks the promise of the #add method
It is an abstract class in Guava, very nice
Yeah since a singleton list, the empty list, arrays:: aslist and a list::of all arenโt substitutable with List ๐ฆ
@quaint mantle
..
Figuring out Resource Pack magic
does any1 know why nothing happens when I right click with this item? https://paste.md-5.net/fefagayagu.java
also it might help so my main https://paste.md-5.net/nocitavoqa.java
and the command https://paste.md-5.net/urevisirag.java
why is no-one answering?
yeah, I get that but with a server of this size I feel like at least one person would be on, and no errors, anywhere
most of the people in here ask for server help
any plugins interfering
my plugin is the only one on my testing server
Try normalizing the velocity vector @shadow tide
oh yeah the velocity is 0
Is it 0 or some ridiculously high value that you can't even see it
Call normalize() after the getDirection()
k
And add print statements.
wut print statements, and why
Anything. To track your code.
Yeah
right clicking isn't doing anything

show new code with the debug statements
its not much different
show it
did you even add prints
?
yes
Plugin.plugin().getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "Player Right Clicked");
Plugin.plugin().getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "Player Right Clicked");
->
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Player Right Clicked");
k
also put it after the isSimilar check
if(!wand.isSimilar(event.getItem())) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Not the right item");
return;
}
oh
also extra_damage is an invalid attribute
idk why the name of an attribute exists, it doesn't do anything
?
extra_damage is the name of the attribute, not the type
in short terms, idk how I'm helping you, but the name of an attribute is redundant
u said this also extra_damage is an invalid attribute
its a name to it can't be invalid if there isn't one of the same name
Broooooooooo
the point is it works
lets just let go of the attribute and go back to the item not doing anything when I right click
@quaint mantle
i dont know
too bad no one can do your camp because of unobtainable requirements... 
๐
lol
if(!pdcManager.isCustomItem(event.getItem()))``` in your camp it uses the variable `pdcManager` which you make in the `VanisherItem` thing (please, tell me what its called), so its inaccessible. @quaint mantle
?
private final PDCManager pdcManager;
private final ItemStack item;
public MyItem(Plugin plugin) {
pdcManager = new PDCManager(new NamespacedKey(plugin, "myitems.item"));
item = this.makeItem();
pdcManager.assignCustomItem(item);
}
u didn't show these in the camp java private final PDCManager pdcManager; private final ItemStack item;
I did
its, common sense
if im assigning a variable you'd expect it to exist right
I followed your tutorial on Item PCDs and now nothing is working, its all saying "Wrong Item"
send the PDCmanager calss
try just doing a normal item
erase all of that custom meta stuff
add things one by one and keep testing them
I erased all the meta for my item and it still isn't working
I do have a bunch of items, if that makes a difference
they all have different keys, though
@shadow tide your code works perfectly for me
wuut
the f*ck
when I right click it shows Wrong Item
what did you do in your plugin thats different for mine
gtg
so if i wanted to make a vehicle
for the movement portion
would i be using packets?
block head*
well to add a player as a passenger to an armorstand im pretty sure you will need packets but for movement i think it should be fine if you just teleport the armorstand
.addPassenger()
i was told that is a thing
well how would i mimick realtime movement
i would avoid packets if you don't need them
teleport it like 0.1 block every milisecond?
well
it was randomly chosen
but
should i teleport it like a small amount per tick?
Cause i want to mimick boat movement
Including turning
you can get smooth movement by teleporting incrementally by tick
there is no way to update the position faster than a tick
packets won't help you there
just choose a speed in blocks/s and divide it by 20 and teleport the entity that much every tick
ye thanks
a normal boat is 7 b/s so i would start there
7 blocks per second?
yeah
so 7/20 every tick?
wait hold on
ye that would be 0.35 blocks per tick
nvm yeah its 7 b/s or 0.35 block per tick
Ah cool thanks!
I see a way to get the seed, nothing to set it though
Yea i dont think its possible
how does WorldCreator work? I see theres a constructor that takes a world name. Could I possibly just create a new WorldCreator and set the world name to "world"?
Then set the seed from there
probably
only oine way to find out
True
But by the looks of it I dont think I can use WorldCreator to edit a current worlds settings sadly
Buildtools keeps crashing when i try to update my server

