#development

1 messages · Page 134 of 1

shell moon
#

pretty sure there is something else handling events

craggy zealot
#

fixed it

shell moon
idle harbor
#

Hello, im not sure is this right channel for ask one question. With plugin DeluxeMenu, i want this plugin connect with residence plug. And here is one problem. Res plugin have command where you need to write username. For exapme / res padd (name). Is it posible, to make what user press on button, and console asked him to write user name to chat. After you write a nickmame command made success. Is it posible, or need some extra plugin for that?

wintry grove
#

I think there is an option for that

tame orbit
#

Hey, im trying to use plugin messaging to send a player to a server, and nothings happening. I have done this once before in another plugin, and just copied the code over. theres no errors, just nothing happens. I have registered it in my onEnable with this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");, and am using the below code to send them:

        System.out.println(player.getName() + " : " + server);
        try {
            ByteArrayOutputStream b = new ByteArrayOutputStream();
            DataOutputStream out = new DataOutputStream(b);
            out.writeUTF("Connect");
            out.writeUTF(server);
            player.sendPluginMessage(ManhuntMinigamePlugin.getInstance(), "BungeeCord", b.toByteArray());
            b.close();
            out.close();
        }
        catch (Exception e) {
            e.printStackTrace();
            player.sendMessage(ChatColor.RED+"Error when trying to connect to "+server);
        }
    }```
thanks
#

Idk how to go about debugging this, I have verified the input player and server is correct, but there’s no errors printed in the console or the proxy console

shell moon
#

Max BurnTime before animation burn animation breaks in furnaces?

#

98100 in 1.18, any place to find it for older versions?

pearl topaz
#

is there a more readable way of writing val arrayType = object : TypeToken<ArrayList<T>>() {}.type

#

i tried val arrayType = TypeToken.getParameterized(ArrayList.class, T).type but it says "name expected" on , and "expecting an element on )

pearl topaz
#

val arrayType = TypeToken.getParameterized(ArrayList::class.java, this.getValue()::class.java)

#

gross

#

idk if that even works

lyric gyro
#

Kotlin moment

dense drift
pearl topaz
#

anything neater? 😭

ocean raptor
lyric gyro
shell moon
#

seems that something is breaking about burn time when it's 40000

#

burn animation breaks, but it's still cooking items

tame orbit
craggy zealot
#

how do i make the citizens npc have my skin?

lapis pilot
#

does anyone know why this is dropping like 3-4 stacks of nether stars

    @EventHandler
    public void mobDeath(EntityDeathEvent event) {
                for (World Decepticon getWorlds()) {
                    for (Entity e : Decepticon.getEntities()) {
                        e = event.getEntity();
                        if (e instanceof Silverfish) {
                            e.getLocation().getWorld().dropItem(e.getLocation(), new ItemStack(Material.NETHER_STAR));
                        }
                }
            }
        }
}```
neon wren
#

well you are looping through all the entities in that world that are a Silverfish, not simply setting the drop to a silver fish.

#

Can you provide when it should drop a nether star? @lapis pilot.

#

Like is it only in specific world(s), etc.

lapis pilot
#

testing this

   @EventHandler
    public void mobDeath(EntityDeathEvent event) {
        Entity entity = event.getEntity();
        if (entity instanceof Silverfish) {
                    event.getDrops().add(new ItemStack (Material.NETHER_STAR));
                }
            }
        }
neon wren
lapis pilot
#

yes ty

lyric gyro
#

Then there was a command like /npc mirrorskin or something that you had to run

#

That is of course if you want it to be different for each player, which is what I'm guessing

crisp robin
#

any1 knows how to make a player Invulnerable in 1.8.9
i used to do isinvulnerable
but apparently it aint a thing in older versions of spigot

lyric gyro
#

why are you on older versions of spigot

crisp robin
#

cuz i wanna make a plugin for 1.8.9...

lyric gyro
#

that's not the greatest idea, but you could try giving them a high resistance level

crisp robin
#

mmmm

#

but im doing a /god cmd

lyric gyro
#

yea

crisp robin
#

i dont think that's gonna be effective

lyric gyro
#

pretty sure after a certain point resistance makes you unkillable

crisp robin
#

welp

#

i'll give it a try

lyric gyro
#

you could also potentially cancel the damage event

crisp robin
#

thats a big brain moment

#

i'll just cancel the damage event

#

looks better to me

lyric gyro
#

yeah, that's probably a good way to do it lol

crisp robin
#

ya lol

#

ty btw

#

!

lyric gyro
#

np

lyric gyro
#

yep that's what I said a few seconds later haha

#

I saw it 👍🏻👍🏻

lyric gyro
#

I guess server sided, so that everyone sees the same skin of that npc

#

Dm ^

#

Just doing /npc skin <username> should work I think

#

Oh wait unless he wants to do it through the API or something

#

I think that he wants to do it with his plugin yea haha

lyric gyro
#

💀💀

pearl topaz
#

what does

myMap[myKey]?.invoke(null) ?: return false
```do
#

.invoke(null) never seen this before

dense drift
#

invoke(null) is for static methods

#

d;jdk Method#invoke

uneven lanternBOT
#
public Object invoke(Object obj, Object... args)
throws IllegalArgumentException, InvocationTargetException, NullPointerException, ExceptionInInitializerError, IllegalAccessException```
Description:

Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary.

If the underlying method is static, then the specified obj argument is ignored. It may be null.

If the number of formal parameters required by the underlying method is 0, the supplied args array may be of length 0 or null.

If the underlying method is an instance method, it is invoked using dynamic method lookup as documented in The Java Language Specification, section 15.12.4.4; in particular, overriding based on the runtime type of the target object may occur.

If the underlying method is static, the class that declared the method is...

This description has been shortened as it was too long.

Parameters:

obj - the object the underlying method is invoked from
args - the arguments used for the method call

Throws:

IllegalArgumentException - if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
InvocationTargetException - if the underlying method throws an exception.
NullPointerException - if the specified object is null and the method is an instance method.
ExceptionInInitializerError - if the initialization provoked by this method fails.
IllegalAccessException - if this Method object is enforcing Java language access control and the underlying method is inaccessible.

Returns:

the result of dispatching the method represented by this object on obj with parameters args

dense drift
#

the first parameter is the object instance, and the varargs are the parameters of the method itself

#

@wheat carbon can we possible add some ` around parameters / exceptions? https://github.com/PiggyPiglet/DocDex/blob/393efbf8ad85c4bd34834c9cbe85942daa8f30b7/discord/src/main/java/me/piggypiglet/docdex/bot/embed/documentation/SimpleObjectSerializer.java#L89

IllegalArgumentException - if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
InvocationTargetException - if the underlying method throws an exception.

https://github.com/PiggyPiglet/DocDex/pull/55

tender thicket
#

Hey so I'm just curious if this would work? I'm trying to figure out mapping and flat mapping thru streams, but I'm not home right now and had a theory, and was wondering if you guys knew if this would work or not.

#
List<String> onlinePlayerNames = Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList());```
#

Does map return a new stream of the desired result?

#

Or do I still not understand what map does

sterile hinge
#

a Stream doesn't really contain a result, it contains a description of how to transform the input

#

and the last step (terminal operation) does not return a stream but actually does the processing

tender thicket
#

Right so does the map part of the stream tell the stream to transform the result to a new type of object?

sterile hinge
#

yes

tender thicket
#

Ah so then getting a list of all online player names would be done using exactly that

#

Rather than creating a list and manually populating it with something like a forEach or an enhanced for loop

#

That's what I'm avoiding here anyways

#

Extra boilerplate

sterile hinge
#

well there are multiple ways of doing things, each with their pros and cons

tender thicket
#

Yes, in some cases it's better to use enhanced for instead of forearm

#

ForEach

#

Like when trying to assign variables within a loop that aren't effectively final

#

😜

#

I still have yet to find a reason to use while

#

Even when using an iterator my ide suggests just using an enhanced for

dense drift
#

while (resultSet.next())
while (matcher.find())

tender thicket
#

while (iterator.hasNext())

#

I get that

#

But my ide almost always suggests that using an enhanced for is better

#

¯\_(ツ)_/¯

sterile hinge
#

wait until you find use for do while

tender thicket
#

I do appreciate do while though

