#help-development

1 messages · Page 1774 of 1

sullen marlin
#

Java 9 has asIterator but they shouldve added asIterable

lavish hemlock
#

the syntactic sugar from Iterable was never implemented for it

sullen marlin
#

I hate that you cant for loop an Iterator

#

actually why dont they add that

lavish hemlock
#

bc circular dependency bullshit

#

Iterator implements Iterable but Iterable requires an Iterator

#

but ye asIterable would be handy

sullen marlin
#

doesnt need to be circulat

#

just allow this

#
        for (Object o : it) {
            
        }```
#

as different sugar

lavish hemlock
#

oh plus

round finch
#

i'm about to yeet my pc
my ecplise is on something

lavish hemlock
#

Iterables can pass Spliterators

#

which

sullen marlin
#

yeah but why not just allow for looping Iterator objects

lavish hemlock
#

true

sullen marlin
#

thats entirely a source code thing

#

someone propose this

#

its actually an amazing idea

echo basalt
#

IDEs actually do a weird workaround for loop

lavish hemlock
#

really?

sullen marlin
#

for (Iterator<E> iter = list.iterator(); iter.hasNext(); ) {

#

that? sucks

echo basalt
#

yeah

#

kinda sucks but eh

lavish hemlock
sullen marlin
#

also sucks

echo basalt
#

I don't really use iterators so

lavish hemlock
#

iterators are required for avoiding CMEs

echo basalt
#

depends on the case

#

Synchronized blocks and concurrent collections exist

sullen marlin
#

yeah but .remove

lavish hemlock
#

ye you can't loop and remove at the same time

ruby turtle
#

You can just extend iterable and make your own adaptation for iterators i think

lavish hemlock
#

unless you use iterators

lavish hemlock
#

But you'd need to do some shit like

#

new IteratorIterable(it) every time

#

or maybe Iterators.toIterable(it)

#

which is a bit different from it.asIterable()

#

(extension methods when)

ruby turtle
#

Yes true..

west oxide
#

how do i make it say the name only ?

#

am guessing there's something in the api ?

lavish hemlock
#

.getName() probably

west oxide
#

oh ok

#

i will try that

lavish hemlock
#

it's using .toString() by default

#

which, is not designed for end-users

#

also you're forgetting spaces lol

west oxide
#

yeah true lol

#

i'll add them between the " "

#

cuz am pro dev

#

lets goo

lavish hemlock
#

gg

west oxide
#

ty

#

i would share the source code

#

but afraid someone will copy me and claim it as his

#

obviously its very advanced code

lavish hemlock
west oxide
#

i actually did change something from the tutorial code lol

#

player.sendMessage(ChatColor.AQUA + "Welcome " + player.getName() + " To The Server !");

#

the tutorial only says " welcome to the server"

foggy estuary
#
                Bukkit.broadcastMessage("test");
                }
                     ``` i feel stupid asking but does anyone know why this isnt broadcasting the message?
#

seems fine to me

round finch
#

fixed everything
all my problems was just my eclipse on crack
😄

hollow spindle
young knoll
#

It’s generally the way you should do it

#

I wonder if the compiler optimizes the later, probably not

hollow spindle
#

Ahhh interesting

worldly ingot
#

I don't know what the heck &3 is

west oxide
#

I have been scammed

ivory sleet
#

It’s technically possibly to use anything else than & but apparently & has become an unspoken convention

young knoll
#

Wonder what happens if you try and use a color char

ivory sleet
#

Lmao that sounds so cursed

round finch
#

what about §b

#

for blue xD

stone sinew
round finch
#

lemme use my minecraft bb gun xD

young knoll
#

Dangit what color is b

#

I can’t remember now

#

Lime?

round finch
#

are you kidding? AFsmugLaugh

#

b is banana color

#

well lemme ask what is the more readable way to do it?

young knoll
round finch
#

thanks

hasty prawn
#

a is lime

#

b is aqua

left swift
#

how can i edit the velocity entity after hit? (I mean this entity recoil when I hit it). Do I have to cancel the event and give myself the damage and velocity, or is it some other option?

young knoll
#

You could apply your own velocity 1 tick later

proud basin
#

What would be good medium font size?

#

Currently have the large font size as 40

unkempt peak
#

Depends on what it's for ig

#

Normal text size is usually 12 or 16

valid solstice
#

