#help-development

1 messages · Page 1549 of 1

chrome beacon
#

The Recipie book isn't an actual item

candid galleon
#

where are you creating it?

quaint mantle
chrome beacon
#

Anyway that error comes from an invalid NBT tag

quaint mantle
#

hmmm

chrome beacon
#

Why would there be one

#

The tag is invalid so the client has no idea what to do with it

quaint mantle
#

ahhh

smoky oak
#

the problem is probably in your initialization/setup of the book

quaint mantle
#

ahh Do you know which one(method) is related to nbt tag?

chrome beacon
#

So you don't know what your code does?

quaint mantle
#

yes I tried to find, but I don't know

#

what is related to nbt tag

smoky oak
#

It's where you set what the book displays the code you posted is fine

chrome beacon
#

Can you open your book in the first place without forcing it

smoky oak
#

the problem lies in a wrong setup of the book information, not the book opening itself

quaint mantle
#

when I give player a book, and open it, it doesn't have Invalid tag

smoky oak
#

maybe its a timing issue

#

if its like that i dont know what the issue could be, sorry

quaint mantle
#

its ok thanks you

smoky oak
#

If i might aska a question mysyelf...

#

did java -jar BuildTools.jar --rev 1.17 --generate-docs but i cant find the javadoc

quaint mantle
#

hmm

#

Anyone knows a way to get fully black player screen ? No potion effect 🙂

smoky oak
#

blindness x

#

ah wait

#

oops

quaint mantle
#

Yea it's for my hardcore plugin when player lost all lives. Would like to make it completely black

smoky oak
#

tell the player they're surrounded by black concrete

opal juniper
#

Send block change packets

#

So that they think they are surrounded

quaint mantle
#

Ah I'll look into that one thanks for that!

opal juniper
#

The only thing is that if they interact with the blocks they get removed - I think there is an event listener you can cancel though

quaint mantle
#

any example of config with saving all comments (custom)?

quaint mantle
opal juniper
smoky oak
#

back to my question where does buildtools.jar generate javadocs (I have the flag enabled?)

quaint mantle
quaint mantle
#

I save it -> access to store things from it -> comments kept only first header, not whole file, which is my issue

opal juniper
hybrid spoke
#

PacketPlayOutGameStateChange

opal juniper
#

Yeah, are you then talking about the sky colour one?

#

Or like the weather field

#

Or some shit like that

hybrid spoke
#

just googled and it was the first result

opal juniper
#

The problem I have had with that packet is that if you put a high number in it it gets unplayable

#

It gets really laggy

opal juniper
#

Oh he just triggered the game end screen

hybrid spoke
opal juniper
#

Lmao

hybrid spoke
#

never did anything with this packet

opal juniper
#

He cut out the credits

#

From the video

#

But not the first like 0.5 seconds

torn shuttle
#

get set get set get set get set this is my life now

opal juniper
#

Ayyyyy

torn shuttle
#

just hundreds of files of getters and setters

toxic mesa
#

Those are rookie numbers, you should go for thousands of getter and setter files

hybrid spoke
opal juniper
torn shuttle
#

well there's 729 class files in the project rn so I guess we're not that far off from thousands

quaint mantle
#

any example of config with saving all comments and not keeping only first header (custom)?

hybrid spoke
quaint mantle
hybrid spoke
#
                PrintWriter pw = new PrintWriter(file);

                pw.print(IOUtils.toString(Objects.requireNonNull(Core.getInstance().getResource("messages.yml"))));
                pw.flush();
                pw.close();
#

its not reading. you print the received contents of the requested resource to the given file.

#

afterwards you flush it to close the stream so there will be no memory lying around

quaint mantle
#

yes, but I need to access things from it afterwards

#

and then the comments are lost again, once I do it

hybrid spoke
#

yeah so just get the FileConfiguration from the file

quaint mantle
#

will try, thanks

native gale
#

Hi, is there any simple way to open additional port to the server, let's say, 127.0.0.1:1111, and be able to determine, if the player joined via main port 127.0.0.1:25565 or 127.0.0.1:1111?

hybrid spoke
native gale
#

Eh, thank for the link, but it isn't particularly what I meant. I was talking about Spigot plugin, where the behaviour will depend on the port the user uses to connect.

#

And I was wondering if there's a way to handle this using Bukkit/Spigot API only

hybrid spoke
#

you have to state your needs clearly

native gale
#

Sorry, English isn't my first language

#

It was difficult to even state them as I did

hybrid spoke
#

you could use the PlayerLoginEvent and check for the hostname

grizzled bear
#

Hello,
Is someone knows how to use Maven Shade Plugin with Eclipse, it's my first time and I look a few dozen of forum discussions, but I still have the same exception on my plugin: ClassNotFoundException
I give my pom.xml file: https://pastebin.com/ygi6HNnM
thank you in advance 🙂

eternal night
#

?paste

undone axleBOT
eternal night
#

please

#

delete the code block and paste the link

grizzled bear
#

Sorry, but this website isn't working

eternal night
#

oh damn, it is actually down 😱

grizzled bear
#

Can I use pastebin ?

eternal night
#

yea

#

any bin website is good, just pasting huge codeblocks is clearing every other problem from the chat

grizzled bear
eternal night
#

Hmm why are you depending on yourself tho ? What class is not found when running ?

grizzled bear
#

I've created an API that give an access to my databases so I use on my plugin many classes to get some datas from tables. Classes are GeneralPlayer and CharacterInformations, there are each used to access to a table

eternal night
#

oh, right I see your artifact is called mmoDatasaved

#

your groupId is wrong btw

#
<groupId>mmoDatasaved</groupId>
<artifactId>mmoDatasaved</artifactId>
grizzled bear
#

It's my plugin so I need to use my package for the groupId ?

eternal night
#

Yea, similar to what you did for mmoDatabase

#

fr.MrUrica I guess

grizzled bear
#

Oh ok, I'll try it

eternal night
#

can you paste the output of your mvn package run ? the maven shade plugin seems fine to me, so the log should show more

grizzled bear
#

I installed it only on my eclipse IDE 😦

eternal night
#

but doesn't eclipse also show the logs ?

#

you are compiling using maven right ?

grizzled bear
#

No, I compile like another plugin (JAR file)

eternal night
#

well then obviously your maven configuration isn't going to get you anywhere 😅

grizzled bear
#

Has I understand, when I compile like another plugin, I already checked maven files so it compiles with
Maybe a version problem

eternal night
#

I am not sure that eclipse actually uses maven under the hood to compile your plugin

cold field
#

Does anyone know why with the InventoryClickEvent when I change the itemMeta of the "currentItem" it works only in survival or also in creative if I delay the task by 1 tick?

grizzled bear
#

My plugin is running on my server, only with ClassNotFoundException exceptions, and I used spigot in maven dependencies. I think if Java had compiled without maven, the plugin didn't load on my server

quaint mantle
eternal night
#