dense drift
#

I don't think I ever used do while 🤣

tender thicket
#

do while is very useful in occasions where you'd want to apply something like an effect and then while the duration of a boolean is active keep updating that effect

#

That's the only time I've used it though

dense drift
#

wont that have the same effect as a simple while?

tender thicket
#

Not unless you want it to trigger ONLY if the boolean is true

dense drift
#

do while simply execute the code before checking the condition

tender thicket
#

In this case I want it to apply the effect

sterile hinge
#

I used both in several situations, but that's rather super specific use cases

tender thicket
#

Then keep applying the effect if the boolean is active

sterile hinge
#

like most looks can be covered with for

dense drift
#

yup

wheat carbon
#

@dense drift i'll merge soon

#

next time i'm on linux

dense drift
#

oky

lyric gyro
dense drift
#

sadly, you have to write it as multiple cases one under eachother, and the last one will have the return ..

#
case 0:
case 1:
// 2 3 4 5 6 7 8
case 9: return "&f" + profile.getLevel();```
lyric gyro
#

uh

#

0 - 9 is the same as 10 - 19

#

which is the same as 20 - 29

#

that is what that's "complaining" about

dense drift
#

and that

#

When was case a, b, c, d, e -> added?

lyric gyro
#

16 I think?

lyric gyro
#

it's a math expression

#

0 - 9 is -9

#

10 - 19 is -9

#

oh

dense drift
#

^ that - doesn't act like a range

lyric gyro
#

so it calculates

#

I see

#

yeah

#

how to make a range like u said Gaby?

#

case 1, 2, 3...?

dense drift
lyric gyro
#

I use java 8

#

fastasyncworldedit on 1.8 requires java 8

sterile hinge
#

just dont use switch

#

or divide by 10

lyric gyro
#

an if is probably clearer

lyric gyro
sterile hinge
#

?

lyric gyro
#
        Profile profile = ProfileManager.getProfile(player);
        switch (level/10){
            case 1: return "&f" + profile.getLevel();
            case 2: return "&e" + profile.getLevel();
            case 3: return "&a" + profile.getLevel();
            case 4: return "&2" + profile.getLevel();
            case 5: return "&3" + profile.getLevel();
            case 6: return "&d" + profile.getLevel();
            case 7: return "&b" + profile.getLevel();
            case 8: return "&6" + profile.getLevel();
            case 9: return "&9" + profile.getLevel();
            case 10: return "&c" + profile.getLevel();
            case 11: return "&4" + profile.getLevel();
            case 12: return "&4&l" + profile.getLevel();```
sterile hinge
#

where is case 0?

lyric gyro
#

oh lmao my bad

#

thx guys that worked 🙂

left olive
#

java.lang.NoSuchFieldError: SNOWBALL
at me.streakymask.Items.switcherballitem.createswitcherballitem(switcherballitem.java:16) ~[?:?]
at me.streakymask.Items.ItemHandler.init(ItemHandler.java:9) ~[?:?]
at me.streakymask.main.onEnable(main.java:24) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:332) [patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:407) [patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:359) [patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:318) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.s(MinecraftServer.java:408) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.k(MinecraftServer.java:372) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.a(MinecraftServer.java:327) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:267) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:563) [patched.jar:git-PaperSpigot-"4c7641d"]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_331]

The line is ItemStack item = new ItemStack(Material.SNOW_BALL, 1);
But if i do it with EGG its fine and it works perfectly... what's the problem?

#

i just started learning so forgive me

hoary scarab
left olive
#

Sorry i sent it wrong i just tried with snow_ball

#

sorry i actually wrote SNOWBALL i just sent it wrong

#

if i write SNOW_BALL i get the error: Cannot resolve symbol 'SNOW_BALL'

hoary scarab
#

Show updated code and point out line number. (.txt please)

dense drift
#

SNOWBALL is named SNOW_BALL in 1.8

#

d;1.8 Material%SNOW_BALL

uneven lanternBOT
hoary scarab
dense drift
#

d;spigot Material#getMaterial

uneven lanternBOT
#
@Nullable
public static Material getMaterial(@NotNull String name)```
Description:

Attempts to get the Material with the given name.

This is a normal lookup, names must be the precise name they are given in the enum.

Parameters:

name - Name of the material to get

Returns:

Material if found, or null

dense drift
#

getMaterial only strips stuff like spaces I believe, and turn the string uppercase

hoary scarab
#

??? Its to supply material from the string

#

He got it to work lol

dense drift
#
    @Nullable
    public static Material getMaterial(@NotNull String name, boolean legacyName) {
        if (legacyName) {
            if (!name.startsWith(LEGACY_PREFIX)) {
                name = LEGACY_PREFIX + name;
            }

            Material match = BY_NAME.get(name);
            return Bukkit.getUnsafe().fromLegacy(match);
        }

        return BY_NAME.get(name);
    }```
#

this is literally all it does

#

basically a replacement for Enum#valueOf

hoary scarab
#

sigh

His issue is his plugin is compiled against spigot 1.18 so the Material enum doesn't have SNOW_BALL which he needs so he has to use Material.getMaterial("SNOW_BALL")

dense drift
queen plank
#

I spawn a custom projectile with a particle trail and I want to remove the particle trail once the projectile is picked up (it's an arrow). However, the particle stays even though I've picked up the arrow projectile. I can't figure out why. Here is my code, projectile class: https://paste.helpch.at/obemequmuf.java and particle spawner: https://paste.helpch.at/opahuvovot.cs. Sorry if I explained it poorly, don't know how to do it better : |

proud pebble
scenic vapor
#

Hey Guys! Does anyone have experiences with ProtocolLib? I am trying to spawn packet-based ItemStack entity and I cannot find any way to do that... 😦

#

(ping me if you reply)

dense drift
scenic vapor
#

or I can just try to spawn an ItemStack and cancel the EntitySpawn Packet to other players

dense drift
#

you are sending the packet to a certain player

scenic vapor
dense drift
scenic vapor
#

why shouldnt I just spawn ItemStack entity?

#

instead of putting it on an armorstand

cloud sierra
#

I'm getting this error. Any help? java Error: Could not find or load main class Caused by: java.lang.ClassNotFoundException:

#

This is the entire error nothing else.

dense drift
#

because I believe you can not do that

scenic vapor
# dense drift I guess you have to send another packet afterwards https://wiki.vg/Protocol#Enti...

I somehow need to convert that into ProtocolLib

        Location loc = middle.clone().add(0,0.015*80+0.3,0);

        OverridenEntityItem entityItem1 = new OverridenEntityItem(((CraftWorld) middle.getWorld()).getHandle(),loc.getX(),loc.getY(),loc.getZ());
        entityItem1.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());

        entityItem1.setItemStack(CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND)));
        entityItem1.setCustomName(CraftChatMessage.fromStringOrNull("§bDiamond"));
        entityItem1.setCustomNameVisible(true);

        CraftItem craftItem1 = (CraftItem) entityItem1.getBukkitEntity();
        craftItem1.setVelocity(new Vector(0,-0.1,0));
        craftItem1.setGlowing(true);

        sendPkt(new PacketPlayOutSpawnEntity(entityItem1));
        sendPkt(new PacketPlayOutEntityMetadata(entityItem1.getId(), entityItem1.getDataWatcher(), true));
        sendPkt(new PacketPlayOutEntityVelocity(craftItem1.getHandle()));
dense drift
#

but you can try

scenic vapor
#

UH

#

xD

dense drift
#

yeah, this is where my plib knowledge ends 🤣 soz

lyric gyro
#

how does the game do it if not lol

dense drift
#

¯_(ツ)_/¯

#

I always see people using armor stands, idk

broken elbow
#

I Mean armor stands make it easier to animate. that's probably why

scenic vapor
past ibex
#

Player target = Bukkit.getPlayer(args[0]);

#

if bukkit can't find a player by the argument, it is null

warm steppe
past ibex
#

I'm confused, I think someone deleted a message

lyric gyro
#

yep

slim vortex
#

I want to get into developing Bedrock servers, and I'm unsure where to start. For Java, there is Paper and its forks, but I can't seem to find any examples of software like Nukkit or Cloudburst being used in the professional scene. I am looking to create effects that servers like CubeCraft, MineVille, The Hive (featured servers), etc have and I am looking for a robust and fast server software that allows me to pull this off.