I'm trying to use holographic displays api for my plugin but maven is saying that the dependency is not found

            <groupId>com.gmail.filoghost.holographicdisplays</groupId>
            <artifactId>holographicdisplays-api</artifactId>
            <version>2.4.0</version>
            <scope>provided</scope>
        </dependency>```
#

Dependency 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:2.4.0' not found

#

anybody know how'd you fix this?

quaint mantle
#

reload maven repo?

#

did you?

valid solstice
#

yea, an error pops out Could not find artifact com.gmail.filoghost.holographicdisplays:holographicdisplays-api:pom:2.4.9 in spigotmc-repo

sullen marlin
#

It won't be in the spigot repo

valid solstice
#

wdym by that

#

fixed it, thanks!

#

i added the repo group to my pom.xml

proud basin
#

Does a .gitignore still work if you add it late

#

I have my project in a repo and now I want to add a .gitignore will I need to delete every file in the repo for it to take effect?

ivory sleet
#

Yes it does work even if you add it post-initial commit and push

proud basin
#

so I just added the gitignore

#

What should I do now?

ivory sleet
#

Commit it

proud basin
#

yea, I still see the files though

ivory sleet
#

You might have to delete those files in the remote repo manually

#

Since git ignoring won’t inherently do it

quaint mantle
#

anyone know how to check if someone ops themselves?

#

and how to de-op someone?

#

ok but does anyone actally know how to use ChatColor.getByChar

#

because that shits confusing asf

sullen marlin
#

What are you trying to do

#

Both of you actually

quaint mantle
#

so basically my friend has been cheating on our server and we wanted it to stop... I am coding a plugin to check if he is oped and if so de-op him... and I also want to know if he ops himself again and how I can stop that

quaint mantle
tranquil viper
quaint mantle
#

how do I do that?

#

I usually don't work with the console

tranquil viper
#

What are you using to host

quaint mantle
#

what does that mean?

tranquil viper
#

Because realistically the only way he can get op again is if he gets it through console or someone gives it to him

tranquil viper
quaint mantle
#

we are using a service called minehut

#

so I really don't know

tranquil viper
#

oh is that the one where u go on the server

#

and you can click the server to ur own server

#

or smth like that

quaint mantle
#

something like that

tranquil viper
#

Well how is he getting op

quaint mantle
#

basically we all share an email address(I know it sounds bad)

#

there is a console on the website's server

#

when you start the server

tranquil viper
#

There's nothing you can do if you share an email lmfao

quaint mantle
#

meh I thought it would be a bad idea but we went with it anyway XD

#

so back on topic?

tranquil viper
#

I don't think there is an op event

quaint mantle
#

hmm

tranquil viper
#

You would have to take a different approach

quaint mantle
#

I guess

#

can you check if someone unbans themselves?

tranquil viper
#

My best idea would be to choose an event and then within that event, check if he is oped then if he is just deop him

tranquil viper
quaint mantle
#

how can I check that? @tranquil viper

tranquil viper
#

PlayerCommandPreprocessEvent

#

That's only if a player unbans him though

#

not console

quaint mantle
#

hmmm

#

I will figure it out

tranquil viper
#

Anyone know what the clicking sound in crate plugins is? Been trying to find it for like a day now

young knoll
#

I think it’s one of the noteblock instruments

random epoch
#

Note block pling

leaden sphinx
#

how i can create a custom world generator that extends vanilla generator?

#

e.g: only to place custom houses or trees

young knoll
#

BlockPopulator

leaden sphinx
#

can you show me examples?

tranquil viper
#

What is the proper way of reloading one plugin for quick development changes

young knoll
#

I just use /reload

#

You could use something like plugwoman I guess

tranquil viper
#

I know I use /reload but that causes problems every once in a while

young knoll
#

I’ve never had issues personally

#

Maybe if you are developing a plugin that has dependencies that don’t behave

tranquil viper
#

it gets stuck reloading and I have to stop and restart my server

sullen marlin
#

jstack and find where it's stuck

young knoll
#

Probably in the middle with you

near kite
#

hey ima new dev
and im trying to start spigot plugins i got a problem

#

when i click new it wont show java class

summer scroll
#

make sure it's inside src/main/java

near kite
#

oh wait

#

i read that wrong

#

it is inside

summer scroll
#

you need to create a package first ideally

near kite
grave hound
#

do blocks lose their meta data like lore info when placed and broken in the world ?

summer scroll
# near kite i did?

well idk, when you try to create a new file when right clicking the java folder

#

can you create a java class?

hollow hill
near kite
#

when i right click

#

java

summer scroll
#

you can create the java class directly

#

so click the create new java class

#

and put io.github.creeperz653.bedwars1085-geysersupport.YourClass

near kite
#

whats yourclass

#

mean

quaint mantle
#

Your class name

near kite
#

i think i need to name it

#

my plugin name

quaint mantle
#

Create java class in package
io.github.creeperz653.bedwars1085-geysersupport

#

Yes

near kite
#

into my package?

quaint mantle
#

Yes

near kite
quaint mantle
#

Bruh?

#

Delete what you have in name

#

And set your plugin name

#

Without .java

near kite
sullen marlin
#
  • is not valid in a package name
quaint mantle
#

Ya

#

Delete - in package

#

You need to learn java ig

near kite
#

theres nothing in the package

near kite
#

dw about it

#

its basicly a test

quaint mantle
#

You can't use - in package name

#

Rename package

near kite
#

ioh

quaint mantle
#

Delete -

near kite
#

why did you put that

#

lol

quaint mantle
#

What?

near kite
#

can you put spaces

quaint mantle
#

No?

near kite
#

done

#

created

quaint mantle
#

And now create java class named your plugin inside package

quaint mantle
#

😐

near kite
#

more then one file showed

quaint mantle
#

I told you to remove it - in the package

near kite
#

i did

quaint mantle
#

you didn’t remove it?

near kite
#

i dont know why it loaded

#

must have been mistake ima remove the file

hollow spindle
#

Is it possible to manipulate the outcomes of an enchanted item from an Enchanting Table?

I currently have this at the moment although I might not be correct with switching the ItemStacks.

@EventHandler
public void GiveItem(EnchantItemEvent e) {
    if (e.getEnchantBlock().getType() == Material.ENCHANTING_TABLE) {
        this.plugin.getLogger().warning("Attempting to change item to chicken.");
        ItemStack oldItem = e.getItem();
        ItemStack newItem = new ItemStack(Material.CHICKEN);
        newItem.addUnsafeEnchantment(Enchantment.MENDING, 255);

        oldItem = newItem;
    }
}
quaint mantle
#

you can set the result of the event

#

maybe

#

I don’t remember, maybe it’s in CraftItemEvent

hollow spindle
#

Hmmm what do you mean by "set the result of the event"?

quaint mantle
#

event.setResult(ItemStack)

#

Or something like that

#

Maybe this method exists in PrepareEnchantItemEvent

hollow spindle
#

setResult is only in Crafting

#

I only have cancel in my Intellisense

quaint mantle
quaint mantle
hollow spindle
#

And with PrepareEnchantItemEvent, it's better to obtain and modify the offer listing instead of actually returning the final "ItemStack"

hollow spindle
quaint mantle
#

Just domen.ClassName

#

domen.pluginname.ClassName

#

It's standart🥺

#

Yea that's true 🙂

quaint mantle
# near kite

What's the reason you are adding bedwars support for Geyser ? The only thing that's not functioning is void death, if you die on java you get respawned on touching void while bedrock just hits it as "floor"

hollow spindle
#

Ahhh i figured it out. Had to edit the ItemStack directly from the event rather than replacing it with a new ItemStack

near kite
#

uh

#

i dont see the maven tab

hollow spindle
#

Its a small tab on the right of the IDE

quaint mantle
#

Terminal -> mvn clean install

near kite
near kite
hollow spindle
#

package

near kite
#

i did click it already

hollow spindle
#

Then go to your project dir and it sits inside "target"

near kite
#

sadly

quaint mantle
#

🤦‍♂️

hollow spindle
#

Well if you're lucky enough, the run window would've told you where it is

#

Alternatively you can right click the target file inside your IDE -> Open In -> Explorer

near kite
#

i dont see a target file

hollow spindle
#

Was there an issue compiling?

quaint mantle
#

I wonder what he is trying to compile

#

it feels like absolutely everything is wrong there

#

😋

near kite
quaint mantle
#

Show your code

#

And package

near kite
quaint mantle
#

Just interesting

near kite
hollow spindle
near kite
#

Nope

#

i prob did something wrong

hollow spindle
#

Lifecycle

near kite
#

this is what i see

#

?

hollow spindle
#

Package sits under the lifecycle tab

hollow spindle
# near kite

In the Run window, did it say "Build Success"?

hollow spindle
near kite
#

k

#

[INFO] Scanning for projects...
[INFO]
[INFO] ----------< io.github.Creeperz653:BedWars1085-GeyserSupport >-----------
[INFO] Building BedWars1085-GeyserSupport 1.17.1-R0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ BedWars1085-GeyserSupport ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ BedWars1085-GeyserSupport ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\7\IdeaProjects\BedWars1085-GeyserSupport\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.461 s
[INFO] Finished at: 2021-11-17T22:26:44-08:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

hollow spindle
hollow spindle
#

Hrmmm, im not too sure then. I didn't have any hiccups following that guide.

near kite
#

im at the plugin.yml part

#

then i pressed conplie

#

oh

#

i didnt press package

#

i pressed conplie

#

POGGERS

#

i made my frist java JAR

#

LETS GO

hollow spindle
#

Good job

near kite
#

have you made

hollow spindle
#

Uhhh im learning as well, only picked up SpigotAPI since last week.
Made some plugins that used the XP system as a health bar, some that communicate to a MongoDB server, some that handles other plugin's API like citizens and currently making a tweak to obtain higher vanilla enchantment levels and cool drop box system with a gui interface

near kite
#

tbh

#

ive wanted to make plugins

#

for a lONG time

#

just was too lazy

quaint mantle
near kite
#

jk

#

Im making a addon

#

to a big plugin

#

that adds geyser support legit in the name ive posted

#

bedwars1058 im making a addon for it

quaint mantle
#

Yea I'm aware :p I've also made a few plugins for geyser 🙂

near kite
#

I KNOW YOU

#

YOUR JENS

#

YOU MADE

#

GEYSER HUB

#

( i think)

quaint mantle
#

Yup 🙂

quasi flint
#

Caps Lock stuck?

near kite
quaint mantle
#

I saw that 😳

near kite
quasi flint
#

Sus

near kite
#

dont post here

#

dm it

quaint mantle
near kite
quaint mantle
#

Done 🙂

west oxide
quaint mantle
#

go format color wiki when... when i was still using 1.12 i always have it there on my important bar lol https://minecraft.gamepedia.com/Formatting_codes

Minecraft Wiki

A book showing the possible formatting options with the character that performs them.
Formatting codes (also known as color codes) add color and modifications to text in-game.
Text in Minecraft can be formatted with the section sign (§). In Bedrock Edition, the section sign can be entered into signs, world names, books, renaming items and ...

west oxide
#

could be a stupid question but

#

to change this' name

#

how

#

or should i just do it trough file explorer ?

summer scroll
#

shift + f6

west oxide
#

sounds like something that i'll destroy my computer lol

#

oh wait it worked

west oxide
#

does this work to change the plugin's name also ?

summer scroll
#

lol

ivory sleet
#

Yuh shift f6, or well it’s called a refactor which you can find by right clicking the class

#

Yeah

summer scroll
#

refactor in intellij is very good

ivory sleet
#

IntelliJ is good, because it understands that changing the name of a class is a semantic change to the system

#

Not just a simple name change

summer scroll
#

you can refactor method, class, etc

west oxide
#

damn that's op

#

progress :D
added :
-/heal or /heal player
-/feed or /feed player
-join message
-welcome message

candid galleon
#

F2 works also

ivory sleet
#

Maybe have a . at the end of the sentence

west oxide
#

oh yeah ok

candid galleon
#

No need to specify that it's a player imo

west oxide
#

lol

candid galleon
#

Healed shakiz.

west oxide
#

ok i'll do that

#

it'll look cleaner

quaint mantle
#

I personally don't really like using text that isn't that big in that box chat, I would prefer to use that text in subtitle (player.sendTitle("", "Nice text here", 10, 40, 10)) or might be actionbar (p.sendActionBar("") and only if you use paper, else then you should make yourself a method using the nms then)

west oxide
#

how do i fix this ```java: error reading /C:/Users/Shakiz/Desktop/myplugins/BwCore/src/online/shakiz/BwCore/Commands/gm.java; C:\Users\Shakiz\Desktop\myplugins\BwCore\src\online\shakiz\BwCore\Commands\gm.java (The system cannot find the file specified)

