#help-development

1 messages · Page 1451 of 1

quaint mantle
#

Just wondering, anyone has made something like this before, and if so, can they share their code.
If not, could you help me think this out?

I need to find a way to automatically generate a multiline message, however, messages are saved in config file with multiple lines.
I want to allow people to add their own keys, in the form of key_name_iterator

What I have now, but It's not complete at all

 public String getMultiMessage(String message) {
        // Trying to find a way to automatically loop through all the messages and return the value in a single string
        // Example:
        /*
            create_info_1: "&a&m-------------------------------------------"
            create_info_2: "&a "
            create_info_3: "&7Usage: &a/xvote create <question> "
            create_info_4: "&7<answer1> | <answer 2> | ..."
            create_info_5: "&a "
            create_info_6: "&a&m-------------------------------------------"
        */

            ArrayList<String> matches = new ArrayList<String>();

            Pattern p = Pattern.compile(message);

            for (String s:Messages.getInstance().getMessageData().values()) {
                if (p.matcher(s).matches()) {
                    matches.add(s);
                }
            }


        StringBuilder stringBuilder = new StringBuilder();

        for (int i = 1; i < matches.size(); i++)
            stringBuilder.append(getString(message + "_" + i) + "\n");
        String msg = stringBuilder.toString();
        return msg;
    }
wraith rapids
#

what

quaint mantle
#

I dunno, I want to allow people to change messages, but also make it multiline, as many lines as they want

wraith rapids
#

yaml supports multiline strings

quaint mantle
#

Yeah but I like reinventing wheels...

#

( I didn't know it supported it lmao )

#

oh, isn't it the |-

wraith rapids
#
create_info: >
  "&a&m-------------------------------------------
  &a 
  &7Usage: &a/xvote create <question> 
  &7<answer1> | <answer 2> | ...
  &a 
  &a&m-------------------------------------------"
#

there are like 7 or 10 different ways

#

|- is one of them

#

or no > strips newlines

#

use | not >

ripe marlin
#

Hey guys! Today I am showcasing my famous Minecraft Craftbukkit / Spigot Plugin Template! With it, you can get right to making the fun stuff instead of fiddling with the annoying behind the scenes work. Also, using this template got my plugins immediately approved on SpigotMC, so you know everything is implemented according to proper OOP princip...

▶ Play video
wraith rapids
#

probably not

ripe marlin
wraith rapids
#

you should learn how to make it from scratch before using a template anyway

ripe marlin
#

kk

ripe marlin
#

no no not to learn

#

but nvm

eternal oxide
#

Until you are capable of creating a basic plugin yourself never use any templates

sharp bough
#

does '2': items: {}
mean that path.2.items == null ? or its 0

#

like 0 items

wraith rapids
#

it means that it's not null, but rather, an empty section

#

items: ~ would be null

sharp bough
#

ah

#

so

#
            
        }``` would be true
#

in that case

wraith rapids
#

in the case of ~ yes

#

not totally sure how bukkit handles empty sections

sharp bough
#

uh im gonna test it then

wraith rapids
#

they might show up as null rather than empty sections as well but i'm pretty sure they'll just show up as empty

eternal oxide
#

empty sections return null (I believe)

warm galleon
#

How would i get the current server name as listed in the bungeecord config.yml?

olive pawn
#

anybody have experience using leads and connecting them from block to entity?

sharp bough
#

👍

eternal oxide
#
ConfigurationSection getConfigurationSection​(@NotNull
String path)
Gets the requested ConfigurationSection by path.

If the ConfigurationSection does not exist but a default value has been specified, this will return the default value. If the ConfigurationSection does not exist and no default value was specified, this will return null.

Parameters:
    path - Path of the ConfigurationSection to get.
Returns:
    Requested ConfigurationSection. ```
#

says its nullable

#

it doesn;t say what happens if teh path exists but its empty

#

I believe it returns null too

wraith rapids
#

nullable is because ~ would have to return null

#

i super vaguely remember someone ending up with an empty configuration section in some arcane circumstance so i think it just returns an empty section

#

but the level of fog is to the point where I might've just hallucinated it

warm galleon
#

How would i get the current server name as listed in the bungeecord config.yml?

somber hull
#

best way to check if a player has clicked on a specified item in a gui?

#

would it be NBT?

eternal oxide
#

getClickedItem and teh GUI instance

somber hull
#

or is there a better way to check for an item

eternal oxide
#

That depends. You create teh GUI, you prevent things being put in or taken out of the GUI.

#

when someone clicks you test the GUI instance, you check the item thats clicked, and you check the slot

somber hull
#

But what if i want it multi-page

#

So i dont know what the items are gonna be

eternal oxide
#

You should still know whats being clicked

somber hull
#

i think imma use NBT

#

it makes the most sense

#

and also

#

im trying to use a inventory API

#

and honestly i have no idea what this means

#