do you have maven installed ?

cold field
grizzled bear
#

Only on my Eclipse IDE

quaint mantle
#

creative is clientside

eternal night
#

try to run it as a maven build

cold field
quaint mantle
cold field
#

So this guy is right

#

But idk why If I delay by 1 tick it works

grizzled bear
eternal night
#

you are missing package as a goal

grizzled bear
eternal night
#

I think the newest would be 3.8.1 ?

grizzled bear
cold field
grizzled bear
#

Haha, it's a bad joke I think, but my console tells that my plugin.yml is invalid 😦

eternal night
#

sounds like an easy fix tho

grizzled bear
#

Probably

#

Jar does not contain plugin.yml 👀 what ?

eternal night
#

where is your plugin.yml

#

better be in the resource folder

grizzled bear
#

ohhh, I put it in the same root as src folder

eternal night
#

it goes in src/main/resources

grizzled bear
#

like src/fr/MrUrica/mmoDatasaved/resources ?

eternal night
#

oh

#

you aren't even following maven project structure

#

did you just throw in a pom.xml ? xD

grizzled bear
#

I converted my project into a maven project, then I edited pom.xml but I didn't change anything else 😅

eternal night
#

yeah maven projects have a set layout you gotta follow

#

an example maven repo

grizzled bear
#

ok so I have to put before my package a main folder

eternal night
#

yea basically goes src/main/java/my/package/name

grizzled bear
#

Okay then, I create a src/main/resources

#

Again an error on compilation: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

#

Don't I need to edit this line on my pom.xml ? <sourceDirectory>src</sourceDirectory>

#

Ok, I changed my sourceDirectory to src.main and the plugin works !
Thank you @eternal night

eternal night
#

np

torn shuttle
#

?paste

undone axleBOT
torn shuttle
hybrid spoke
torn shuttle
toxic mesa
#

If I use #hideplayer, how can I show the player again?

toxic mesa
#

how tf did i miss that

#

ty

loud island
#

should stuff in a DatabaseHandler class be static?

eternal night
#

not really a reason to

ivory sleet
#

No

loud island
#

ty

ivory sleet
#

Of course this depends more exactly on how you’re designing it but when it comes to storage types you probably want to take advantage of polymorphism and abstraction which static isn’t the best at.

loud island
#

im not making anything complicated

#

the most complicated thing I need rn is just checking whether something exists in a mongo collection lol

eternal night
#

An interface abstraction might still be pretty useful for you

last harbor
#
String code = "public class Test {"
                + "    public static met() {"
                + "        System.out.println(\"hi\");"
                + "    }"
                + "}";```
I'm trying to compile this string
And to have access to run the method from anywhere
Does anyone know a way to do that?
eternal night
#

I think compiler API is only part of the oracle JDK iirc

#

so you are probably fucked

noble spire
#

Does Bukkit#BanList#addBan work for offline players?

#

(It takes the username rather than the UUID)

eternal night
dire marsh
noble spire
#

Then I'd expect it to take a UUID object

dire marsh
#

¯_(ツ)_/¯

#

try it

noble spire
#

okay

dire marsh
#

Bans by name are no longer supported and this method will return null when trying to request them. The replacement is bans by UUID.

#

it seems if you provide username it will just use their uuid

wraith rapids
#

imagine if the documentation actually described what form 'target' is in

tardy delta
#

does this returns the args with a space between them?

public static String getFinalArg(String[] args) {
        StringBuilder message = new StringBuilder();
        for (String arg : args) {
            message.append(arg).append(" ");
        }
        return message.toString();
    }
quaint mantle
#

Is there GoatBumpBlock event?

#

1.17 of course

quaint mantle
hybrid spoke
tardy delta
#

ok

eternal oxide
#

No trailing space

tardy delta
#

does that also work for an array?

eternal oxide
#

args is an array, do you mean a List?

tardy delta
#

nah i meant does that return the args with a space between them? thats what i need

eternal oxide
#

yes

tardy delta
#

oh lemme try then

#

but how can i remove the lore from an item?

#

i did meta.setLore(null);

tame coral
#

Once you modified the meta of the item, you need to set the item's meta to the new ItemMeta object you modified

#

(don't know if it's clear lol)

tardy delta
#

yea i know

#

its just that question ^^

tardy delta
#

ah ok

#

thanks

tame coral
#

np

smoky finch
#

Is there a way to show multiple tab complete options for a command, but prevent players from being able to use them?

#

Like when they press tab and it copies the text into their chatbox.

frosty tinsel
#

No

eternal oxide
#

anything you put in the list will be shown on the client. Whether they can use that option is up to your command code.

tame coral
#

How to you add tab complete options ?

#

Is it in plugin.yml that i need to add something ?

eternal oxide
#

no, in code in teh tabcompleter method

smoky finch
frosty tinsel
eternal oxide
smoky finch
#

I'm trying to colorize tab completes for showing error messages and colorized info in general, but it kicks the player if they tab complete that message and send it

frosty tinsel
tame coral
#

Okay, thanks

frosty tinsel
tame coral
#

Don't worry i'll figure it out

#

The docs are good enough

eternal oxide
#

public class BaseCommand implements TabExecutor

frosty tinsel
#

Yeah, the TabExecutor is better

eternal oxide
#

that does both CommandExecutor and TabCompleter

tame coral
#

Okay thanks

eternal oxide
noble spire
#

?javadoc

zealous hill
#

hey, I use for my plugin Ageable ageable = (Ageable) b.getBlockData(); on Sweet Berries and Glow Berries (1.17), for the Sweet Berries it works, but for the glow berries they are not ageable, how can i get if they are grown or not ?

eternal oxide
#

Its not ageable as its a random chance for growing a berry

ivory sleet
#

Like a vine

eternal oxide
#

well, it is actually agable, but the age does not affect when/if it has fruit

zealous hill
#

Okay but how can I check if the player is harvesting a grown glow berry (if it has fruit) ?

tame coral
#

PlayerInteractEvent ?

eternal oxide
#

I would guess watch teh PlayerHarvestBlockEvent

tame coral
#

Yeah that's better

zealous hill
#

Ok thx ;)

noble spire
#

(Or just specify an rgb value for a ChatColor)

tame coral
#

For chatcolor there's only the specified color available

#

But I guess you can try to add an if close with the hex tag to find the closest one

#

I don't know if there's any easier way to do this

noble spire
#

hmm okay I'll keep searching

tame coral
#

good luck

eternal oxide
#

^ using vectors and shortest distance is the only way really.

noble spire
#
Minecraft Wiki

Formatting codes (also known as color codes) add color and modifications to text in-game.
Text in Minecraft can be formatted with the section sign (§). In Bedrock Edition, the section sign can be entered into signs, world names, books, renaming items and in the chat. In Java Edition, section signs may be used in server.properties, pack.mcmeta, s...

eternal oxide
#

Ok, so a totally different question

noble spire
#

Well, my aim is to send a message closest to a specified rgb value

tame coral
noble spire
tame coral
#

yeah but still

#

i hate vectors

#

lol

noble spire
#

Launches Unity3D

eternal oxide
summer scroll
#

There is a libs from like 2013 to get closest ChatColor from Color.

eternal oxide
#

So yes you can use rgb colors in books but only using unsafe

#

to access the json

noble spire
#

Yeah, but I'm not talking about books 😔

eternal oxide
#

Eff man, you just showed us a BOOK and asked for that

noble spire
#

it's what ChatColor's constants are

eternal oxide
#

ask yoru ACTAUAL question, not around the bloody houses

noble spire
#

right?

eternal oxide
#

ask an actual question. As we have answered every one you asked and you keep telling us thats not it

wraith rapids
#

bukkit does have an implementation for a rgb supporting § colorcode, but it is super gay and nobody uses it

#

various plugins have their own implementations

ivory sleet
#

§x§F§F§F§F§F§F NNY?

#

Tomasan don’t use that command in this channel thx

frosty tinsel
#

Sorry

noble spire
#

Is that a thing?

frosty tinsel
ivory sleet
#

Well with the help command but use something like #spigotcraft for it I guess

ivory sleet
#

I think at least

noble spire
wraith rapids
#

yes, that one conclure

outer moth
#

When premium plugins are approved do they get listed right away?

cold tartan
#

im not sure why my bossbar isn't working (it just is completely empty every tick until i update then the next tick it is empty again), this is the code that is updating the bossbar:

bar.setProgress(val/max);
``` is there something wrong with that?
#

