#Beginner needs help

1 messages · Page 1 of 1 (latest)

alpine trail
#

here

rose vine
#

thanks

#

alright

#

@shadow heron

#

First of all

This line
Player p = (Player)sender

alpine trail
#

?paste

#

oh

#

Basically you’re converting the Sender Object to a Player object regardless of if you know that it’s supposed to be one

rose vine
#

that is what i am trying to say

alpine trail
#

idk if they can see this thread actually

#

@shadow heron
you should use
if (sender instanceof Player)
because there are commands that should be console only and player only

rose vine
#

he wrote me

#

i told him

shadow heron
#

i did that and as you can see i checked before if sender is not instanceof player doing (!(sender instanceof Player))

alpine trail
#

So you want it to be a console command only ?

shadow heron
#

no just simply i want if the command get executed by console this gave the message of "sorry console you can't do"

alpine trail
#

That statement is only going to affect the code contained within those {}. Since you’re casting it before, it happens regardless.

#

@shadow heron could you please provide a code snippet so I can see what you're trying to do ?

rose vine
#

this is your class but with a better look and the fix with the cast

shadow heron
#

Can you teach me how to do that?

rose vine
#

The others and me will help

alpine trail
#

Do you have any past experiences with java @shadow heron

shadow heron
#

Never

rose vine
#

any experience with programming?

alpine trail
#

How long have you been using the Spigot-API for ?

shadow heron
#

Also guys... before everything sincerely THANK YOU SO MUCH! Plugin community here just destroy new people trying to approach plugins and java

#

Just something like 4/5 days i want to create my own plugins

rose vine
#

alright so a newbie

shadow heron
#

exactly

alpine trail
#

Not trying to be rude or anything, but I'd first suggest to learn java before diving into the Spigot API.

rose vine
#

I learned java with spigot

alpine trail
shadow heron
#

Yeah I know and I am with the opinion No Spigot Without Java

shadow heron
#

But sincerely for what i looked if you try and re-try and try againg you can do this!

#

I know learning java could be soooo much better

alpine trail
#

Java tutorial for beginners - Learn Java, the language behind millions of apps and websites.
🔥 Want to master Java? Get my complete Java mastery bundle: http://bit.ly/2tKoy8C
👍 Subscribe for more Java tutorials like this: https://goo.gl/6PYaGF

📕 Get my FREE #Java cheat sheet: http://bit.ly/2JNlQnw

⭐️ Want to learn more from me? Check out thes...

▶ Play video
#

Idk if I'm allowed to post videos here, if not I'm sorry.

rose vine
#

question: Do you wanna learn now, or do we fix your problem? (not rude)

alpine trail
#

But I watched this video when I first started, and it cleared some things up.

#

I’d first go through a beginner Java tutorial to learn the core fundamentals of programming
Learning declaring variables, casting, assigning, if/else statements, for loops, functions, classes and OOP, etc. will be very useful in the long run

#

When I started I used a resource called freeCodeCamp, they make decent introductory tutorials on YouTube though they can drag out for quite long

shadow heron
#

For the moment i can use the datatype... booleans method... so variables ext

#

i can't do a loop but i know for that i need an hash map

rose vine
alpine trail
#

Okay yeah you went too far without knowing the basics, and that's kind of a bad thing.

shadow heron
#

but i know there is a lot of other stuff also

rose vine
#

do what @alpine trail said and then maybe we can help you better c:

shadow heron
#

ok I'll promise you guys I'm going to learn it

alpine trail
shadow heron
#

I don't want the help for change

rose vine
shadow heron
#

Just say me where to do it

alpine trail
#

@shadow heron

#

what do you exactly need rn ?

quaint canyon
#

Please name your threads more useful names in the future, thanks

rose vine
quaint canyon
#

Yes you can

rose vine
#

alright

shadow heron
#

Right now i have problem to take variable of player and intellij says me there are errors in the p

alpine trail
alpine trail
#

I think I had used something like this https://youtu.be/GoXwIVyNvX0
As I said it might be kinda long and some of the stuff in the latter half may not be too important yet

#

Could you provite us the error ?

#

Beginner needs help

shadow heron
#

and also i tried doing a NoHitDelay remake doing setNoDamageTicks(using 1.14.4) then but it wasn't working so i tried changing API in 1.8.8 and now setNoDamageTicks doesn't appears in the IDE

shadow heron
#

My error is in the compiler

#

IDE can't understand "p" variable i got with Player p = (Player) sender;

alpine trail
rose vine
#

can you send a screenshot?

alpine trail
#

Because variables can only be used after they're assigned.

rose vine
#

^

shadow heron
#

But is 1.14 API i didn't have problems and also god command was working amazing way

alpine trail
#

So what I'd do is put the Player p = (Player) sender; at the top

shadow heron
#

Can i just screenshare you or something like that?

rose vine
shadow heron
#

if for you is good i will appreciate that

rose vine
#

im fine