Put it inside your plugin jar, initialize an InventoryManager in your plugin (don't forget to call the init() method), and add a .manager(invManager) to your SmartInventory Builders.

eternal oxide
#

You made teh GUI, its pointless to use NBT

somber hull
#

It will change per-server

eternal oxide
#

Why not? its your GUI

somber hull
#

Nvm

#

Ill just store the gui slot the item is in

#

In a file

somber hull
wispy monolith
#

Do u obfuscate ur code if u wanna publish ur plugin?

eternal oxide
#

Pretty much no one does

wispy monolith
#

Code**

eternal oxide
#

You don;t secure it. If someone really wants your code they will get it

onyx shale
#

True..

somber hull
wispy monolith
#

If they add an encryption code that encrypts but the code is so easy to get reversed enginerd

eternal oxide
eternal oxide
#

The only person in the world who should know a password is the user.

wraith rapids
#

the key for the encryption is not in the code

#

the code is available to everyone

wispy monolith
wraith rapids
#

what is your question

#

most encryption algorithms are in the public domain

#

the point of an encryption algorithm is that you can't reverse engineer something that is encrypted with the algorithm alone

#

you need the key

#

having the code is not sufficient

#

the code is available to everyone

#

the algorithm is available to everyone

wispy monolith
#

And how to use it

wraith rapids
#

again, what is your question

#

what are you trying to do

wispy monolith
#

I just want to know how ppl encrypt

wraith rapids
#

encrypt what

somber hull
#

Plugins

wraith rapids
#

you don't encrypt plugins

wispy monolith
#

Stuff that's getting saved in the data.yml

eternal oxide
#

You asked how do people encrypt their code. We answered that they generally don't

wispy monolith
#

Ik

#

This is not the q now

wraith rapids
#

stuff in data.yml generally doesn't need to be encrypted

eternal oxide
#

if you are storing data in a file, its your server so why do you need it encrypted?

wraith rapids
#

the only case where it would have to be encrypted would be if the host filesystem is compromised

#

in which case everything you do is compromised and security is out of the window to begin with

wraith rapids
#

are you asking how to hash things like passwords for storing them?

eternal oxide
#

and if its passwords, you need to redesign your system as the server should never store any passwords.

wispy monolith
#

Thx

eternal oxide
#

String stringHash = Hashing.sha256().hashString(pass, StandardCharsets.UTF_8).toString();

wraith rapids
#

of course you'd want to look into salts and shit

somber hull
#

Im trying to use this library

#

I have added it to my build path

#

and i was just gonna test one of their examples

#

but so many errors

#

Do i have to do extends smthng or implements something?

wraith rapids
#

that is supposed to go in a method

somber hull
#

i just copy pasted

wraith rapids
#

yes but it is supposed to go in a method

#

copy paste it into a method body

somber hull
#

holy shit

#

thank you

#

lol

#

i didnt see that lol

warm galleon
#

@sullen marlin wait so what if 2 plugins all ask for getserver, what plugin would get the message/request?

#

and how do i differentiate from who sent what or there will be duplicates

eternal oxide
#

bad ping

warm galleon
#

?

sullen marlin
#

they will both get the response

somber hull
#

oh hi

warm galleon
sullen marlin
#

shrug

warm galleon
#

f

#

then is there a awy to send a custom msg through plugin messaigng

sullen marlin
#

sure but then you need a bungee plugin

warm galleon
#

o

wispy monolith
#

Is there an event for shield blocking a hit?

sullen marlin
#

damageevent with shield modifier

worldly ice
#

is there any easy way to disable the sweeping edge attack when using a sword?

sullen marlin
#

DamageCause.ENTITY_SWEEP_ATTACK

worldly ice
#

i'm guessing you mean to "cancel" the attack, but wouldn't the mobs that got hit still take kb?

#

nvm, i just tested it and the mobs do not take any kb

somber hull
#

how do i add a shaded jar to my project?

#

do i need maven or smthng?

eternal oxide
eternal oxide
#

Yes, it tells you on its spigot page

somber hull
#

oh

#

yea, do i need maven or gradle?

eternal oxide
#

read its spigot page and you decide

somber hull
#

bruh

#

I have read it

eternal oxide
#

Then read it again as you clearly missed how to shade

somber hull
#

Im gonna assume i need maven

#

now another question

#

Im only asking because i have already tried myself

eternal oxide
#

under Usage it tells you how to use it with or without maven

somber hull
#

Ahhh

#

So i would need to add it as a dependency?

#

thank you

#

hmm

#

but if i use maven

#

I dont need to add it as a dependency?

#

wait

#

it says add as a dependency to my IDE

#

but how the fuck do you do that?

eternal oxide
#

Please read its Spigot page and don;t skip bits. It states If you're not using a build system, you can download the resource from the download link here and add it as a dependency in your IDE.

#

using maven is easier

somber hull
#

Would i still need it as a depenedncy?

paper viper
#

just dont use your ide for this lmao

#

yes you would

somber hull
#

Ok

#

So

#

Give one sec

#

Im big dum

#

let me figure it out

paper viper
#

wat

eternal oxide
somber hull
eternal oxide
#

You must be blind

somber hull
#

since im not gonna use maven or smthng

#

this is all i see related to normal thing

#

If you're not using a build system, you can download the resource from the download link here and add it as a dependency in your IDE.

eternal oxide
#

Yes

somber hull
#

Ok

#

Does that mean add as a dependency in yml?

#

Or should i look up how to add a dependency to eclipse?

eternal oxide
#

Does it say yml?

#

or does it say IDE?

paper viper
#

Yeah you are clearly blind lmao

somber hull
#

I looked it up, and all im seeing is maven stuff. so do i need to import my project to a maven project?

#

wait

#

give one sec

#

might have found something

eternal oxide
#

I'd probably press the power button about now.

paper viper
#

lol

somber hull
#

i found this

eternal oxide
#

You are not using maven

somber hull
#

i litterally looked up how to add a dependency to eclipse

#

and everything is maven

#

so im gonna follow the tutorial where the guy says "I know nothing about maven"

eternal oxide
somber hull
#

nvm

#

Ok, i did the home computor setup

#

And the build path

#

testing now

#

aaaand

#

still same error

eternal oxide
#

error?

robust creek
#

Could one get around the lack of custom biome support by returning a vanilla biome in getBiome?

#

If not, how about through protocollib?

somber hull
#
java.lang.NoClassDefFoundError: com/github/stefvanschie/inventoryframework/pane/Pane
        at me.silentprogram.safecheck.commands.MainCommand.<init>(MainCommand.java:19) ~[?:?]
        at me.silentprogram.safecheck.Main.onEnable(Main.java:21) ~[?:?]
dusk flicker
#

What are you actually trying to do (MicleBrick)

dusk flicker
eternal oxide
somber hull
dusk flicker
#

It's not a main class

#

Thats why

somber hull
#

?

dusk flicker
#
  • can cause some problems with other libraries (rare)
somber hull
#

got it

dusk flicker
#

@paper viper you here for a Main.java post?

dusk flicker
dusk flicker
#

Heres a really good explanation on it

paper viper
#

but ig you already did it

#

lol

wispy fossil
#

just name every class main
idiot

paper viper
#

lmao

somber hull
paper viper
#

proceeds to ignore the post

wispy fossil
#

Every Java-related CS course ive seen use "main" and that's probably why it's so widespread
hell, it's not even just java. Imagine seeing a "main.js" on a production website 🤣

somber hull
paper viper
#

i think its pretty common outside of plugins

wispy fossil
#

name your classes random greek letters

#

that's the way to go

#

why even obfuscate when your code is as bad as mine

eternal oxide
robust creek
#

it already needs to use world time to synchronize the angular positions of the planets

dusk flicker
#

Dear lord

#

All im going to say is good luck

wispy fossil
#

that sounds fun

#

good luck lol

robust creek
#

lol ty

somber hull
robust creek
#

rn i just send the client fake blocks

#

but you can't see those out of render distance

#

which is lame

eternal oxide
robust creek
#

but really

#

would either of those solutions enable the use of custom biomes?

somber hull
eternal oxide
#

a runnable jar includes all dependencies too

#

else you have to start with build scripts, at which point you may as well use maven

somber hull
#

But it will still work as a plugin?

eternal oxide
#

yes

somber hull
#

ok

#

cool

robust creek
#

I've been trying to research what exactly breaks with custom biomes but it seems like it's mostly just the fact that biomes are an enum

somber hull
#

it wont let me hit finish

#

and i cant put anything in launch configureation

robust creek
#

so theoretically couldn't I just make it always return some vanilla biome if it's a custom biome --> nothing breaks?

candid galleon
#

try it and see ¯_(ツ)_/¯

robust creek
#

fair enough lol

eternal oxide
somber hull
#

hmmmm

#

Aight fuck it

eternal oxide
#

right click your project and convert to maven

somber hull
#

ok

vestal moat
#

Why is he doing runnable jar?

#

Beside he should use maven

eternal oxide
#

for dependencies

vestal moat
#

Oh

#

Requires maven

somber hull
candid galleon
#

just use maven

somber hull
#

what do i put here?

robust creek
#

or gradle

candid galleon
#

the main package

vestal moat
#

Leave it like this

candid galleon
#

eg: xyz.msws.skywars

vestal moat
#

Oh wait he right

somber hull
eternal oxide
#

add to your pom ```xml
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

</properties>```
somber hull
#

thank

#

just below the project?

eternal oxide
#

I usually have properties just under teh main header like name and version

somber hull
#

alright

#

do i add dependencys in like that too?

#

inside of <propertys>

eternal oxide
#

no

somber hull
#

sorry

#

<project>

eternal oxide
somber hull
#

thank you

#

ok

#

i think everything is good

#

but im still getting some errors

#

unrelated

eternal oxide
#

now you don;t use export anymore

somber hull
#

to that

somber hull
#

Ok yea i know nothing about maven lol

#

WHat do you mean

eternal oxide
#

one sec, openign my IDE

#

right click your project, goto run as -> run configurations

somber hull
#

ok

#

run maven builkd?

eternal oxide
#

in that window, you shoudl be in teh maven section on the left

#

in teh window on teh right....

somber hull
eternal oxide
#

press new, in teh menu

somber hull
eternal oxide
#

enter in teh Goals entry clean package

#

use teh Workspace button to select your project workspace

somber hull
#

clean package or ``clean package`

eternal oxide
#

clean package

somber hull
#

ok

eternal oxide
#

Enter a Name at teh top (your project name)

quaint mantle
#

aw.

somber hull
#

alright

#

IS that it?

eternal oxide
#

then click the run button

somber hull
#

ok

#

same

quaint mantle
#

Ignore it

eternal oxide
#

you are more interested in the build console log

queen dragonBOT
somber hull
eternal oxide
#

now you have a few things to add to your pom

somber hull
#

ok

eternal oxide
#

like the maven entries IT says to add

#

you can also delete the lib you manually added to your project for IT

somber hull
#

ok

#

whats IT

eternal oxide
#

maven will be dealing with that now

somber hull
#

you said it twice so i assume it wasnt a capslock error

eternal oxide
#

sorry IF

#

Inventory Framework

somber hull
#

got it

#

i already added those

#

so just ignore these?

eternal oxide
#

ok, and deleted teh IF lib from your buildpath?

#

ignore for now

#

before you go any further show me (in a paste) your pom

somber hull
#

build path

#

?paste

queen dragonBOT
somber hull
eternal oxide
#

if you CTRL+A then CTRL+I Eclipse will sort that indentation in your pom

somber hull
#

ok

eternal oxide
#

you need to edit line 47 <shadedPattern>[YOUR PACKAGE].inventoryframework</shadedPattern>

somber hull
#

got it

#

thank you lol

eternal oxide
#

save that...

somber hull
#

just me.silentprogram.safecheck?

eternal oxide
#

yes

somber hull
#

ok

eternal oxide
#

now, right click your pom, select Maven -> update Project

#

Ensure teh bottom three options are ticked

somber hull
#

alright

#

done

eternal oxide
#

click ok

somber hull
#

i did

quaint mantle
#

Sorry to interfere, but I need help with particles. What i'm using:

p.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pLoc, 10);

Particles moving fastest than light, when they spawned. How I can fix this?
||I'm really newbie||

eternal oxide
#

now from yoru run as icon in your tools bar run it

somber hull
eternal oxide
#

yep

somber hull
eternal oxide
#

There should be a run confguration in there you did earlier

somber hull
#

not there

eternal oxide
#

pull down teh menu

#

not select run as

somber hull
#

got it

#

ok i ran that configuration

eternal oxide
#

now it should be built and you can find your jar in the target folder in your project

somber hull
#

sick

#

ok

#

running it

#

sick

#

it works

#

thank you 🙂

eternal oxide
#

np

somber hull
#

so now if i want to add a library just use maven?

eternal oxide
#

yes

somber hull
#

alright cool

eternal oxide
#

A Particle has a fixed animation.

quaint mantle
#

they fly out of the player's feet when you want them to just appear.

eternal oxide
#

a campfire particle will move and animate as its pre-determined style. You probably selected the wrong particle

quaint mantle
#

ok i will try other now.

#

k. that looks better

#

thanks

somber hull
#

@eternal oxide is there a way to export it directly to my plugins folder with maven like normal?

eternal oxide
#

not easily. just add a copy command to your server startup

somber hull
#

?

eternal oxide
#
copy /B/Y P:\eclipse2020-workspace\GroupManager\target\groupmanager.jar plugins
java -Xms1G -Xmx1G -jar spigot-1.16.5.jar nogui```
somber hull
#

yea im too lazy to figure that out rn

#

ill do it later

eternal oxide
#

that way every time you start your server it updates its plugin

somber hull
#

well

#

where would i put it?

#

my run.bat?

eternal oxide
#

yes

somber hull
#

do i leave the /b/y

final fog
#

So, I decided to be a dumbass and accidentally delete my plugin, and I need the code back. I still have the plugin, and I was wondering if I could open the jar file as a project through intellij?

somber hull
#

pretty sure you can open .jars with winrar

#

well im 100% sure you can do that

#

idk if the code would be intact

final fog
#

wdym intact

somber hull
#

like i just did it

#

and maybe its cause i opened it with a text editor

#

but it has a bunch of squares

final fog
#

Ohhh

#

I see

somber hull
final fog
#

yeah ill give it a try, thank you.

sullen marlin
#

you need a decompiler, eg jd-gui

somber hull
#

Im dum

final fog
#

Oh ok

#

ty, the great md_5

#

aw crap I just realized I deleted the plugin from my server to test another plugin a while ago

#

🤦‍♂️

eternal oxide
#

recycle bin?

vagrant stratus
#

or any of these really

cyan oyster
sullen marlin
#

download the jar and run it

#

there is no step 2

dusk flicker
#

?bt

queen dragonBOT
dusk flicker
#

a guide

vagrant stratus
#

I have so many decompilers but use literally two of them 👀

cyan oyster
#

I need to download last successful Artifacts?

warm galleon
#

Is there a way to access APIs from bungeecord in a spigot plugin? In order to puing if a server is online

sullen marlin
#

only via the plugin channels which youve already been linked

halcyon bridge
#
Caused by: java.lang.NoClassDefFoundError: net/foxmc/survival/extensions/clans/messaging/ClanPacket
        at java.lang.Class.forName0(Native Method) ~[?:?]
        at java.lang.Class.forName(Class.java:398) ~[?:?]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:79) ~[patched_1.16.5.jar:git-Paper-575]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[patched_1.16.5.jar:git-Paper-575]