do i need to do that every tick?

#

btw val is a num between 0 and 120, and max is 120

#

do i need to like round that to the nearest 100th?

#

cuz sometimes i can get numbers like 8.(3 repeating)

hybrid spoke
summer scroll
hybrid spoke
cold tartan
hybrid spoke
#

show us the code

cold tartan
#

ok

hybrid spoke
#

doesn't also bossbars have a cooldown

#

and vanish afterwards

quaint mantle
#

Ok so Im trying to check if the location in the configuration file equals to the location of the STONE_BUTTON clicked in the PlayerInteract event with this: https://paste.md-5.net/ecazuwipig.cs
It does get the location but it does not go through if (event.getClickedBlock().getLocation() == loc) {

wraith rapids
#

use equals

#

== doesn't do what you think it does

quaint mantle
#

I tried equals as well, doesnt work

hybrid spoke
#

== checks if the adress of the object in the heap are the same so the vars are refering to the same object or not

quaint mantle
#

no error

#

== and equals doesnt work

hybrid spoke
#

?paste

undone axleBOT
cold tartan
#

@hybrid spoke there u go

quaint mantle
#

?paste

undone axleBOT
cold tartan
#

oh shoot

hybrid spoke
#

and delete your codeblocks

cold tartan
#

yeah sorry forgot about that

quaint mantle
hybrid spoke
#

at least equals

quaint mantle
#

gimme a sec

cold tartan
tardy delta
#

does Statistic.PLAYER_KILLS returns a value? or do i need to use Statistic.PLAYER_KILLS.name() ?

cold tartan
#

there u go @hybrid spoke sorry about that i forget aobut paste.md a lot

dusk flicker
hybrid spoke
#

and what exactly isnt working? where is your scheduler setting the val every time?

dusk flicker
#

?jd

hybrid spoke
#

you need to get the value by that enum with the #getStatisticmethod

cold tartan
tardy delta
#

so like this

meta.setDisplayName(p.getStatistic(Statistic.PLAYER_KILLS) + " kills");
cold tartan
quaint mantle
tardy delta
#

oki

hybrid spoke
cold tartan
#

OH WAIT

#

AHHHHH

#

INTEGER DIVISION

#

mmmmmmmmmmmmmmmmmmmmmmmmmmmm

#

that might be it

tardy delta
#

yay it works

hybrid spoke
cold tartan
hybrid spoke
#

np^^

quaint mantle
hybrid spoke
#

not the value

#

ah wait nvm

#

pastebin is just eyecancer

#

why do you have different casings?

quaint mantle
#

for the traitorTester?

#

yeha already saw that and fixed it but wasnt the issue

eternal oxide
#

your world name is null

tardy delta
#

why do i get that * or **?

wraith rapids
#

because they are valid arguments

proud basin
#

isn't * everyone?

wraith rapids
#

as for what they do, I don't remember; * probably heals everyone and ** might heal yourself

tardy delta
#

yea it is * everyone but when i try its null

wraith rapids
#

what is null

proud basin
#

Yea what Mr Skull Head said

hybrid spoke
#

mr chaplin

tardy delta
#

i have something that checks is the argument is valid and it says * is null

wraith rapids
#

context

#

we have no idea what you are talking about

hybrid spoke
wraith rapids
#

* is *, not null

hybrid spoke
#

and you wonder why its null?

dusty sphinx
#

How can I get an Advancement from it's key?

tardy delta
#

nah it looks for the player called * or something

hybrid spoke
#

yeah

#

and he cant find one

#

what is he returning if he cant find a player named *?

tardy delta
#

null

hybrid spoke
wraith rapids
#

and you are wondering why it is null

noble spire
#

?javadoc

wraith rapids
#

more like learnjava

tardy delta
#

no i understand

hybrid spoke
#

after we said that yep

tardy delta
#

i was wondering what * and ** meant 🤔

hybrid spoke
tardy delta
#

yessir

quaint mantle
vague cypress
#

?learnjava

undone axleBOT
quaint mantle
#

The vibration particle, its asking for data whats the best way of finding out what data it wants as the javadocs dont seem to help

dusk flicker
#

Google is your best bet if javadocs aren't helping

vague cypress
#

What's the best way to lock items into a custom GUI so they can't be removed?

worldly ingot
#

RE: the * vs **, Essentials distinguishes the two by * = everyone, ** = everyone including every offline player

#

If you have a large playerbase, ** will easily crash the shit out of your server

ivory sleet
vague cypress
#

Yes, but what do you use to cancel the click event? I tried using title and it didn't work

quaint mantle
#

event.cancelled

vague cypress
#

I have

            event.setCancelled(true);```
but it doesn't work
ivory sleet
#

I use InventoryHolder but arguably InventoryView is better

vague cypress
#

I do have an inventoryHolder, how would I use it to cancel an inventory click event?

tardy delta
#

what does the statistic BOAT_ONE_CM returns? the distance travelled by boat in cm?

unreal quartz
#

yh

tardy delta
#

in cm 🤔

unreal quartz
#

1 block = 1 metre

tardy delta
#

uhu

hardy swan
vast sapphire
#

what should this return? v @EventHandler public Object onAppleEat(PlayerInteractEvent event) { Action action = event.getAction(); Player player = event.getPlayer(); if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) { if (event.getItem().equals(Material.APPLE)) { if (event.getItem() != null) { player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 600, 5)); } } } return true; }

unreal quartz
#

void

#

?learnjava

undone axleBOT
tardy delta
vast sapphire
#

oh mb i was testing something and i put public potioneffect and was confused on why i was missing a return statement for a void function

cold tartan
#

hey, im wondering how to edit block type without editing the direction/shape, i want to edit stair/slab types (from stone_brick to end_stone) without changing their shape. how do you do that? whenever i use block.setType() it also sets the shape

quaint mantle
#

Hi, I'm developing a simple economy plugin. Each player has a file to define their balance.

cold tartan
quaint mantle
#

So I developed a richer server system. It pulls all files to make a list, over time it would get heavy?

cold tartan
#

ok but a file for every player is a lot

unreal quartz
#

it's fine

quaint mantle
vast sapphire
#
    @EventHandler
    public void onAppleEat(PlayerInteractEvent event) {
        Action action = event.getAction();
        Player player = event.getPlayer();
        if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
            if (event.getItem().equals(ItemManager.invertedApple())) {
                if (event.getItem() != null) {
                    player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 600, 5));
                }
            }
        }

    }``` Why am i not getting the potion effect applied?
unreal quartz
#

that's what you want

#

the other one is deprecated

vast sapphire
#
ItemManager.invertedApple()``` is a public itemstack
cold tartan
unreal quartz
#

seems pointless to have another map after username

quaint mantle
#

I currently use this.

hardy swan
cold tartan
cold tartan
vague cypress
unreal quartz
#

not sure what other info you would need except a number under "balances"

hardy swan
unreal quartz
#

i would keep transactions under a separate key

hardy swan
#

different economy balances

tardy delta
quaint mantle
vague cypress
#

menuGUI impliments InventoryHolder

unreal quartz
#

ideally i would do that

#

or.. use an actual database designed for this stuff

hardy swan
#

ideally sql db lol

quaint mantle
hardy swan
#

hmm... learn?

unreal quartz
#

then learn

hardy swan
#

can start from sqlite, the easiest & serverless one

unreal quartz
#

this is exactly what sql is for

hardy swan
quaint mantle
#

I'm going to look for some tutorials on spigot

hardy swan
#

if former, instanceof isn't correct, if latter, your naming isn't correct

unreal quartz
#

whatever you do i wouldnt keep all playerdata in a single file unless you plan on reading the entire thing into memory one time

vague cypress
hardy swan
#

then your naming isn't correct

#

MenuGUI, PascalCase

cold tartan
vague cypress
unreal quartz
hardy swan
#

It is a convention for java classes to be in PascalCase

unreal quartz
#

/ walls

hardy swan
hardy swan
unreal quartz
#

don't really know anything about towny

#

but it generally doesn't sound like a good idea if you're gonna have a shit ton of playerdata

#

because you're going to be reading and writing to that single file constantly and you're going to have a nightmare synchronising it if you don't want to lock up the main thread

hardy swan
#

yea i understand, just stating what I observed lol

#

maybe it is a rabbit hole

loud island
#

So I'm attempting to use https://github.com/lucko/commodore, and CommodoreProvider#isSupported seems to be returning false even after following all the steps to implement it

hardy swan
#

have you tried opening up or search through the issues?

loud island
#

I'll take a look

hardy swan
loud island
#

use it in my plugin

hardy swan
#

then returning false is a sign that it is implemented

#

else it would throw classnotfound

loud island
#

It should be returning true, if it's false Commodore can't work

#

The problem is Brigadier not being supported for some reason as far as I can tell

#

I haven't found any issues related to this in the github repo

hardy swan
#

hm you can consider opening an issue regarding that

loud island
#

I asked in the lucko discord, if nobody is able to help there I'll open an issue

#

ty for trying to help tho :)

hardy swan
#

yea... it is weird

quaint mantle
#

How can I create the player in the database?

unreal quartz
#

insert into if not exists

#

also you should lookup how to use prepared stmts properly

dusk flicker
#

Also a note it may be good to make that a util to execute querys so you do not re type everything every time.

hardy swan
#

in most situations you dun even need to create the player

dusk flicker
#

And also you should store it by uuid not by name

torn shuttle
#

world#getWorldType is deprecated, what replaced it?

dusk flicker
#

You seem to be trying to do something that you don't have enough experience to do.

wraith rapids
#

world environment something something?

dusk flicker
#

?jd

torn shuttle
#

@wraith rapids yeah that's it thanks

hardy swan
#

why need check if player has account?

#

if it is to check before creating an account, then the "account creation" might not even be needed

quaint mantle
#

Do you think it is necessary to check?

unreal quartz
#

doesn't look like a how-to, but more like "here's a shit ton of code for you to shove into your plugin with no explanation"

hardy swan
#

but

#

it did mention replace

#

REPLACE INTO inserts if not already exists in sqlite

loud island
dusk flicker
#

^^ that's a huge thing, as your code could be heavily improved with a better understanding

hardy swan
#

I would say otherwise tho 🤔 to copy first then understand it. Cuz you can mess with it and find out what it actually does

loud island
#

copying is ok as long as you understand what it does

#

i'm definitely not saying don't copy, but it's worthless if you fail to understand what you're actually copying

#

all you end up learning then is how to press ctrl+c and ctrl+v repeatedly

earnest sonnet
#

yes

hardy swan
#

Yea definitely must understand it nonetheless

quaint mantle
#

Having an hard choice here, need to freeze player, currently I disable movement which is crap due to looking like massive lagg, what would be an better option ? Was thinking to teleport player each x ticks but think that would not be to great of an option either, anyone got an better way to handle player freeze ?

opal juniper
#

Cancel the move event

#

It’s the only way

#

You cannot tell the client it can’t move

unreal quartz
#

just teleport them to the centre of the block if they leave the block if you don't want it to look too laggy

#

or stick them on an arrow and don't let them dismount it

hardy swan
#

What is that thing whereby slab bugs the hell up players and traps them in place

quaint mantle
unreal quartz
#

woudl probably work

quaint mantle
#
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/mashape/unirest/http/async/Callback
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:149) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:384) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at net.minecraft.server.dedicated.DedicatedServer.init(DedicatedServer.java:232) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:987) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:307) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.NoClassDefFoundError: com/mashape/unirest/http/async/Callback
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:466) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    ... 7 more
Caused by: java.lang.ClassNotFoundException: com.mashape.unirest.http.async.Callback
    at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:142) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:99) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
    at java.lang.Class.forName0(Native Method) ~[?:?]
    at java.lang.Class.forName(Class.java:466) ~[?:?]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:67) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:145) ~[spigot.jar:3164-Spigot-f773da8-b069f22]
    ... 7 more

Hi when i tryin' send post request to api i have an error i don't know why

unreal quartz
#

whatever library you're depending on is not shaded

hardy swan
#

Chunk bigger than minecraft chunk

agile anvil
#

Hi there,
I'm just getting into the 1.17 and I already have a issue. Here is the context: I used to spawn an ArmorStand using nms in 1.16.5 (and lower). So I tried just to "translate" all the class to the new mapping. Result: no error but armorstands are not spawning.
Is there anything new in the involved packets?

hardy swan
#

Nms yes, package changed

agile anvil
#

Yep I noticed, so I moved all the class, but it doesn't work

hardy swan
#

Any snippets?

#

Are you doing it in server/exposed thread?

agile anvil
#

How do I spawn an armorstand?

  1. Create EntityArmorStand instance with parameters: CraftWorld, x, y, z
  2. Invoke setInvisible(true) to the instance
  3. Invoke setCustomNameVisible(true) to the instance
  4. Invoke setMarker(true) to the instance
  5. Invoke setCustomName(IChatBaseComponent) to the instance
  6. Send PacketPlayOutSpawnEntityLivingConstructor(instance)
  7. Send PacketPlayOutEntityMetadataConstructor(getdataWatcher)
#

Sorry but the code is horrible so here is the step I do ^^

agile anvil
hardy swan
#

I believe you dun have to spawn armor stand this way

#

In fact no need nms at all

#

There is a method in World

agile anvil
#

I'm doing a plugin which is compatible with 1.8-1.17 and which require to use NMS with reflection

hardy swan
#

Even the spawning part?

quaint mantle
#

Does anyone have a good sqlite tutorial?

#

I want to implement a local database in my economy plugin

agile anvil
hardy swan
torn shuttle
#

the official sqlite docs are p good

hardy swan
#

Then i dont know lol, weird to have no error

agile anvil
cold field
#

Guys just wondering, is it possible create a new file inside a jar or is it blocked for security purpose?

agile anvil
#

Create while running ? Like storing data inside the jar?

cold field
#

Yes

eternal oxide
#

no

#

You store data in a database or in files in teh plugins data folder

torn shuttle
#

actually yes you can write into a jar file

#

maybe you shouldn't, but you can

#

I have a new hobby and it's giving emotional support to people who ask for support and provide literally no details

#

the great thing about my hobby is that I get to do it for 4 hours every day

cold field
#

I was just wondering on how an updater of a java application works. I'm not talking about the plugin that you put the jar inside the update folder and spigot take care. What I don't get is how the java application is able to replace itself with the updated one

torn shuttle
#

it doesn't, not really

#

it creates a new copy and self-destructs

#

but since the end result is seamless you end up with a ship of theseus or a teleportation philosophical question

cold field
#

Is it able to delete itself?

eternal oxide
#

theres two ways to do it

torn shuttle
#

pretty sure it's possible yeah

#

hell back in the day I believe it was myth 2 that had an uninstaller which uninstalled your entire OS

#

the good old days of gaming

#

I still have that sucker installed somewhere

eternal oxide
#

you either execute an updater which then replaces teh original, or it places teh new one in an update location. Then next startup it copies anything from teh update location to teh new

#

When you execute a "Launcher" its just a wrapper that checks for a new version, replaces the old version and then executes it.

cold field
#

That was what I was thinking to do. And that is because I asked if I can save stuff inside my jar

#

Thank you

shrewd solstice
#

is this correct????

public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
    ArrayList<String> list = new ArrayList<>();
    if (args.length > 0) {
        list.add("set");
    }
    
    
    return null;
}```
quaint mantle
#

should be

#

there might be spacing errors but nothing I can see

#

are you programming a datapack or a plugin

shrewd solstice
#

plugin

quaint mantle
#

yeah idk what would be the problem

shrewd solstice
#

ok i go try this (because im trying to make a tab complete)

unreal quartz
#

you're not returning the list

shrewd solstice
#

ok how?

unreal quartz
#

?learnjava

undone axleBOT
shrewd solstice
#

if i add this.. it is correct????

return list.stream()

unreal quartz
#

no

wraith rapids
#

learn java

shrewd solstice
#

return list.stream()
.filter(arg -> arg.startsWith(args[0].toLowerCase()))
.collect(Collectors.toList());

silver cove
#

return list; ??

#

and replace ArrayList<String> with List<String>

shrewd solstice
#

ok

quaint mantle
#

Y'all know how to connect my discord bot to my minecraft plugin ?

#

like could y'all give me the method for getting the jda variable

#

cuz when I try doing Bot.jda= JDABuilder.createDefault(Bot.botToken).build();

#

it says java.lang.NoClassDefFoundError: net/dv8tion/jda/core/JDABuilder

unreal quartz
#

shade jda

#

though you should be aware that jda is massive and you won't be able to post it to spigot

quaint mantle
#

yes It's a private plugin

#

but how does discordsrv work then?

unreal quartz
#

by releasing on github

quaint mantle
#

i see

#

so what about shade jda?

#

how shall I do that

unreal quartz
#

depends what you're using to build the plugin

quaint mantle
#

I'm exporting the jar to my plugins folder

unreal quartz
#

then add the contents of the jda jar to your own

#

how you do that with your ide is something you're gonna google yourself

quaint mantle
#

I've downloaded jda

unreal quartz
#

i gathered

quaint mantle
#

I've added the build path to the plugin

#

like I did with spigot

#

so im not sure why thats wrong

unreal quartz
#

because that is only available at compile time

#

at run time spigot is provided (for obvious reasons), but jda is not

#

so to fix that, you shade it in yourself

quaint mantle
#

how may I "provide" it to the plugin

unreal quartz
#

and once again how you do that depends on your build system and unfortunately i can't read your mind

quaint mantle
#

there

#

a screenshot

unreal quartz
#

i don't use eclipse so i have no idea

#

i am sure a simple google search will solve your issue

quaint mantle
#

all I've seen so far are tutorials for how to shade a jar file using a maven project

#

but my project isn't maven

#

so

unreal quartz
unreal quartz
quaint mantle
#

So every project I make I should make it a maven project?

unreal quartz
#

if you want to use maven

quaint mantle
#

but is that the only way to shade a jar?

shrewd solstice
#

how to put the players to completion????

quaint mantle
#

cuz every tutorial I've seen uses maven

unreal quartz
#

well at some point you'll eventually use a build system like maven

wraith rapids
#

there are alternatives to maven that perform the same functions

#

maven is just popular in the bukkit ecosystem

quaint mantle
#

ok so there's no way to use maven to shade a jar into my plugin for my existing project ?

#

I have to make a new maven project?

unreal quartz
#

maven has a file called pom.xml which contains details about the project, you add one of those to your project and you have a maven project

quaint mantle
#

that's all I have to do to shade ?

#

a jar

shrewd solstice
#

@silver cove how to put the players to completion????

shrewd solstice
#

like /hat set PLAYER

steady saddle
#

tab completion

shrewd solstice
#

yes

unreal quartz
#

you literally don't need to do anything to add player tab completion

#

the server does that by default

shrewd solstice
#

x) ok

