#help-development

1 messages ยท Page 1695 of 1

solid cargo
#

bad news: the zombie doesnt utilize jump boost to its full potential :(

sullen geyser
shadow tide
#

ok, good and bad news, good news: my give commands work, bad news: none of my events work

solid cargo
#

check if you set up curly braces correctly

quiet ice
#

mandatory DiD yOu ReGiStEr yOuR eVeNtS

sullen geyser
solid cargo
#

and still do

sullen geyser
shadow tide
solid cargo
sullen geyser
quiet ice
#

Did you register the listener though?

quartz pike
solid cargo
#

class blah blah blah implements Listener

onyx fjord
#

you can just use this

solid cargo
#

true true. am i lazy? yes. am i just finding excuses? yes!

shadow tide
#

what?

#

huh

#

I don't know what just happened

#

sorry

#

what

#

hello

solid cargo
shadow tide
#

hi

sullen geyser
#

hi

shadow tide
#

so what my issue

#

sorry, I'm allergic to everyone yelling at me for doing something stupid and not actually telling me whats wrong

solid cargo
#

whats ur java exp

#

if its same as me

#

then

shadow tide
#

beginner

solid cargo
#

?learnjava

undone axleBOT
paper geyser
#

you gotta add @EventHandler

shadow tide
#

I did

paper geyser
#

NOOOO

solid cargo
#

yes im also bad at java

sullen geyser
#

Even where are you?

solid cargo
#

@fresh temple

paper geyser
#

SORRY

sullen geyser
#

We need you even

shadow tide
#

lol

#

but, actually. where am I missing @EventHandler

quartz pike
sullen geyser
#

On the bottom method

quartz pike
#

you have to put on both methods

shadow tide
#

ooh

quartz pike
#

not only one

shadow tide
#

k

quartz pike
#

?learnjava

undone axleBOT
onyx fjord
shadow tide
#

I missed one god

quartz pike
#

rude

solid cargo
#

porque not work?

#

well it works

sullen geyser
solid cargo
#

ok then, i can do sysout

#

wait nvm

#

@solid cargo, this link is very useful for you!

#

?learnjava

undone axleBOT
solid cargo
#

that command was made for me!

shadow tide
#

k, now everything works except my "Admin Wand"

sullen geyser
#

Oh no, not the admin wand ๐Ÿ˜ข

solid cargo
#

what does the wand do? is it abusive? if yes then abort it, if no, then continue fixing it!

shadow tide
#

sorry dude

shadow tide
#

it does a ton of damage thats all

#

it doesn't kick or ban or anything like that

solid cargo
#
#

it kinda counts as abusive of my opinion

onyx fjord
#

whats that?

shadow tide
#

whatever

solid cargo
#

skyblock Profile

#

of an admin

onyx fjord
#

@solid cargo wrong channel

shadow tide
#

its my plugin for me and my friends, its not going public or anything

onyx fjord
#

#general for offtopic stuff

paper geyser
#

its for dev stuff?

onyx fjord
#
  • nobody cares about hypixel skyblock
shadow tide
solid cargo
shadow tide
#

can u please continue helping me? my arrow isn't working at all

#

it isn't spawning anything

onyx fjord
#

you will have better luck in making this with visualbukkit

shadow tide
#

what is that

quartz pike
#

^

shadow tide
#

sorry

solid cargo
#

better to understand for beginners

onyx fjord
#

oh sorry i will shut my fucking mouth

shadow tide
#

sorry

onyx fjord
#

i apologize for causing trouble

solid cargo
#

sorry doesnt change anything

#

that just makes you look more guilty of my opinion

shadow tide
solid cargo
#

anyways, people want to help you. if they ask you to learn java, learn it!

paper geyser
#

out of curiosity

solid cargo
#

and yes, im bad at java stop screaming at me about saying stuff that applies to me

paper geyser
#

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

paper geyser
#

^

#

including me

#

sometimes you'll know java but not know how to apply it

shadow tide
#

?learnjava whats the best one

undone axleBOT
onyx fjord
paper geyser
#

and that's ok

onyx fjord
#

oops wrong chat

paper geyser
shadow tide
#

I like doing

quaint mantle
#

say obscene words

#

more

#

please

#

russian

#

say obscene words

#

who knows obscene words in Russian?

paper geyser
#

wrong channel

burnt current
#

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?

quaint mantle
#

dayn

#

peace door ball

quaint mantle
#

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

stone sinew
quaint mantle
#

no

#

you want a stick to switch hands?\

#

yes, and it doesn't matter in which hand

stone sinew
quaint mantle
#

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

eternal oxide
#

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.

stone sinew
quaint mantle
#

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

stone sinew
quaint mantle
#

that ternary shoots itself in the leg

stone sinew
quaint mantle
#

he did

#

and if I press it in two hands at once

eternal oxide
#

You can;t press it in both at once

#

two events will fire

stone sinew
#

^^

quaint mantle
eternal oxide
#

no you can't

quaint mantle
#

How about I record a video and send it?

eternal oxide
#

You will see both placed, but its TWO events

quaint mantle
#

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?

#

๐Ÿฅ„

#

?

chrome beacon
#

?spoon

undone axleBOT
#

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.

quaint mantle
#

what?

chrome beacon
#

Yeah that command didn't really fit there

quaint mantle
#
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

eternal oxide
#

CTRL+C

quaint mantle
#

))

