#help-development

1 messages · Page 1697 of 1

idle cove
#

why

quaint mantle
#

it cant find it

idle cove
#

.-.

quaint mantle
#

so

idle cove
#

how can i fix

quaint mantle
#

you're probs typing something wrong

#

just double check spelling

idle cove
#

kk

quaint mantle
#

seems more like a server issue

wary harness
#

any one can suggest

#

good SQLiberry

regal dew
#

an SQL library..?

#

like, connector/pool management?

#

or like query builder level stuff

wary harness
regal dew
#

hibernate

idle cove
regal dew
idle cove
#

there are no errors in code

#

just that when i build

#

it gives that error

#

i tried switching to jdk 16

#

and still same error

ivory sleet
#

Invalidate caches and restart

idle cove
#

no this is a different error

#

the java thing is solved

#

using jdk 17 and 16 ive gotten this error

ivory sleet
#

I don’t believe a lot of stuff supports java 17 yet btw

patent quarry
#

Hey, I have seen that when I right click on an EnderDragon ,
the result of event.getRightClicked() of the event PlayerInteractEntityEvent
is ==> CraftEnderDragonPart But There is no CraftEnderDragonPart in the javadoc. How can I turn CraftEnderDragonPart into EnderDragon entity ?

mb I resolved my problem, (EnderDragonPart).getParent()

idle cove
ivory sleet
#

The little picture you sent isn’t a lot to go on

#

But looks like your jdk 17 is missing something

idle cove
#

its there

tardy delta
#

is there a alternative for a list with one object inside?

#

i tried Collections.singletonList() but i dunni if thats good

ivory sleet
#

Collections::singletonList?

tardy delta
#

maybe

ivory sleet
#

It’s good

tardy delta
#

oki

ivory sleet
#

It doesn’t require an internal array

#

As opposed to new ArrayList<>().add() would require an array to be created and a O(n) add operation

Arrays::asList which is mutable and requires an array tho no array creation

List::of which requires an array/vararg

tardy delta
#

great

regal dew
#

and a O(n) add operation
actually the operation would be O(1) since the array has an initial capacity of 10 by default

#

but Collections.singletonList much much better for this

quaint mantle
#

See!!

ivory sleet
#

Hmm true lol

tardy delta
#

and uh is it possible when i use PersistentDataContainer#set(namspacedkey, PersistentDataType.STRING, some string) that it is overwritten when i recall it?

#

or is that because i use the same namespacedkey?

#

prob

ivory sleet
#

Wym?

tardy delta
#

i'm storing uuids in a pdc instance but they seem to dissapear for a magical reason

young knoll
#

Using the same key will override the old value

tardy delta
#

nvm that i use a key depending on the block coordinates

#

can't be the same

#

but still

quaint mantle
#

so how do i make an update check

#

sorry i could probs google that but im on mobile

tardy delta
#

update on spigotmc?

quaint mantle
#

like

#

'You are behind versions!!!!!'

tardy delta
#

?paste

undone axleBOT
tardy delta
tardy delta
#

what's the point of @loud prismtract("null -> false") if you can do a null check inside the method?

#

bruh tagg

quaint mantle
#

its like @notnull but its a contract

#
@Contract("null -> false")
public boolean something(Object a) {
    if (a == null) return false;
    return other();
}
tardy delta
#

i dont understand the point of it

tardy delta
#

smh some event is stopping me from moving

#

probably my own listener :/

#

also is it possible to di something like this?

tardy delta
#

stacktrace from registering command...

shadow tide
#

@quaint mantle I'm using your ItemPDC thing and I think either the setting, or the checking isn't working because I have multiple items now and when I right click one of them all of their events go off, actually all the events go off if I right click while I'm holding anything

quaint mantle
#

send the code 😦

#

but im telling you it works perfectly for me

shadow tide
shadow tide
shadow tide
quaint mantle
#

send event listener class

shadow tide
#

I'll send them all because they are in the items,

eternal night
#

If you have multiple different items, marking them all with the same PDC tag won't get you far 😅

quaint mantle
#

^

eternal night
#

Well if you are just using the class you sent to assign custom item tags

#

But whatever XD show the code

#

My dumb guesses won't get us anywhere

shadow tide
#

anyways, it doesn't matter if it has pdc at all, I right clicked with iron ore lol

quaint mantle
#

nah