#

i changed the file name using refactor

#

nvm i just changed it back

#

and rechanged it and it fixed

gritty whale
#

Hello everyone, I have a little problem. I tried to create a command that teleports players to a location specified in the config.yml, but somehow it keeps teleporting me to 0, 0, 0.
I am not close to my pc rn, but I recreated the part of the code which I think has the error.

#

for (Player player : Bukkit.getOnlinePlayers() {

double spawnX = config.getDouble(„locations.player.spawnX“);
double spawnY = config.getDouble(„locations.player.spawnY“);
double spawnZ = config.getDouble(„locations.player.spawnZ);
World world = player.getWorld();


Location loc = new Location(world, spawnX, spawnY, spawnZ);

player.teleport(loc);

Bukkit.broadcastMessage(„§eDu wurdest zu deiner Startposition teleportiert“);

}
#

In the config file, I set spawnX to -120.85732959, spawnY to 69.0 and spawnZ to 361.937492572

near kite
#

i have a problem
[01:27:02 ERROR]: Could not load 'plugins/BedWars1085-GeyserSupport-1.17.1-R0.1-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `io.github.creeperz653.bedwars1085geysersupport'
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:75) ~[patched_1.17.1.jar:git-Purpur-1427]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[patched_1.17.1.jar:git-Purpur-1427]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Purpur-1427]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Purpur-1427]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Purpur-1427]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:322) ~[patched_1.17.1.jar:git-Purpur-1427]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1231) ~[patched_1.17.1.jar:git-Purpur-1427]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:322) ~[patched_1.17.1.jar:git-Purpur-1427]
at java.lang.Thread.run(Thread.java:831) ~[?:?]
Caused by: java.lang.ClassNotFoundException: io.github.creeperz653.bedwars1085geysersupport
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:153) ~[patched_1.17.1.jar:git-Purpur-1427]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:105) ~[patched_1.17.1.jar:git-Purpur-1427]
at java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:466) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:73) ~[patched_1.17.1.jar:git-Purpur-1427]
... 8 more