#

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

eternal oxide
#

He did say it would not work if your copy/paste it

#

read it, learn from it and do it.

quaint mantle
#

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

undone axleBOT
quaint mantle
#

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

eternal oxide
#

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?

quaint mantle
#

no idea

#

no

#

I just need to pick up a stick from the inventory when I click on it

hasty prawn
#

Maybe their plugin is worshiping stick gods Prayge

eternal oxide
#

Lets build a house, with sticks

hasty prawn
#

Just hope there's no wolf

quaint mantle
#

๐Ÿบ

#

๐ŸŒฌ๏ธ

#

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?

#

๐Ÿคจ

#

,

#

?

dense remnant
#
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?

quaint mantle
#

this is a great tutorial

#

@quaint mantle

#

help me please

dense remnant
quaint mantle
#

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

shadow tide
#

?paste I have an item and when I right click it doesn't do anything, here is my event

undone axleBOT
shadow tide
eternal oxide
#

show the full event

opal juniper
#

also - why not just use the pdc

shadow tide
#

?

#

wdym

opal juniper
#

?pdc instead of checking the meta

eternal oxide
#

You could also use launchProjectile

shadow tide
#

I'm dumb

quaint mantle
#

@shadow tide check your pings

shadow tide
#

and I've never heard of launchProjectile

quaint mantle
shadow tide
#

cool

shadow tide
quaint mantle
#

?

shadow tide
#

can I use the same meta

quaint mantle
#

ye

shadow tide
#

k

quaint mantle
#

its just a tutorial on how to better manage your items

shadow tide
#

cool

quaint mantle
#

yes conclure, im adding a pdc page

shadow tide
#

good

ivory sleet
#

everything was perfect until I saw

if () {
}
else {
quaint mantle
#

Shut

ivory sleet
#

its supposed to be }else{ ๐Ÿ˜„

quaint mantle
#

Ewwww

#

its so hard to read

ivory sleet
#

no

#

u

young knoll
#
if () { } else 
{
}
quaint mantle
#

wtf

#
if (asdsd) {
    something();
} else {
    other();
}
if (asdsd) {
    something();
}
else {
    other();
}
#

^ its just so much better

ivory sleet
#

former, former, former

ivory sleet
shadow tide
#

where is that?

#

I should also stop using managers and start using seperate classes

ivory sleet
#

depends what those managers are

#

manager itself is quite the ambiguous term imo

shadow tide
#

My item manager has EVERY item in it

ivory sleet
#

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

lavish hemlock
#

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)

ivory sleet
#

if (x) if (y) o(); else p(); else a();

quaint mantle
#

inline ifs are only really used for null checks or validation calls

lavish hemlock
#

I prefer removing redundant information over "readability" for other people

ivory sleet
#

I prefer verbosity

lavish hemlock
quaint mantle
#
condition = True