#
if(!pdcManager.isCustomItem(wand)) {
#

🙂

#

should be event.getItem

shadow tide
#

ooooooooh

#

got it

quaint mantle
#

👍🏿

shadow tide
#

in the parenthesis?

eternal night
#

Yes

shadow tide
#

k

quaint mantle
#

if (!pdcManager.isCustomItem(event.getItem())

shadow tide
#

Thanks, that was probably my shortest question yet 👍

quaint mantle
#

get the inventory then use Player#openInventory(theInventory)

#
// The GUI class
public Inventory getInventory() {
    return inventory;
}
// Wherever you want to open it
Player player = ...;
player.openInventory(guiClass.getInventory());
quartz basalt
#

how can i use NBT to summon a firework? for example if a player does /firework <some random NBT of a firework> | it would summon a firework with that NBT?

turbid tiger
#

Hello I am doing Bukkit.getEntity(UUID) to fetch an entity object from a stored uuid. I know that the entity's chunk needs to be loaded before I can get it, which is why I am using a chunk.addPluginChunkTicket(Plugin) before I run the getEntity method. However, I am still returned with null in the getEntity method. I know the entity's chunk is correct as I am using a stationary entity (Ender Crystal) in the center of the chunk for testing purposes. Any ideas?

last sleet
#

Alright ive been trying at this for hours but i can't get it to work.

#

here's my error, i really tried everything in intelliJ and no success

opal juniper
#

You have compiled with a newer java than ur server is running

last sleet
#

everything is set to java 8

tacit drift
#

pom?

last sleet
#

the problem popped up suddently, and i dont know how to fix it

last sleet
opal juniper
#

check ur project jdk

last sleet
#

java 8

#

I don't know what's causing this

#

and it's really frustrating

tacit drift
#

Well, it recognizes it as being compiled with java 10

last sleet
#

Are there any other factors that can affect it?

regal lake
#

do you use windows, linux or mac ?

last sleet
#

Linux

regal lake
#

What is the output of echo $JAVA_HOME ?

last sleet
#

my path is set to java 16

tacit drift
#

what is your start script?

regal lake
#

Then i can't help, i had the same issue like you.
For me the issue was that the path was incorrect within intellj (what ever cause that 😄 ), so i have to run export JAVA_HOME="/usr/lib/jvm/java-16-openjdk-amd64/"

last sleet
#

ah :/

last sleet
tacit drift
#

how do you start your server?

#

the command

last sleet
#

java -jar spigot1.8.8 something

onyx fjord
#

Don't use 1.8 sir

regal lake
#

lol

last sleet
#

I'm making a PvP plugin

tacit drift
#

You are using java 16 on 1.8?

regal lake
#

Then make a PvP plugin on a up to date version 😄

last sleet
#

and I doubt things like viaversion be good for 1.8 battles?

onyx fjord
#

Cool but don't use 1.8 anyway

tacit drift
#

install java 8

#

and then in the start command

tacit drift
#

use the path to the install of java 8

onyx fjord
#

Aka old combat mechanics

turbid tiger
last sleet
#

I want people from 1.8.9 to go on my server

#

not ppl in 1.17 with 100 attack speed

turbid tiger
#

are you going to use the java 8 install hello

last sleet
#

yes

onyx fjord
#

1.8 players won't see difference

#

Cuz they don't have cooldowns in their clients

tacit drift
#

Dude

#

if he wants to use 1.8

#

he can use 1.8

#

there are a ton of reasons for why I would use 1.8

onyx fjord
#

K

#

But if you use 1.8 don't ask for support

tacit drift
#

Lolz

last sleet
#

...

onyx fjord
#

Because it's not updated since like 2014

#

And it won't be

last sleet
#

it now gives Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project PitRemake: Fatal error compiling

yeah maybe i'm just better off using a plugin to allow people from 1.8.9 to join the server

#

this is a hassle

onyx fjord
#

Great

tardy delta
#

ugh is there a way to call this in a super call?

regal dew
#

you mean in the constructor? then no

#

reason being, first the parent is constructed, then the current class, thus you cant call anything from the class thats being constructed

quartz basalt
#

how can i use NBT to summon a firework? for example if a player does /firework <some random NBT of a firework> | it would summon a firework with that NBT?

eternal night
#

are you willing to use NMS

ivory sleet
#

🥲

lethal knoll
#

Anyone got an idea why I cannot remove teams in onEnable() ?

        Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
        List<String> teamNames = scoreboard.getTeams().stream().map(Team::getName).collect(Collectors.toList());

        for(String teamName: teamNames)
            scoreboard.getTeam(teamName).unregister();
#
19.09 19:43:03 [Server] INFO java.lang.UnsupportedOperationException: null
19.09 19:43:03 [Server] INFO at com.google.common.collect.ImmutableCollection.removeIf(ImmutableCollection.java:270) ~[spigot_1.17.1.jar:3231-Spigot-3c1fc60-e167f28]
19.09 19:43:03 [Server] INFO at me.mrgeneralq.survivednights.SurvivedNights.onEnable(SurvivedNights.java:39) ~[?:?]
#

If removing them doesn't work, and unregister, then how else can I do it

quartz basalt
eternal night
#

yes

ivory sleet
#

Unregister should work

quartz basalt
#

yeah

eternal night
#

because NBT is not exposed to the API at all.

ivory sleet
#

However it’s fully plausible you might need to fix that post bootstrap

#

So defer a task instead

quartz basalt
#

ill use whatever i need to for it to work

lethal knoll
#

@ivory sleet , any examples? I'm sorry, I don't fully get that part.

eternal night
#

well, let me rephrase it then. Do you know how to use NMS xD

ivory sleet
#

Also yeah yet another time when spigot fools you by showing you the type List instead of ImmutableList 🥴

lethal knoll
#

Yea

quartz basalt
ivory sleet
#

Liskov substitution principle goes brrr, but uh try something like
Bukkit.getScheduler().runTask(this,() -> {
//unregister here
});

lethal knoll
#

But how will I know that it will be ready?

ivory sleet
#

Wym by ready?

#

Like once it gets executed?

lethal knoll
#

Well, I'm interacting with the spigot APi correct ?

echo basalt
#

if you read the stacktrace

#

it's an ImmutableMap

ivory sleet
#

Yup

echo basalt
#

Why would the definition change post-load

lethal knoll
#

It's discouraged to access the spigot API async

ivory sleet
#

Most of the api yeah

lethal knoll
ivory sleet
#

Well a lot of stuff are either not thread safe or just will be catched when dispatched async

lethal knoll
#

I'll try the async method

ivory sleet
#

No why lol

#

That one would execute immediately

lethal knoll
#

the scheduler I mean

eternal night
#

create a firework rocket itemstack

quartz basalt
#

yeah but then id need to summon it

eternal night
#

pass that and the user input nbt into it

#

then spawn a normal firework rocket

#

to set the firework meta of the rocket to the one of the itemstack

quartz basalt
#

mkay ill try it thanks

eternal night
#

good luck 👍

lethal knoll
#

@ivory sleet same error :/

ivory sleet
#

Send your onEnable

#

?paste

undone axleBOT
eternal night
#

you cannot removeIf if you are still doing that

#

the collection is immutable

#

the unregister way is the way to go

ivory sleet
lethal knoll
#

@eternal night , it does the exact same thing

eternal night
#

it does not

#

the list returned by getTeams is not to be mutated

lethal knoll
#

well, whathever is going on , unregister also doesn't work

#

it throws the same error

ivory sleet
#

Doubtfully the case

lethal knoll
#

        Bukkit.getScheduler().runTask(this,() -> {
            Bukkit.getLogger().info("Cleanup of existing teams started ...");
            Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
            List<String> teamNames = scoreboard.getTeams().stream().map(Team::getName).collect(Collectors.toList());

            for(String teamName: teamNames)
                scoreboard.getTeam(teamName).unregister();

        });
hardy swan
#

PotionEffect#apply(Player) doesn't seem to not work in 1.14 as opposed to later versions. Do we need to remove existing potion effect of the same type before adding one of a higher amplifier?

ivory sleet
#

Why not just Bukkit.getScoreboardManager().getMainScoreboard().getTeams().forEach(Team::unregister) @lethal knoll speaking of which

lethal knoll
#

I tried that as well

#

I can try once more

#

but I assume it will be the same thing

ivory sleet
#

Not sure how it works the other way around

ivory sleet
hardy swan
lethal knoll
#
        Bukkit.getScoreboardManager().getMainScoreboard().getTeams().stream().filter(t -> t.getName().startsWith("sn:")).forEach(Team::unregister);
#

like that?

#

nothing wrong right?

ivory sleet
#

Why the filter?

lethal knoll
#

I need it because my plugin adds teams with that specific name

ivory sleet
#

Ig, you’re really obsessed with streams aren’t you

lethal knoll
#

lol

#

not at all :p

#

this is the only way

ivory sleet
#

But yeah try and see

quasi flint
#

There are always other ways

#

The old Egypt's already knew that

lethal knoll
#

lol xd

ivory sleet
#

I haven’t messed with the scoreboard api a lot although last time I tested the unregister stuff worked at its finest

quasi flint
#

If the API supports it

lethal knoll
#

nope

#

same error

quasi flint
#

It should work

#

I suppose

lethal knoll
#

it doesn't

quasi flint
lethal knoll
#

I guess it's because of the onEnable()

ivory sleet
#

Feels like you’re not putting in the new jar into your plugins folder

eternal night
#

xD

lethal knoll
#

I am lol

#

I'm even stopping the server

ivory sleet
#

Btw do u use plugman or plugwoman?

quasi flint
#

Or the one able is too early

ivory sleet
#

Nvm

turbid tiger
#

Hello I am doing Bukkit.getEntity(UUID) to fetch an entity object from a stored uuid. I know that the entity's chunk needs to be loaded before I can get it, which is why I am using a chunk.addPluginChunkTicket(Plugin) before I run the getEntity method. However, I am still returned with null in the getEntity method. I know the entity's chunk is correct as I am using a stationary entity (Ender Crystal) in the center of the chunk for testing purposes. Any ideas?

lethal knoll
#

Just FYI, i'm not a beginner dev

quasi flint
#

Maybe a tad later when a player joins?

ivory sleet
lethal knoll
#

so something odd is ongoing here

quasi flint
#

Try it later in startup

#

Like when a player joins

eternal night
#

notably, entities are not loaded in sync with the chunk anymore as of 1.17

ivory sleet
#

Yeah looks like it, assuming the error still yields from the current code of yours

eternal night
#

just because you are loading the chunk, entities might not be loaded in yet

lethal knoll
#

wait wtf

lethal knoll
eternal night
#

did you discover that your plugin jar was not being replaced xD

#

yeaa

quartz basalt
ivory sleet
#

Lmao

lethal knoll
#

I just opened the jar with jdgui

ivory sleet
#

Been there too

lethal knoll
#

and the old code is there ...

#

let me try a clean

upper mica
#

Hello, I have a question that has been bugging me. So for example I have a new BukkitRunnable() { stuff... } in my main plugin class, and sometimes I want to get plugin's instance with this, but it returns BukkitRunnable instance. I sometimes just make public MyPlugin get() { return this; } method just to get plugin's instance in a runnable method. So, is there a way to somehow get plugin's instance and not bukkitrunnable?

quasi flint
#

Maybe export it to somewhere else

lethal knoll
#

yea, worst case

quasi flint
#

And from there shove it into Ur plugin folder

quaint mantle
lethal knoll
#

lol

#

no errors

#

let's see if the teams are gone

quasi flint
lethal knoll
#

well

ivory sleet
lethal knoll
#

I got no words for this

#

it works

#

thanks lol

ivory sleet
quasi flint
#

Fking mint

upper mica
eternal night
#

you can then spawn a new firework in the world

#

and apply the firework meta from the items stack

quartz basalt
eternal night
#

the spawn method returns the firework instance

#

on that instance you can call the method I linked prior

#

setFireworkMeta

#

and pass it1meta (great name btw xD)

#

you'll have to cast it

quartz basalt
#

would i need to store the loc.getWorld().spawn(loc,Firework.class); or something then?

eternal night
#

yea

#

final Firework firework = loc.getWorld().spawn(...)

#

you can also use the even cooler way of ```java
loc.getWorld().spawn(loc, Firework.class, f -> {
// do something with f
});

quartz basalt
#

sorry for asking so many questions havent really worked with anything like this before but would this ItemStack firework = new ItemStack(Material.FIREWORK_ROCKET); Bukkit.getUnsafe().modifyItemStack(firework, args[8]); ItemMeta it1meta = firework.getItemMeta(); final Firework firework2 = loc.getWorld().spawn(loc,Firework.class); firework2.setFireworkMeta((FireworkMeta) firework); get the meta assigned to firework then summon it with that nbt?

eternal night
#

don't cast the item stack

#

you cast the item meta

quartz basalt
#

ah alright thanks

eternal night
#

but besides that, give it a try

quartz basalt
#

alright

eternal night
#

also, like args[8]

#

that sounds like a fun command to invoke

quartz basalt
#

it is

#

so from the code i sent above it doesnt really work, i added nbt {FireworksItem:{id:firework_rocket,Count:1,tag:{Fireworks:{Explosions:[{Type:0,Flicker:1b,Trail:1b,Colors:[I;16711680]}]}}}} to test it, and nothing happened the firework just acted like a normal firework as if u just did /summon firework nothing special just disapears after like 2 seconds

eternal night
#

that wouldn't be the nbt I think

#

you must keep in mind that you are technically applying the NBT to the item now

quartz basalt
#

i got the NBT from a website

#

thats what goes after a command for example /summon firework <nbt stuff>

eternal night
#

yea but probably to spawn a firework

#

yea use the one to create a firework item

quartz basalt
#

huh?

hearty fractal
#

Ok im gonna get straight to the point,

I need a way of detecting if a player has more than 12 hearts, and if they do, setting their hearts back to 12. I am using this plugin https://www.spigotmc.org/resources/lifesteal-smp-plugin.94387/reviews but since it doesn't have a built in limiter to the amount of hearts a player can have, there are people which can have like 50 hearts which will just wont do for my purposes.

#

Any solution would be great, and any help is appreciated.

#

Im a noob with plugin coding so please nothing along the lines of ---- Code )(*&#$()YDFH and then do that )(#&()YHDAF and boom, done.

eternal night
#

you are not actually applying the NBT to a firework entity

#

but to an item

quartz basalt
#

but the entire thing is the nbt?...

eternal night
#

yea but it is NBT that would be applied to a firework rocket entity

#

the method right now applies NBT to a firework rocket ITEM

#

which is different

quartz basalt
#

i just tried it still nothing

#

so theres no way to make it work with the NBT i sent? because im making this to follow the same syntax of another plugin which uses that nbt and it works fine so if it changes like that it would sorta mess everything up

eternal night
#

hmmm, I mean you could do it but I guess not really with the method you are using rn

#

and concerning you don't know NMS

#

its kind of rough

quartz basalt
#

well if ItemStack firework = new ItemStack(Material.FIREWORK_ROCKET); Bukkit.getUnsafe().modifyItemStack(firework, args[8]); ItemMeta it1meta = firework.getItemMeta(); final Firework firework2 = loc.getWorld().spawn(loc,Firework.class); firework2.setFireworkMeta((FireworkMeta) it1meta); is what i have rn and it isnt working, and just the tag thing isnt working, if i got this to work maybe the original nbt i sent would work with this?

eternal night
#

let me try to reproduce

#
final String nbt = args[0];
final ItemStack fireworkRocket = new ItemStack(Material.FIREWORK_ROCKET);

Bukkit.getUnsafe().modifyItemStack(fireworkRocket, nbt);

final ItemMeta itemMeta = fireworkRocket.getItemMeta();
player.getWorld().spawn(player.getEyeLocation(), Firework.class, firework -> {
    firework.setFireworkMeta((FireworkMeta) itemMeta);
});

and
/tmp {Fireworks:{Explosions:[{Type:0,Colors:[I;16711680],FadeColors:[I;16731983]}]}} work well for me

#

tho, tbh to do this right you should/would want to look into NMS

#

the unsafe method does (for whatever reason) not offer a way to see if the tag was parsed correctly

quartz basalt
eternal night
#

that seems like you are doing some loop xD

quartz basalt
#

its just inside of a bukkit runnable

naive jolt
#

hey is it not possible to make custom entity?

quaint mantle
#

google it

#

"spigot make custom entity"

naive jolt
#

i did

#

and its always changing an existing mob

quaint mantle
#

thats just how it works

#

you can change everything

#

just extend a base mob

naive jolt
#

so I cant use blockbench?

eternal night
#

entities do not have the concept of a CustomModelData tag like item stacks do

#

so you'd have to fully replace an entity

#

or model an item, throw it on an armor stand and go from there

naive jolt
#

😭

#

I ran away from that with datapacks

quartz basalt
# quartz basalt its just inside of a bukkit runnable

^


                        @Override
                        public void run() {
                            Location loc = as.getLocation();
                            as.remove();

                            final String nbt = args[8];
                            final ItemStack fireworkRocket = new ItemStack(Material.FIREWORK_ROCKET);

                            Bukkit.getUnsafe().modifyItemStack(fireworkRocket, nbt);

                            final ItemMeta itemMeta = fireworkRocket.getItemMeta();
                            loc.getWorld().spawn(loc, Firework.class, firework -> {
                                firework.setFireworkMeta((FireworkMeta) itemMeta);
                            });
                        }
                    }.runTaskTimer(plugin, (long) (translated2 * 20), 1);```
quaint mantle
#

instead of new BukkitRunnable

quartz basalt
#

Bukkit.getScheduler().runTaskTimer { Cannot resolve symbol 'runTaskTimer' tried using new and all that as well

quaint mantle
#

thats not java

quartz basalt
#

wdym?

quaint mantle
#

im thinking of a different method

quartz basalt
#

huh?

quaint mantle
#

ignore me

#

i was thinking about another method

quartz basalt
#

so keep my runnable how it was?

quaint mantle
#

ye

quartz basalt
#

any other ideas why the fireworks just keep spawning in and dont just spawn one time? my code worked fine until i added the code lynx sent but now its just spamming fireworks

shadow night
#

Probably because its a loop

quartz basalt
#

its not a loop

eternal night
#

it is

quartz basalt
#

how is it a loop

eternal night
#

timers are executed indefinitely

#

until cancelled

quartz basalt
eternal night
#

I mean, a) isn't yours args[8] not args[0] ?

quartz basalt
#

oh wait forgot to replace that...

#

it works now thanks 😄

ivory sleet
#

lol

proud basin
#

anyone know how to fix the missing sounds with mixins?

opal juniper
#

how about just pr them

dry forum
#

is there a way to send a silent console command (meaning theres no feedback in the chat)? ive found some on spigot but they arnt working for me

crimson terrace
dry forum
#

the message that gets sent when you run a command from console, for example if u did /summon creeper it would say Summoned Creeper

crimson terrace
#

just go into your server properties file and disable the setting for it

#

broadcast-console-to-ops=true // set to false to disable

dry forum
#

but i need to do it in my plugin, hide the feedback

crimson terrace
#

not sure if you can change the server file from inside a plugin...

dry forum
#

but theres no way to just not send feedback from a consolecommand sender?

quaint mantle
#

**What ? **
I'm trying to build a library that can help people using hibernate inside Spigot (Minecraft) plugins.

Why am I doing this ?
Because, when making spigot plugins that connects to database, some things are almost always needed :

  • [as a spigot plugin developer] The ability to add the default hibernate configuration inside the plugin.jar resources.
  • [as a spigot plugin user (a minecraft server owner)] The ability to modify this configuration within a /plugins/MyPluginName/database/configuration.yml in order to:
    • Define connection URI and credentials.
    • Change database type (mainly h2 but possibly postgres/mysql/mongo/...)

My questions :
I'm trying to simplify DAO/Repository creation:

  • Can I force users to follow some good practices about DAO/Repository using inheritance (by creating for example some abstract DAO/Repository class) ? If so, what should I put in this abstract classes ? Already implemented list/find methods ?
  • Is there some already existing library (like Panache or Spring-JDBC) I could include in my library ? I would really like to provide already implemented list and find methods and I imagine there is already libs that does this. But they seems to be built uppon framework components I don't want/need. I would like to avoid reinventing the wheel but I fear that including such libraries would add too much dependencies to those frameworks.

Thank you per advance for your advice !
You can also read this question here: https://stackoverflow.com/questions/69247350/hibernate-related-spigot-library
Since I don't think any people will respond quickly, please ping me if you answer my question ^^

crimson terrace
#

its nothing to do with spigot really

dry forum
#

dang thats anoying, ive seen spigot forums on it though but dont work for me

crimson terrace
#

actually

#

I think i found it

crimson terrace
#

if you can change the gamerule you can disable it

dry forum
#

yeah but then i would need to turn it back on?

crimson terrace
#

disable it at the start of your code and enable it at the end?

dry forum
#

eh not ideal but i guess it can work, thanks

#
                                Bukkit.getWorld(args[1]).setGameRule(GameRule.LOG_ADMIN_COMMANDS, false);
                                ### My console command stuff ###
                                Bukkit.getWorld(args[1]).setGameRule(GameRule.LOG_ADMIN_COMMANDS, true);``` i have ^ to check if LOG_ADMIN_COMMANDS in the given world is true/false, if its true i want to set it to false so the command feedback from a console command doesnt get send then at the end set it back to true. this isn't working, nothing happens i still get sent the feedback and ive also tried the gamerule SENDCOMMANDFEEDBACK
twin venture
#

hi , anyone good with sql ?

#

i got a duplicatation .. :

#

this is my code for the insertOrUpdate

#

anyone can see what iam doing wrong here?

#

its been 3 hours trying to google it and trying to fix it but with no luck ..

waxen plinth
#

Do you have a primary key

#

What's the schema for the table

twin venture
#

this is where i create the table

#

its the same code as my ffa sql base

#

the weird thing is , my ffa working fine no duplicate , but the skypvp code [for sql] is not and its the same as ffa [ i just added the rank in it and that's all .. its driving me crazy for real ..]

waxen plinth
#

That shouldn't be possible

#

If the primary key is the UUID column then it shouldn't even be possible to have duplicate entries

twin venture
#

but it does

#

this is my inserOrUpdate

waxen plinth
#

Is that the same query you have always been using to create the table

twin venture
#

yes

#

same as in ffa

#

same everything

#

i just added the rank only that ..

waxen plinth
#

And this is mysql?

twin venture
#

sqlo2 its same as mysql

#

and i use it in my ffa project

#

and its working finne

#

idk what to do .. i need to fix it today ..

exotic scroll
#

how do i enable --enable-preview in gradle with intellij?

waxen plinth
#

It literally won't allow you to insert duplicate entries into the primary key column

twin venture
#

but it does

#

😦

waxen plinth
#

No, pretty sure that's a different table

#

The one you showed me the create query for has uuid in all lowercase

#

That one has UUID in all uppercase

#

A primary key column can't have duplicates

#

And it can't be null

twin venture
#

but why its duplicate for me ..

waxen plinth
#

It's not the same table

#

Like I said

#

Your uuid column is uppercase in the screenshot and lowercase in the query you showed me

#

I can only conclude it's a different table and UUID is not the primary key

twin venture
#

same table

exotic scroll
#

how do i enable --enable-preview in gradle with intellij?

twin venture
#

how i can edit it to be uper case?

#

in my main server its upper case

#

[the old skypvp code .]

twin venture
#

i changed it to upercase

#

and still 😦

#

this is from my localhost : test >

#

and this is from my main server .. :

#

i dont know why its beeing duplicateed..

#

i only call it once when player quit ..

#

so that it save

#

and when server restart

quaint mantle
#

how can I allow putting a certain block in the worldguard private?

long helm
#

anyone know why this doesnt print anything in chat

#

when I sneak

sullen marlin
#

did you register the event

long helm
#

doing that rn, its probably that

sullen marlin
#

are there any errors in the console

long helm
#

I just forgot to register it, thx

waxen plinth
#

lol

quaint mantle
#

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project htmljv: Fatal error compiling: invalid target release: 16 -> [Help 1]

twin venture
#

iam still struggling with my sql code .. :

quaint mantle
#

since when can sql have duplicates

twin venture
#

😦 its just happend its been 6 hours iam so tired .. i tried everything i can think of ..

exotic scroll
#

how do i enable --enable-preview in gradle with intellij?

torn shuttle
#

huge shout out to how rotating blocks is ruining my life, I've been stuck on it for 3 days, I hate everything

quaint mantle
quaint mantle
#

It's not the best code but works for me :p

dry forum
twin venture
#

thank you so much Redempt its worked ..

#

you really made my day ❤️

turbid tiger
#

?paste

undone axleBOT
turbid tiger
#

If I want to implement my own land protection is it worth creating a system from scratch or is it better to use something like the WorldGuard API?

olive valve
#

hello i need help ```int period = getConfig().getInt("periodDelay");
public void runnable() {
new BukkitRunnable() {

        @Override
        public void run() {

        }
    }.runTaskTimerAsynchronously(this, 0, period);``` i need to get a instance of the world inside of the BukkitRunnable, but ive tried so many things that dont work, can someone help?
young knoll
#

What world

olive valve
#

the servers world

young knoll
#

The server has several worlds

olive valve
#

the overworld

#

or all of the worlds

young knoll
#

Bukkit.getWorlds

olive valve
#

nevermind

olive valve
#

got it

floral flare
#

I am using SpigotUpdater to check for new updates for my plugin, but when I update to the latest version, it recommends previous versions to the one I installed.

young knoll
#

What does the code look like

floral flare
# young knoll What does the code look like
        int ID = 96330;
        SpigotUpdater updater = new SpigotUpdater(this, ID);
        try {
            if (updater.checkForUpdates()) {
                if (!updater.getLatestVersion().equals(getInstance().getDescription().getVersion())) {
                    getLogger().info("An update was found! New version: " + updater.getLatestVersion() + " download: " + updater.getResourceURL());
                } else {
                    System.out.println("Plugin is updated!");
                }
            }
        } catch (Exception e) {
            getLogger().warning("Could not check for updates! Stacktrace:");
            e.printStackTrace();
        }
    }```
young knoll
#

There is a delay after posting an update iirc

floral flare
#

Yes, I know that, but I don't know how to make it recommend only higher versions to me

young knoll
#

You would have to make a way to check if the version is newer

floral flare
#

I have tried a method to check, but it still recommends previous versions

young knoll
#

Something like a simple semver implementation would work

young knoll
subtle kite
#

@quaint mantle what version is it

#

It is limited to mvp+ and they can make there own server

#

so it's like max 5-10 people a server

#

I saying that because for your friends

#

most people don't have friends 10+

#

Create your own SMP server on hypixel and play with friends.

#

Aren't you like asking how they keep the servers non laggy

#

what you mean by main

#

no as I believe.

young knoll
#

No

#

The main servers are on different hardware

subtle kite
#

it's basically a bungee server

#

When you create your own smp , Your own world gets it own hardware, or a part of it

young knoll
#

I doubt that

#

But they likely keep them separate from the main server machines in case someone does something stupid

subtle kite
#

I know

#

They have there own hardware.

young knoll
#

This is why you properly divide up your hardware resources so one server can't hog all of them

subtle kite
#

^

#

Plus [MVP+] can make the world so it is a limited amount of people

hardy swan
#

?paste

undone axleBOT
hardy swan
#

https://paste.md-5.net/cemucitusa.xml
Hi guys, this is about maven resources plugin configuration. Aim is to copy output jar from project's build directory to the plugins folder of my test server directly. The above configuration only copies a corrupted jar. If I take away the includes and set filtering to false everything works fine except it copies other unwanted files as well (such as classes and surefire reports). Are there any ways to solve this?

Edit: Solved, change filtering to false but continue to put jar under includes.

#

is thread creation disabled in this channel....

hardy swan
young knoll
brazen bolt
#

hey so, i am new to plugin development and i learned java recently.
I wanna know how do i check like, if player hasnt moved for x seconds, then summon anvil.
for an example can someone help me with this?

hardy swan
brazen bolt
#

m quite new m sorry

turbid tiger
#

is this for a minigame type thing

brazen bolt
#

no

#

i just wanna summon primed tnt if player didnt move for 5 sec

lavish hemlock
#

Is there an event for player move?

brazen bolt
#

i dont know

#

i havent started yet, i just got the idea

hardy swan
#

If im not wrong

lavish hemlock
#

You could check if playerMove == true (set to true on player move event) each tick via the scheduler.

#

if playerMove == false for 5 seconds (which is like, 500 or 5000 ticks I think?)

#

then you summon a TNT entity

brazen bolt
#

ohki

#

ill try it

brazen bolt
#

thx

lavish hemlock
#

so 1000 ticks then?

hardy swan
#

100

#

1 tick is 0.05s

brazen bolt
#

100

#

e

lavish hemlock
#

sorry correction

brazen bolt
#

yes remove 1 zero

#

okok

lavish hemlock
#

my brain malfunctioned

brazen bolt
#

let me check

#

itll be so fun if this works

lavish hemlock
#

but you'd basically increment an int every tick and if it == 100 and playerMove == false, then you summon a TNT, on player move you'd also set the int to 0

#

actually you probably don't need a playerMove boolean

#

just use an int lol

brazen bolt
#

ill see

#

its super over whelming rn

hardy swan
#

Why would Entity#addPotionEffect(PotionEffect) ever return false on players? Only on 1.14.4. Works with later versions.

Edit: Turns out 1.14.4 cannot apply potion effect on entities that already have that effect. Need to remove it from the entity first, F.

#

Confused and angri

brazen bolt
#

only the int??

#

or weh

lavish hemlock
#

like an int noMoveTicks or smthn

brazen bolt
#

int noMoveTicks == 0 then:
do shibaliba

#

like dis

#

i regret learning python lol

lavish hemlock
#

uh well you'd set noMoveTicks to 0 in the event

brazen bolt
#

okok

#

ill try

#

sorry if m being annoying

lavish hemlock
#

then outside of your event, in the same class but different method, you register a scheduler that increments the ticks by 1 every tick as well as checks if ticks == 100, if they do then you spawn TNT and set ticks to 0

young knoll
#

Use a timestamp

brazen bolt
#

okk

young knoll
#

Add it to a map with the player uuid, and use a task to check it every few ticks

brazen bolt
#

ill read abt em first

lavish hemlock
young knoll
#

Every time they move, update the timestamp

brazen bolt
lavish hemlock
#

alright well Coll's is probably better

brazen bolt
#

oki

#

i found this raw code

#
            Player player = (Player) sender;
            int now = (int) (System.currentTimeMillis()/1000/60); // system time in mins
         
            if (args.length > 1) {
                HashMap<UUID, HashMap<String, Integer>> ml = members.getData();
             
                UUID pId = null;
                String pName = args[1];
                pId = getId(pName, ml);
                if (pName != null) {
                 
                    if (ml.containsKey(pId)) {
                        Integer expiry = ml.get(pId).get(pName);
                        if (expiry - now < 0) {
                            expiry = now;
                        }
                        Integer pHours = (expiry - now) / 60, pMins = expiry - (pHours * 60) - now;
                        player.sendMessage(greenPrefix + "Player " + pName + " has " + pHours + "hrs " + pMins + "Mins of Play Time remaining");
                        return true;```
#

i could use this for refrence

#

right

somber hull
#

So

#

Im trying to change a armorstands looking direction

#
                Player plr = event.getPlayer();
                if(plr.getVehicle() == null) return;
                ArmorStand entity = (ArmorStand) plr.getVehicle();
                
                Location locCopy = entity.getLocation().clone();
                locCopy.setPitch(plr.getLocation().getPitch());
                locCopy.setYaw(plr.getLocation().getYaw());
                
                entity.teleport(locCopy);
#

and this isnt working

#

setting the locations pitch and yaw directly doesnt work either

#

i added checks after the plr.getVehicle == null and its running

#

also, its getting the correct entity since i have used other methods on it that have worked

tacit drift
#

100% they thought about that

#

Maybe it's like on skyblock

#

if you make a laggy smp, they wont let you on it

somber hull
#

Setting the body pose doesnt work either

#

Ok

#

i figured it out

#

Spigot doesnt let you teleport or change the location of a entity being ridden

#

So

#

To fix this i will just make its head angle change

tacit drift
#

👍

somber hull
#

entity.setVelocity(plr.getLocation().getDirection().multiply((sidewaysFloat == 0 ? 0 : (sidewaysFloat > 0 ? 0.10 : -0.10))).multiply((forwardFloat == 0 ? 0 : (forwardFloat > 0 ? 0.10 : -0.10))));

Sideways float is >0 when moving left, and <0 when moving right, and for forwardFloat its the same but >0 is forward, etc. How would i be able to set the velocity relative to the players direction without just moving forward, regardless of Y direction

young knoll
#

What?

copper scaffold
#

Does somebody know how to delete a path with the value from a Configuration file? Without deleting the whole file?

young knoll
#

Set it to null

copper scaffold
#

What should i set to null the path?

#

Or the value

young knoll
#

Value

copper scaffold
#

And the path how can i delete that?

young knoll
#

Setting the value to null will remove the entry

copper scaffold
#

Okay also with the self coded Config?

tardy delta
#

Is it possible to send messages cross server without being to the same bungee proxy?

tacit drift
#

having a plugin connected somehow

#

like have the same plugin on both servers

#

would be pretty hard

tardy delta
#

Could i use sockets?

chrome beacon
#

Yeah

quaint mantle
#

this is a question that will lead to more questions, im sorry

echo basalt
quaint mantle
#

how can i play a MIDI file in-game

#

to every player

#

like, how should i*

echo basalt
quaint mantle
echo basalt
#

Keep in mind BPM, volume, pitch and such exist

quaint mantle
#

let me just

#

yeah

#

im a noob

#

i'm gonna do some google research on this

onyx shale
echo basalt
#

Redis has pubsub

#

I doubt sql has that

#

You can also use RabbitMQ

onyx shale
#

I explained how sql would work

echo basalt
#

ehh not the best but sure

onyx shale
#

Well its the... easiest of em all i think

echo basalt
#

Nah

#

Redis with its pubsub

#

Is as easy as a bungee proxy

quaint mantle
onyx shale
#

Well he did give you an answer

#

But be more precise what are you trying to do?

onyx shale
#

Yeah but near location as in what?

#

A random one or predefined or...

quaint mantle
#

U mean u spawn them nearby their respawn location ?

#

No, what i mean is this:
I set random spawn location all around the map, when player die, they will respawn at the nearest spawn location

#

Oh

#

Loop through all the locations and find the nearest one from their dead location

#

Then set the respawn location to the nearest position

quaint mantle
#

Location#distance(location)

quaint mantle
#

Use that method

#

It will give u the distance between 2 location

#

Wait I saw this method but wait wait...

#

And use that distance to compare

#

I thought to use that, but I thought that I need something else and that not work. Ok thanks for your help to remind me of something I already know lol

#

Thanks man!

#

Gl

#

lol

torn oyster
#
            Player p = ((Player) e.getEntity());
    
            if (!isInCombat(p)) {
                p.sendMessage(WAPvP.PREFIX + ChatColor.RED + "You are now in combat! Do not log out.");
            }
            lastDamages.put(p, System.currentTimeMillis());
            
            new BukkitRunnable() {
                @Override
                public void run() {
                    if (isInCombat(p)) {
                        p.sendMessage(WAPvP.PREFIX + ChatColor.GREEN + "You are no longer in combat. You may safely log out!");
                        lastDamages.remove(p);
                    }
                }
            }.runTaskLater(WAPvP.getInstance(), WAPvP.inCombat * 20L);```
#

this is prob bad code

#

but

#

how come this is flooding chat

#

with

#

You are now in combat! Do not log out

#

You are no longer in combat. You may safely log out!

#

when im in a fight

#
public static boolean isInCombat(Player p) {
        return PlayerDamage.lastDamages.containsKey(p) && //if they are in the list
                System.currentTimeMillis() - PlayerDamage.lastDamages.get(p) < WAPvP.inCombat * 1000L; //if it hasnt been > 5s
    }```
#

that is the combat method

#

im trying to make anti combat logging thing

eternal oxide
#

System.currentTimeMillis() - PlayerDamage.lastDamages.get(p) < WAPvP.inCombat * 1000L;

eternal oxide
#

no, but its simpler and more readable logic

torn oyster
#

ok

#

fixed

#

now what

eternal oxide
#

check your value for WAPvP.inCombat

torn oyster
onyx shale
#

Well.. you do have a sendmessage on the 1 second runnable..

eternal oxide
#

and make Player p final

quaint mantle
#

hey, i wonder

#

why something like player p or some string need to be final

#

i dont think that it makes any sense

onyx shale
#

Doesnt rly need to be its just practice

eternal oxide
# torn oyster 5

You should also have a single runnable testing all contents of lastDamages for expiring timers. You are creatign a new runnable for every damage

quaint mantle
torn oyster
#
        if (e.getEntity() instanceof Player) {
            final Player p = ((Player) e.getEntity());
    
            if (!lastDamages.containsKey(p)) {
                p.sendMessage(WAPvP.PREFIX + ChatColor.RED + "You are now in combat! Do not log out.");
            }
            lastDamages.put(p, new BukkitRunnable() {
                @Override
                public void run() {
                    if (lastDamages.containsKey(p) && lastDamages.get(p).equals(this)) {
                        p.sendMessage(WAPvP.PREFIX + ChatColor.GREEN + "You are no longer in combat. You may safely log out!");
                        lastDamages.remove(p);
                    }
                }
            });
            lastDamages.get(p).runTaskLater(WAPvP.getInstance(), WAPvP.inCombat * 20L);
        }```
#

would that work @eternal oxide

#

prob not

#

im dumb

eternal oxide
torn oyster
#

i got rid of that method

eternal oxide
#

you are testign that they are no longer in combat

#

so yoru isInCombat test will not work correctly in yoru runnable

torn oyster
#

i have a new method

#

read

eternal oxide
#

you need them to be in the Map and the timers to have expired

eternal oxide
#

so they have to be in the Map AND the timer has expired

torn oyster
#

im confused

#
            final Player p = ((Player) e.getEntity());
    
            if (!isInCombat(p)) {
                p.sendMessage(WAPvP.PREFIX + ChatColor.RED + "You are now in combat! Do not log out.");
            }
            lastDamages.put(p, System.currentTimeMillis());
            
            new BukkitRunnable() {
                @Override
                public void run() {
                    if (isInCombat(p)) {
                        p.sendMessage(WAPvP.PREFIX + ChatColor.GREEN + "You are no longer in combat. You may safely log out!");
                        lastDamages.remove(p);
                    }
                }
            }.runTaskLater(WAPvP.getInstance(), WAPvP.inCombat * 20L);```
#

i put it back to this

#

what do i change

eternal oxide
#

your second one was better

#

you just had to also check the timer had expired in the runnable

torn oyster
#

how do i track timer 😫

eternal oxide
#

you already are. you are storing the time it was set

torn oyster
#

yes but if i change to 2nd opne

#

it is storing a runnable

eternal oxide
#

ah sorry

#

use yrou original Map

torn oyster
#

actually i could make a variable in the bukkitrunnable

eternal oxide
#

player adn time

eternal oxide
torn oyster
#

hmmm

eternal oxide
#

as you'd auto remove the player, even if they had a new timer set

torn oyster
#
            lastDamages.put(p, new BukkitRunnable() {
                long ms = System.currentTimeMillis();
                
                @Override
                public void run() {
                    if (lastDamages.containsKey(p) && lastDamages.get(p).equals(this)) {
                        p.sendMessage(WAPvP.PREFIX + ChatColor.GREEN + "You are no longer in combat. You may safely log out!");
                        lastDamages.remove(p);
                    }
                }
            });```
#

long ms = System.currentTimeMillis();

eternal oxide
#

yes, but thats always going to be expired when it runs

#

so what happens when a player is hit twice, a couple of seconds apart

torn oyster
#

it replaces the runnable with a new one

#

in the list

eternal oxide
#

the first runnable executes, removes the player from inCombat

#

second task runs and the player is no longer in the Map

torn oyster
#

if the runnable hasnt been overrided

#

so if they hit again

#

it overrides with new one

#

that lasts another 5s

eternal oxide
#

yes, so he's no longer classed as in Combat even though he has nor tasks left to run

quaint mantle
quaint mantle
quasi flint
#

for Player p : Bukkit.getOnlineyPlayerd

#

as an example of course

quaint mantle
#

for each?

quasi flint
#

that does what u need

#

(al though u would need to sort through dmth different)

#

because that goes through ALL Players

quaint mantle
#

how do you loop through those? i need to get the name of that

#

and that is what i need, only need the name of the start (the random names)

quasi flint
#

just save what ever string there id into an temporary variable

#

and use it then further

quaint mantle
#

:/

quasi flint
quaint mantle
#

w3school

quasi flint
#

or an alternative way to do it is here

#

this js what u want and need

quaint mantle
#

oh wait

#

get keys

#

yes i forgot

quaint mantle
#

getkeys lol

quasi flint
#

the 3rd one is exactly the one u need and want

eternal oxide
# torn oyster that lasts another 5s
    Map<Player, Long> lastDamaged = new HashMap<>();
    String PREFIX = "PREFIX";
    int LOG_PREVENT = 5;

    @EventHandler
    public void onDamage(EntityDamageByEntityEvent event) {

        if (event.getEntity() instanceof Player) {
            final Player player = ((Player) event.getEntity());

            if (!lastDamaged.containsKey(player)) {
                player.sendMessage(PREFIX + ChatColor.RED + "You are now in combat! Do not log out.");
            }
            lastDamaged.put(player, System.currentTimeMillis());

            new BukkitRunnable() {
                @Override
                public void run() {
                    if (lastDamaged.containsKey(player) && !inCombat(player)) {
                        player.sendMessage(PREFIX + ChatColor.GREEN + "You are no longer in combat. You may safely log out!");
                        lastDamaged.remove(player);
                    }
                }
            }.runTaskLater(getInstance(), LOG_PREVENT * 20L);
        }
    }

    private boolean inCombat(Player player) {

        if (!lastDamaged.containsKey(player)) return false;

        return System.currentTimeMillis() - lastDamaged.get(player) < LOG_PREVENT * 1000L;
    }```
#

Should work

last ledge
#

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;

public class ClickEvent implements Listener {

    @EventHandler
    public void onClickEvent(InventoryClickEvent event){
        event.setCancelled(true);
        Player player = (Player) event.getWhoClicked();


        if(event.getView().getTitle().equalsIgnoreCase(ChatColor.AQUA + "Server Selector")){
            if(event.getCurrentItem().getType().equals(Material.RED_BED)){
                player.sendMessage( ChatColor.GREEN +"Sending you to Bedwars Server");
                player.closeInventory();
            }else if(event.getCurrentItem().getType().equals(Material.GRASS_BLOCK)){
                player.sendMessage(ChatColor.GREEN +"Sending you to Survival Server");
                player.closeInventory();
            }else if(event.getCurrentItem().getType().equals(Material.BEE_NEST)){
                player.sendMessage(ChatColor.GREEN + "Vote For Us : Link 1 2 3 4");
                player.closeInventory();
            }
        }


    }
}``` 


Players not getting messages when they click on items
quasi flint
#

registered it??

last ledge
#

yes

#

getServer().getPluginManager().registerEvents(new ClickEvent(), this);

quasi flint
#

then no clue

#

try some sysouts

#

for debugging

eternal oxide
#

Don't check the inventory by the title

#

match by instance

torn oyster
eternal oxide
#

sec

#

its probably a very close timing issue, increase the delay on the runnable. (LOG_PREVENT * 20L) + 5L

ivory sleet
#

If you want to be very precise using System::nanoTime might be a better idea

eternal oxide
#

Nah, he just needs close enough

#

but his runnable has to run after the time expires and not on or before

quaint mantle
quaint mantle
#

maybe some minor bugs

#

Ok

#

im trying to make it doing what im intend to do

#

Gl

#

wait I can't do this?

        for(String path : getConfig().getKeys(false)) {
            Bukkit.getLogger().info("hello" + path);
        }```
#

it still doing wrong :LLLLL

torn oyster
quaint mantle
#

Um wat do u get in the console ?

torn oyster
#

i tried this

    @EventHandler(priority = EventPriority.LOWEST)
    public void onEntityDamage(EntityDamageByEntityEvent e) {
        if (!e.isCancelled()) {```
#

but that doesnt work

quaint mantle
#

Do u have anything in ur yml file ?

eternal oxide
#

in the annotation

eternal oxide
quaint mantle
quaint mantle
#

config.yml

torn oyster
quaint mantle
#

btw even if i change to ' but it still not doing anything ....

quaint mantle
ivory sleet
#

Yml specs accepts either
'str' or "str" or just str

quaint mantle
#

changed to this

#

let me test (again) to see how it work

#

Do u have a config.yml file created when u run the plugin ?

#

snipe

#

this is just testing purposes so i dont do anything much to this

ivory sleet
#

Looks like an odd way to test stuff out

#

You could atleast print the path?

quaint mantle
ivory sleet
#

Or log it for that matter

quaint mantle
#

if i put the bukkit getlogger out of the for loop

#

then it would work

#

What is in the config.yml?

#

but if in the for loop then nothing will work

#

ummm

ivory sleet
#

Well you should also use your plugins logger over the global Bukkit logger

quaint mantle
#

just System.out.print

quaint mantle
#

they are the same

ivory sleet
#

Wat

quaint mantle
#

wtf

#

im now confused

#

Huh

#

if i put them out of the for loop then it would work

ivory sleet
#

Oh like outside the scope?

quaint mantle
#

this, will work

#

not this

#

Um can u print the size of the getKeys()

#

very cool moment

quasi flint
#

my brain cant comprehend this bs

ivory sleet
#

Oh yeah well shouldn’t you call the saveDefaultConfig() before the copyDefaults?

quaint mantle
#

this right?

#

Yes

quaint mantle
#

i mean i just print only hello

#

nothing i tried really use config

quaint mantle
#

gonna do this

#

Ok

#

i do think something weird is happening with the for-each loop today

ivory sleet
quaint mantle
#

okay this work, as they not in the for loop

#

Oh

#

nah man

quasi flint
#

^

quaint mantle
ivory sleet
#

Presumably

quaint mantle
#

i only see the opposite way, from kody i think

quasi flint
#

ye

quaint mantle
#

Ur config.yml is empty when u run getkeys method

ivory sleet
#

I haven’t used those methods in ages so can’t tell whether that’s the correct order but by the looks it seems more right

quaint mantle
#

is it emty?

quaint mantle
quasi flint
#

thats the right order

quaint mantle
#

No I mean the program can't see anything in that configmynl maybe

ivory sleet
#

No that’s not true

quasi flint
#

i think

quaint mantle
quaint mantle
#

of course i print that "hello" in the for-each loop

#

so, nothing matter with those 2

quaint mantle
quasi flint
quaint mantle
quasi flint
#

packedged into the plugin itself?

quaint mantle
#

okay okay?

quasi flint
#

print i.size

quaint mantle
quasi flint
#

perfect

quaint mantle
ivory sleet
#

Thing is, object orientation works with state, for instance you can’t open a file before closing a file and so on, we work with changes to the system. Therefore it’s conspicuously silly trying to close a file before opening it. The same goes here, one order will work whilst another shouldn’t. But make sure your config.yml resource is actually contained within your jar. Then in principle if you just want to access the data from config something like:
saveDefaultConfig();
reloadConfig();
should work.

quasi flint
#

print i.sizey() reeeee

quaint mantle
#

kody do that all the times so i dont think it really matter, but, who knows?

ivory sleet
#

Who’s kody

tribal sparrow
#

try

  public void onEnable() {

        saveDefaultConfig();

        boolean has = (getConfig().isSet("hello.hello"));
        if(has) {
            System.out.println("config has value: " + getConfig().getString("hello.hello"));
        } else {

            System.out.println("config doesn't have value");
        }
    }
quaint mantle
tribal sparrow
#

to determine if the config.yml is being loaded.

does the config.yml actually copy to /plugins/(plugin)?

ivory sleet
#

Idk who that is

quaint mantle
#

wait wat

#

this just work

ivory sleet
#

Nice

quaint mantle
#

*visible confusion

#

Expected

ivory sleet
#

Oh it’s a YouTuber?

stone sinew
quaint mantle
#

wait

quaint mantle
#

i just realized

#

didnt put {}

#

so i this case

tardy delta
quaint mantle
#

Its ok

#

it means that it still outside of the for-loop

tribal sparrow
ivory sleet
#

That shouldn’t matter rpgaccount

quaint mantle
#

It's inside

ivory sleet
#

^

quaint mantle
#

what?

#

gonna test this out

#

1 line of code after a statement is inside

#

Without {}

ivory sleet
#

Java isn’t indentation based

quaint mantle
#
If (isDead)
  Inside
Outside

If (isDead) {
Inside
Inside
} 
Outside
#

okay everything works fine now, gonna back to the start, maybe something weird just happens to for-each :l

stone sinew
ivory sleet
#

Logger(3

quaint mantle
#

now gonna test this

quaint mantle
quaint mantle
eternal night
#

any reason to not just use the default btw ? xD

quaint mantle
#

There is no .

eternal night
#

instead of a random tenary

quaint mantle
#

I mean there's is no path that is hellohello

ivory sleet
#

Store the view when invoking HumanEntity#openInventory

quaint mantle
#

wait

tribal sparrow
#

path + ".hello"
is what he is talking about

quaint mantle
#

But there is a path that is hello.hello

#

so that what im encountering?

quaint mantle
#

very nice thanks everyone for helping :sadman:

#

so, everyone's confusion is becuz my me?

#

sorry lol

ivory sleet
#

Wat

ivory sleet
#

The event is just api

#

Nothing more

eternal night
#

whatever example yapper threw in above

quaint mantle
quaint mantle
#

but actually everyone dont even noticed that

#

OK OK OK @ivory sleet right now im very confused, but your way just work

ivory sleet
#

Wait what are you actually trying to do?

quaint mantle
#

but... wait, i always do this and it always work... seems a bit weird

#

I have no idea

#

this is weird

#

but anyways

#

thanks for helping

ivory sleet
#

Well yeah the methods are badly named arguably,
saveDefaultConfig just takes the config from your jar and puts it into your data folder

Unsure what the copy defaults is doing exactly

eternal oxide
#

never use copyDefaults() it pointless

quaint mantle
#

i have no idea

eternal oxide
#

that line literally does nothign. It returns a boolean. calling that method does nothing

ivory sleet
#

Not to be mean now but kody simpsons is probably not the best guy to worship when it comes to opinionated spigot plugin development

quaint mantle
#

it just really fun hearing his voice, like wtf idk but his voice kinda cool

ivory sleet
#

Lol alr

quaint mantle
#

😫

#

still have no idea

#

exactly from one of his videos.

eternal oxide
#

Yes, one person added that one time to a tutorial, now everyone just copies it with no idea what it does.