What does that mean? I've included it in maven and no import errors? I haven't had this issue before so not sure what does this error mean :PP

olive pawn
#

Are you including the library in your artifact when you shade?

halcyon bridge
#

Uhm what do you mean by that?

#

Thats all what i did

        <dependency>
            <groupId>net.foxmc</groupId>
            <artifactId>FoxSurvival</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
#

^ The class is coming from this

olive pawn
#

Oh that’s odd

#

Did you try rebuilding lib and refreshing maven cache?

dusk flicker
#

Are you trying to include it in your jar file

#

Or is it a separate plugin in the server

halcyon bridge
halcyon bridge
sage swift
#

shade it

dusk flicker
#

^

halcyon bridge
#

Idk how to shade it :<>

dusk flicker
#

google

#
<scope>compile</scope>
``` will also be needed more then likley
sage swift
#

honestly google showed me no information for how to shade something

olive pawn
#

Maven shade plug-in

olive pawn
#

Tutorial on shading artifacts

dusk flicker
#

I had to learn by googling it lol

vagrant stratus
#

What's your build section look like? 🤔

dusk flicker
#

Literally the first result

#

they have a full usage page

vagrant stratus
#

😂

halcyon bridge
#

I would rather watch 1 hour video than read this

dusk flicker
#

welp ¯_(ツ)_/¯

halcyon bridge
#

thanks Rack :))

haughty haven
#

anyone know if it's possible to disable the lapis requirement for enchanting (for version 1.8) with a plugin? Such as essentials

sage swift
#

wrong place to ask

#

this is where you would make a plugin for such a thing

#

also 1.8? lmao

#

sad that people still use it

haughty haven
dusk flicker
#

You def can but no idea if it is a thing

haughty haven
#

ok thanks!

quaint mantle
subtle kite
sage swift
#

outdated, featureless, over half a decade old, missing many useful api additions

vagrant stratus
#

have to use a multi-line method just for things like sending titles too 👀

quaint mantle
#

when 1.8 is bad!

sage swift
#

vagrant stratus
quaint mantle
#

mb

sage swift
#

"wrong server"

quaint mantle
#

was supposes to be scissors

#

i have no idea how to make sciccors

quaint mantle
#

○ \ /
○ / \

#

eh

vagrant stratus
#

insert patents here

quaint mantle
vagrant stratus
#

usually give you some idea on how to make them 🤣

quaint mantle
#

€-€
\__/

quaint mantle
#

○○
\__/

vagrant stratus
#

('Д')

quaint mantle
#

_ -
° °
___

vagrant stratus
#

(・∀・)

quaint mantle
#

\ ____/
( = _ = )

#

(<> <>)

#

deadpool

torn oyster
#

how do i get nms in paper
im using windows

#

probably not the place to ask

vagrant stratus
#

they literally have a support server

#

ask there

sage swift
#

papper

quaint mantle
#

How can I make mob to no drowned?(unDrawnable) But I don't want use EntityDamageEvent and cancel it. cuz it makes lag

eternal oxide
#

why do you want to prevent drowned?

#

and cancelling the EntityDamageEvent for drowning will not cause lag

quaint mantle
#

I'm using Event and cancelling it. and many mobs is drowning and server crashed. and i'm making npc plugin so i want prevent drowning 🙂

robust beacon
eternal oxide
#

You have other issues if you have so many drowning its crashing your server

quaint mantle
#

I maked fish npc

#

It is therefore a natural phenomenon.

eternal oxide
#

shouldn't it be a water mob then? So it can;t drown

quaint mantle
eternal oxide
#

why not?

quaint mantle
#

cuz this npc is on the ground

robust beacon
#

toto?

#

africa.

eternal oxide
#

you said it was a fish npc

quaint mantle
#

yaaa

#

fish on the ground

#

!!

quaint mantle
sage swift
#

stop the fish from drowning

quaint mantle
#

i cantttttt

#

cuz it's on the ground

sage swift
#

so its not drowning

#

so theres no problem

robust beacon
#

♫ I hear the drums echoing tonight ♫

quaint mantle
robust beacon
#

♫ but she hears only whispers of some quiet conversation ♫

sage swift
#

if the fish was underwater it would be drowning and there would be problems

quaint mantle
#

so iwant prevent without event

#

bro

sage swift
#

but since its outside of water it doesnt drown

#

so no problem

quaint mantle
#

wat

robust beacon
#

I can't sing the chorus in mayus

quaint mantle
#

brrr

#

I'm making npc plugin. and my fish npc on the ground. it drowneds. how can I prevent this without event?

sage swift
#

how is it drowning on the ground

#

drowning is in water

quaint mantle
#

ohh hsorry

#

i said wrong

#

wait

#

no i said correct

sage swift
#

no, you said wrong

#

lol

#

but there's setInvulnerable

quaint mantle
#

It means wearing damage on the ground. That's what I looked into with Damage Cause (DROWN).

sage swift
#

but for npcs the best way to do it is through packets

quaint mantle
#

thanks you

sage swift
#

don't spawn any mobs server side

quaint mantle
#

but i want multiple types

sage swift
#

citizens has an api i believe

quaint mantle
#

I don't want use citizens 🙂

sage swift
#

good luck

quaint mantle
#

thanks you

sage swift
#

(really not worth the effort)

quaint mantle
#

whhyyy 😦

#

it will be nice plugin

sage swift
#

redoing that which has been done

#

common problem

stable patrol
#

Trying to give players a coloured nametag in the tablist but its not currently doing anything

public void addToTeam(Player player) {
        Bukkit.broadcastMessage("it works");
        ScoreboardManager scorem = Bukkit.getScoreboardManager();
        Scoreboard board = scorem.getNewScoreboard();
        Team red = board.registerNewTeam("Red");
        Team blue = board.registerNewTeam("Blue");
        red.setPrefix("§4Red");
        blue.setPrefix("§9Blue");
        Random random = new Random();
        String team;
        if (red.getPlayers().size() == blue.getPlayers().size()) {
            if (random.nextBoolean()) {
                red.addPlayer(player);
                team = "&c&lred";
            } else {
                blue.addPlayer(player);
                team = "&b&lblue";
            }
        } else {
            if (red.getPlayers().size() < blue.getPlayers().size()) {
                red.addPlayer(player);
                team = "&c&lred";
            } else {
                blue.addPlayer(player);
                team = "&b&lblue";
            }
        }
    }
#

All help appreciated

sage swift
#

using an alt huh SuckMyFoot?

#

smh

plush pilot
#

For some reason the persistent data container of every mob is getting reset when my server restarts and I can’t figure out why

stable patrol
#

we're both in a mutual server

#

and he asked me to ask here

#

sorry if thats not allowed

#

i promise im not an alt tho

sage swift
#

i mean if he had looked at Team in jd for more than half a second he would have seen setColor

wet breach
sage swift
#

took me 5 seconds to find

stable patrol
#

i do admit we're in a vc

#

they just asked me to ask

wet breach
#

?jd

wet breach
#

Either there is something wrong with your code or you are force closing your server which doesn't let it save

#

?paste

queen dragonBOT
vast quest
#

How can I spawn a baby version of a mob like is there a nbt for it or smth

eternal oxide
#

ageable

vast quest
#

Huh

#

like

#

set the age?

eternal oxide
#

search the javadocs for ageable

sullen marlin
#

or even 'baby'

vast quest
#

Huh?

#

I mean I can use age but wdym by baby?

sullen marlin
#

if you type baby into the search box is comes up with a very handy method

eternal oxide
#

yep, mine was for blocks, my bad

sullen marlin
#
Sets the age of the mob to a baby```
#