royal hawk
#

Guys how kick player in RedisBungee i need help.
I search method and not found.
I found this method from api and don't understand what to do next...

ivory sleet
#

I think you wanna use sendProxyCommand assuming you have a kick plugin installed on your bungee proxies

royal hawk
ivory sleet
#

Oh yeah well then use the sendData

#

Google plugin message channels or something

#

You should probably find a wiki page

vague cypress
#

So, I tried to use this to stop people from removing items from my custom GUI, and it's telling me expression expected on "Inventory". Why doesn't this work?


        if(event.getInventory() != Inventory) return;

        event.setCancelled(true);

    }```
wraith rapids
#

Inventory is a class

#

you need an object

shrewd solstice
#

it juste set nothing

silver cove
#

change args.length > 0 to args.length == 1

vague cypress
# wraith rapids you need an object

Well I want to reference the inventory, here's the line where it's created the inventory in that file. What would I put in? Inventory inventory = Bukkit.createInventory(new menuGUI("Menu"), 9, "Menu");

vast sapphire
#
            put(0, ItemManager.compressAmethyst());
            put(1, ItemManager.compressAmethyst());
            put(2, ItemManager.compressAmethyst());
            put(3, ItemManager.compressAmethyst());
            put(4, new ItemStack(Material.GOLDEN_APPLE));
            put(5, ItemManager.compressAmethyst());
            put(6, ItemManager.compressAmethyst());
            put(7, ItemManager.compressAmethyst());
            put(8, ItemManager.compressAmethyst());
        }});
    }

    public void checkCraft(ItemStack result, CraftingInventory inv, HashMap<Integer, ItemStack> ingredients){
        ItemStack[] matrix = inv.getMatrix();
        for(int i = 0; i < 9; i++){
            if(ingredients.containsKey(i)){
                if(matrix[i] == null || !matrix[i].equals(ingredients.get(i))){
                    return;
                }
            } else {
                if(matrix[i] != null){
                    return;
                }
            }
        }
        inv.setResult(result);
    }```
 the crafting works but when i fill all 9 slots with compressAmethyst() i get 1 compressAmethyst()?