print("true" if condition else "false")
lavish hemlock
#

oh yeah why the fuck does Python use True instead of true?

quaint mantle
#

I dont know

#

i hate it

#

i think its because its not a keyword, its just a constant

#

atleast it doesnt use nil

lavish hemlock
#

you see now one of the reasons I dislike Python

#

stylization

#

it is such a mixed language in terms of its style

shadow tide
#

// Cancel the event. This prevents the player from interacting with the item. does this mean that they won't be able to right click?

chrome beacon
#

Yes

shadow tide
#

k

regal dew
slim kernel
#

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

Gist

GitHub Gist: instantly share code, notes, and snippets.

hasty prawn
#
if() 
{
}
else
{
}
``` anyone?
quaint mantle
#

I cant find enum constant for dye, can anyone tell me how to get dye

blissful folio
#

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

shadow tide
#

stupid question, I want to organize my plugin, can you use onEnable in a class other than the main?

shadow tide
#

k

hasty prawn
#

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

chrome beacon
blissful folio
quaint mantle
hasty prawn
#

You have to use magic values in 1.8 for dye/wool etc

#

Google time! PeepoHappy

shadow tide
#

@quaint mantle private final ItemStack wand; this is unused

quaint mantle
#

?

shadow tide
#

in your tutorial thing

quaint mantle
#

what

shadow tide
#

you did private final ItemStack vanisherItem;

chrome beacon
quaint mantle
shadow tide
#

it says its unused, is it even necessary

quaint mantle
#

what ๐Ÿ˜‚

shadow tide
#

The value of the field Wand.wand is not used

#

sorry

hasty prawn
#

It is used

shadow tide
#

when?

hasty prawn
#
public ItemStack getItemStack() {
    return vanisherItem;
}
quaint mantle
#

also when you're checking the item

hasty prawn
#

Yep

shadow tide
#

I did that with a pdc

#

just my little twist

shadow tide
chrome beacon
#

And how are you building

quaint mantle
blissful folio
shadow tide
quaint mantle
#

๐Ÿ‘๐Ÿฟ

chrome beacon
blissful folio
chrome beacon
#

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
blissful folio
shadow tide
chrome beacon
blissful folio
quaint mantle
shadow tide
#

a ton

chrome beacon
#

Alright want to continue in DMs so we don't flood the chat here?

blissful folio
#

Sure

opal juniper
#

or a thread

chrome beacon
#

Oh yeah threads exist

shadow tide
#

make a thread

opal juniper
#

lol

chrome beacon
#

Forgot about them

blissful folio
#

lmfao fair enough

shadow tide
#

other people can join in and help with a thread

blissful folio
#

Unsupported class file major version 60

quaint mantle
#

Please, stop pinging me. If i were able to help you i would've

#

somebody will help you when they can

opal juniper
#

literally didnt ping you idk what you are on about imajin

quaint mantle
quaint mantle
opal juniper
quaint mantle
#

i am not anyone's personal help assistant, i will help you if i can

opal juniper
#

can you help me NM_peepoPlease

quaint mantle
#

Ok

opal juniper
#

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)

quaint mantle
#
List<String> strings = Arrays.stream(FillType.values())
    .filter(m -> !m.isAir())
    .map(Material::toString)
    .collect(Collectors.toList());
#

might wanna use Material::name

opal juniper
#

oh

#

they arent materials

quaint mantle
#

what are they

opal juniper
#

just strings

shadow tide
#

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)

opal juniper
#

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

quaint mantle
#

yeah i know about streams i just dont know what you're doing

quaint mantle
#

is filltype an enum?

shadow tide
#

k

opal juniper
#

Enums -> List of strings

#

ie their values

shadow tide
quaint mantle
#
List<String> values = Arrays.stream(FillType.values())
    .map(FillType::name)
    .collect(Collectors.toList());
opal juniper
#

and a .filter(name -> !name.equalsIgnoreCase("AIR")) ?

#

ig

#

yep works

#

thanks

quaint mantle
#

@quaint mantle, can you help me?

karmic bear
#

why are there wierd circumstances
where you do this
SomeClass someclass = SomeClass.create("thing");
instead of like
SomeClassclient someclass = new SomeClass("thing");

quaint mantle
#

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

shadow tide
quaint mantle
#

instead of making a random one on constructor, it has a method for that

quaint mantle
karmic bear
#

thanks for the explanation

quaint mantle
#

imaginedev

#

can you help me?

#

ask

shadow tide
quaint mantle
#

@paper viper

paper viper
#

main?

quaint mantle
#

if ()
if ()
๐Ÿคœ๐Ÿฟ if ()

paper viper
#

Oh

#

let me get it

#

lol

shadow tide
paper viper
quaint mantle
paper viper
#

Lol

quaint mantle
quaint mantle
paper viper
#

lol

quaint mantle
#
                        } else {
                            return;
                        }

your ide should be telling you that this is redundant

shadow tide
#

is he even using an IDE?

#

please, don't say no

#

it hurts

quaint mantle
#

its a bunch of tabs, so i assume its not a good one

shadow tide
#

JUST USE ECLIPSE, ITS SOOOOOOO EASY

quaint mantle
#

Intellij ๐Ÿ’ช๐Ÿฟ

shadow tide
#

either are cool

#

just not some random one you found in a "Top 10 Progamming IDEs, Number 1 on our list is Microsoft Notepad!"

hasty prawn
quaint mantle
hasty prawn
#

So you just don't want it to double place?

#

Add a cooldown or something

young knoll
#

You can still listen to cancelled events

opal juniper
#

bUt ItS cANcEllEd

shadow tide
#

@quaint mantle is it ok if this is public? private final ItemStack wand;

quaint mantle
#

no

#

use a getter

shadow tide
#

k

#

can I just use the one that eclipse creates for me?

#

when I hover over the error

quaint mantle
#

its just a getter

shadow tide
#

k

#

idk

#

so

quaint mantle
#
public ItemStack getWand() {
    return wand;
}
#

Ewwwwww

#

its eclipse!

#

eclipse uses tabs ๐Ÿคฎ

hasty prawn
#

๐Ÿคฎ

shadow tide
#

c'mon, eclipse is fine

eternal oxide
#

The bestest evar!

shadow tide
#

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

quaint mantle
#

so make an instance

shadow tide
#

oh, ye me dumb

quaint mantle
#

remeber

#
@Override
public void onEnable(){
    VanisherItem vanisherItem = new VanisherItem();

    // Register the item events.
    this.getServer().getPluginManager().registerEvents(vanisherItem, this);
}
quiet ice
quaint mantle
#

pretty sure you can change that too

exotic obsidian
#

guys

#

how i can cancel particale packets?

quiet ice
#

Yes, of course. But having 3 spaces for indentation by default is a bit cruel

quaint mantle
#

u right

#

tabs ๐Ÿคก

quiet ice
#

Either tabs or 2/4 spaces. But not 3

shadow tide
#

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

ornate heart
#

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.

trail sandal
#

How to open this??

quaint mantle
#

are you banned

quaint mantle
trail sandal
#

What??

#

No im not

quiet ice
#

what exactly do you want to open?

idle cove
#

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);

quaint mantle
#

thats not even valid java

idle cove
#

.-.

#

how is it

young knoll
#

You can't just create a new player anyway

quaint mantle
#

^ its an interface

idle cove
#

oh how would i do it then?

quaint mantle
#

Google it

quiet ice
#

While technically possible, given that you ask this question, no

quaint mantle
eternal oxide
#

your IDE should have been screaming at you

quiet ice
#

Not possible, at all

idle cove
#

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

quiet ice
#

And don't bother googling it, creating fake players is far beyond your knowledge

idle cove
#

?

shadow gazelle
#

Is it possible to set custom item meta for recipe ingredients?

eternal oxide
#

Its a complex task of diving down to core minecraft code and other wizardry

quiet ice
#

There are libraries that will aid you, but they won't abstract out everything

shadow gazelle
young knoll
#

Take a look at RecipeChoice.ExactChoice

shadow gazelle
#

Thanks

quaint mantle
#

how can I prohibit the left hand if the click was in the right hand?

shadow tide
#

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.

young knoll
#

I mean adding a command to the plugin.yml is what makes the command exist

#

So

shadow tide
#

so what?

young knoll
#

So you can't add a command to the plugin.yml that doesn't exist

shadow tide
#

k

echo basalt
quaint mantle
#

how can I prohibit the left hand if the click was in the right hand?

echo basalt
#

you mean
list.size() == 2
?

echo basalt
#

It's weird but PlayerInteractEvent gets called twice

young knoll
#

Java has a queue interface

echo basalt
#

Once for each hand

echo basalt
quaint mantle
echo basalt
#

yeah whatever

quaint mantle
#

how to cancel the left hand?

echo basalt
#

just event.setCancelled

#

or just ignore that event if it's left hand

quaint mantle
#

how?

young knoll
#

Just return

quaint mantle
#

how?

young knoll
#

return

quaint mantle
#

okay

#

how?

#

if (e.getHand() == EquipmentSlot.HAND) {

quaint mantle
#

if (e.getHand() == EquipmentSlot.OFF_HAND)
return;

#

?

#

how can I prohibit the left hand if the click was in the right hand?

young knoll
#

for (Player player : list)

#

Bukkit.getPlayer

quaint mantle
#

hi i need help with the plugin goldencrates in minehut

quasi flint
quaint mantle
#

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

young knoll
#

getEyeLocation

#

I believe

quaint mantle
#

getEyeLocation's yaw and pitch are identical to getLocation

shadow tide
#

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?

eternal night
#

seems like they all left

#

the javadocs are rather straight forward

shadow tide
#

ik, I need to know where to put it

eternal night
#

whenever you want to spawn the arrow ?

shadow tide
#

Ik its spoonfeeding but its one small question, so can you tell me the syntax please

#

@eternal night

eternal night
#

it is a normal java method ?

quaint mantle
#

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

eternal night
#

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

shadow tide
#

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);

eternal night
#

the method should return you an arrow instance

#

you can just store that in a variable instead of casting it like this

shadow tide
#

?

#

store what?

eternal night
#

instead of casting it randomly like this you can just: ```java
final Arrow arrow = player.launchProjectile(Arrow.class, velocity);
arrow.setDamage(1);