past ibex
#

mineplex uses java servers with their own protocol translation

slim vortex
#

When I join on Bedrock, it is a different server than MC Java. Different layout, different everything.

ocean raptor
#

form guis are a part of bedrock but other than that (giant npcs etc.), texturepacks i guess

#

just like java

slim vortex
#

Form GUIs aren't supported on any existing Spigot fork

ocean raptor
#

you may not noticed but you install the server's texturepack everytime you join the server

slim vortex
#

I understand that

#

But on Bedrock it's way more powerful

#

Can you go into detail? All the information I've been able to get in months is just that- foggy and no actual information.

ocean raptor
#

yes because Java Edition client does not have Form GUIs but Bedrock Client does

slim vortex
#

So then why are there different servers for Bedrock and Java if they operate the same theoretically?

#

From the backend POV

pulsar ferry
#

They have different protocols

ocean raptor
#

very different yeah

slim vortex
#

So why do they implement it with a Minecraft Java server if they can just write a Bedrock protocol server without a middle man?

#

Let's forget about Mineplex because it seems like that's the exception rather than the rule. What about other Bedrock featured servers?

ocean raptor
#

same, texturepacks or whatever its called in bedrock

slim vortex
#

I don't see why any developer would intentionally add another layer to their software by using a server software that is meant for an entirely different game.

#

Are you 100% sure that all of the featured servers above use this method or are you just speculating?

#

I'm looking for a concrete answer

dusty frost
#

lot of the mechanics of the serverside are better in java and less glitchy

#

the bedrock server has a shit ton of bugs, I'm sure you've seen reddit videos of people like randomly dying from fall damage and stuff

#

so I presume it's better to run the mechanics, which are intended to be basically identical, on java, then just swap a few packets out at the proxy layer

tame orbit
#

Plus, they can make use of Java plugins and their Java developers much easier

slim vortex
#

So why are there pieces of software being developed in Go (DragonFly, etc) and Java (Nukkit, Cloudburst) if nobody is professionally using them?

dusty frost
#

I mean I'm sure there are a few smaller servers using them

#

But yeah they don't have the vast ecosystem behind them that spigot does, and I also am not aware of any bstats stuff for bedrock so we don't really have a way to track

slim vortex
dusty frost
proud pebble
#

nukkit is still stuck using 1.16 features

dusty frost
#

same as Java pretty sure

proud pebble
#

it doesnt support 1.17 and above features

slim vortex
dusty frost
#

I think the only notable difference is form guis

proud pebble
#

tbh the form guis look quite ugly

slim vortex
proud pebble
#

yeah

dusty frost
#

I mean yeah presumably

slim vortex
tame orbit
#

You gotta scroll for an hour to get anything

proud pebble
dusty frost
#

I dunno I quite like the look of glass pane guis

slim vortex
#

In bedrock

tame orbit
#

Yea I do to

dusty frost
#

and especially if you get deep into resource pack stuff, you can basically retexture the entire chest GUI to look different

proud pebble
#

thats cause bedrock supports 3 and 6 row inventories

#

they dont suport 1,2,4,5 row chest inventories

#

which is dumb tbh

tame orbit
#

Yea, idk why they are relive features like that from bedrock, like when they added chest gui why don’t they just add it the same way in Java

broken elbow
#

in bedrock, glass is not flat

tame orbit
#

I want to like bedrock since it’s so much faster but they are making it hard

dusty frost
dusty frost
#

Java just has years of backing, solid modding support, and okay performance if you can instance properly

slim vortex
#

Here's what I'm talking about- no packet translation or retexturing

dusty frost
broken elbow
#

I wonder what antvenom has to say about bedrock. he made a video recently complaining about the people that reposted the aether mod or rather a copy for a price.

broken elbow
dusty frost
#

oh man the aether is such a throwback

#

i remember being like 12 years old and wanting to do it so bad, I built a portal and obviously it didn't work lmao

slim vortex
#

So, do you suggest I develop a fully Minecraft Java network, and use something like Geyser to proxy?

broken elbow
#

yeah but some people copied that mod and a few others and made into a survival map. it wasn't even a dimenstion it was a pregenerated map lmao

lyric gyro
dusty frost
broken elbow
dusty frost
#

bedrock players are a whole different breed

broken elbow
#

but they pay Star

dusty frost
#

and just supporting all that shit makes any new feature kinda weird

broken elbow
#

that's the whole point of bedrock

lyric gyro
#

^ and there are tons of them

broken elbow
#

money generation

dusty frost
#

yeah, kinda sad

#

i dunno, I'm happy with my all java servers

slim vortex
#

Do you have any useful/informative articles or videos on how to develop texture packs for Bedrock that don't interfere with Java players?

dusty frost
#

but I suppose we are also a serious roleplay 18+ kinda vibe

broken elbow
#

imagine having a successful minecraft server tho

proud pebble
#

a better idea is to not have anything in the inventory instead of having panes on bedrock

hoary scarab
#

In what way is bedrock "faster" than Java? When ever I play it, it's slow af the movement is weird. When you alt tab it kicks you from servers its all around a shitty version lol

broken elbow
#

I mean its more lightweight than java edition that's for sure

dusty frost
#

It's written in C++, but it's far from the same as Java edition

#

lot more bugs

broken elbow
#

yes. from what I've heard redstone is also a pain

lyric gyro
#

you can place repeaters underwater tho

#

oh and snow layers are affected by gravity (?????), they don't pop off when you break the block underneath

#

those are the two things I remember about it from when I played it

broken elbow
worn jasper
#

Lets not forget that HiveMC went to bedrock and closed the java servers xd

#

According to them it was a lot cheaper to run the servers in bedrock and they had more customization

#

Like the builtin menus you can do etc

hoary scarab
#

You can make custom guis in Java to. (Ever since they added resources packs)

#

Actually for longer then bedrock.

dense drift
#

is not the same thing =/

dense drift
#

"pretty close" != same thing

#

I'm aware of that

robust osprey
#

true

hoary scarab
upper jasper
#

True

hoary scarab
#

... Bedrock forces the resource pack upon joining.

upper jasper
#

All featured servers still use packs tho

#

But they only have to load once a change has been made

robust osprey
#

if there's a universal injector that can let client and server more fancy...

hoary scarab
#

I think bedrock doesn't even let you join if you have resource packs disabled, where as java gives a prompt.

broken elbow
#

yeah. lately you can force them to accept. but you still get the prompt

hoary scarab
#

Yeah bedrock doesn't give a prompt it just starts downloading.

timber gale
acoustic quest
#

Quite a noob here, i'm trying to create my first plugin just saying hello world in chat when running a cmd. it gives me no error on load, i can use the commands only that nothing then happens, what would be the best way to send you my code?

hushed badge
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

acoustic quest
#

idk if that also is important:
[16:54:45] [Server thread/WARN]: Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!
[16:54:48] [Server thread/WARN]: Legacy plugin HelloWorld v1.0 does not specify an api-version.
[16:54:48] [Server thread/INFO]: [HelloWorld] Loading HelloWorld v1.0

#

trying all with java 11 installed if that matters

lyric gyro
acoustic quest
#

so i tryed playing around a bit more, idk what i did, now it doesn't want to really load anymore, but instead says: Could not load 'plugins\HelloWorld.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.irongaming.helloworld.Main;'

lyric gyro
#

Can you share your plugin.yml

acoustic quest
#

name: HelloWorld
version: '1.0'
author: Irongaming
main: me.irongaming.helloworld.Main;

commands:
helloworld:
description: Says "Hello World"
aliases: [hw,hellow]

permissions:
helloworld.command:
description: Unlocks "Hello World"
default: op

#

main would be:

package me.irongaming.helloworld;

import org.bukkit.plugin.java.JavaPlugin;

import me.irongaming.helloworld.command.HelloWorldCommand;

public class Main extends JavaPlugin {

//@Override
public void onenable() {
    
    new HelloWorldCommand(this);
    
}

}

lyric gyro
#

remove the semicolon at the end of the main: me.irongaming...

acoustic quest
#

that was what i had before, there nothing then happened on cmdr execution

lyric gyro
#

and now it's not working altogether lol

#