#

im trying to load it

glossy venture
#

plugin.yml?

glossy venture
#
main: io.github.creeperz653.bedwars1085geysersupport.bedwarsgeysersupport
``` ^ in `plugin.yml`
#

also make the class name camel case (MyClass) please
in your case BedwarsGeyserSupport

#

much easier to read

glossy venture
#

your class is in io/github/creeperz653/bedwars1085geysersupport right?

#

ok

#

do you know why you have to enter that

#

instead of what you had before

near kite
#

no bc my brain is smooth

glossy venture
#

learn basics

#

now it should work

#

but i would first of all make your class name BedwarsGeyserSupport

#

instead of all lower case

#

and then you would have to change

main: io.github.creeperz653.bedwars1085geysersupport.bedwarsgeysersupport
``` to
```yml
main: io.github.creeperz653.bedwars1085geysersupport.BedwarsGeyserSupport
#

io.github.creeperz653.bedwars1085geysersupport is the package your class is in (the folder) and the .BedwarsGeyserSupport is the class name

near kite
#

mhm ik

glossy venture
#

ok

near kite
#

my stupid plugin

#

loaded even doe

#

the depend isnt there

glossy venture
#

bedwars1085?

near kite
#

mhm

#

it should not load

#

if bedwars1085 isnt there

#

bruh

glossy venture
#

did you put

depend:
  - "bedwars1085"
``` in there
#

in the plugin.yml

near kite
#

fuck

#

i forgot the

#

"

glossy venture
#

idk if it matters

#

otherwise bedwars1085 is not the correct id

near kite
#

huh

#

ima look at a another addon

#

to check what id it is

west oxide
#

epic spelling

glossy venture
#

nice

west oxide
#

uwu

near kite
west oxide
#

ayo nah am never sus

#

even when i say ||i love men||

near kite
#

SUS

west oxide
#

hey question
when someone issues a command like this
/test player uwu

to get the 2nd or 3rd argument we do args[2] or args[3] ?

#

with this declared before

#

or am i stupid

drowsy helm
#

yep

west oxide
#

ayyy

drowsy helm
#

but args[1] for 2nd

west oxide
#

ohh

#

arg[0] for first

#

nice

drowsy helm
#

index starts at 0

#

yeah

west oxide
#

ty very much

#

:D

#

time to add ban command

near kite
#

@Override public void onEnable() { //Disable if pl not found if (Bukkit.getPluginManager().getPlugin("BedWars1058") == null) { getLogger().severe("BedWars1058 was not found. Disabling..."); Bukkit.getPluginManager().disablePlugin(this); return; } }

#

would i make another file for this?

glossy venture
#

you mean class?

near kite
#

mhm

glossy venture
#

this is fine to put in onEnable

#

having another class just for this is pointless

near kite
#

do i put it in main

glossy venture
#

yeah

#

you always put onEnable, onLoad and onDisable in your main class

#

otherwise they dont even work

near kite
# glossy venture you always put `onEnable`, `onLoad` and `onDisable` in your main class

package io.github.creeperz653.bedwars1085geysersupport;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class bedwarsgeysersupport extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("onEnable is called!");
}

@Override
public void onDisable() {
    getLogger().info("onDisable is called!");
    @Override
    public void onEnable() {
        //Disable if pl not found
        if (Bukkit.getPluginManager().getPlugin("BedWars1058") == null) {
            getLogger().severe("BedWars1058 was not found. Disabling...");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
    }
}

}

glossy venture
#

what

#

put onEnable outside of onDisable