nah you were also right Elgar

#

setBaby is just a convenience thing

vast quest
#

Oh ok tysm

eternal oxide
#

ah ok

sullen marlin
#

does setAge(0) or something

quaint mantle
#

hello spigot !How can I change hover text on player list? Like picture

#

I couldn't found solution

#

from google

#

and source code are very hard

crude charm
#

I have an interface and want to add every item that implements that interface into an inv

public interface Kit {
    public String name();

    public String description();

    public int slot();

    public void onSelect();
}

This is what I have, for some reason intelliJ wants me to have all these brackets and stuff

        for (kit.slot();;) {
          
        }
sullen marlin
#

for (kit.slot();;) { <--- wtf is that

crude charm
#

dont ask me

#

intelliJ cried and wanted it

quaint mantle
#

xd

eternal oxide
#

The great and powerful InteliJ code suggestion 🙂

crude charm
#

ikr lmfao

subtle kite
#

zoi you doing guis?

#

or commands

crude charm
#

a kit selector and I want to add all the kits that implament the interface to be added to the gui

sullen marlin
#

you need to put all your kits in a list or something and loop that

crude charm
#

my List is of Integer type

sullen marlin
#

no, why do you need slot

crude charm
#

so I can add it in x slot

sullen marlin
#

that would be something like inventory.setItem(kit.slot(), <kit item>)

crude charm
#

oh im dumb dont bully me LMFAO HAHAHA been up till 5am and am trying to code at a party

sullen marlin
#

go party instead

#

lol

crude charm
#

lmfao

quaint mantle
#

Hello, I can not see the plugin in my server, How?

#

But he is in the plugin folder ( english is very bad sorry )

eternal oxide
#

latest.log

quaint mantle
#

show log

#

probably not included plugin.yml

#

Show my log?

#

yes

#

?paste

queen dragonBOT
quaint mantle
#

its big

#

enter it above

chrome beacon
#

rg.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/rick/tutorial/Tutorial has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0

quaint mantle
#

you have to change your jdk

chrome beacon
#

You've compiled with a newer version of Java than the server is running

#

You need to set your target jdk version

quaint mantle
#

where?

#

in the log?

#

what do you use eclipse or intellij?

chrome beacon
#

How are you compiling?

quaint mantle
#

Intellij

chrome beacon
#

Maven, Gradle or built in build artifact

quaint mantle
#

then do Ctrl + Alt + Shift + S

#

In the?

chrome beacon
#

No wrong arrow

#

Don't change jdk

#

Change the setting below

#

Set the project language level

quaint mantle
#

oh yea sorry my bad

#

1.8 version i have 1.6?

#

1.8 right?

chrome beacon
#

Which one are you changing now?

quaint mantle
#

Project

chrome beacon
#

Yeah let it be 16

quaint mantle
#

Yes

chrome beacon
#

Change the setting below

quaint mantle
#

wich one?

chrome beacon
#

Project language level

coral sparrow
#

Hello , I m new to command args, How get the args like /command (args0) (args1)

quaint mantle
#

and then?

chrome beacon
#

Set it to 8 and click apply

#

then ok

#

Now rebuild your jar and try that

quaint mantle
#

Lamdas?

chrome beacon
#

Yes

quaint mantle
#

i rebuild

chrome beacon
coral sparrow
#
                    sender.sendMessage("Usage: /kb (player) (profile)");
                } 
                
                if(args[0].equalsIgnoreCase("")) {
                    if (args.length == 0) {
                        sender.sendMessage("Usage: /kb (player) (profile)");
                    }
                    @SuppressWarnings("deprecation")    
                    CraftPlayer target = (CraftPlayer) Bukkit.getServer().getPlayer(args[0]);
                    if (target == null) {
                        sender.sendMessage("User not online!");

                    }```
#

@chrome beacon

#

I dont know

#

where I made it

#

wrong

quaint mantle
#

THANK YOU

chrome beacon
#

CraftPlayer kekwhyper

quaint mantle
#

xD

#

I WORKS

coral sparrow
chrome beacon
#

Use Player not CraftPlayer

coral sparrow
#

My code doesnt work tho

coral sparrow
#

ok

chrome beacon
#

Yeah args 0 will never be ""

#

So your code won't run

coral sparrow
#

:/

chrome beacon
#

Also that code is just messed up and shouldn't even compile

coral sparrow
#

xd

chrome beacon
#

Which means you didn't send everything

#

Send the whole method in a paste next time

coral sparrow
#

ok

#

@chrome beacon

eternal oxide
#

wow

coral sparrow
#

kinda messed up

chrome beacon
#

What is that spacing

coral sparrow
#

ik xd

#

um

eternal oxide
#

testing args.length THREE times? Sending the same message twice

chrome beacon
#

Yeah

#

And not returning after the error message

#

Why is there a supresswarnings mid code

coral sparrow
chrome beacon
#

Yeah it's a deprecated method

#

But don't put that mid method

coral sparrow
#

oh didnt know that

torn oyster
#

why when im checking if is something with the @nullable annotation is not null

#

does it give nullpointerexception

chrome beacon
#

Send code

#

You did something wrong

eternal oxide
#

getPlayer(String) is not deprecated

torn oyster
#
if (m.getMinigamePlayer(player) != null) {```
#

thats the line

#

this is the method

chrome beacon
torn oyster
#
    public @Nullable MinigamePlayer getMinigamePlayer(Player p) {
        for (MinigamePlayer pp : playerList) {
            if (pp.getPlayer() == p) {
                return pp;
            }
        }
        return null;
    }```
#

playerlist is not null

chrome beacon
#

And what line is the nullpointer sent

eternal oxide
torn oyster
#

wait it might be

#

yes it is

#

i am dumb

#

ok thank you

chrome beacon
#

I'd recommend using a newer version of Java for better exeptions 🙂

torn oyster
#

well i have open jdk 11

#

but it still thinks im on java 8

#

so its kinda dumb

chrome beacon
#

Not really

maiden thicket
#

jdk 16 :lipbite:

chrome beacon
#

jdk16 is nice

#

Can't wait to be able to use it fully 🙂

maiden thicket
torn oyster
#

i fixed that but it is still throwing a nullpointerexception

chrome beacon
#

Run with Java 16 and it will tell you what's null

#

or add a bunch of debug checks

torn oyster
#

fixed

#

its fine

quaint mantle
#

how i can create temp team and change its color?

#

needs for custom glowing effect

#

1.16

untold kernel
#

is posting something on spigot mc built using paper bannable

#

?

quaint mantle
#

i dont really think so but cant prove it

quaint mantle
quaint mantle
#

does it have api? 😅

chrome beacon
quaint mantle
#

oi thanks

#

just for my knowledge anyone have idea why its like that tho?

#

arent u duplicanting somehow runnables?

#

well i do use runnable for the scrollable text

chrome beacon
#

Yeah you might have multiple of them

quaint mantle
#

erm

#

yeah i thought of that

#

show code where you do the runnable

chrome beacon
#

?paste

queen dragonBOT
quaint mantle
#

please paste it

#

xd ok

chrome beacon
#

Make sure you don't call giveTab multiple times

quaint mantle
#

ohhh

#

i see the problem i thimk

#

i believe thats the problem

#

lol

chrome beacon
#

oh yea

quaint mantle
#

remove the for (player player and replace it only with the ((craftplayer)

chrome beacon
#

Yeah

#

For each player you're sending the packet to all players

#

Causing a mess

quaint mantle
#

yea and then i would do something liek if (player == null) cancel();

chrome beacon
#

As Pavlyi said remove the for loop

tardy delta
#

what is the String label inside the onCommand method?

quaint mantle
#

its something like cmd but it recognizes aliases

tardy delta
#

oh

chrome beacon
#

Yeah it will show if they used an alias

quaint mantle
#

ex in plugin.yml
gamemode:
aliases: [gmc, gms]

and the Command only shows the gamemode
and the label shows even the gmc, gms, gamemode

tardy delta
#

ooh okay

keen kelp
#

hey guys

quaint mantle
#

hey

tardy delta
#

hello

keen kelp
#

Im trying to make sort of a custom health system

#

but it looked to me as though the hashmap didn't save

chrome beacon
#

How are you saving the hashmap?

quaint mantle
#

add static to the hashmap

keen kelp
#

oh ok 1m imma test

quaint mantle
#

okey

keen kelp
#

nope still

#

every time it just reports the default health - the damage I took

#

here's my code

chrome beacon
#

?paste

queen dragonBOT
keen kelp
#

oh ok

chrome beacon
#

camelCasing on methods

keen kelp
#

I have done some debugging and it seems like line 20 is always reporting true

#

although the player's entry would already be in the hashmap

chrome beacon
#

I wouldn't cancel the event that gives a bad result

#

Why are you calling Map.of()

keen kelp
#

idk what to use

#

I just wanted to check if that entry is in the map

chrome beacon
#

Replace Map.of(). with HealthMap

keen kelp
#

ok brb

chrome beacon
#

Because what you're doing is creating an empty map and checking if the player isn't in it

keen kelp
#

oh

chrome beacon
#

That will always be true since it's empty

keen kelp
#

breh

#

also is p.kick breaking something?

#

cause it looks to me like I can't join back

maiden briar
#

Which packet do I need to send if I want to send a json message to chat? And is this packet also available in bungee?

quaint mantle
keen kelp
#

the map is fine

chrome beacon
maiden briar
#

Ok but I wanna know which packet it is

#

PlayerPacketPlayOutChat or something?

chrome beacon
sullen marlin
#

no

#

do not use packets for this

#

you will kill me

keen kelp
#

Olivio the great do you have idea why I can't rejoin after dieding

chrome beacon
#

What happens when you try to rejoin?

maiden briar
#

Ok I won't use packets then

quaint mantle
keen kelp
#

I get stuck on Joining world

chrome beacon
#

Don't think that should cause an issue but you can try delaying the kick with one tick

quaint mantle
keen kelp
#

ok

quaint mantle
#

in team no players

#

what is wrong?

dense goblet
#

question, which of these functions loads chunks?:
-play particles
-get a BlockIterator
-update an entity's position

quaint mantle
#

I need to setting team

#

and add player to this team

maiden briar
#

If I do new TextComponent(&lTest);, will this text be bold then?

quaint mantle
#

that isn't works for me

#

1.16

maiden briar
#

Must do #setBold ?

wraith rapids
#

use the legacy parser

maiden briar
#

Which one?

wraith rapids
#

the one

maiden briar
#

TextComponent.fromLegacyText() ?

quaint mantle
#

or something like this

maiden briar
#

Ok, and then bungee will accept it in the constructor?

quaint mantle
#

i think it must

wraith rapids
#

that will give you a textcomponent directly

maiden briar
#

Ok I will try

wraith rapids
#

it is a factory method that replaces the use of a constructor

maiden briar
#

Yes

tardy delta
#

I'm wondering how many slots this would create?

Inventory gui = Bukkit.createInventory(null, 9, ChatColor.RED + "Stats");
#

9?

wraith rapids
#

yes

quaint mantle
#

yup

maiden briar
#

TextComponent.fromlegacy will return BaseComponent array?

tardy delta
#

how would that look like? just like a crafting table i assume

wraith rapids
#

yeah

tardy delta
#

okay

wraith rapids
#

i think

#

i don't remember

#

if it doesn't, it won't

tardy delta
#

I'll try

#

oh

tardy delta
#

😮

wraith rapids
#

1 row has 9 slots

#

a workbench also has 10 slots, as it has an output slot

#

visually at least

#

use a dispenser if you want a 3x3 grid

tardy delta
#

hmm I just want a use a double chest of 54 slots

wraith rapids
#

then do 6*9

tardy delta
#

brr i forgot to register the cmd

keen kelp
#

how do I kill the player

pallid oxide
maiden briar
#

The favicon?

wet breach
#

/kill is generally effective @keen kelp

keen kelp
#

Hello! While that would work, it unfortunately would not work in a plugin and lack customisability

wraith rapids
#

if there isn't a direct kill method, set the health to 0 like was mentioned

wet breach
#

definitely would work in a plugin and can be customizable, but you are right it probably isn't the proper way to do thatt 😛

quaint mantle
#

spigot!

#

@quaint mantle

#

check args length

#

args.length << Checking length

#

for example, if (args.length == 0)

#

args.length == 1 - if args[0] only
args.length == 2 - if args[0] + args[1]
and etc.

keen kelp
#

what is the default scale of a player's health?

#

is it 0-20?

quaint mantle
#

20.0

#

1 heart = 2hp

keen kelp
#

ok

#

how do I make a value 0 at least then

drowsy helm
wet breach
#

I wouldn't use that

tardy delta
#

this works smh

wet breach
#

@drowsy helm I suppose you could use abs on top of min lol

#

to avoid getting them pesky negatives

drowsy helm
#

not exactly sure the context of the question

wet breach
#

well I mean the question is pretty straight forward, just kind of an odd thing to ask though considering how basic it is XD

keen kelp
#

how do I make an event do the damage I want it to deal and not the original amount

wet breach
#

cancel and then apply it

keen kelp
#

say I want fall damage to always be 1 heart

opal juniper
wet breach
#

so you cancel the event, and then apply the damage after or create a new event for it with the appropriate values

keen kelp
#

then it would not have the same KB right

#

if it's not KB

#

like if I want a player to not die the first time they would've died

wet breach
#

not what you mean by KB

keen kelp
#

knockback

wet breach
#

but, you can cancel the event and apply the damage you want all in the same method, just have to make sure to cancel the event first before changing the damage amounts.

#

and you can even apply Knockback if it doesn't apply it

tribal sparrow
#

i'm having some issues with UUID.fromString i keep getting a java.lang.IllegalArgumentException: Invalid UUID string:

                .stream()
                .map(UUID::fromString).collect(Collectors.toList());``` could someone help me?
keen kelp
#

but I dont know the original knockback

wet breach
#

so play around with it

#

part of being a dev 😉

keen kelp
#

it's dynamic how am I suppose to know

wet breach
#

test it?

keen kelp
#

hand and a knockback 1000 stick all goes to EntityDamageEvent

#

I can't make it set knockback

wet breach
#

all knockback is, is just velocity

wraith rapids
#

one of the strings split from the original string is not a valid uuid

keen kelp
#

and?

tribal sparrow
wet breach
#

means you are able to replicate it 🙂

#

target.setVelocity(damager.getLocation().getDirection().multiply(1.5D));

#

@keen kelp there you go, knockback

#

go have some fun 😉

keen kelp
#

thaaax

kind coral
wraith rapids
#

isSet or something

keen kelp
#

how do I get damager from entitydamageevent

wraith rapids
#

it might not have one

kind coral
wraith rapids
#

listen to entity damage by entity event if your logic requires an entity damager

wet breach
#

if there isn't a damager, then get the reverse of the players direction being damaged

kind coral
#

or just check if e.getDamager() instanceof Player and then cast to player i think i really dont know

wraith rapids
#

you probably don't want to apply knockback from cacti or magma do you

wet breach
#

it is in reference to the snippet I posted about in replicating knockback lol

#

well cacti knocks you back doesn't it?

#

maybe not magma

wraith rapids
#

it doesn't i don't think

kind coral
wraith rapids
#

i don't think any non-entity damage sources do

keen kelp
#

that

wet breach
#

either way, I gave the code to work with on how to replicate knockback, it isn't meant to be directly used without understanding it though IE copy paste lol

#

?spoonfeed

#

?spoon

queen dragonBOT
#

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.

keen kelp
#

but if I want it to handle entity damage AND block damage

#

what do I do

#

since if I listen to both

#

the it would deal damage twice

wraith rapids
#

wat

wet breach
#

welcome to the world of being a developer solving problems 🙂