the main entry in the plugin.yml does not take a semicolon at the end

#

it's just the package name + main class name

acoustic quest
#

following a tutorial and the guy has it there and it is still working for him

broken elbow
#

well don't lol. try and remove it

lyric gyro
#

it definitely does not contain it

acoustic quest
#

alright plugin loaded now, but nothing comes if i write /hw

#

it accepts the command but does nothing

#

I'm op on the server so that shouldn't be the issue

broken elbow
#

do aliases automatically register if you put them in plugin.yml?

acoustic quest
#

i tryed full cmd also doesn't work

broken elbow
#

idk how that works lol. that's the problem when you use matt's lib. you don't have to deal with all this stuff :))

lyric gyro
#

.

acoustic quest
#

having a bit more of a look at the tutorial, eclipse auto correct seems to have changed my @override in the main to a comment, but if i remove the // it says The method onenable() of type Main must override or implement a supertype method

lyric gyro
#

capitalization matters, it's onEnable

#

and yeah that should be the issue looking at it closely

acoustic quest
#

Me after realizing eclipse said it is right xD

#

Thx finally works

lyric gyro
dense drift
#

forEach(line -> code here);

craggy zealot
#

how do i call in my own method?

#

is it just private Object method;

#

like i have this countdown method

#

and i want when the countdown to end to call this method i have to assign spawn points

pulsar ferry
timber gale
#

@craggy zealot

#

wrong copy and paste my bad

#

I meant to say can you elaborate

#

Send code please.

formal crane
#

did you ever get to fix this issue? i still got it

craggy zealot
#

how do i change the java version in my pom

#
        <java.version>8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>```
#

i need java 16 becuase when i try to add it to jitpack

#

it says this

#

class file has wrong version 61.0, should be 52.0

#

it says that when my java version is 8 and not 16

#

can anyone help on what i should do

cerulean birch
#

<java.version>8</java.version>
=>
<java.version>16</java.version>

#

oh

#

try going to your project structure, going to the specific maven module and changing the language level there/making sure you have java 16 downloaded

craggy zealot
#

it says there is no java 16

cerulean birch
#

do you have a jdk 16 downloaded?

craggy zealot
#

yes

#

thats what i use

#

for the project structure

#

i do this right

#
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>```
#
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build tool exit code: 0```
#

see

#

idk what to do

dusty frost
#

gradle

craggy zealot
#

never

#

im not THAT down bad

dense drift
#

🤣

dusty frost
#

down bad for repeatable builds and a build tool made in the modern era? lmao

craggy zealot
#

big words dont know what they mean

wintry grove
#

gradle is fucking easier lmao

#

and more complete

sudden sand
formal crane
#

i got this rn

        if(!(playerExists(p.getUniqueId().toString()))) {
            try {
                PreparedStatement ps = hikari.getConnection().prepareStatement("INSERT INTO bounties (UUID,BOUNTY) VALUES (?,?)");
                ps.setString(1, p.getUniqueId().toString());
                ps.setInt(2, amount);
                ps.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }else{
            try {
                PreparedStatement ps = hikari.getConnection().prepareStatement("UPDATE bounties SET BOUNTY=? WHERE UUID=?");
                ps.setInt(1, amount + getBounty(p.getUniqueId().toString()));
                ps.setString(2, p.getUniqueId().toString());
                ps.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

    }```
sudden sand
formal crane
#

so just ps.close() ?

sudden sand
#

wait

#

Connection connection = ps.getConnection();
ps.close()
connection.close()

#

add this at the end of your 2 statement

formal crane
#

so i just add that after the 2 statements?

sudden sand
#

for both