#
package io.github.creeperz653.bedwars1085geysersupport;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class bedwarsgeysersupport extends JavaPlugin {

    @Override
    public void onEnable() {
        //Disable if pl not found
        if (Bukkit.getPluginManager().getPlugin("BedWars1058") == null) {
            getLogger().severe("BedWars1058 was not found. Disabling...");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
    }

    @Override
    public void onDisable() {
        getLogger().info("onDisable is called!");
    }
}
#

wtf

#

they are methods

#

they belong in classes

#

not other methods

near kite
glossy venture
#

i fixed it

#

you had duplicate onEnable

near kite
#

dont i still have?

glossy venture
#

i fixed the code

#

look in the block

near kite
glossy venture
#

no i edited it

#

the duplicate is gone

near kite
#

nvm

gusty bough
#

Hey, is it normal that Bukkit.getOfflinePlayer(uuid)#getName() returns null even if the player did join the server before?

#

Seems like i can do getName() and have players name, but if they didn't join for like a day it returns null

glossy venture
#

i think its stored in usercache.json

#

if theres something clearing it then thats the problem

gusty bough
#

my usercache.json looks good

#

I found the player name with his uuid

echo basalt
#

That's odd

#

Considering it queries the mojang api

#

Are you sure you're running an online server?

gusty bough
#

yes

candid galleon
west oxide
candid galleon
#

😮 no w a y

#

I think if you get an offlineplayer via UUID it doesn't necessarily fetch the name

#

could be wrong

#

you might have to store the name with it, or manually query the mojang api

gusty bough
#

I think i will need to store the player name in my config

#

rly strange behaviour though...

candid galleon
#

(Java)
This method uses the mojang API to convert from a UUID to the player's username.

String getName(UUID UUID) {


    try {
        URL url = new URL("https://api.mojang.com/user/profiles/" + UUID.toString().replace("-", "") + "/names");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        connection.setRequestProperty("Content-Type", "application/json");
        connection.setRequestProperty("Accept", "application/json");
        connection.setDoOutput(true);
        connection.connect();
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        StringBuilder builder = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            builder.append(line);
        }
        reader.close();
        return builder.toString();
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
#

there we go

#

definitely should cache it

gusty bough
#

thx will try

elfin talon
#
 else if (p.getLocation().getY() >= ConfigManager.cfg.getInt("gamehigh") - 1) {

            p.getInventory().clear();

            ItemStack Stick = new ItemStack(Material.STICK);
            ItemMeta StickMeta = Stick.getItemMeta();
            StickMeta.addEnchant(Enchantment.KNOCKBACK, 1, true);
            Stick.setItemMeta(StickMeta);
            ItemStack Blöcke = new ItemStack(Material.SANDSTONE, 64);

            p.getInventory().setItem(0, Stick);
            p.getInventory().setItem(1, Blöcke);
        }

how can i do this only once and not all the time when the player is under this height?

west oxide
#

hey

#

i need help

#

so i can understand pretty much almost any java plugins tutorials

#

but

#

this one

#

what even is this lol

#

i dont understand almost anything he did here

#

in the start phase

#

pls

ivory sleet
#

He made a type aware manager thing

#

It’s generics if you’re curious

#

The type parameters and that stuff

west oxide
#

hm

#

i dont understand

#

what should i know to understand this ?

#

like any videos ?

#

also thank you

ivory sleet
#

Google java generics or smtng

#

There should be plenty of resources to learn from

west oxide
#

ok

#

thank you man

quaint mantle
#

if i create this new file and use the file, will it use the new created file ?

eternal oxide
#

No

quaint mantle
eternal oxide
#

when you use new File(... its creating a pointer to where a file MAY be

#

it could be a folder, or it may not exist

#

when you call File#createNewFile() it will attempt to create a file at that location, IF one does not already exist.

#

teh return of the method tells you what happened

quaint mantle
#

im testing stuff

#

will this work ?

#

or no

eternal oxide
#

I guess you didn;t read what I typed

quaint mantle
#

i dont get it

#

like

#

should i do this ?

eternal oxide
#

I already told you no, and why

quaint mantle
#

so wtf should i do

quaint mantle
eternal oxide
#

are you actually trying to replace a file, or just create one if its not already there?

quaint mantle
#

create a new file

#

that doesnt

#

and CANT

#

cause i will have a list of arenas

#

and if the name is in it

#

it will give an error

#

that an arena with this name exists

#

!

#

so what should i do now @eternal oxide

eternal oxide
#
File file = new File(Trex...
try {
    file.mkdirs();
    // Create file or save resource here
    TrexFFACore.INSTANCE.saveResource("fileThatsInYourJar", false);```
quaint mantle
#

bruh the file is not in jar

#

i know how to create custom configs
but files for data

#

for each arena

#

or player

#

create the file

#

load it

#

and set stuff

eternal oxide
#

then you create an empty file in memory, add what you want and save it

quaint mantle
#

how to

eternal oxide
#

FileConfiguration data = new YamlConfiguration.load(); or something close

quaint mantle
#

bruh dude

#

i want to create a file in java

#

and use it

#

can you help me do THAT ?

#

and maybe load it with yamlconfiguration

eternal oxide
#

you don;t use an empty File, its pointless

#

you create a File when you have somethign to save

quaint mantle
#

im going to set the name

#

and save it

#

is it hard for you to help me with the thing that im going to do

#

?

eternal oxide
#

I have told you everything you need to know, but you listen as well as my wife does.

candid galleon
eternal oxide
#

I know its surprising, but someone was willing to marry me 🙂

candid galleon
#

how much Didja pay her

#

ecksdee

eternal oxide
#

You just have to lock them in for a while and their will breaks down.

eternal oxide
#

ok

quaint mantle
#

im not going to save a yml file to my plugin folder

#

for every arena name possible

#

and save the resource

#

i want to know how to create a file

#

in java

#

and load it

#

is it that hard for you to help me with that ?

eternal oxide
#

As I already said, you don;t create an empty file. You create yoru data in memory, THEN save it to file.

quaint mantle
#

DUDE

#

THE FILE IS NOT IN JAR

eternal oxide
#

dude

#

I don;t see ANY mention of any jar in that sentence

quaint mantle
eternal oxide
#

old and irrelevant

quaint mantle
#

and i asked you how to create a file in memory

#

and save it

#

and you gave the load config method

#

someone please help, my intellij intellisense is bugged

eternal oxide
#

and I already told you, data = new FileConfiguration("path").load() or somethign close

quaint mantle
#

i litearlly created Inventory inv up there

eternal oxide
#

data.save();

quaint mantle
#

data.save ?

#

and the file will be created ?

eternal oxide
#

of course

#

So long as the directory path exists

quaint mantle
#

somenoe help?

#

please

eternal oxide
summer scroll
quaint mantle
#

you mean YamlConfiguration.load() ?

eternal oxide
#

yes

#

as I said, or something close

quaint mantle
#

what to put in params

eternal oxide
#

the path

quaint mantle
#

Bukkit.createInventory...

eternal oxide
#

the same as if you were trying to load a yaml

quaint mantle
#

i declared it

#

but

#

i have worse problems with itemstacks

misty current
#

You need to put it in a method...

summer scroll
#

you are writing it outside the method, which is in field area

eternal oxide
#

and as others told you, code goes inside methods

quaint mantle
misty current
#

Doubt

misty current
#

You can't do what you are doing in field area

quaint mantle
#

um

eternal oxide
#

you are trying to write code at teh class level.

quaint mantle
#

and then save ?

#

right ?

quaint mantle
#

i did it before

#

it worked

eternal oxide
#

You can define and initialize variables/Fields but it has to be in teh same line as you define it.

quaint mantle
#

so why does this not work

eternal oxide
#

else it has to be initialized inside a method

quaint mantle
#

i initialized

#

yet

#

the code complete doesnt give me sensible options

eternal oxide
#

what do you mean by "not work"?

quaint mantle
#

and when i uninstall and reinstall it works again

#

but i cant keep doing that

eternal oxide
#

it looks like you are in a method which already has a variable called item

quaint mantle
#

im not

#
package net.fordium.skyblockremake.CraftingTable;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

import java.util.ArrayList;
import java.util.List;

public class CraftingInventory {

    private Inventory inv;

    public void createCraftingInventory(Player p) {
        inv = Bukkit.createInventory(p, 54, "Craft Item");

        for (int i = 0; i <= 53; i++) {
            if (!getCraftingSlots().contains(i)) {
                if (i == 24) {
                    inv.setItem(24, new ItemStack(Material.BARRIER));
                }
            }
        }

    }

    ItemStack item = new ItemStack(Material.STICK);





    item

    public List<Integer> getCraftingSlots() {
        List<Integer> craftingSlots = new ArrayList<>();

        craftingSlots.add(10);
        craftingSlots.add(11);
        craftingSlots.add(12);

        craftingSlots.add(19);
        craftingSlots.add(20);
        craftingSlots.add(21);

        craftingSlots.add(28);
        craftingSlots.add(29);
        craftingSlots.add(30);

        return craftingSlots;
    }

}
#

this is the entire code

eternal oxide
#

You only typed item, there was no period

#

add a period, then look at teh code complete

quaint mantle
#

lemme send

#

THERE IS NO CODE COMPLETE

#

when i add period

#

can i stream?

#

somewhere

eternal oxide
#

and again you typed item at teh class level, you are outside any method

quaint mantle
#

but i have created tons of items like this

#

and they worked

#

but then after using the ide for some time

#

@eternal oxide right ?

#

the code complete dies

eternal oxide
#

not outside a method you didn;t, not without a code block

quaint mantle
#

pwdym

summer scroll
#

do you know what a method is?

quaint mantle
#

yes

#

?

#

is that a question

#

i mean im using java, duh i know what methods are

eternal oxide
#

to use item like you are trying, it has to be INSIDE a method or a codeblock

quaint mantle
#

okay

proud basin
#

nested method

summer scroll
#

you are writing it outside the method/codeblock that's why there is no auto-completion/suggestion that you wanted

quaint mantle
#

it works that way

#

somehow

eternal oxide
#

teh IDE is expecting only Field definitions at that level

quaint mantle
#

but

#

i cant keep doing that

eternal oxide
#

it has no idea what you are trying to do so its completely confused

quaint mantle
#

okay

#

hold on

candid galleon
#

declarations and instantiating is run when the class is created

#

the code isn’t necessarily linear, you could make a static block and it’d run linearly

#

but ultimately your scope is incorrect

quaint mantle
west oxide
#

i tried to do exactly what the if statement says

#

but it doesnt work

#

i was just testing and idk how to fix this error

eternal oxide
#

the full error probably mentions null

candid galleon
#

most likely you want the item modification to be done in the constructor

west oxide
eternal oxide
candid galleon
#

Probs target

#

Or enchantment

#

Lots of NPE are possible looks like

west oxide
eternal oxide
#

When you have found the line it says is null, look at your code and see if you can understand why

west oxide
#

how can i read it

eternal oxide
#

at online.shakiz.BwCore.Commands.enchant.onCommand(enchant.java:22)

quaint mantle
west oxide
#

i mean understand the error

eternal oxide
#

you look for teh Caused by line

west oxide
#

ok i'll try to see if i can fix

quaint mantle
#

which theme?

quaint mantle
west oxide
#

what

quaint mantle
#

okay

west oxide
#

why delete :(

candid galleon
#

Incorrect information

west oxide
#

how did you do that xD

#

oh

#

F

candid galleon
#

I’d recommend using pastebin or a text website for code / errors

#

images are meh

#

and don’t upload it as a file either

west oxide
#

ì dont have nitro ;-;

#

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.lang.annotation.Target;

public class enchant implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if (!(sender instanceof Player)){
            sender.sendMessage(" §dThis command can only be run by players");
        }
        else if(args.length==3){
            Player target = Bukkit.getPlayerExact(args[1]);
            ItemStack hand = target.getInventory().getItemInHand();
            Enchantment enchantment = Enchantment.getByName(args[0]);
            int Level = Integer.getInteger(args[1]);

            hand.addUnsafeEnchantment(enchantment,Level);
            return  true;
        }
        else{
            sender.sendMessage("  failed!");
            return true ;
        }

        return true;
    }
}
candid galleon
eternal oxide
#

you don't need nitro

#

?paste

undone axleBOT
west oxide
#

oh ok

#

?paste

undone axleBOT
candid galleon
#

icodex


import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.lang.annotation.Target;

public class enchant implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if (!(sender instanceof Player)){
            sender.sendMessage(" §dThis command can only be run by players");
        }
        else if(args.length==3){
            Player target = Bukkit.getPlayerExact(args[1]);
            ItemStack hand = target.getInventory().getItemInHand();
            Enchantment enchantment = Enchantment.getByName(args[0]);
            int Level = Integer.getInteger(args[1]);

            hand.addUnsafeEnchantment(enchantment,Level);
            return  true;
        }
        else{
            sender.sendMessage("  failed!");
            return true ;
        }

        return true;
    }
}

What’s wrong with the above code?

west oxide
eternal oxide
#

args is indexed on 0 not 1

quaint mantle
#

player and level are getting from the same index, not possible

west oxide
#

i do this

candid galleon
#

Why do you use getPlayerExact

eternal oxide
#

you are tryign to get a player from args 1

candid galleon
#

args 0 is sharpness, 1 is 100, 2 is shakiz

quaint mantle
#

it should be target = Bukkit.getPlayerExact(args[2]);

quaint mantle
#

u put 1 in the args[1]

west oxide
#

oh wait

#

lol

#

am stupid

#

thanks

#

nvm that didnt fix

quaint mantle
#

xD

#

im stupid

#

why not use Bukkit.getPlayer

#

and if it didnt find the player

#

just send a message

#

The player is either offline or doesn't exist

#

EZ

west oxide
#

ok i'll try

quaint mantle
#

will Objects.requireNonNull change the functionality? or im doing it just for the sake of the ide shouting at me to do it

west oxide
#

i used getplayerexact cuz its the only one i know of xD

west oxide
#

that didnt fix either

#

F

#

lol

quaint mantle
#

rip

#

i have no idea how to do it

#

sorry my guy

west oxide
#

i'll do some digging on forums

#

and try to find

#

if i do i'll share here

eternal oxide
#
Player player = Bukkit.getPlayer(args[2]);
if (player != null) {```
west oxide
#

still issue

quaint mantle
#

how can i recreate the crafting table from hypixel skyblock?

#

create new inventory and put the blocks in their right position?

#

yeah but how do i check for the crafting recipes

#

hmmm idk i dont really know about all of these GUI

#

and more importantly

#

how do i set the product item

tulip owl
quaint mantle
#

did you reload maven repo?!?!?!

tulip owl
#

no, how would i do that (in intellJ)?

quaint mantle
#

?learnIntelliJ

#

well it looks like there is no links...

tulip owl
west oxide
#

i added a try catch thing

#

but still when i add actual arguments it gives error

proud basin
#

what’s the error?

west oxide
#

wait 1 sec i think it worked

west oxide
#

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;

import java.lang.annotation.Target;

public class enchant implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

        if (!(sender instanceof Player)){
            sender.sendMessage(" §dThis command can only be run by players");
        }
        else if(args.length==3){

                    Player target = Bukkit.getPlayerExact(args[2]);
                    ItemStack hand = target.getInventory().getItemInHand();
                    try {
                        Enchantment enchantment = Enchantment.getByName(args[0]);
                        int Level = Integer.parseInt(args[1]);
                        hand.addUnsafeEnchantment(enchantment, Level);
                    }
                    catch (IllegalArgumentException e){

                        sender.sendMessage("§cInvalid Argument !");

                    }
                    return true;

            }


        else{
            sender.sendMessage("  failed!");
            return true ;
        }

        return true;
    }
}
#

and this is my code

#

now it gives me this as error

proud basin
#

yeah because you’re missing an argument

#

you only have 2 arguments

west oxide
#

what

west oxide
proud basin
#

Java always starts at 0

west oxide
#

0 is enchantment

#

1 is level

#

and 2 is player

proud basin
#

That’s different from my screen

west oxide
#

oh

proud basin
#

anyways

proud basin
#

add e.printStackTrace(); to your catch

#

im assuming though the enchantment name is wrong

#

could be capital sensitive

west oxide
#

[16:05:00 WARN]:        at org.apache.commons.lang.Validate.notNull(Validate.java:192)

[16:05:00 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack.addUnsafeEnchantment(CraftItemStack.java:184)

[16:05:00 WARN]:        at online.shakiz.BwCore.Commands.enchant.onCommand(enchant.java:27)

[16:05:00 WARN]:        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)

[16:05:00 WARN]:        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146)

[16:05:00 WARN]:        at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13)

[16:05:00 WARN]:        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)