shrewd solstice
keen kelp
#

Bukkit#EnablePlugin gives the error
Enabled plugin with unregistered PluginClassLoader PluginName PluginVersion

frosty tinsel
shrewd solstice
#

yes i do and nothing

frosty tinsel
#

It maybe overridden by your plugin

shrewd solstice
#

maybe???

keen kelp
#

there is no more

#

there's no stacktrace

#

That's it

twin venture
#

so i was searching for 3 weeks now ..

#

and no one here helpful enought to answer me ..

ivory sleet
#

@keen kelp are you using plugman or doing something else which isn’t normal

ivory sleet
keen kelp
#

I just wrote my own thing

#
        PluginManager pluginManager = Bukkit.getPluginManager();
        Plugin game = pluginManager.getPlugin("Game");

        if(pluginManager.isPluginEnabled("Game"))
        {
            pluginManager.disablePlugin(game);
        }
        pluginManager.enablePlugin(game);
#

That's it

ivory sleet
#

Is this within your game plugin?

keen kelp
#

No

#

This is an external pluign

#

a plugin can't restart itself ._.

ivory sleet
#

Not true but ok

keen kelp
#

Since it can't run code to enable a plugin when it's disabled

#

runnable?

ivory sleet
#

You can do some extremely hacky stuff to self restart