shadow tide
#

ooh

#

What does final do?

#

I've been meaning to ask

eternal night
#

you cannot change the variable reference after assigning it

#

e.g. ```java
final String a = "hi";
a = "bye";

shadow tide
#

does it have any cases where it is needed?

eternal night
#

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

shadow tide
#

I literally have no idea what lambda means lol

eternal night
#

yea then don't worry about it xD

shadow tide
#

I wish there was a way to reload the plugins in a minecraft server without restarting it

hasty prawn
#

./reload?

shadow tide
#

does that reload everything in the plugin?

turbid tiger
#

Hey guys does CraftItemStack class not exist anymore?

hasty prawn
#

It calls onDisable & onEnable again, and I think it clears all your Lists and Maps

turbid tiger
#

Im playing around with 1.17 spigot api, cant find the import

shadow tide
#

k

#

@eternal night it isn't spawning anything

hasty jackal
#

yes

eternal night
#

validate that the respective code is executed

shadow tide
#

?

#

u need my main class?

eternal night
#

no just validate that your code is actually called in that event

shadow tide
#

? wdym

eternal night
#

e.g. that the wand.isSimilar check is not messing you up

hasty jackal
shadow tide
young knoll
#

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

turbid tiger
#

One question however, is net.minecraft.world.item.ItemStack the proper nms itemstack?

limpid bone
#

IntelliJ is not letting me import, how do i fix? if i dont it simply says "cannot find symbol"

exotic obsidian
#

anyone know how i can hide particales to player?

#

without ProtocolLib

quaint mantle
#

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

paper viper
#

use that and also a boolean to enable it too and stuff

quaint mantle
#

okayyy

#

so that while() shouldnt cause much lag, right

#

if its just like 10-20 entities?

paper viper
#

i would still recommend like a 1 second delay per check or something tick related

#

and def make it async

quaint mantle
#

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?

paper viper
#

what hell does conds mean

quaint mantle
paper viper
#

Oh

quaint mantle
#

if the entity.. is...

#

etc.

#

monster, certain scoreboard tags, etc.

paper viper
#

I mean are there any conditions you are checking?

quaint mantle
#

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

eternal night
#

imagine using scoreboard tags smh

paper viper
#

yeah

quaint mantle
paper viper
#

PDC

quaint mantle
#

doesnt that take memory though

#

as does scoreboard tags

#

but doesnt that take like, a lot of memory

eternal night
#

its a map vs list

quaint mantle
#

Entity#getScoreboardTags().contains("") ??

eternal night
#

Yea scoreboard tags is a set

#

and pdc is stored in a map

quaint mantle
#

i prefer the scoreboard tags, personally

unkempt peak
#

PDCs are superior in every way

eternal night
#

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

quaint mantle
#

yeah

#

so as back to the while statement

#

that is correct?

eternal night
#

while statement is a pretty useless solution for this

quaint mantle
#

check for entity, create while(), bukkitrunnable?

eternal night
#

a simple ticking timer

#

should be enough no ?

quaint mantle
#

ticking timer, like a task

quaint mantle
#

im not sure i really want a scheduler that gets every entity, and compares

eternal night
#

well the async version of this is submitted to a thread pool anyway

quaint mantle
#

ah

eternal night
#

not much difference to just spawning a new thread yourself and while looping

#

question obviously also is, does a thread/timer per entity actually make sense

wary harness
#

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

shadow gazelle
#

Would getItemInMainHand().equals(ItemStack) check if there is also the same amount of the held item?

quaint mantle
#

isSimilar ignores amount

shadow gazelle
#

Oh

#

Thanks

#

Also, will remove/removeItem remove every instance of that ItemStack?

#

I only want to remove one

quaint mantle
#

remove will, removeItem removes the amount of the item

quaint mantle
#

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

twin venture
#

iam getting this error

#

its been 3 hours .. iam trying to fix i did everything i can

shadow gazelle
#

The ItemStack is already set to one if that changes anything

quaint mantle
#

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?

untold rover
#

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
uneven dock
#

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?

quaint mantle
#

listen to the error

#

it wouldnt do it for no reason

uneven dock
# quaint mantle it wouldnt do it for no reason

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

shadow tide
shadow gazelle
shadow tide
#

yes

quaint mantle
#

^ use the variable instead of calling a getter

shadow tide
#

k

quaint mantle
#

show the adminwand command class

shadow tide
#

giving it works but ok

quaint mantle
#
    AdminWand adminWandItem = new AdminWand();
    @SuppressWarnings("unused")
    private final AdminWand adminWand;

what is this

#

๐Ÿคจ

shadow tide
#

wdym

quaint mantle
#

you're creating two for no reason

shadow tide
#

they are different

quaint mantle
#

no they arent

#

they're the exact same, thats why nothing happens when you only register one

shadow tide
#

k

quaint mantle
#
AdminWand adminWandItem = new AdminWand(); // command class

delete this

#

that suppresswarnings is actually telling you whats wrong

#

listen to the errors dont ignore them

shadow tide
#

umm, even without this java AdminWand adminWandItem = new AdminWand(); it still shows the warning lol

quaint mantle
#

and i bet there's errors

shadow tide
#

wait nvm

#

lol

#

yeah

quaint mantle
#

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

shadow tide
#

sorry, I get it now

quaint mantle
#

np

shadow tide
#

cool

#

but we still haven't answered my question

shadow tide
#

thats the answer

#

lol

shadow gazelle
#

What was the enchantment that made items have the enchanted glint but show no enchantment in the lore?

waxen plinth
#

There isn't one by default

quaint mantle
#

you can assign an empty nbt tag or just give it unbreaking 1 and set the itemflags to HIDE_ENCHANTS

waxen plinth
#

The unbreaking trick only works if you don't want any other enchantments to show

quaint mantle
#

ye

waxen plinth
#

And if you want it to have unbreaking ๐Ÿค”

#

Luck of the sea

shadow tide
#

u can use luck

waxen plinth
#

Give it luck of the sea

#

Yeah lol

shadow tide
#

its just called luck

#

luck of the sea is an effect

quaint mantle
#

@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."));
shadow gazelle
waxen plinth
#

No

#

But you can add the HIDE_ENCHANTMENTS item flag

shadow gazelle
#

Okay

shadow tide
quaint mantle
waxen plinth
#

Why would it need to be mutable

quaint mantle
#

Idk

paper viper
#

List.of is so much better

#

lol

shadow tide
#

?

waxen plinth
#

meta.setLore(List.of("A very, very powerful weapon."));

shadow tide
#

k

waxen plinth
#

List.of("whatever"); creates a new list containing just one string "whatever"

ivory sleet
#

Wat

quaint mantle
#

still gonna use Collections.singletonList myself

waxen plinth
#

Why

#

You could always do...

ivory sleet
#

Collections::singletonList is also immutable

quaint mantle
#

Oh ye

#

so it doesnt matter

waxen plinth
#
new ArrayList<String>() {{add("A very, very powerful weapon.")}}```
quaint mantle
waxen plinth
#