[16:05:00 WARN]:        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713)

[16:05:00 WARN]:        at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616)

[16:05:00 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)```
west oxide
#

lshould i add the minecraft:sharpness thing ?

#

nope that didnt fix

proud basin
#

yeah invalid enchantment

west oxide
#

oh

#

weird

#

idk how to fix ;-;

#

i looked here and copy pasted this

#

then it worked

#

i'll try to find a way to make it ignore caps

quaint mantle
#

nah

lavish hemlock
#

.toUpperCase()

west oxide
#

i found this

#

how can i use it ?

lavish hemlock
#

no

#

just no

west oxide
#

oh

lavish hemlock
#

use .toUpperCase()

analog prairie
#
# HELP player_count
# TYPE player_count gauge
player_count 1
# HELP cpu
# TYPE cpu gauge
cpu 2.652843
# HELP uptime
# TYPE uptime gauge
uptime 2973630
# HELP threads
# TYPE threads gauge
threads 184.000000
# HELP gc
# TYPE gc summary
gc{name="G1 Old Generation"} 0
gc{name="G1 Young Generation"} 5366
# HELP tps
# TYPE tps gauge
tps 20.000000
# HELP mspt
# TYPE mspt gauge
mspt 10.858425
# HELP loaded_chunks
# TYPE loaded_chunks gauge
loaded_chunks 9197
# HELP entity_count
# TYPE entity_count gauge
entity_count 786
# HELP packets_rx
# TYPE packets_rx gauge
packets_rx 71415
# HELP packets_tx
# TYPE packets_tx gauge
packets_tx 8575903
# HELP disk_space_world
# TYPE disk_space_world counter
disk_space_world{world="world"} 1681992267
disk_space_world{world="world_the_end"} 90885096
disk_space_world{world="world_the_nether"} 187266488
# HELP loaded_chunks_world
# TYPE loaded_chunks_world counter
loaded_chunks_world{world="world"} 8356
loaded_chunks_world{world="world_the_end"} 0
loaded_chunks_world{world="world_the_nether"} 841
# HELP entity_count_world
# TYPE entity_count_world counter
entity_count_world{world="world"} 756
entity_count_world{world="world_the_end"} 0
entity_count_world{world="world_the_nether"} 30
# HELP free_memory
# TYPE free_memory gauge
free_memory 2653133552
# HELP total_memory
# TYPE total_memory gauge
total_memory 5368709120
# HELP max_memory
# TYPE max_memory gauge
max_memory 5368709120
lavish hemlock
#

?paste @analog prairie

undone axleBOT
quaint mantle
#

hmmm i wonder why do bukkit team use wrapper for the potioneffecttype and enchantments hmm?

analog prairie
#

What format is this file

west oxide
analog prairie
#

Can anyone help me?

analog prairie
#

Isn't json or yml

lavish hemlock
#

I don't think it's any specific format

#

but I might be wrong

analog prairie
#

How can I read it

lavish hemlock
#

idfk

#

you'd have to find a spec

#

but if you don't even know the format, then good luck

#

the fuck is the file extension btw

lavish hemlock
#

to explain what a switch statement is, if you don't already know:

quaint mantle
#

?learnjava

undone axleBOT
quaint mantle
#

best way to explain lol

lavish hemlock
#

So switch is a conditional just like if, but the main difference between the two is that switch has to evaluate the value of a non-object (except for Enum/String) type.

quaint mantle
#

or else you will hear maow talking about it for 1 hour straight if you cant understand him

lavish hemlock
#

This is because switch can do branches faster than if.

#

if has to evaluate every single else if which reduces speed the more branches you have (and is just generally ugly to look at)

#

switch doesn't because it just jumps to the correct branch.

#

To give an example:

#
if      ->
else if ->
else if ->
else if ->
else if ->
else if ->
else if ->
we stop here > else
#

For each else if, it has to run that condition, so to get to the else it has to go through everything else.

#

In a switch:

#
case
case
case
case
case
case
we stop here > default
#

You can notice it doesn't have to go through any of the cases.

#

So ye, use switches when you can.

#

Word of warning for switches tho

#

For each case, you should either end it with a break or return

#

This is because if a case is matched and there's cases below it, the switch will continue into the cases below that case.

#

This is called switch fall-through and is shit, for the most part.

lavish hemlock
#

This is called a switch expression ^

west oxide
lavish hemlock
#

return for if you need to end the method/return a value, break if you don't

paper viper
#

when it finds a place to return at

naive rose
#

How do I set it so when a bed is placed next to another bed and both players sleep on it, a command is execute

paper viper
#

you can just do some string manipulation

lavish hemlock
# west oxide

That wouldn't work as it converts an enchantment to a user-friendly name, as opposed to what you need to do, which is the exact opposite.

west oxide
# west oxide

should i change it to be return swtich(name.toUpperCase()){?

west oxide
#

am confused

#

but i'll try to understand now

#

and make it work

#

i get that i'll need to use switch return

lavish hemlock
#

ARROW_DAMAGE results in Power, as opposed to power resulting in ARROW_DAMAGE

#

So... just use the example I sent far above.

west oxide
#

ohh

#

okok

#

thanks

west oxide
#

and use it

#

i mean i'll use it to make it work

#

case* =original
return = what its transfered to

#

right ?

#

or am i stupid

lavish hemlock
#

p'much

west oxide
#

ok

#

i meant to say case instead of switch

west oxide
lavish hemlock
#

I honestly have no idea

lavish hemlock
#

But ye Pulse please explain to the beginner how to convert ARROW_DAMAGE to Punch or vice versa without a switch? /s

west oxide
#

case "PUNCH" -> Enchantment.ARROW_KNOCKBACK;
is this a good way to type it ?
or does this translate to :

    return:"ARROW_KNOCKBACK";```