keen kelp
#

Yeah but no thanks :D

ivory sleet
#

Anyways need to eat ttyl

keen kelp
#

I would figure there is a hacky way

#

ttyl?

#

oh talk to you later

#

thx google

weary pagoda
#

Italy wins everything

frosty tinsel
#

Read the rules, if it isn't there, then you probably can

agile anvil
#

@hardy swan Just for information I found the issue (about NMS) : The problem was during the packet sending, I use reflection to fetch sendPacket method but the "playerConnection" stuff was also changed... So I finally succeed !

earnest sonnet
#

I've seen developers printing the consoles messages like that, probably it's safe

eternal oxide
#

Its frowned upon. It can be classed as advertising which is not permitted

unreal quartz
#

paperlib provides a method which does exactly that, i'm fairly certain that it was already agreed on that it was allowed

wraith rapids
#

it's only frowned upon by those who don't know better

eternal oxide
#

paperlib isn't distributed on the spigot platform

wraith rapids
#

namely the majority of spigot's userbase

#

people not knowing better is literally the last thing keeping spigot going

#

well, that and people getting banned for no reason from the paper discord and refusing to use it out of spite

#

cc tan juck

smoky oak
#

quick question quick answer, is the saveConfig() function working even if the directory Plugins/<Pluginname here> is not yet created?

wraith rapids
#

it'll most likely throw a file not found exception

eternal oxide
#

I know saveDefaultConfig creates the directory. No idea on just save

smoky oak
#

wait i have a ide just look up the function

wraith rapids
#

imagine not developing with ms notepad and javac

#

my keyboard only has 2 buttons

#

a 1 and a 0

eternal oxide
#

abacus or bust

smoky oak
#

Better than running it on a mechanical computer

#

err

#

correction, just slightly worse

wraith rapids
#

i use small stones instead of pen and paper

smoky oak
smoky oak
#

I have no idea if you're referring to me or not

wraith rapids
#

i will eventually build myself a pneumatic computer

#

it's probably going to sound great

smoky oak
#

Oh try to rebuild the gear computer! Might be a good stepping stone to calculate how to preassurize everything

wraith rapids
#

gears are more annoying to work with than pneumatic tubes

#

tubes are kind of like wiring, just thicker

smoky oak
#

...i just realized i just thought 'steampunk' and had the completely wrong idea lol

#

what about a water powered computer tho?

#

we already have the logic gates for that

wraith rapids
#

water is kind of messy and corrodes components

#

the thing with air is that it's easily available and disposable

#

no need to route everything back into a tank

smoky oak
#

eh true

#

btw do you plan to work with overpreassurized or underpreassurized air?

wraith rapids
#

the advantage of hydraulics is that liquids don't compress, so you get accurate and strong movement

#

but neither of those are really necessary i wouldn't think

#

overpressurized is better as vacuum pumps are slow and the tubes would probably collapse and get stuck

smoky oak
#

i see. maybe hydraulics would be a good idea to shift what the main bus is connected to atm?

wraith rapids
#

perhaps

vast sapphire
wraith rapids
#

though, i really don't look forward to hydraulics

#

i need to deal with hydraulics just enough irl

#

it's cancer

#

everything needs to be perfectly sealed and withstand high pressures

#

it's like being a plumber but on steroids

opal juniper
#

hydraulics are cringe

smoky oak
#

ouch, but how else to shift the bus?

wraith rapids
#

air pressure will probably be enough

smoky oak
#

Good luck with your ram tho

wraith rapids
#