lmao

ivory sleet
#

Yeah imagine tho wouldnโ€™t be surprised if List::of might just delegate to Collections::singletonList

waxen plinth
#

Vice versa?

ivory sleet
#

No?

quaint mantle
#

I think it would be singletonList -> list.of

waxen plinth
#

Nope

proud basin
#

This is how you get the center of a screen right sr.getScaledWidth() - (width / 2)

waxen plinth
#

singletonList actually is its own thing

#

And it instantiates a class called SingletonList

#

An internal one

ivory sleet
#

^

quaint mantle
#

but why

waxen plinth
#

I don't get the point

#

It's been around since java 1.3

quaint mantle
#

i mean tf would it even do ๐Ÿ˜‚

waxen plinth
#

So maybe it's still there just for backwards compatibility

quaint mantle
#

deprecate it !

waxen plinth
paper viper
#

wtf is that formatting

ivory sleet
#

Only thing that drives me nuts with these private internal implementations is that it breaks liskov substitution principle.

paper viper
#

lol

waxen plinth
#

Decompiled

waxen plinth
ivory sleet
#

Yeah

quaint mantle
waxen plinth
#

It's decompiled

ivory sleet
#

Which breaks the List::add method promise of the interface

quaint mantle
#

who even thought of creating a singleton list class