lavish hemlock
#

depends on which version of Java you're usin'

west oxide
#

17 👀

lavish hemlock
#

ye use the top one then

west oxide
#

ok thank you

naive rose
west oxide
#

LMAO

naive rose
#

It spawns a baby villager

west oxide
#

lol

naive rose
#

Dont wanna say it openly

west oxide
#

imagine asking "how to make a sex plugin"

naive rose
#

Yes

#

That's the main issue

west oxide
#

cant wait to see the servers that use ur plugin lol

naive rose
#

I am only gonna have it on private

#

But I might actually make it public

west oxide
#

bruh make it public

#

would be funny ||to join and see how cringe it gets||

naive rose
#

Will do

#

I'm personally asking SaberFactions dev to help me

west oxide
#

oh idk

#

hmm

#

i am noob

#

but

#

maybe if you get the location of the beds

#

and then get their x loc or y loc of the beds

#

and then see if one is equals to first one + 1 or -1

#

then they are technically next to each other ?

#

but idk

#

@naive rose

naive rose
#

Good odea

west oxide
#

but it'l depend on the bed rotation

tropic kelp
#

Hey, is there a shield use event?

naive rose
gilded seal
#

👋 hii - is there any way to make breakNaturally() drop the contents of things like furnaces, droppers etc? i've specified that it's broken with a pickaxe but that doesn't change anything