#
public void addBounty(Player p, int amount) {
        if(!(playerExists(p.getUniqueId().toString()))) {
            try {
                PreparedStatement ps = hikari.getConnection().prepareStatement("INSERT INTO bounties (UUID,BOUNTY) VALUES (?,?)");
                ps.setString(1, p.getUniqueId().toString());
                ps.setInt(2, amount);
                ps.executeUpdate();
Connection connection = ps.getConnection();
ps.close()
connection.close()
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }else{
            try {
                PreparedStatement ps = hikari.getConnection().prepareStatement("UPDATE bounties SET BOUNTY=? WHERE UUID=?");
                ps.setInt(1, amount + getBounty(p.getUniqueId().toString()));
                ps.setString(2, p.getUniqueId().toString());
                ps.executeUpdate();
Connection connection = ps.getConnection();
ps.close()
connection.close()
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

    }```
lyric gyro
sudden sand
#

bad yml

#

you made a format error

lyric gyro
#

how should i fix it

formal crane
# sudden sand ```java public void addBounty(Player p, int amount) { if(!(playerExists(...

Do you also maybe know why after exactly 10 times (using this code) this code stops working and gives a HikariPool timeout?

        try {
            PreparedStatement ps = hikari.getConnection().prepareStatement("SELECT BOUNTY FROM bounties WHERE UUID=?");
            ps.setString(1, playerUUID);
            ResultSet rs = ps.executeQuery();
            return rs.getInt("BOUNTY");
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }```
warm steppe
#

Connection is not available, request timed out after 30001ms.

sterile hinge
sudden sand
#

Actually it's for the error not to happen

#

the error is caused because the pool limit is full

#

the reason it's full it's because you don't close connection so they just stay inactive but existing

sterile hinge
#

if an error occurs before you call the close methods, the close methods won't be called

#

that's the issue

#

and there are several reasons why errors could occur

sudden sand
#

Ok ? but that's not the problem Razer encounter

sudden sand
sterile hinge
#

well your solution is insufficient

sudden sand
#
public int getBounty(String playerUUID) {
        try {
            PreparedStatement ps = hikari.getConnection().prepareStatement("SELECT BOUNTY FROM bounties WHERE UUID=?");
            ps.setString(1, playerUUID);
            ResultSet rs = ps.executeQuery();
            
            int bounty = rs.getInt("BOUNTY");
              
Connection connection = ps.getConnection();
rs.close
ps.close()
connection.close()

            return bounty;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }```
sudden sand
sterile hinge
#

already said, try-with-resources

sudden sand
#

I mean there shouldn't be any mysql error in production so mine would still work.

#

but yes using a finally stat is better

sterile hinge
#
public int getBounty(String playerUUID) {
        try (Connection connection = hikari.getConnection();
              PreparedStatement ps = connection.prepareStatement("SELECT BOUNTY FROM bounties WHERE UUID=?")) {
            ps.setString(1, playerUUID);
            ResultSet rs = ps.executeQuery();
            if (rs.next()) {
                int bounty = rs.getInt("BOUNTY");
                return bounty;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }

something like that, ResultSet doesn't need to be closed according to the documentation

sudden sand
#

I don't think resultset close it self but if you tell so

sterile hinge
#

d; ResultSet

uneven lanternBOT
#
public interface ResultSet
extends Wrapper, AutoCloseable```
ResultSet has 10 fields, 94 methods, 2 extensions, 2 super interfaces, and  7 sub interfaces.
Description:

A table of data representing a database result set, which is usually generated by executing a statement that queries the database.

A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set.

A default ResultSet object is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row. It is possible to produce ResultSet objects that are scrollable and/or updatable. The following code fragment, in which con is a valid Connection object, illustrates how to make a result set that is scrollable and insensitive to updates by others, and that is updatable. See ResultSet fields...

This description has been shortened as it was too long.

Since:

1.1

sterile hinge
#

it's closed when the statement is closed, that part is cut off here sadly

formal crane
#

idk what i did wrong but after changing some things this code stopped working:

        hikari = new HikariDataSource();                  <---- THIS IS THE LINE THE ERROR REFERS TO
        hikari.setDriverClassName("org.sqlite.JDBC");
        hikari.setJdbcUrl("jdbc:sqlite:plugins/" + MTBounties.getInstance().getDataFolder().getName() + "/data.db");
    }```
error: https://paste.helpch.at/mijosamaku.css
anyone that knows a possible solution?
sterile hinge
#

you changed something about your setup

#

you should shade and relocate hikari I guess

formal crane
icy shadow
#

yes

#

are you sure about that?

sterile hinge
#

interesting

warm steppe
#

java experience: 3 minutes

#

i see

warm steppe
#

What did you want to tell with that?

high edge
#

wxip such a noob smh

#

He really got you

edgy wedge
#

absolutely demolished

warm steppe
#

yep

#

gg

formal crane
#

i have only done it with gradle shadowjar before

icy shadow
#

why are you using maven is the question

#

especially if you know what gradle is and how to use it

#

But anyway, look into the maven-shade-plugin

formal crane
icy shadow
#

🤔

#

can confirm that it definitely works with gradle

formal crane
#

i was doing exacly what my friend was doing but it wasnt working for me, but he was on maven

#

so i was gonna try it

#

i dont like maven

#

but i had to try

icy shadow
#

What was the issue with gradle?

formal crane
#

database locked, hikaripool warns after 10 times etc

#

same on maven tho

#

i am just to lazy to turn it back to gradle

dense drift
#

gradlew init

formal crane
#

what is that?

icy shadow
formal crane
#

this is the right import right? implementation 'com.zaxxer:HikariCP:5.0.1'

#

seems like its not

dense drift
#

Looks like you need java 11 for 5.0.1

formal crane
#

do you know the version for java 8?

dense drift
#

4.0.3

formal crane
#

ty

dense drift
formal crane
icy shadow
#

clean build

formal crane
#

but if i use clean build it isnt shaded

dense drift
#

clean package or whatevee

formal crane
#

what do i have to see with the clean package?

dense drift
#

The 'clean' command will create a fresh jar

formal crane
#

i just get this

dense drift
#

Do clean + your build command

formal crane
#

i pressed clean and then i pressed shadowjar

dense drift
#

clean shadowJar then

#

You were using maven 5m ago, thats why I said "package"

broken elbow
formal crane
#

still same error

pulsar ferry
broken elbow
#

:kek:

timber gale
icy shadow
#

the link you sent was to a .java file though

#

🤓

timber gale
#

shush alex you literally use gradle

cerulean birch
timber gale
#

legend has it he went quiet

dense drift
covert citrus
worn jasper
dense drift
#

json.getFileData().insert("gens." + loc, serialManager.toString(cache.getGenerators().get(location)));

#

most likely this is the problem

#

if you need the key and the value, then iterate over entrySet()

worn jasper
#

oh ok

#

nvm

#

ty

craggy zealot
#

anyone know what i need to do for this my scorebord team isnt updating right its setting the same name as i gave it

#

for lets say the game time how do i give it a new updated version of the name?

#

without hard coding it

#

in

#

im so confused to how to do this

sudden sand
#

@craggy zealot Send your actual code

lyric gyro
#

Any idea how to disable residence creation on region spawn/any region?

lethal shell
#

May I ask why the Maven does not work or where I can find it currently?

pulsar ferry
#

You're going to have to be a bit more specific than that, what is "it"?

lethal shell
dense drift
#

change http to https, as the error says

lethal shell
#

ok, thanks

neon summit
#

Hello, I have a question. I'm making a JFrame and drawing my items as usual, but when I launch it, it doesn't show any items, but when I minimize it and then pull it up again, it shows every item. I've done a lot of googling and none of the solutions have worked for me.

queen plank
#

I'm trying to make an item not get destroyed by lava or fire. I have this, https://paste.helpch.at/anuyucetiq.cs, but it does not work. I register the event properly but it isn't cancelled

lyric gyro
#

Trying to disable dropping items with specific name, but no working... any suggestions?

public void onDropItem(PlayerDropItemEvent e) {
Player p = e.getPlayer();
if (e.getItemDrop().getItemStack().hasItemMeta()) {
if(e.getItemDrop().getItemStack().getItemMeta().getDisplayName() == "§b§ltest") {
e.setCancelled(true);
p.sendMessage("§cНидей хвърля пари уе ;(");
}
}

}

dense drift
#

yes, dont use §

slim estuary
lyric gyro
odd prawn
#

Hey, im currently on 1.12.2 and im trying to turn on redstone lamps but I can't figure out how.

formal crane
#

nms

odd prawn
#

I've searched on spigot like everywhere defective

formal crane
#

i! think you can do this with nms blockstates

odd prawn
#

But how?

#

Okay, I found BlockRedstoneLamp in NMS, but it doesn't do anything.

broken elbow
#

I don't think you need NMS

#

try BlockState#update

winged pebble
#

In the API they are separate items it looks like

broken elbow
#

BlockState.update(true, false).

winged pebble
odd prawn
#

yeah but setting it to ON doesn't turn it on.

broken elbow
#

yeah but when you place them it turns off bcz update

odd prawn
#

Ill try states.

broken elbow
#

that's why you need the block state

odd prawn
#
                for (Block block : blocks) {
                    block.setType(Material.REDSTONE_LAMP_OFF);
                    block.getState().update(true, false);
                }

This doesn't seem to work.

broken elbow
#

you have to set the state first

#

try BlockState#setType then BlockState#update

odd prawn
#
                    block.getState().setType(Material.REDSTONE_LAMP_OFF);
block.getState().update(true, false);```
Like this, I feel really dumb rn 😅
lyric gyro
#

getState returns a "snapshot" of the block each time you call it

#

put it in a variable, set the type, then update it

odd prawn
#
                    BlockState state = block.getState();
                    state.update(true, false);

I put it this way is this correct?

#

I dont' really know how these blockstates work 😅

broken elbow
#
                    BlockState state = block.getState();
                    state.setType(Material.REDSTONE_LAMP_ON);
                    state.update(true, false);```
odd prawn
#

Doesn't work.

broken elbow
#

have you tried debugging?

lyric gyro
# lyric gyro someone?

Use ChatColor.stripColor (I think) to remove the colors from the item meta and just compare without any colors. try using .equals as well

#

Actually that's probably a terrible idea lol

#

You shouldn't use item names for comparison really

#

is there any way to disable it, i dont really want to disable the item from dropping

dusty frost
lyric gyro
# dusty frost you can't use `==` for Strings, use `.equals` or, better yet, `.contains`

Done it like this, and still not working, am i doing something wrong?

public void onDropItem(PlayerDropItemEvent e) {
    Player p = e.getPlayer();
    if (e.getItemDrop().getItemStack().hasItemMeta()) {
        if(e.getItemDrop().getItemStack().getItemMeta().getDisplayName().contains("&b&ltesting")) {
            e.setCancelled(true);
            p.sendMessage("&cНидей хвърля пари уе ;(");
        }
    }

}

dusty frost
#

Not sure how the colors work with that

#

Paper's displayName method returns a Component, which is much easier to check, if that's an option

lyric gyro
#

is there any other way disable dropping named items excluding the not finished way above

dusky harness
#

to debug

#

oh wait

#

ik the issue

#

&b&l this isn't translated into the color codes

#

thats literally the characters &b&l

#

PDC = PersistentDataContainer

surreal lynx
#

So if I was hypothetically looking to have someone rewrite Minecraft's leaf decay system for me, how much would a fair base price be?

#

Would require forking paper

#

(i do have an actual usecase for this if you were planning on asking 🤣)

lyric gyro
surreal lynx
#

I believe a friend said the data could be stored inside of the chunk via PDCs

#

Might be wrong, not really a developer myself

hoary scarab
#

PDC's are only attached to certain blocks and entities. I don't think leaves are in that list.

surreal lynx
#

You can store PDC in the chunk though

hoary scarab
#

Ah ok.

lyric gyro
dark garnet
#

im trying to store an itemstack in a hashmap, but whenever i recall the data in another method it changes the material to AIR, why?

#

method one:
hashmap.put(player.getUniqueId(), player.getInventory().getItemInMainHand());

method two:
player.getInventory().addItem(hasmap.get(player.getUniqueId()));

proud pebble
#

i would assume this is because the mainhand is air

dark garnet
#

omg embed

#

why can we not upload images bruh

dark garnet
proud pebble
#

what are you doing in the method when you add the item to the hashmap?

dark garnet
#

ohhhhhh

#
hasmap.put(player.getUniqueId(), player.getInventory().getItemInMainHand());
player.getInventory().getItemInMainHand().setAmount(0);```
#

thats probably why, im changing the amount and nothing else

proud pebble
#

change the amount on the next tick

dark garnet
#

wouldnt that give them the item back tho?

proud pebble
#

no?

#

you could also try hasmap.put(player.getUniqueId(), player.getInventory().getItemInMainHand().clone());

#

or just Bukkit.getScheduler().runTask(yourplugininstancehere,()-> player.getInventory().getItemInMainHand().setAmount(0));

#

i believe thats correct

proud pebble
#

im assuming the reason why it wasnt working is because when you added the itemstack to the map, it doesnt create a copy, just creates a reference of that itemstack.

dark garnet
#

oh

proud pebble
#

so when you made a change to that itemstack, the reference itemstack instead the hashmap was updated aswell

#

or atleast thats how i believe maps and stuff work

dark garnet
#

yeah thats what i thought was happening

proud pebble
#

i believe the way to not have it update is to use the setItemInMainHand() and set it as a new air itemstack

#

tho im not entirely sure if thats how it works or not

dark garnet
proud pebble
#

since stuff inside single quotes are classed as char, and inside double quotes speech marks or whatever are classed as strings

#

actually ignore me thats wrong, double quotes are correct

#

hmm

#

actually i see the issue now, you need to encase that int with a String.valueOf();

#

put String.valueOf( just before getConfig().getInt(...

#

and then the extra closing bracket

proud pebble
dark garnet
#

except edit the one where u replied to their msg (so that they know u replied to them)

formal crane
#

(Discord.js v13) I cant find a way to set/change the banner of a guild, anyone that knows how i could do this?

night ice
#

What tf happened here lol 😂

near shale
#

can i do it last time pls

#

i wont do it again

broken elbow
#

no.. you will get timed out

near shale
#

okk.

rigid mountain
#

Question, so im creating a world when i run a command with the name for example x and i have a command to tp to the center of said world. So i get the world by doing Bukkit.getWorld(x) and it works fine, but if i reload it doesnt work. It looks like if i sout Bukkit.getWorlds() before i reload the world is in it, after it is not. How do i add it back to that list?

#

Wait i think im in the wrong channel...

broken elbow
#

if you reload what exactly? the server? first of all you shouldn't. you should restart instead. but anyways I'm fairly certain worlds don't stay loaded by default. you either have to load it every time its unloaded or you have to declare it in bukkit.yml

#

you're in the right channel

rigid mountain
#

oh, well restart the server yes

broken elbow
#

that's why when you use plugins like Multiverse, if you remove the plugins, the worlds won't load anymore even tho their files still exist

rigid mountain
#

so is there a way i can make sure it loads?

broken elbow
#

well you have to load it yourself

#

every time

#

the server starts

tropic glen
#

Hello guys, I simply made a plug-in that allows you to create a custom name, gender and age and puts them in the config (and then giving value to the placeholder). I added a command that allows you to reset the values of this player and re-entering them requires the "setup" resetting the data in the config. The problem is that the data remains old and the placeholder does not update except with a /reload confirm. Can you help me?
PlaceholderExpansion class: https://paste.md-5.net/otunadiyet.java

(Command codesnippet)

                    if(args[0].equalsIgnoreCase("removePlayer") && sender.hasPermission("identity.removePlayer")) {
                        if(main.getConfig().isConfigurationSection("data") && main.getConfig().getConfigurationSection("data").contains(args[1])) {
                            main.getConfig().set("data." + args[1], null);
                            main.saveConfig();```
#

blitz I belive in you

broken elbow
#

I mean that's not something related to PAPI. At least I doubt it. Don't you have to reload after you save the config?

tropic glen
#

reload what

broken elbow
#

the config. with JavaPlugin#reloadConfig

tropic glen
#

hmmhmmmmmmmmmmmmmmmmmmmm

#

im trying rn

broken elbow
#

I might be wrong. I haven't used the bukkit yaml config in a while

tropic glen
#

nothing changes

#

I still believe in you

broken elbow
#

mind sending the entire command class? in a paste bin

tropic glen
#

by resetting the name, the placeholder doesn't change, with or without reloadConfig

neat pierBOT
#
📋 Paste Converted!
https://paste.helpch.at/gapubojiku

A member of staff has requested I move your pastebin.com paste to our paste.helpch.at!

broken elbow
tropic glen
#

yeah, just refreshing variables and hashmaps with new values

#

but no

#

look at the removePlayer

broken elbow
tropic glen
#

I'm just in the removeplayer deleting the config portion containing the date anyway but not changing the placeholder.

broken elbow
#

anyways. I forgot how the bukkit config works. Can't really help you. It for some reason doesn't reload correctly. or something like that.

broken elbow
tropic glen
#

sure

broken elbow
#

like if you open the config file after you use removePlayer

tropic glen
#

data: {}

#

that was the only entry

broken elbow
#

and your placeholders still return stuff? like player name etc.?

tropic glen
#

yep

#

until I don't do /reload confirm

tropic glen
lyric gyro
broken elbow
#

Can you show where you're creating the MenuHandler? bcz its saying that plugin is null. which means you

#

you're most likely passing null instead of the plugin instance when you create it

lyric gyro
#

The menu handler is a sub class its meant to be opening a gui menu from the main class here plugin.openArmourStandMenu(p); line 30

This is the main https://pastebin.com/geePBdN6

lyric gyro
broken elbow
#

no. you need to pass the plugin instance there

#
public MenuHandler(ArmorStandGui plugin) {
    this.plugin = plugin;
}```
#

and then you create the menu handler you pass the instance in the constructor

lyric gyro
#

Oh yeah im dumb i forgot about that..

lyric gyro
broken elbow
#

put this inside the constructor

#

new MenuHandler(this)

lyric gyro
#

ah i see

neat pierBOT
broken elbow
#

if you do not understand dependency injection I recommend you read this this

lyric gyro
#

O alright i will have read

odd prawn
#

Hey, im trying to do cooldown. But everytime I call getCooldown() it's always 2147483647. I set the cooldown to 10 secs.

past ibex
#

Try 1000L

#

You might be running into integer max value

lyric gyro
#

Hey

#

im getting an Error with this Code:

public class Countdown {
    public static int time;
    public void startCountdown(int time)
    {
        this.time = time;
        int Ticks = time*20;

        new BukkitRunnable() {

            @Override
            public void run() {
                Bukkit.getOnlinePlayers().forEach(player -> {
                    player.setLevel(time);
                    player.setExp(time / 15);
                });
                if (time == 0) {
                    cancel();
                    return;
                }
                time--;
            }

        }.runTaskTimerAsynchronously(Main.instance, 0, 20);
    }
}

It says in Intelij when I hover over time
"Variable 'time' is accessed from within inner class, needs to be final or effectively final"

past ibex
#

You can only use variables that don’t change after initialization inside of lambdas

#

It should let you make the variable effectively final

#

Btw please don’t do that async

#

That’s not safe to do async and you lose performance doing simple tasks async

lyric gyro
#

I kinda want to make a Countdown that I can use everywhere but this prob. isnt the way to do it

#

like just a simple ansynchron Countdown that returns the value it is at every second

past ibex
#

You can also use an atomic integer

proud pebble
past ibex
#

Stop using an int

#

You need longs with Unix time

lyric gyro
past ibex
#

AtomicInteger

#

You can use it inside of lambdas

proud pebble
#

which integer would suffice

#

basically you were doing (cooldowns.get(player) - System.currentTimeMillis()/1000)
when you should be doing ((cooldowns.get(player) - System.currentTimeMillis())/1000)

odd prawn
#

I fixed it by doing:

    public int getCooldown(Player player) {
        UUID uuid = player.getUniqueId();
        return (int)  ((cooldowns.get(uuid) - System.currentTimeMillis()) / 1000L);
    }
past ibex
#

Yeah that’s fine

odd prawn
#

It work's so im not complaning 😂

proud pebble
#

you missed the brackets, so you were basically doing cooldown - (currentTime/1000) instead of (cooldown - currentTime)/1000

odd prawn
#

welp, I found another way 😂

proud pebble
#

you fixed your mistake in the new one aswell as removing the unneeded rounding at the same time :)

odd prawn
#

Thanks for the help anyways!

lyric gyro
#

How can I lower the Experience for the Countdown?
So like when it time goes down the XP in the EXP Bar goes down slowly too?

#

got it 🙂

#

how can I reset the hit delay?

#

any ideas why this error appears

#

You have two constructors, only one of them is initializing the map

molten wagon
#

I get this error error: cannot access EnumDirection when try use 1.18.2 and try access nms

#

lol, remove it same issue

molten wagon
#

is no issue if i use 1.16.5 insted i think is something with java 17 update i have always problems after that update.

dense drift
#

Any idea why selenium throws this when the element is literally on a screen and I have a WebDriverWait for that button? 🥲

Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: Element <button class="btn btn-primary js-accept gtm_h76e8zjgoo btn-block"> could not be scrolled into view

new WebDriverWait(driver, Duration.ofSeconds(10))
    .until(ExpectedConditions.elementToBeClickable(xpath("//div[contains(@class, 'gdpr-cookie-banner')]//button[1]"))).click();```
dense drift
#

Changed to ExpectedConditions#visibilityOfElementLocated, I tried that before though xD

formal crane
sterile hinge
#

for one, HashMap isn't thread safe

lyric gyro
#

Any particular reason you're running that runnable async?

#

Does it cause unbearable lag?

formal crane
#

without async it gives the same results

lyric gyro
#

well you have two different maps

sterile hinge
#
        for(Player player : boards.keySet()) {
            if(player == null) continue;
            FastBoard board = boards.get(player);

what's that...

lyric gyro
#

one in MNLobby and one in ScoreBoardTask

sterile hinge
#

thanks

cinder forum
worn jasper
#

IF I put this e.getHand() != EquipmentSlot.HAND in a playerinteractevent, shouldn't it only work once?

#

cause rn, my event is still being triggered twice

sterile hinge
tropic glen
#

Guys, Is it possible to refresh a Placeholder? Because when I change the text in the config and save, it doesn't changes automatically and I need a /reload
Already tried by JavaPlugin#reloadConfig();

sterile hinge
cinder forum
#

😳

#

then how should I do it?

sterile hinge
#

depends on which functionality you actually want

cinder forum
sterile hinge
#

the indexOf approach is probably okay, but I wouldn't do toCharArray and you need to validate the index

#

and you also want to check for , and . (or everything that isn't alphanumeric) instead of just checking for spaces

buoyant haven
#

Hi

#

Error i get with this code

dense drift
#

@buoyant haven you forgot the error

buoyant haven
#

Oh F

#

Sec

dusky harness
tropic glen
#

how can I update it?

dusky harness
tropic glen
#

it doesn't

#

that's the prob

dusky harness
#

what plugin?

tropic glen
#

my plugin

dusky harness
#

show code where ur displaying the placeholder text

icy shadow
#

the config is cached, it won't automatically update the file contents

icy shadow
#

you could look into File Watchers if you want automatic reloading

dusky harness
icy shadow
#

or just make a reload command that calls reloadConfig

dusky harness
tropic glen
tropic glen
icy shadow
#

well are you using it?

dusky harness
#

make sure you're not saving right before reloading

tropic glen
icy shadow
#

no but

tropic glen
#

/** * Saving data into config by Person class (Schema) objects * @param playerName Player name * @param main Main */ public void saveInConfig(String playerName, Identity main) { Person person = personHashMap.get(playerName); if(person.name != null) main.getConfig().set("data." + playerName + ".name", person.getName()); if(person.gender != null) main.getConfig().set("data." + playerName + ".gender", person.getGender()); if(person.age != 0) main.getConfig().set("data." + playerName + ".age", person.getAge()); main.saveConfig(); main.reloadConfig(); }

icy shadow
#

if you reload, does the placeholder update?

tropic glen
#

no I've not tested with the cmd

dusky harness
icy shadow
#

would probably be a good idea to test that lmao

dusky harness
#
  • the person
tropic glen
#

yea

dusky harness
#

i dont think the reloadConfig there would do anything

icy shadow
#

it doesn't no

#

unless the config somehow changes in the nanoseconds between the invocations

tropic glen
dusky harness
#

you have to tell spigot to reload the config then
It won't reload by itself
you also can't reload it after saving the old data since there's nothing to reload (the new data is rewritten over)

#

you have to tell spigot to reload the config then
this can be done with a /identity reload command for example

#

which would call JavaPlugin#reloadConfig

tropic glen
#

I would like the placeholder to update after the setup though

icy shadow
#

what setup?

tropic glen
# icy shadow what setup?

I made 3 inventories where in each of these asks you respectively age name and gender. At the end of setup save the data in the config and should put them in the placeholder

#

that's my best phrase ever

#

idk how to explain better than that

icy shadow
#

well ok that makes sense

tropic glen
#

so

#

have u any idea rn?

dusky harness
#

so now your issue is that you want the data from the setup to be in the placeholder?
not reloading data from you modifying the config?

tropic glen
#

nono that's not the problem

#

the problem is that the placeholder isn't updated after I change or reset the data of a player

#

after the player "re-finish" the setup, the placeholder val still the older

dusky harness
tropic glen
#

like that
} else if(args.length == 2) { if(args[0].equalsIgnoreCase("removePlayer") && sender.hasPermission("identity.removePlayer")) { if(main.getConfig().isConfigurationSection("data") && main.getConfig().getConfigurationSection("data").contains(args[1])) { main.getConfig().set("data." + args[1], null); main.saveConfig(); main.reloadConfig();

icy shadow
#

try removing the reload

tropic glen
#

that's not the problem, the config is working well, I can see that by opening

#

the placeholder value does not update either at the removal of the player or at the end of the setup except with a reload of the plugin/server

wintry grove
#

ah yes

#

that bug is back

#

why. cant. I. fucking. change. floats values with just doing instance.float

lyric gyro
#

what

wintry grove
# lyric gyro what

remember a while ago I was having a problem with changing a float value from other class? its back

lyric gyro
#

my guess is that you're using entirely different instances of the same class

#

other than that I can't really think of anything else

wintry grove
#

the only thing I can think of its that how I get the instance

#

let me try something

lyric gyro
#

you can check instances by attaching IJ's debugger and list all of the class's instances, I know you can do that

#

or using the identity hash code if you're lazy enough to attach a debugger

#

but debugger be cool, you can see much more

tropic glen
#

hey guys

#

have you any idea to optimize my plug-in performance/in general?

lyric gyro
#

Hey;
I want to make that if I rightclick with my Netherite Hoe that it "shoots" particles out
This is what ive got so far

    @EventHandler
    public void onShoot(PlayerInteractEvent event) {
        if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
            Player p = event.getPlayer();
            if (p.getItemInHand().getType() == Material.NETHERITE_HOE) {
                
            }
        }
    }
uneven lanternBOT
#
@NotNull
Location getEyeLocation()```
Description:

Get a Location detailing the current eye position of the living entity.

Returns:

a location at the eyes of the living entity

queen plank
#

Isn't EntityDropItemEvent called when a player drops an item? I get output in the console when a chicken lays an egg, but not when I drop an item?

broken elbow
#

Thrown when an entity creates an item drop.

#

so not just a player.

lyric gyro
#

everytime an Item gets dropped by anything xD

dusky harness
#

theres PlayerDropItemEvent i think

broken elbow
#

yes

queen plank
#

I mean, I read that. But I don't get anything

broken elbow
#

there is

queen plank
#

That is deprecated tho

uneven lanternBOT
#
public class PlayerDropItemEvent
extends PlayerEvent
implements Cancellable```
PlayerDropItemEvent has 1 all implementations, 6 methods, 1 implementations, and  1 extensions.
Description:

Thrown when a player drops an item from their inventory

broken elbow
#

it is?

queen plank
#

Wait wat

#

No it isn't

#

Wot, I was 100% certain it was

broken elbow
#

don't see why it would be

queen plank
#

Wait, so EntityDropItemEvent is for entities, and PlayerDropItemEvent is for players

queen plank
lyric gyro
broken elbow
#

the playerdropitemevent is basically a smaller event that is called just when the entity is a player

lyric gyro
#

Where should I ask staff to verify my expansion?

broken elbow
lyric gyro
#

Thanks 🙂

broken elbow
#

might take a while

lyric gyro
#

It shouldn't take too long because it only has less than 10 classes

#

All it does is to download groovy runtime and call evaluate method

broken elbow
#

yeah. just busy with some other stuff currently.

lyric gyro
#

Okay. thank you anyways

queen plank
#

The only output I get is when chickens lay eggs for some reason?

broken elbow
#

hmm. I guess maybe it isn't called for players since they have their own event

#

not sure

queen plank
#

Yeah, might be ig. Imma try a player event as well

#

Yup, that was it. EntityDropItemEvent does not include players

queen plank
lyric gyro
#

How can I shoot an Arrow?

#

or like how do I define the Arrow

#
                Arrow arrow = new Arrow();
                p.launchProjectile(arrow), p.getEyeLocation().getDirection());
``` this doesnt work
broken elbow
#

Arrow arrow = p.launchProjectile(Arrow.class, p.getEyeLocation().getDirection());

high edge
#

I mean yea, that's giving you errors already

lyric gyro
#

oh

#

Thank you xD

broken elbow
#

but as frosty said, yours wouldn't work bcz you also close the launchProjectile method to soon. but also it doesn't take an object as first parameter

broken elbow
lyric gyro
#

If i want to only speed it up, what velocity do i Set it to?

#

like I want to to be instant

lyric gyro
#

can i make the Arrow Invisable?

#

like I want to "Simulate" an arrow and make it has a Particle trail so it seems like youre shooting particles

broken elbow
#

you might be able to do so with packets but I don't think this is possible with the spigot API.

hoary scarab
broken elbow
#

you'd probably have more chances just calculating it and spawning the particles yourself

lyric gyro
broken elbow
#

more like math. but not high.

lyric gyro
#

xD

#

Someone of you obv. want to help me right ? 😉

hoary scarab
#

Why did it reply???

lyric gyro
broken elbow
hoary scarab
#

It replied when I put the up arrows

lyric gyro
#

xD

broken elbow
#

you on mobile? maybe a mobile thing? or maybe not the official discord client?

hoary scarab
#

No clue. But yeah I'm on mobile

broken elbow
#

do not admit to using non official clients btw. you will get banned.

hoary scarab
#

Nah I don't use anything but discord

broken elbow
#

not follow

#

read.

lyric gyro
#

o.O

hoary scarab
#

Or if you don't care for realism, for every 0.10 blocks decrease the y by .1 or more.

lyric gyro
#

i think im loosing my mind

#

wait on spawnParticle isnt there a way to specify the velocity?

#

I dont get it o.O

#

how do I get the block the Player is looking at? (at any distance)

broken elbow
#

you can't really get it at any distance. you have to specify a max distance. also specifying high distances might be a problem with lag.

lyric gyro
#

so like 25 block?

broken elbow
#

nah. you can give it like 100 blocks or so just fine. talking about thousands of blocks here

lyric gyro
#

Wait do I even need to block the Player is looking at?

#

like

#

I cant get the Solution in my Head o.O

broken elbow
#

so rn I can't think either but you probably only need the vector you get from player.getLocation().getDirection(). this basically shows you the direction a player is looking

lyric gyro
#

So I have like my Location (Players EyeLocation) and then I need to loop the Spawning Particle thing depending on where the Player is looking to

broken elbow
#

and then you can just move like 0.10 blocks or so in that direction and spawn a new particle

lyric gyro
#

xD

broken elbow
#

I guess eye location might be better than location

#

bcz that's at their feet

lyric gyro
#

Ye

#

But like

#

i just dont know how to apply the x, y and z correctly (offsets)

#

so it actually always goes into the right direction

rancid bronze
#

cannot access net.md_5.bungee.api.chat.BaseComponent

#

Any clue as to why I'm getting this error when doing sender.sendMessage()

#

Using paper

#

This is when compiling

#

Seems like it's one of the dependencies causing it

lyric gyro
#

what is sender in this case?

hoary scarab
rancid bronze
#

That is the whole line

#

I changed the scope to provided on the dependency (dont know why it wasnt on that) and it fixed it

#

Odd

#

Like a plugin dependency, not paper

broken elbow
#

its like compile or whatever

rancid bronze
#

No I meant I assumed what I had copy pasted already had the scope defined

#

Silly me

broken elbow
#

ah

lyric gyro
#

can someone tell me why in da hell it says that the uuid at .getLocation(uuid) is a Location and not a Path?
Code:

    public static HashMap<UUID, String[]> users = new HashMap<>();
    private static Config cfg;

    @Override
    public void onEnable() {
        getConfig().options().copyDefaults();
        saveDefaultConfig();
        cfg = new Config("players.yml", getDataFolder());
        for (String uuid: Main.getCfg().getConfiguration().getKeys(false)) {
            users.put(uuid, Main.getCfg().getConfiguration().getLocation(uuid));
        }
    }
icy shadow
#

what?

lyric gyro
#

wait

#

what am I doing here

#

welp

dusky harness
#

then getting that Location

lyric gyro
#

Im kinda Confused since I used that Config Util for Bukkit Locations and now idfk know if it means Location for the thing in the YAML File or bukkit location

dusky harness
#

if so, then it's a bukkit location

#

not sure what u mean by "for the thing in the YAML File"

lyric gyro
#

like

#

it does

#

I think im trying to do it wrong way

#

can someone explain me how I save user with Stats in a YML file

#

like i want to use it as Database

night ice
lyric gyro
#

i made it 🙂

shell moon
#

switch enum or 8 else if statements comparing enum?

dusty frost
#

🤢

west socket
#

I have a ProtocalLib question for anyone who can answer. Does anyone know why this might not be working?

new PacketAdapter(PitSim.INSTANCE, PacketType.Play.Server.NAMED_SOUND_EFFECT) {
                    @Override
                    public void onPacketSending(PacketEvent event) {
                        String soundName = event.getPacket().getStrings().read(0);
                        Bukkit.broadcastMessage(soundName);
                        if(soundName.equals("mob.villager.idle")) {
                            Bukkit.broadcastMessage(".");
                            event.setCancelled(true);
                        }
                    }
                });```
It broadcasts both the right name and the period
#

I've even checked event.isCanceled() and it returns true

#

Yet I still hear the noise

shell moon
#

try replacing the sound

#

just saying

#

what about writting and invalid sound name

#

¯_(ツ)_/¯

lyric gyro
#

not all packets are cancellable

proud pebble
#

im sure you can set the volume of the sound to 0

past ibex
#

PacketEvents can cancel all packets

#

Both 1.8 and 2.0 versions of it

#

Although Protocollib should be able to cancel any packet too unless it’s written in a really weird way

fresh spade
#

Hello! I'm trying to play the block breaking animation using packets but it seems that Packet55BlockBreakAnimation is deprecated?

lilac warren
#

Hello. Im just messing around with packets and I cant figure out how can I make the particle rotate with the player, for example if the particle is 1 block behind the player always.

flat anchor
lyric gyro
#

is there a way to just add Permission to user no matter what perm system

broken elbow
#

vault

craggy zealot
#

how do i create a round system for my minigame
im creating a zombies minigame
and when the players kill all the zombies
a new round starts how can i do that?

grim oasis
#

keep track of which zombies they have to kill

#

I believe every entity will have a uuid

hoary scarab
small talon
#

why /g claim is not working
if i set true the worldguard hook then reload
the plugin got error

lilac warren
# flat anchor https://bukkit.fandom.com/wiki/Scheduler_Programming

Yes, im already using the scheduler to make it always visible, this is not what I was asking. I asked for the equasion to calculate the position of the particle to make it appear always BEHIND the player (for example behind half a block). First read the request properly before pasting random shit.

lyric gyro
#

Anyone got a plugin that I can create a gui in game and put it into a class

cerulean birch
lyric gyro
#

So put create it into a config

wraith scarab
#

hi,
i have som issus with my plugins when i open the inventory "core chest" the first tim everthing work but the second time that not working help pls
https://paste.helpch.at/jezurolifa.php
i have no error bcz i check if ins't null
so ma question is why the first time its work but not the other
thx

wraith scarab
#

pls

night ice
dense drift
lyric gyro
#

nah complete custom plugin i just need a base too work from

#

Yes

#

isaw something on here a while ago but cant remember what it was called

dense drift
#

songoda plugins have that feature

#

if you want some kind of "settings" inventory

wraith scarab
lyric gyro
#

we can't really help you if you flat out refuse to debug

#

asking for help without you wanting to help yourself is pointless

#

print every single thing at every single step, the entire config, each section of the config, player clan name, ...

wraith scarab
#

ok