yeah pneumatics will be slower

#

but it's not like I'm going after speed anyway

smoky oak
#

no how do you want to address stuff?

frosty tinsel
dry meadow
#

Condition: config.getInt("info.version") == 3 is FALSE ==> All Commands shouldn't be enabled
Does anyone know why CommandA is disabled and the other two are enabled?
Server: 1.8.8

if (config.getInt("info.version") == 3) {
    Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_GREEN + "Supported Version found!");
    this.getCommand("cmda").setExecutor(new CommandA());
    this.getCommand("cmdb").setExecutor(new CommandB());
    this.getCommand("cmdc").setExecutor(new CommandC());
} else {
    Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "Unsupported Version found!");
}
wraith rapids
#

i'll either look at some schematics of some simple old chips or just come up with something on my own

#

probably the latter

smoky oak
#

I think intels 4004 is a good starting point

wraith rapids
#

i'd write that down but I'll probably forget about having written it down before I get around to doing it

smoky oak
#

eh just remember it's the first fully functional cpu

#

@dry meadow is that the actual code in your onEnable() ?

dry meadow
#

yes this is in my onEnable()

smoky oak
#

can u pm me your plugin.yml?

opal juniper
#

why pm?

#

just

#

put it here

smoky oak
#

eh fair i just dont want a big file here cluttering things up

opal juniper
#

?paste

undone axleBOT
opal juniper
#

lmao

smoky oak
#

or that

opal juniper
#

Is the issue that the first command does not get registered?

frosty tinsel
#

Rather

dry meadow
#
  name: TempPlugin
  main: io.github.tempplugin.TempPlugin
  author: Temp
  description: Temp
  version: 1.3.2
  commands:
    cmda:
      description: cmda
    cmdb:
      description: cmdb
    cmdc:
      description: cmdc
frosty tinsel
smoky oak
#

okay that makes no sense. Your commands should still show up in the /help but shouldn't be executable

opal juniper
#

If the if statement is false i see no reason why they should run

digital plinth
#

ohh what si that

digital plinth
#

does that work?

#

that plugin.yml

opal juniper
#

why wouldnt it

dry meadow
#

Yes it works

dry meadow
opal juniper
#

although - you should specify the api-version

frosty tinsel
opal juniper
#

so that your plugin is not in backwards compatibility hell

dry meadow
#

I should note, that the actual version should be for a 1.8 server for my friend. So i haven't added the api-version

opal juniper
#

oh ok

wraith rapids
#

and so, the list grows

opal juniper
tall ridge
#

xd

digital plinth
#

arrows lose custom model data when they are shot and picked up

#

is there a way around it

opal juniper
#

I mean it would be a pain

#

you would have to track it from ItemStack -> Entity -> ItemStack

Idrk if there are enough event listeners for that

#

lemme have a look

lunar wedge
#
file = new File(Bukkit.getServer().getPluginManager().getPlugin("PureMail").getDataFolder(),"lang.yml");

        if(!file.exists()) {
            try{
                file.createNewFile();
            } catch(IOException e){
                //owww
            }
        }```

This is throwing an error
```[13:43:49 ERROR]: Error occurred while enabling PureHomes v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.plugin.Plugin.getDataFolder()" because the return value of "org.bukkit.plugin.PluginManager.getPlugin(String)" is null```
opal juniper
#

Do not use getPlugin

#

is PureMail the plugin you are making?

lunar wedge
#

Yeah

opal juniper
#

is this the main class?

digital plinth
#

also is it possible to make a shapeless recipe with a item with custom model data

lunar wedge
#

wow nevermind im an idiot

#

im making PureHomes not PureMail lol

#

its resolved

opal juniper
lunar wedge
#

thanks for pointing that out it would have taken me an hour to figure that out

digital plinth
#

.addItem(Material)

opal juniper
#

you should use the plugin instance

lunar wedge
#

Oh whats a better way to do it?

digital plinth
#

not itemstack

lunar wedge
#

ohh

digital plinth
#

:<

frosty tinsel
opal juniper
#

I wouldn't use the location cause that is not a super persistent way of doing it

opal juniper
frosty tinsel
opal juniper
#

eh

frosty tinsel
tall ridge
#

I name my main class Main

opal juniper
#

Ew

frosty tinsel
wraith rapids
#

Main should be reserved for the application's bootstrap and main class

tall ridge
#

then the class extends JavaPlugin

keen kelp
#

How do I make the output/build jar to just be
PluginName.jar
instead of
PluginName-vPluginVersion.jar

wraith rapids
#

and your plugin is not an application; it's a plug-in

keen kelp
#

gradle

opal juniper
#

oh idk

wraith rapids
#

your plugin's main class is the class that represents your plugin

#

and as names should be descriptive, your main class name should probably take after your plugin

keen kelp
#

k thax

#

wait but Im not running jar?

#

Im running build

digital plinth
#

yea

#

oh niceeeeeeee discord bot you've got here

unreal quartz
keen kelp
#

oh ok

digital plinth
#

how 2 make a shapeless recipe with a item with custom model data

keen kelp
#

you cant iirc

#

extract item is only for shaped

wraith rapids
#

use ExactChoice

#

pretty sure shapeless recipes still let you use ExactChoice over MateriaChoice

keen kelp
#

Oh really

#

cool

digital plinth
rotund pond
#

Hello !
Have you ever made a GUI manager system?
I am trying to make a proper one but I have no idea how to do it .. I would like, if possible, to have examples

opal juniper
#

what does

GUI manager system
mean

digital plinth
#

plenty of examples

frosty tinsel
rotund pond
frosty tinsel
rotund pond
keen kelp
#

is there a better way to get main other than DI?

wraith rapids
#

depends on your definition of better

keen kelp
#

I mean if I can not use it at all...

#

Also another thing, is there a way to get another Plugin's file name?

dusk flicker
#

What do you mean file name? Like the jar?

keen kelp
#

Yes

dusk flicker
#

I doubt there is a method for it, you may be able to scan the plugins directory but not sure how easy it'd be to get a plugin name from that

keen kelp
#

in their main you can do getFile()

#

But how do I do that with only a Plugin

dusk flicker
#

I'm not sure if that, others may. For your DI thing, if you can't use DI that may mean you need to use a singleton, or you need to rework your objects to use DI in some way

keen kelp
#

Ill look into that later

#

but first how get other plugin file

dusk flicker
#

Is it for any plugin or a specific one

vast sapphire
#

how do i play a sound when the player crafts something

keen kelp
#

well the purpose of it is for a specific

#

But I would like it to work with any

#

I dont want to hard-code it

#

especially file names

dusk flicker
#

Yeah I can't help you with that then, my only idea was to hard code it

keen kelp
#

imma hard code it for now... How do I get the plugins directory

dusk flicker
keen kelp
#

That gets you a Plugin right

#

I still dont get a File

dusk flicker
#

It gets you their main class

#

Then you could use that method getFile you said