long elm
#

has everyone a idea why i become this error
ERROR:

CODE:

    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
      <type>bundle</type>
    </dependency>
#

i use vscode with maven !

chrome beacon
#

Why are you using json simple

#

It's dead

#

Use GSON

quaint mantle
#

Which is built-in

hasty prawn
#

Isn't Gson starting to be out dated too

quaint mantle
#

why so

chrome beacon
#

There are better alternatives

#

I wouldn't call it outdated though

hasty prawn
#

Well yeah, I mean like it seems to be on that path

quaint mantle
#

For example? Moshi?

chrome beacon
tardy delta
#

why would someone ask for a plugin variable in a constructor in a command class if every class does it with the same instance and it keeps the same?

#

call super(plugin)

ivory sleet
tardy delta
#

also cant you make a constructor in your class extending JavaPlugin?

ivory sleet
#

The biggest upgrade is probably moshi’s type adapter system

#

And its minimalistic api

ivory sleet
#

But it has to be a nullary one

#

And iirc public also

#

Though that’d basically just be a normal init block

tardy delta
#

wdym with nullary?

#

that takes no arguments?

ivory sleet
#

Yes

#

0 arg constructor is also called a nullary constructor

acoustic pendant
#
        int x = random.nextInt(999999999);
        int y = 100;
        int z = random.nextInt(999999999);
tardy delta
#

oki great

acoustic pendant
tardy delta
#
  • x blocks of distance
ivory sleet
#

Wait wym?

acoustic pendant
ivory sleet
#

You probably want to roll another int with the range x to something bigger than x

tardy delta
#
new Random().nextInt(10) + 5; // will return something form 5 to 14
hasty prawn
#

I think they just want a minimum value

tardy delta
#

i guess

hasty prawn
acoustic pendant
#

but

hasty prawn
#

That will give you a random number within min and max

acoustic pendant
#

wait

#

i don't want that