ivory sleet
#

Itโ€™s not that bad?

quaint mantle
#

yeah i just dont know why it would exist

shadow tide
#

in my commands class

quaint mantle
#

in your adminwand class

shadow tide
#

nowhere except creating the getter

ivory sleet
#

Well yeah now when List::of exists itโ€™s probably quite useless

shadow tide
#

I used ctrl + f

quaint mantle
#

and seems like ImmutableList should be its own inteface

#

like you said, breaks the promise of the #add method

ivory sleet
#

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 ๐Ÿ˜ฆ

shadow tide
paper viper
#

..

hasty prawn
#

Figuring out Resource Pack magic

shadow tide
#

why is no-one answering?

quaint mantle
#

people have lives outside of the discord

#

@shadow tide any console errors

shadow tide
quaint mantle
#

most of the people in here ask for server help

shadow tide
#

oh

#

lol

#

k

#

and no errors, anywhere

quaint mantle
#

any plugins interfering

shadow tide
#

my plugin is the only one on my testing server

hasty prawn
#

Try normalizing the velocity vector @shadow tide

quaint mantle
#

oh yeah the velocity is 0

hasty prawn
#

Is it 0 or some ridiculously high value that you can't even see it

shadow tide
#

?

#

wdym

#

the velocity should be fine