keen kelp
#

But I can't do getFile

dusk flicker
#

Why can't you?

keen kelp
#

It's protected

#

protected getFile()

dusk flicker
#

Oh damn

#

Check that out

#

That's the only way I could think of doing it

keen kelp
#

i dont even know what it's doing

#

maybe it's because it's 6:30

dusk flicker
#

Honestly don't know why that's protected

#

Maybe a PR making it public would be accepted but who knows

keen kelp
#

tbh the post you send is probably an exploit/security concern and most likely already got patched

#

I didn't look into it

#

I just think so

#

since protected means the only way to use it is to extend it

dusk flicker
#

It's reflection so doubtful

keen kelp
#

yeah my brain is turning into brain soup

#

it's melting

#

I gotta sleep

#

bye

rotund pond
# frosty tinsel I've made my own based on Kody Simpsons's YT channel

Still using Kody Simpsons's ways?
I just looked at its code and there are a lot of mistakes in my opinion...
Already, there is no object-oriented code (too bad for Java), no division of tasks and, must of all, no protection:

Not everyone knows this, but there are some hacked clients who can dupe the names of inventories (or even add § signs) to get inventories of the same type as these, so these players can use them to bypass your plugin. To avoid this, I personally add the player to a list when I open the inventory to them and remove them from the list when the inventory closes. So I know who is authorized to use the GUI.

By the way, the things he shows in his videos, I already know them ...
I'm looking for something much more sofficial, which allows to manage GUIs in a very clean way with object oriented code.

quaint mantle
#

Listen for the event, then player.playSound(player.getLocation(), Sound.wahtever, 500.0f, 1.0f);

rotund pond
#

@torn shuttle Hello !
Some months ago you gave me a configuration engine and I was looking for your others classes.
If your still a bit available for some questions about them, can you come on my PM please ? 🙂

wary harness
#

trying to rename it

vague cypress
#

Alright, so I have the below code trying to make a menu. Near the bottom is code trying to lock the menu items from being removed. I'm not sure what to put after event.getInventory() != to reference the custom inventory, or if I'm doing it entirely wrong.


    @EventHandler
    public void onPlayerClicks(PlayerInteractEvent event) {
        Player player = event.getPlayer();
        Action action = event.getAction();

        if (action.equals(Action.RIGHT_CLICK_AIR) || action.equals(Action.RIGHT_CLICK_BLOCK)) {
            if (player.getItemInHand().getType() == Material.NETHER_STAR) {

                Inventory inventory;

                inventory = Bukkit.createInventory(new menuGUI("Menu"), 9, "Menu");
                ItemStack item = new ItemStack(Material.PAPER);
                ItemMeta meta = item.getItemMeta();

                //Paper
                meta.setDisplayName("§f§lWelcome Message!");
                List<String> lore = new ArrayList<String>();
                item.setItemMeta(meta);
                inventory.setItem(0, item);

                //Diamond
                item.setType(Material.DIAMOND_BLOCK);
                meta.setDisplayName("§1§lShop");
                item.setItemMeta(meta);
                inventory.setItem(1, item);

                player.openInventory(inventory);

            }
        }

    }

    public void onClick(InventoryClickEvent event) {

        if(event.getInventory() != ) return;

        event.setCancelled(true);

    }```
vast sapphire
#

how do i set leather armor color

#

.setcolor doesn't work

#

nvm i got it

torn shuttle
#

Also that was what 3-4 weeks ago, surely not "months"

vague cypress
#

Thanks!

#

I do have one more question - How would I go about only opening the inventory if the object that was right-clicked with had a certain custom model data? I already have the below in place:

            if (player.getItemInHand().getType() == Material.NETHER_STAR) {
quaint mantle
#

How do you add a custom patch to Spigot?

quaint mantle
vague cypress
sage swift
#

get the item meta

#

also you should probably do a null/air check before getting type or the like, as the player could be holding nothing

vague cypress
#

Wait sorry, is there a way to check for specific custom model data rather than just having custom model data in general?

sage swift
quaint mantle
#

is the code the same for adding an item to a players inventory the same as for the latest version

vague cypress
#

It appears that when I try to use any of the three custom model data-related methods and put an integer into the parameter, it says that it can't be applied to type int

sage swift
#

what "three methods" are you trying

#

do you want to set it, or check for a certain value?

vague cypress
#

I want to check if the item has a specific custom model data

sage swift
#

and you are putting a specific number into the method

vague cypress
#

But not if it has custom model data in general, but if it has a specific number combination as the custom model data

#

Yes

sage swift
#

?learnjava :/

undone axleBOT
vague cypress
#

?

wraith rapids
#

learn java

vague cypress
#

Uhh... alright

wraith rapids
#

everything you need has already been told to you

vague cypress
#

Is there any one of those links that you would specifically recommend?

wraith rapids
#

codeacademy is supposedly passable, but I don't have first hand experience on any of them

unkempt peak
# vague cypress Is there any one of those links that you would specifically recommend?

Full Java Course: https://course.alexlorenlee.com/courses/learn-java-fast

I recommend installing Tabnine autocomplete on your IDE (free):
https://www.tabnine.com/get?lang=java&utm_source=youtube.com&utm_medium=Ins&utm_campaign=AlexLee

If you're new to programming, I recommend you use Edabit: https://edabit.com/?ref=alexlee

Disclosure: Tabnin...

▶ Play video
vague cypress
#

Thanks

unkempt peak
#

@vague cypress

dusty sphinx
#

This is more of a SQL thing, but how should I implement a table prefix?

#
            PreparedStatement preparedStatement3 = this.connection.prepareStatement("CREATE TABLE IF NOT EXISTS ? (seed VARCHAR(255) UNIQUE, border INT NOT NULL default 60000000, PRIMARY KEY seed);");
            preparedStatement3.setString(1, this.getConfig().getString("db.prefix") + "worlds");
            preparedStatement3.execute();```
#

setString isn't the right method

unreal quartz
#

format the string separately with a placeholder

hardy swan
#

good morning

digital plinth
#

good morning

weak mauve
#

how i can stop the giant head moving (it only happend when its spawn)
teleport(pitch) didnt work tho

digital plinth
#

head?

dusty sphinx
#

How would I get rid of all a player's advancement progresses?

weak mauve
dusty sphinx
haughty musk
#

Hi. I am trying to make a teams system and it doesnt seem to work

#

Maybe because I have another scoreboard running at the same time?

digital plinth
#

well why bother its not too bad

#

also i dunno how 2 fix it

weak mauve
#

they spin

digital plinth
#

rather

#

they snap

reef wind
haughty musk
#

No code errors

#

Just wondering if everything in the code looks ok

#

And where you guys would recommend I call the function

#

(I currently have it in onJoin)

dusty sphinx
lunar wedge
#

I have a custom YML file, I want to take all the Keys in a YML file into a List in Java. Any idea how I can do this efficiently?