hasty prawn
#

Call normalize() after the getDirection()

shadow tide
#

k

hasty prawn
#

And add print statements.

shadow tide
#

wut print statements, and why

hasty prawn
#

Anything. To track your code.

shadow tide
#

k

#

to see if right clicking is doing anything at all?

hasty prawn
#

Yeah

shadow tide
#

right clicking isn't doing anything

hasty prawn
quaint mantle
#

show new code with the debug statements

shadow tide
#

its not much different

quaint mantle
#

show it

shadow tide
quaint mantle
#

did you even add prints

shadow tide
#

?

#

yes

#

Plugin.plugin().getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "Player Right Clicked");

quaint mantle
#
Plugin.plugin().getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "Player Right Clicked");

->

Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Player Right Clicked");
shadow tide
#

k

quaint mantle
#

also put it after the isSimilar check

shadow tide
#

oh

#

wait, huh

#

?

quaint mantle
#
        if(!wand.isSimilar(event.getItem())) {
            Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Not the right item");
            return;
        }
shadow tide
#

oh

quaint mantle
#

also extra_damage is an invalid attribute

shadow tide
#

idk why the name of an attribute exists, it doesn't do anything

quaint mantle
#

?

shadow tide
#

extra_damage is the name of the attribute, not the type

quaint mantle
#

still dont understand

#

are you asking why its not an enum or psf

shadow tide
#

in short terms, idk how I'm helping you, but the name of an attribute is redundant

quaint mantle
#

What.

#

how else are you gonna identify the attribute

shadow tide
#

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

quaint mantle
#

Attribute no exist

#

It do nothing

shadow tide
#

?

#

wut

quaint mantle
#

Broooooooooo

shadow tide
#

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

quaint mantle
#

i dont know

shadow tide
#

k, it thinks its the wrong item

#

i'll try to use pdcs

quaint mantle
hasty prawn
quaint mantle
#

๐Ÿ˜”

shadow tide
#

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
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);
}
shadow tide
#

u didn't show these in the camp java private final PDCManager pdcManager; private final ItemStack item;

quaint mantle
#

I did

#

its, common sense

#

if im assigning a variable you'd expect it to exist right

shadow tide
#

I followed your tutorial on Item PCDs and now nothing is working, its all saying "Wrong Item"

quaint mantle
#

send code

#

it all works for me, i wouldnt post it if i knew it didnt work

shadow tide
#

yeah

#

ik

quaint mantle
#

send the PDCmanager calss

shadow tide
quaint mantle
#

try just doing a normal item

#

erase all of that custom meta stuff

#

add things one by one and keep testing them

shadow tide
#

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

quaint mantle
#

@shadow tide your code works perfectly for me

shadow tide
#

wuut

#

the f*ck

#

when I right click it shows Wrong Item

#

what did you do in your plugin thats different for mine

#

gtg

somber hull
#

so if i wanted to make a vehicle

#

for the movement portion

#

would i be using packets?

unkempt peak
#

depends

#

what do you mean by vehicle

somber hull
#

Better boats

#

But im gonna just use an armorstand

#

and a custom texture head

somber hull
unkempt peak
#

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

somber hull
#

i was told that is a thing

unkempt peak
#

oh

#

yeah ive never really worked with passengers

somber hull
unkempt peak
#

i would avoid packets if you don't need them

somber hull
#

teleport it like 0.1 block every milisecond?

unkempt peak
#

0.1 blocks every millisecond is very fast

#

thats 100 blocks/second

somber hull
#

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

unkempt peak
#

you can get smooth movement by teleporting incrementally by tick

#

there is no way to update the position faster than a tick

unkempt peak
#

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

somber hull
#

ye thanks

unkempt peak
#

a normal boat is 7 b/s so i would start there

somber hull
#

7 blocks per second?

unkempt peak
#

yeah

somber hull
#

so 7/20 every tick?

unkempt peak
#

wait hold on

somber hull
#

ye that would be 0.35 blocks per tick

unkempt peak
#

nvm yeah its 7 b/s or 0.35 block per tick

turbid silo
#

Is there a way to change the seed on a server?

#

Via a method or something

somber hull
#

check world

#

in the docs

#

@turbid silo

turbid silo
#

Ah cool thanks!

turbid silo
somber hull
#

Yea i dont think its possible

turbid silo
#

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

somber hull
#

only oine way to find out

turbid silo
#

True

#

But by the looks of it I dont think I can use WorldCreator to edit a current worlds settings sadly

somber hull
#

Buildtools keeps crashing when i try to update my server