#help-development

1 messages · Page 1776 of 1

candid plover
#

for players i`m using

#

public LBPlayer getCache(UUID uuid) {
return cache.get(uuid);
}

waxen plinth
#

Ok yeah you're still really not showing enough code

young knoll
#

It would be cache.get(uuid).get(string)

candid plover
#

oh

young knoll
#

Or you can use the aforementioned table, which would allow you to do this

waxen plinth
young knoll
#

Yes

#

You could make use of computeIfAbsent or just regular null checking

waxen plinth
#

I would use getOrDefault

#

Actually no

#

That would create an unnecessary hashmap

#

Regular null checking probably better

#
Map<String, LBHome> map = homesCache.get(uuid);
if (map == null) return null;
return map.get(name);```
candid plover
#

    private static final Map<UUID, Map<String, LBHomes>> homesCache = new HashMap<>();

    public LBHomes getCacheHome(UUID uuid) {
        return (LBHomes) homesCache.get(uuid);
    }
    
    public LBHomes getHome(UUID uuid, String name) {
        return homesCache.get(uuid).get(name);
    }
}
#

is bad?

waxen plinth
#

Yeah

candid plover
#

I would like to add houses and pull their name into the hashmap

waxen plinth
#

The second one will error if the nested map is null

#

You need a null check in there

candid plover
#
        if(homesCache.get(uuid).get(name) == null) return null;
        return homesCache.get(uuid).get(name);
    }

young knoll
#

No

#

You’ve been given a direct example of how to do it

candid plover
#
        Map<String, LBHomes> maphomes = homesCache.get(uuid);
        if (maphomes == null) return null;
        return maphomes.get(name);
    }```
young knoll
#

Mhm

candid plover
#
        Map<String, LBHomes> map = homesCache.get(uuid);
        return map != null;
    }

    public LBHomes getHome(UUID uuid, String name) {
        if(!hasHome(uuid, name)) return null;
        return homesCache.get(uuid).get(name);
    }```
waxen plinth
#

Uhh

#

hasHome will just return whether they have any home

#

You want to return if they have a home of that name

#

Or maybe you do just want to check if they have any homes, in which case you should remove the name argument

candid plover
#

I want to check if he has a house with this name

quaint mantle
#

Use ^ and dont fuck with 2d maps

#

It is built-in in spigot

waxen plinth
#

Fuck with 2d maps

young knoll
#

Why stop at 2d

native nymph
#

Looking for a partner for a crypto project. Any specific channel I should post in?

waxen plinth
#

lmao

#

begone crypto bro

#

crypto is a scourge and this is a spigot development discord

native nymph
#

?

#

Looking for some help with randomized worlds to gift to my nft holders as part of a larger gaming ecosystem

#

Does that not fall under development?

native nymph
waxen plinth
#

Well let's see

#

Crypto was meant to be a way to decentralize currencies and help people circumvent oppressive governments, or you know, be some type of currency

#

What with cryptocurrency being the name and all

native nymph
#

I'm going to assume you have white privilege's before you even start

waxen plinth
#

But less than 2% of trades in crypto are actually merchant transactions/sales

#

The remaining are all investments

#

So effectively, crypto is just another investment in... what exactly?

#

Nothing

#

Absolutely fuck-all

#

It generates no net value

#

It contributes net nothing to humanity

#

For one person to gain any money, someone else must lose money buying the crypto

native nymph
#

So building a gaming ecosystem that is open source and provides real world tangible benefits while helping multiple non profit causes is nothing?

waxen plinth
#

It's net zero

#

You can do that without involving crypto

#

More energy is used mining bitcoin than is used by the entire country of sweden

#

The environmental impact is enormous for something so useless

#

And NFTs are just the next step down the useless path

native nymph
#

Says the one typing on the computer that was assembled by slave children in 3rd world countries

waxen plinth
#

It takes a lot of energy to mint an NFT and their actual value is also pretty much zero

native nymph
#

assuming you have an iphone as well

#

you run a server?

#

you use electricity

waxen plinth
#

They're largely used for money laundering schemes

native nymph
#

you part of the problem as well, what are you doing about it?

waxen plinth
#

Love that argument

native nymph
#

We atleast planted 50k trees and donating to help

#

Where we can

#

I am here looking for a developer to give a product to my holders, because we are developing a gaming ecosystem

#

a free gift

waxen plinth
#

"let he who is without sin cast the first stone", right?

native nymph
#

not sell them

#

this project caught my eye

#

looks like the same morals we stand for

waxen plinth
#

You can analyze things beyond just "this causes emissions" vs "this does not cause emissions"

#

Computers are essentially a necessary part of daily life and have contributed massively to human progress

#

The same cannot be said for NFTs and crypto

#

Yes, there are environmental costs to computers

native nymph
#

They haven't iterated yet to that point

waxen plinth
#

And we need to work on minimizing them

#

But there are great benefits as well

#

Crypto is net zero

native nymph
#

If you understood the magnitude of smart contracts, lol

waxen plinth
#

It produces no net value, for one person to gain another must lose

#

That's just how it works

native nymph
#

We are talking about two different aspects of crypto

#

the one you are referring to has no impact on my project and we are not involved in that kind of fuckery

waxen plinth
native nymph
#

But if you don't understand smart contracts I would say you should probably educate yourself as, decentralized autonomous organizations are a thing of the future

native nymph
waxen plinth
#

It's not worth causing a chip shortage and the collective energy usage of sweden for the creation of something that is inherently worthless

native nymph
#

distribution of wealth to the poor isn't worth a chip shortage?

#

lol

#

I'll check another channel or try back tomorrow.

#

Best of luck

waxen plinth
#

Never heard of crypto lifting people out of poverty on any meaningful scale

#

The programs that lift people out of poverty are not decentralized ponzi schemes

native nymph
#

Him and his family

#

2700 people crowdfunded the money necessary to move him out of the warzone

#

thanks to my energy sucking nft project

waxen plinth
#

Crowdfunding is not exclusive to crypto

#

It's also a very dystopian view

#

Crowdfunding healthcare in the US is not uplifting any more than that is

#

All it is is a signal that we live in a dysfunctional society

subtle kite
#

This Forlane guy kinda annoying and cringe ngl

waxen plinth
#

right?

#

he left though

wet stream
#

How to spawn fireball?

gritty urchin
wet stream
#

thanx

wet stream
#

What to write in class place?

silent dew
#

anybody know how i can modify packets in buildtools? i wanna edit server packets but i cant seem to find out how

ivory sleet
#

Uh

opal juniper
#

buildtools????

ivory sleet
#

BuildTools does not contain the packet classes

lavish hemlock
#

You'd have to make your own patches for NMS.

near kite
#

can anyone explain

quasi flint
#

missed one } prob

quasi flint
#

where ur method xd

quasi flint
undone axleBOT
near kite
near kite
quasi flint
#

well useless code not in a method

#

hurray

near kite
quasi flint
#

god help

#

show the WHOLE method

near kite
#

`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;
    }
    Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
}
{
    if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
        getLogger().severe("FloodGate was not found. Disabling...");
        Bukkit.getPluginManager().disablePlugin(this);
        return;
    }
    Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
}
@Override
public void onDisable() {
    getLogger().info("onDisable is called!");
}

public void bedwarsGame() {
    BedWars bedwarsAPI = Objects.requireNonNull(Bukkit.getServicesManager().getRegistration(BedWars.class)).getProvider();
}

}`

quasi flint
#

yea

#

ifs out of onEnable

near kite
quasi flint
#

put our if in onEnablr

near kite
#

wait

#

i see

#

i need to put another

#

public void onEnable() {

quasi flint
#

nooooooooooo

#

put ur code in the existing one

#

why make shit so complicated

#

could fit in one if

near kite
lavish hemlock
#

you have an extra }

quasi flint
#

either that

#

or move the if to the correct place

#

and uncurse this

opal juniper
#

what’s the point of the void bedwarsGame

quasi flint
#

not even accessed ig

lavish hemlock
#

also why are you trying to register BedrockShopEvent twice

near kite
#

i just noticed

opal juniper
#

it’s a listener lol troll - should be called BedrockShopListener

near kite
quasi flint
#

in gods name what

lavish hemlock
#

I think you made the problem worse

quasi flint
opal juniper
#

yeah

quasi flint
#

pesky {} boys

near kite
lavish hemlock
#

yes that is where the problem is

quasi flint
#

remove the highlited character

#

and the one u just added

near kite
#

when i used it

#

it made it worsed

quasi flint
#

.

#

?!?!?! read

#

show code

near kite
#

`package io.github.creeperz653.bedwars1085geysersupport;

import com.andrei1058.bedwars.api.BedWars;
import io.github.creeperz653.bedwars1085geysersupport.events.BedrockShopEvent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

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;
    }
    Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);

    {
        if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
            getLogger().severe("FloodGate was not found. Disabling...");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
    }

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

    public void bedwarsGame () {
        BedWars bedwarsAPI = Objects.requireNonNull(Bukkit.getServicesManager().getRegistration(BedWars.class)).getProvider();
    }
}

}`

lavish hemlock
#

ok cool
now close the fuckin' method with } lmao

quasi flint
#

xd

#

help my brain hurts

#

basic java syntax

near kite
#

last error

#

nvm

#

i removed the }

#

and it fixed

quasi flint
lavish hemlock
#

unbearable*

quasi flint
#

shit is bustin

#

german keybord hitting hard

lavish hemlock
#

I think your brain cells are bustin'

#

or maybe burstin'

#

either way, they're dyin'

near kite
quasi flint
#

yes it was

#

just like this

#

?learnjava

undone axleBOT
lavish hemlock
#

we're just saying this problem would be fixed easily if you had basic knowledge of Java's syntax

quasi flint
#

5 links which explain just that

near kite
#

even the ones i know a lot

quasi flint
#

know em better

near kite
#

i end up fixing it

#

by playing with the file

#

changing stuff

#

if i cant figure out how to fixi t

#

i ask support

quasi flint
#

which is bad. because just fingering at code instead of understanding syntax

#

is shit

quasi flint
lavish hemlock
quasi flint
#

;7

#

u know how

#

unzip pants commit

pulsar cloak
#

Could not Rename File

lavish hemlock
#

like so hot that is_computer_on_fire() always returns true when I run it

quasi flint
#

sheeesh

lavish hemlock
#

credit to my friend for that

quasi flint
#

bruh xd

#

how

#

he readin minds?

lavish hemlock
#

nah I screenshot convos on the regular

quasi flint
#

bruh

lavish hemlock
#

I like sharing the funnies

#

also yes that means my friend group of like 4 other people has seen "unzip pants commit"

quasi flint
#

that has to be my status now

lavish hemlock
#

you're welcome

quasi flint
#

its not like here are more than 4 peopl

lavish hemlock
#

ye but everyone else here is lower class

#

they don't have enough social credit

#

unlike me and the boys (and single female thing)

quasi flint
#

except u and me

#

Maow: female are things confirmed

lavish hemlock
#

but if it makes you happy

quasi flint
#

now my profile has the funny

quasi flint
near kite
#

btw

#

i tested the jar

#

it didnt work

quasi flint
#

show error

near kite
#

no error

#

it auto enabled

#

it should have disabled

#

since i didnt have floodgate installed

quasi flint
#

then check your ifs

#

if they are correctly nested

near kite
#

`package io.github.creeperz653.bedwars1085geysersupport;

import com.andrei1058.bedwars.api.BedWars;
import io.github.creeperz653.bedwars1085geysersupport.events.BedrockShopEvent;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;

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;
    }

    Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);

    {
        if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
            getLogger().severe("FloodGate was not found. Disabling...");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
        Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
    }
}

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

    public void bedwarsGame () {
        BedWars bedwarsAPI = Objects.requireNonNull(Bukkit.getServicesManager().getRegistration(BedWars.class)).getProvider();
    }
}

`

#

there isnt any errors

near kite
near kite
#

.

undone axleBOT
hybrid spoke
near kite
#

:/

#

put ill do it

hybrid spoke
#

yeah but its very compressed on a small ass laptop display

hybrid spoke
#

and what exactly is not working?

near kite
#

wont disable if i dont have floodgate

vestal moat
#

Creeperz

hybrid spoke
#

is "floodgate-spigot" the original name? and why do you put it in an extra scope?

near kite
#

oh theres more then one

#

floodgate plugin

#

all the geyser server use floodgate-spigot

vestal moat
#

Isnt there already a plugin for that

#

Creeperz

near kite
vestal moat
#

Bedwars geyser support

near kite
#

no?

vestal moat
#

No i found one on git before

near kite
#

you dont understand what the plugin is but k

near kite
#

show

vestal moat
#

It prob turns java gui to bedrock's modern thing

vestal moat
#

Check andrei's plugins channel maybe u find it

near kite
hybrid spoke
near kite
vestal moat
#

What name it shows when u do /plugins

near kite
#

nvm

#

its floodgate

hybrid spoke
#

^^

near kite
#

but still even if it cant detect

#

floodgate.spigot

hybrid spoke
#

and also unnecressary scope change. remove those { } around your if statement

near kite
#

why isnt it disabling

hybrid spoke
#

since you put {} around your check, its in another scope, completely unnecressary

near kite
#

my brain is smooth

hybrid spoke
#
        { // <------------------------------------------------------------
            if (Bukkit.getPluginManager().getPlugin("floodgate-spigot") == null) {
                getLogger().severe("FloodGate was not found. Disabling...");
                Bukkit.getPluginManager().disablePlugin(this);
                return;
            }
            Bukkit.getServer().getPluginManager().registerEvents(new BedrockShopEvent(), this);
        } // <------------------------------------------------------------
near kite
#

i dont even have floodgate-spigot and the plugin isnt named that

#

so why isnt it disabling

hybrid spoke
#

could just guess here. try to debug. also you are registering your BedrockShopEvent twice

hybrid spoke
#

there is this thing called delete

near kite
#

?

#

it what

#

top

#

or bottem

hybrid spoke
#

i dont know the flow of your program. if it necressarily needs to be executed before everything else, the last one.

#

otherwise it wont matter

near kite
#

should i test?

near kite
#

wait

#

why the hell

#

is my main class

#

changed

karmic mural
#

I want to make sure I'm not completely off the reservation here. This is not exact code but it' should be enough to understand what I'm trying to achieve.

In the Config:

SubSection:
  TrueOrFalse: True

In the code:

If (SubSection.get("TrueOrFalse"){execute code}

Or is my thinking wrong here?

The reason I ask is that IntelliJ freaks out at this and places a red line under it, suggesting to invert it making it:

 If (!(SubSection.get("TrueOrFalse")){code}

Except that doesn't make any sense

hybrid spoke
#

simply said, you are completely off

karmic mural
#

Could you elaborate? What should I be doing to extract that "True" value?

hybrid spoke
#

you need to get your paths thing as a boolean

#

there is an method called getBoolean(String path)

karmic mural
#

Thank you

near kite
# hybrid spoke simply said, you are completely off

01:56:56 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:73) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:153) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:414) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:322) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Paper-385]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:287) ~[patched_1.17.1.jar:git-Paper-385]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-385]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-385]
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:151) ~[patched_1.17.1.jar:git-Paper-385]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[patched_1.17.1.jar:git-Paper-385]
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:71) ~[patched_1.17.1.jar:git-Paper-385]
... 8 more

#

werid

hybrid spoke
#

org.bukkit.plugin.InvalidPluginException: Cannot find main class

near kite
#

yeah i saw it

#

but it is main class?

hybrid spoke
#

check your plugin.yml for any typos

near kite
#

`name: 'BedWars1085-GeyserSupport'
softdepend:

  • BedWars1058
  • floodgate-spigot
    version: '1.17.1-R0.1-SNAPSHOT'
    main: io.github.creeperz653.bedwars1085geysersupport
    api-version: '1.17'`
hybrid spoke
#

yeah no

near kite
#

wdym

hybrid spoke
#

you declared your path to your main class as your main class

#

not the main class itself

#

also check out javas naming conventions

near kite
#

it worked before

#

idk what happened

hybrid spoke
#

seems like some evil hackers changed your main class path

#

or do you have any ghosts around you?

karmic mural
#

your main class is io.github.creeperz653.bedwars1085geysersupport.bedwarsgeyesersupport

near kite
#

huh

karmic mural
#

I might have mistyped that

near kite
#

let me check smh

karmic mural
#

It's long and really convoluted name please change it

#

For your own sanity

near kite
#

bedwarsgeysersupport

#

extra folder?

karmic mural
#

Just add ".bedwarsgeysersupport" to what you've defined as main in your plugin.yml

#

io.github.creeperz653.bedwars1085geysersupport.bedwarsgeysersupport

#

You wanna doublecheck that to make sure there are no typos but it should find the main class just fine then

near kite
#

this addon im making IS teach me a lot

#

about mc plugins

winged ocean
#

how do ik which one to download for the spigot api

#

im new to dis

#

a little confused

near kite
winged ocean
#

1.17.1

near kite
#

did you make your plugin.yml

#

what step r u on

winged ocean
#

im just following the guide on making one from scratch on intellij

#

it wants me to put the spigotAPI for the dependencies

#

im still preparing the IDE

winged ocean
near kite
#

i asked

#

what step r u on

#

on guide

winged ocean
#

"preparing the ide"

mellow flower
#

Hi guys I am trying to set a smoker to burning state I did something like that but I am getting this error Craftsmoker cannot be cast to block.smoker Block block = p.getTargetBlockExact(5); Material smoker3 = block.getType(); BlockState state = block.getState(); Smoker smoker = (Smoker)state; BlockData data = Material.SMOKER.createBlockData((blockData) -> ((Smoker)blockData).setBurnTime((short) 1)); p.sendBlockChange(smoker.getLocation(), (BlockData) smoker);

sullen marlin
#

any -shaded one is fine

near kite
near kite
#

in order

winged ocean
#

i am...

near kite
#

why are you asking for

#

spigot api

#

thats not the right step

#

oh wait

#

i see

near kite
#

also i know a better guide on spigot

winged ocean
#

are they different completely?

near kite
#

it will make it easy

near kite
winged ocean
#

im not really sure where to find the maven one

near kite
winged ocean
#

aight i will try it

#

why is it easier tho?

near kite
#

stuff

#

in pom.xml you can just type a version

#

lol

#

just read it

near kite
#

in case you dont own

#

jdk

winged ocean
#

i have 16 installeed

#

sorry

#

not 16 different ones

#

but java 16

near kite
#

????

quaint mantle
quaint mantle
#

it will do everything for you.

near kite
#

lol

#

i should have known that

#

when i installed it

#

i didnt know what it was

quaint mantle
#

hmm?

winged ocean
#

so with the plugin installed i wont have to do anything?

#

sorry if im asking obviously stupid questions

#

im just trying to start a small project whilst learning to have some sort of application with what im learning

near kite
#

ima go

#

cya

winged ocean
#

ok wait nvm its convenient

#

tysm

wicked tiger
#

is it possible to do sth similar to

public class eventManager implements Listener{
    public Plugin plugin;
    public eventManager(Plugin p){
        plugin=p;
    }
    @EventHandler
    public void onEvent(Event e){
        plugin.hashmap.get(e.someKindOfOperationToGetWhichWorldThisEventWasTriggeredFrom()).dealWith(e);
    }
}```
to separate event handling in different world instead of checking which world the event belongs to in every EventHandler?
vale ember
wicked tiger
#

no

misty current
#

yes

#

do you want to check what world was an event fired from?

wicked tiger
#

ye

misty current
#

which event?

wicked tiger
#

all event that can be triggered from a world

misty current
#

hm i don't think you can do it with any event, you'd have to code your own implementation

wicked tiger
#

ye

misty current
#

checking if the event is an instanceof another event, cast it and use methods from that event

#

it's painful and you probably don't need that

wicked tiger
#

¯_(ツ)_/¯

misty current
#

also why do you need to listen for a general event?

wicked tiger
#

bc i dont wanna check which world the event belongs to in every EventHandler

hybrid spoke
hybrid spoke
quaint mantle
#

Packets and events are really different

hybrid spoke
#

they aren't. events are just received packets translated into an api

young knoll
#

Not really

#

A lot of events don’t rely on receiving a packet

quaint mantle
#

Absolutely no

#

Sure, packets sent by client causes events

#

But events arent got handled on packet level

hybrid spoke
#

events are mostly the result of a sent packet

young knoll
#

Eh idk if I’d say mostly

hybrid spoke
#

i would

quaint mantle
#

No. Those are for absolutely different things. Events can be caused without packet being sent. Event is not an api representation of packet, thats a representaion of game event. Packets is just the way for clients to interact with game.

hybrid spoke
#

I've never said that an event represents a packet. nearly every, or when we dive into the technological terme, everything that happens for the server and the player are packets. events are the result of a packet. a packet is being sent, evaluated and processed, sent to the opposite and, if there is a reason, translated to an event.

quaint mantle
hybrid spoke
#

a packet is being sent, evaluated and processed, sent to the opposite and, if there is a reason, translated to an event.
and i just did again, more clearer.

#

the perfect example would be the PlayerInteractEvent since you can't detect a rightclick made into air if the player doesn't hold anything in his hand because no arm swing packet is fired.

worldly steppe
#

Hello

#

Can someone tell me a plugin that allows players with an permission enter my server although it is full

#

Needs to work on 1.17

ivory sleet
#

?paste

undone axleBOT
hollow cliff
#

there

#

It's supposed to give xp only on natural blocks(they arent placed) but its not giving exp on anything.. ideas?

worldly steppe
eternal oxide
#

you are getting the state of a Block in teh world. it will be placed

lusty raft
eternal oxide
#

you can;t add metadata to placed blocks

lusty raft
eternal oxide
#

when a block is placed add its x/y/z to the chunk pdc. Then you can check to see if tis a placed block or original.

#

?pdc

worldly steppe
#

Make the server slots the amount you want, then you can code/use a plugin to adjust what shows up as the player slots.

I dont understand, is there a plugin or no? Sorry for dont understanding im Spanish

lusty raft
#

Does metadata get removed when a server is restarted?

eternal oxide
#

You are in the wrong channel to ask for plugin suggestions. #help-server

#

metadata does not persist. Thats what the pdc is for

lusty raft
#

damn... I just coded a plugin for a client which will most likely break on restart 😂

#

I thought it was persistent didn't know there was a whole thing for persistent data

topaz cape
#

hey, recently i kinda started my first 1.16 plugin which went well but I have seen something that i don't understand
which is RGB colors
i can't find how people added it to mc

#

it really looks cool and amazing but i still wonder how

lusty raft
#

ChatColor.of(color)

topaz cape
#

what about the gradient they do?

lusty raft
#

color = hexcode etc.

#

Some psychos write it out themselves

topaz cape
topaz cape
jade grove
#

anyone have any idea on how to fill remaining air slots in an inventory with a specified material? using a library to handle inventories btw

topaz cape
#

i think i should write a lib for it

#

breh

quaint mantle
#

or what do you want to implement

jade grove
#

bruh alright nevermind then 😔

lusty raft
lusty raft
topaz cape
smoky tinsel
#

guys

#
@EventHandler
    public void test(PlayerInteractEntityEvent e)
    {
        Player p = e.getPlayer();
        Entity en = e.getRightClicked();

        if(p.getItemInHand().getType() == Material.SADDLE)
        {
            if(p.getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.GOLD + "THE Saddle"))
            {
                en.setPassenger(p);
            }
        }
    }
#

um

#

this is my code and i want to controll all the entity that the player ride?

#

but i have any clue to make that

#

so i need help for this can someone help me to do this?

young knoll
#

You’ll need NMS

smoky tinsel
#

ik that

#

alr

#

b-but i dont know what NMS that i need for this

#

;-; ....help

#

i try this for 1month on 1.16.5 but NMS change on 1.17...

young knoll
smoky tinsel
#

is that

#

1.17 code?

young knoll
#

Have you opened the link?

smoky tinsel
#

dude i really want to say THANK you this is THE THING what i really looking for 9999999999999999year

#

thank you (:

west oxide
#

yo

#

how to use intellij decompikler ?

#

i've been trying

#

cant see to find any tutorials that worked for me :(

wide coyote
#

just drag and drop the class

west oxide
#

.jar file

visual tide
#

or just use fernflower yourself

#

or jd-gui is also a good option imo

burnt current
#

Hello! I have a quick question: Is it somehow possible to save a location in a database? If so, how can i do that?

eternal oxide
#

what database?

burnt current
#

MySQL

eternal oxide
#

read its data or use serialize

burnt current
#

how do you mean that exactly?

eternal oxide
#

well, first you need to learn how to use an SQL database in Java

#

I'd recommend you do that first

burnt current
#

I already know how it works.

eternal oxide
#

Your question implies you don't

old cloud
#

Is it possible to somehow join an async task?

eternal oxide
#

you either end it or jump back sync

burnt current
eternal oxide
#

saving locations to a config is simple as its serializable

old cloud
eternal oxide
#

no, you can never wait

old cloud
#

Thats what ive meant with joining

eternal oxide
#

all tasks ran by teh scheduler will be terminated when it shuts down

old cloud
#

For example:

//my async task:
while(running) {
    Thread.sleep(10000); // now imagine the server shuts down while this task is sleeping here
}
```What am I supposed to do then?
eternal oxide
#

send it an interupt

old cloud
#

Howto

eternal oxide
old cloud
#

Yea but I dont have the thread, do I?

eternal oxide
#

if you made it you do

old cloud
eternal oxide
#

then you have a handle or id of the task

#

if its a BukkitTask, call cancel

old cloud
#

doesnt work

#

I tried that

eternal oxide
#

doesn;t work?

old cloud
#

Thats just an example

#

I basically did this:

int count = 0;
while(true) {
    count++;
    if(count % 10000000 == 0)
        info(count+"");
}
```as a test and if I call `task.cancel()` it doesnt stop.
`info` just prints a message to the ConsoleCommandSender
tardy delta
#

Thread.interrupt()?

#

Does that exist

old cloud
#

not in a bukkittask

eternal oxide
#

then use while(!isCancelled())

proud basin
#

if 10 is greater than 5 return 1

old cloud
eternal oxide
#

yes, untill you call task.cancel()

old cloud
#

I mean yea, in practice I could do this but not for this example

ivory sleet
eternal oxide
#

your while(true) will never end

#

testing cancel state will allow you to stop it

old cloud
ivory sleet
#

Yeah you can

indigo cave
#

What am I doing wrong?

ivory sleet
#

You could setup a CountDownLatch in the runnable which gets queued on to the cached thread pool, then just countdown the latch and await somewhere else

#

If its some reusable task, might wanna use CyclicBarrier instead

eternal oxide
indigo cave
#

i do in the onEnable

eternal oxide
#

your error says you didn;t

#

Caused by: java.lang.IllegalArgumentException: Specified class does not exist ('de.crowraw.chatmessages.SendableMessage')

indigo cave
#

ConfigurationSerialization.registerClass(SendableMessage.class);

eternal oxide
#

Do you register it before you attempt to use it?

indigo cave
#

yes

#

ofc

eternal oxide
#

The error seems to say you didn;t

old cloud
#

But would it be possible to wait for a non-endless task in onDisable like this:

while(task.isRunning());
```Or would this cause errors or something?
indigo cave
#

checkout the whole code here

ivory sleet
#

But probably would work

old cloud
#

Yea but if I need to do some operations in a database for example before the server stops, then I'll have to wait somehow in the main thread

eternal oxide
#

private final MessageConfig config = new MessageConfig(this, new ConfigProvider(this));

#

initialized at teh class level, before onEnable runs

ivory sleet
eternal oxide
#

does that use your class?

ivory sleet
#

And ftr you could use a countdownlatch here

#

Or something else which is proper

old cloud
#

yes agreeing, ty 👍

ivory sleet
#

I might ask

#

Are you familiar with promises (Future and CompletableFuture in Java)

#

Concerning the database operations

#

Because that class actually has a join and get method (which basically await the current thread for the computed result)

#

And if you really want to be sophisticated here, you could even use your own thread pool with a calculated blocking coefficient

old cloud
quaint mantle
#

Does anyone know a good documentation on creating spigot plugins? Explaining all things like commands, items, events etc.

ivory sleet
#

?jd

ivory sleet
#

That’s for all the classes, items and api coverage generally

#

Spigot offers a set of wiki pages on how to get started with certain topics

quaint mantle
#

i know the spigot docs but it's just useful for finding very specific things i use it mostly for events

quaint mantle
ivory sleet
#

?scheduling

undone axleBOT
ivory sleet
#

The entire branch that wiki is on

quaint mantle
#

just to refresh my brain with spigot

ivory sleet
#

Is just filled with articles on how to do x and y

quaint mantle
#

yea idk spigot's main wiki is kinda shit imo

hollow cliff
ivory sleet
#

Just use Chunk::getPersistentDataContainer iirc

eternal oxide
#

?pdc

eternal oxide
#

You have the block, get the Chunk, get the PDC

vagrant heron
#

hey, so im trying to make a custom GUI but for some reason tuSKe is sending loads of errors is there an upto date verion or another plugin i can use to make guis/plugins?

quaint mantle
#

who is tuske

ivory sleet
#

A Skript iiirc

quaint mantle
ivory sleet
#

Get a new jar

#

And remove the cached jars

#

Also seek help in the paper community as you’re using paper next time

quaint mantle
#

Aight!

ember estuary
#

is it a bad practice to saveConfig() on WorldSaveEvent?

west oxide
#

and it just doesnt work

#

when i try to export the files

quaint mantle
ember estuary
#

meh, just need to save 3 variables, not worth the effort

#

but alright, thx!

#

wasnt sure if maybe something could go wrong

pine island
#

any way to find where am player is looking so North, East also i want timplement this into a join event so i have to get the player name too!

quaint mantle
#

ah then fine

pine island
#

ah

ember estuary
#

yea xD

#

and then check the value

#

its between 0 and 360 i think

quaint mantle
#

but why ping

ember estuary
#

maybe getFacing() also works?

#

oh sorry didnt mean to ping u

#

lol

west oxide
#

hey

#

i decompiled the plugin with intelij

#

and

#

did the creator really made them named a and b or is the decompiler that did that ?

#

i decompressed the .jar file

#

and then opened the folder with intelij

pine island
#

how do i get the player in a event handler? NOT in a command

hasty prawn
hasty prawn
west oxide
#

how can i edit the plugin

#

i just want to change the bed break event

#

and make it make the player a final kill and not end the game

pine island
hasty prawn
pine island
#

yeah

#

shall i send it?

hasty prawn
west oxide
#

its not

#

i just need it for my server

hasty prawn
#

If it's not open source you're not really supposed to modify it 😬

west oxide
#

oh

pine island
#

almost done.. just waiting to get the player name

 public void onPlayerJoin(PlayerJoinEvent event)
    {

        String PlayerName = event.getPlayer().getName();
        /**
         * Created by lorinthio on 3/3/2018.
         */
        class DirectionHelper {

            enum Direction{
                NORTH, EAST, SOUTH, WEST
            }

            /**
             * Get the cardinal compass direction of an entity.
             *
             * @param entity
             * @return
             */
            public static Direction getCardinalDirection(LivingEntity entity) {
                double rot = (entity.getLocation().getYaw() - 90) % 360;
                if (rot < 0) {
                    rot += 360.0;
                }
                return getDirection(rot);
            }

            /**
             * Converts a rotation to a cardinal direction name.
             *
             * @param rot
             * @return
             */
            private static Direction getDirection(double rot) {
                if (0 <= rot && rot < 45) {
                    return Direction.WEST;
                } else if (45 <= rot && rot < 135) {
                    return Direction.NORTH;
                } else if (135 <= rot && rot < 225) {
                    return Direction.EAST;
                } else if (225 <= rot && rot < 315) {
                    return Direction.SOUTH;
                } else if (315 <= rot && rot < 360.0) {
                    return Direction.WEST;
                } else {
                    return null;
                }
            }

        }

        Direction direction = DirectionHelper.getCardinalDirection();





    }```
hasty prawn
west oxide
#

:(

hasty prawn
#

or ok

#

You're already getting the player Lumina

pine island
#

i was too lazy to make my own direction thing

west oxide
pine island
#

yes ik but it wont work with Direction

hasty prawn
hasty prawn
west oxide
#

i still dont get why

#

:(

hasty prawn
#

Legal reasons shakiz

west oxide
#

okay

hasty prawn
#

But I'm also not a lawyer so I can't really help much with that

pine island
#

getting a players facing location when a player joins

hasty prawn
#

Best thing you can do is ask the original developer to either make the change or give you the source

pine island
#

its for a wb message

west oxide
#

😩 now i gotta make a plugin from scratch and am not that good lol

#

or pay 100 bucks to buy frozed plugin that has everything i need

hasty prawn
sharp heart
#

Hello i have a bug with bungeeCord, and idk how to fix him:

java.lang.NoClassDefFoundError: net/md_5/bungee/BungeeCord
Caused by: java.lang.ClassNotFoundException: net.md_5.bungee.api.ProxyServer
Caused by: java.lang.NoClassDefFoundError: net/md_5/bungee/api/ProxyServer
#

it's a class import error i think

pine island
#

hmm ok so PlayerName as a str would work right?

sharp heart
#

but idk how to fix

hasty prawn
#

Don't need the name

pine island
#

ok cool!

west oxide
#

hey anyone can helpe me , i need to learn how to make a practice core/plugin

undone axleBOT
ember estuary
#

Why do you have to use player.spigot().sendMessage(BaseComponent[])
and not player.sendMessage(BaseComponent[]) ?
Why isnt that method implemented on the player? its really counter intuitive

vale ember
#

if i write and compile my plugin in java 11, 16 or 17 will it run on 1.8 mc server?

hasty prawn
west oxide
#

i know cuz i tried

vale ember
#

ty

sharp heart
west oxide
#

idk if its the best thing

#

lol

#

but it worked for me

hasty prawn
hasty prawn
hasty prawn
#

What is your plugin supposed to do

sharp heart
hasty prawn
#

Ah, yeah you need to use PMC to get those things

#

?pmc

sharp heart
hasty prawn
#

Send your code in another paste

pine island
#

it wont allow me to import shall i do it manually? if so whats the import

west oxide
#

i love minecraft

#

uwu if you agree

hasty prawn
#

Or DirectionHelper.Direction

west oxide
#

damn no one loves minecraft

#

F

sharp heart
#

i think it's better

hasty prawn
#

Ok

pine island
#

it really wants it to be direction

hasty prawn
#

DirectionHelper.Direction direction = DirectionHelper....

quaint mantle
#

But still dumb

young knoll
#

New features don’t do that though

#

So ¯_(ツ)_/¯

tardy delta
#

xd

pine island
#

thansk!

tardy delta
#

still havent found after a few days why my config doesnt save

hasty prawn
#

Wdym doesn't save

west oxide
#

why does every tutorial about plugins do the same thing

#

like they all change this

hybrid spoke
#

because they are all crap

west oxide
#

to the exact same thing

pine island
#

yeah

hasty prawn
#

Wdym

west oxide
hasty prawn
#

Like change the variables?

west oxide
#

yeah

hasty prawn
#

The names?

pine island
#

a lot of ppl do it just to make it simple

west oxide
#

yeah

#

they all change it to the same names

#

no one i have seen so far made it a different name

#

and most of them make the same plugin for tutorial xD

hasty prawn
#

Just easier I guess

tardy delta
#

i showed code

hasty prawn
west oxide
tardy delta
#

nobody knows whats wrong

hasty prawn
west oxide
#

lol yeah

pine island
hasty prawn
#

no NOPERS

west oxide
#

i wanna find that tutorial uwu

hasty prawn
#

args is good

west oxide
#

yeah

pine island
#

args make sense while being ez

west oxide
#

args is good

burnt current
tardy delta
#

if i'm right this was it

#

yes it is

hasty prawn
#

Does it throw an error or just do nothing

west oxide
#

what plugin you making ?

tardy delta
#

nope nothing

#

it seems like the file lives in cache but never gets saved

hasty prawn
#

But it does copy the original file right

#

Like the file is there you just can't update it

tardy delta
#

yes the file.createFile() and plugin.saveResource() work

#

i can read from it and set values, and read those but at the end of the day nothing gets saved

#

its just an empty file

hasty prawn
#

Well you are calling saveConfig() right

pine island
#

is there a better way to test out other than building like Fabric has a inbuilt client

long elm
#

hello i have a question how can i run a interval (task run)
i have try it with bukkitrunable but it doesn't work
i wanna know to fix the plugin parameter
here my code ...

public class SideBoard {


  public void setScoreBoard(Player player) {
   ...
    player.setScoreboard(board);
    //HERE I WANT TO REFRESH THE BOARD EVERY X SECONDS  
}

  public void updateScoreBoard(Player player) { //<-- this is the update void

    Scoreboard board = player.getScoreboard();

    //players
    if (Bukkit.getOnlinePlayers().size() == 0) {
      board.getTeam("onlineCounter")
          .setPrefix(ChatColor.DARK_RED + "0" + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers());
    } else {
      board.getTeam("onlineCounter").setPrefix(ChatColor.DARK_RED + "" + Bukkit.getOnlinePlayers().size()
          + ChatColor.RED + "/" + ChatColor.DARK_RED + Bukkit.getMaxPlayers());
    }
   //health
   board.getTeam("HealthCounter").setPrefix("" + ChatColor.DARK_RED + player.getHealth() + ChatColor.RED + "/"
   + ChatColor.DARK_RED + "20");
  }

}

i call the function in my conntection class here the class to view..

public class Connect implements Listener {
   @EventHandler
    public void onJoin(PlayerJoinEvent event) {
        welcomeMsg(event);
        new SideBoard().setScoreBoard(event.getPlayer());
    }
}

and my main file

public class App extends JavaPlugin {
    @Override
    public void onEnable() {
        System.out.println("[MCP]::START");
        //Events
        getServer().getPluginManager().registerEvents(new Connect(), this);
}

have everyone a idea to make the interval ?

hasty prawn
#

With the FileType

undone axleBOT
tardy delta
#

yes like here

west oxide
#

hey i want to add a thing where if someone joins and they never joined before the plugins +1 to a variable and displays it on chat

#

my question is

west oxide
#

should i just put that variable normally

#

or will i have to store it somewhere

#

👀

#

am noob dont bully me

#

lol

pine island
#

i think it will have to be a file unless u dont restart ur server ever again

west oxide
#

ok

hasty prawn
west oxide
#

i only know how to use .json uwu

tardy delta
#

if you click on the "link" to the picture, its just below

#

configManager.getHomes();

pine island
#

i used python f.write functions so i have no idea

hasty prawn
#

Hmmm

#

Yeah that's really odd Fourteen

tardy delta
#

which is set in the constructor

hasty prawn
#

I'm wondering if you're accidentally overwriting it or something

tardy delta
#

i dunno

long elm
young knoll
#

The plugin is an instance of your main class

tardy delta
#

your main class' instance

hasty prawn
#

Oh plugin parameter

#

I really can't read today

tardy delta
long elm
tardy delta
#

i dunno whats your main class is

west oxide
#

hey i've watched a few tutorials now

#

not that many

#

but

#

this guy is the best i have found

#

:D

steady rapids
#

anyone know if is this the right path for my settings?
private final File SIGNS_FILE = new File("plugins/RecipeSigns/signs.yml");

#

i get permission error

quaint mantle
#

Use getDataFolder

steady rapids
#

kk

steady rapids
quaint mantle
#

new File(getDataFolder(), "signs.yml")

pine island
#

Registered listener still dosnt show a msg on join

CODE :

 @EventHandler

    public void onPlayerJoin(PlayerJoinEvent event)
    {

   
        class DirectionHelper {

            enum Direction{
                NORTH, EAST, SOUTH, WEST
            }

            /**
             * Get the cardinal compass direction of an entity.
             *
             * @param entity
             * @return
             */
            public static Direction getCardinalDirection(LivingEntity entity) {
                double rot = (entity.getLocation().getYaw() - 90) % 360;
                if (rot < 0) {
                    rot += 360.0;
                }
                return getDirection(rot);
            }

            /**
             * Converts a rotation to a cardinal direction name.
             *
             * @param rot
             * @return
             */
            private static Direction getDirection(double rot) {
                if (0 <= rot && rot < 45) {
                    return Direction.WEST;
                } else if (45 <= rot && rot < 135) {
                    return Direction.NORTH;
                } else if (135 <= rot && rot < 225) {
                    return Direction.EAST;
                } else if (225 <= rot && rot < 315) {
                    return Direction.SOUTH;
                } else if (315 <= rot && rot < 360.0) {
                    return Direction.WEST;
                } else {
                    return null;
                }
            }

        }

        DirectionHelper.Direction direction  = DirectionHelper.getCardinalDirection(event.getPlayer());
        Bukkit.broadcastMessage(ChatColor.RED + "for debugging ONLY~ " + direction);


    }```
tardy delta
#

public void
class DirectionHelper

#

?

wide coyote
#

class in a method?

#

that explains a lot lol

hybrid spoke
#

local class

tardy delta
#

does that work in a method?

hybrid spoke
#

yeah, it will be just like a normal class just that you can only access it within that method

tardy delta
#

me who never uses it :kek:

pine island
#

OK

#

my bad lol

long elm
#
Caused by: java.lang.ClassCastException: class de.maurice.mcp.events.Connect cannot be cast to class org.bukkit.plugin.Plugin (de.maurice.mcp.events.Connect is in unnamed module of loader org.bukkit.plugin.java.PluginClassLoader @42e4d7d; org.bukkit.plugin.Plugin is in unnamed module of loader 'app')
#

...

        new SideBoard().setScoreBoard(event.getPlayer(), (Plugin) this);

and this in on my main file

package de.maurice.mcp;

import de.maurice.mcp.events.Connect;
import org.bukkit.plugin.java.JavaPlugin;

public class App extends JavaPlugin {
    @Override
    public void onEnable() {
        System.out.println("[SERVER]::START");
        


    //Commands
        getCommand("api").setExecutor(new testiing());



    
        



        //Events
        getServer().getPluginManager().registerEvents(new Connect(), this);





    
    }

    @Override
    public void onDisable() {
        System.out.println("[SERVER]::SHUTDOWN");
    }
}
young knoll
#

class de.maurice.mcp.events.Connect cannot be cast to class org.bukkit.plugin.Plugin

vague oracle
#

my head, you can only cast a class that extends JavaPlugin with (Plugin)

young knoll
#

Connect does not extend JavaPlugin

#

App does, because App is your main class

tardy delta
#

App instance then

pine island
#

not really spigot but can i tp aplayer while looking in lets say North?

long elm
worldly steppe
#

How can i do in the plugin protectionstones put a limit of each protection can a player have?

steady rapids
#

how is it possible that my plugin cant write its settings because "permissions denied" but any other pl can?
[19:18:03 INFO]: Sapu98 issued server command: /recipe edit [19:18:12 WARN]: java.io.FileNotFoundException: plugins/RecipeSigns/signs.yml (Permission denied) [19:18:12 WARN]: at java.io.FileOutputStream.open0(Native Method) [19:18:12 WARN]: at java.io.FileOutputStream.open(FileOutputStream.java:270) [19:18:12 WARN]: at java.io.FileOutputStream.<init>(FileOutputStream.java:213) [19:18:12 WARN]: at java.io.FileOutputStream.<init>(FileOutputStream.java:162) [19:18:12 WARN]: at me.sapu.RecipeSigns.saveSigns(RecipeSigns.java:67)

#

I save it like this:

File signsFile = new File(this.getDataFolder() ,"signs.yml");

public void saveSigns() {
        try (FileOutputStream outputStream = new FileOutputStream(signsFile)) {
            outputStream.write(Serialization.serialize(recipeSigns).getBytes(StandardCharsets.UTF_8));
        }catch (Exception e) {
            e.printStackTrace();
        }
    }```
tardy delta
#

:sad_pepe:

quaint mantle
#

hm?

young knoll
#

Plugin.saveResource

steady rapids
pine island
#

is there a way to check if a item is on the ground im using this to trigger a different command

pine island
#

ty

tardy delta
#

is an item an entity?

pine island
#

yes

tardy delta
#

oh

pine island
#

how do i check for a entity? also is a specific entity type / cords possible?

young knoll
#

entity.isOnGround

pine island
#

where do i implement it?

young knoll
#

If you are waiting for an item to hit the ground, start a runnable when the item is thrown

#

And keep checking until isOnGround is true

pine island
#

i need a example

#

pls lol

tardy delta
#

pls lol me

#

smh me stopping my plugin with my database still open

round finch
#

Bukkit Runnable on Time

if Item is onGround add to list?
if item doesn't contain list?
Check if Item in list isn't onGround?
if false then remove

pine island
#

yeah i switched it up is there a way to check what item a player has held so smth like player.mainHandHeldItem?

tardy delta
#

'has held'?

#

nope

round finch
#

Main hand

#

?

#

and Offhand

pine island
#

woops

#

i meant MainHandItem

#

or just in inventiory

round finch
#

For 1.9+ use 👇

player.getInventory().getItemInMainHand();
OR
getItemInOffHand();

otherwise use 👇

p.getInventory().getItemInHand();

pine island
#

how can i implement this so when i press a button it works?

tardy delta
#

what are you even trying?

round finch
#

you mean PlayerInteractEvent?

pine island
#

i press butoon if the item is held ill be tped

round finch
#

Like left and right like

pine island
#

button**

#

yeah left click works too

#

left clicking the item tp's me

round finch
#

register Your Event_Class

pine island
#

im new help with that

tardy delta
#

so you want to teleport yourself when you right click a button with an item? 🌝

round finch
#

(Main_Instance)getServer().getPluginManager().registerEvents(new YourEventClass(), Main_Instance);

round finch
#

i will help you along :))

pine island
#

also very off but ```java
public void onPlayerJoin(PlayerJoinEvent event)
{

    String PlayerName = event.getPlayer().getName();

    Bukkit.broadcastMessage(ChatColor.RED + "for debugging ONLY ");
    Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),"execute as "+PlayerName+" run tp " +PlayerName+ " -206 71.500 47 -90 0");
round finch
#

you probably miss @EventHandler

pine island
#

its there

#

also imagine being even that person just got pinged bcs a event handler

tardy delta
#
@EventHandler
public void onClick(PlayerInteractEvent event) {
  if (event.getAction() != Action.Right_click_block) return;
  if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.YOUR_MATERIAL) {
  Bukkit.broadcastMessage(event.getPlayer().getName') + "right-clicked with a block from a type idk")
}
}```
round finch
#

shh you didn't see that

tardy delta
#

dont dispath command

pine island
#

whats a better way>?

tardy delta
#

event.getPlayer().teleport(loc) would work

#

but i dunno what that run as does

round finch
#

i tried to tell you @pine islandbut @tardy delta was more clear about how to do it

pine island
#

yes

round finch
#

does it work for you now?

tardy delta
#

anyways any ideas to do when closing my database fails?

round finch
#

@tardy delta have you check your database

tardy delta
#

wdym?

round finch
#

on my database opens for 30 secs and closes in my settings

tardy delta
#

hmm yea you're riht

#

right

pine island
#

uhh imported it stil?

round finch
#

Click block and click air

tardy delta
#

Action.RIGHT_CLICK_BLOCK

pine island
#

ty

jade grove
pine island
#

i copied it ;-;

#

loom up

#

look*

round finch
#

it shows recomandation after .

hoary pawn
#

getting this error java no suitable constructor found for ItemStack(no arguments)
with this code java itemstacks.put(filename, new ItemStack());
can anyone see why this wouldnt work?

#

is that really required?

pine island
#

do i make it a int then use it or is there a diff way?

hoary pawn
#

FUCKING HELL THEN

#

i need the object to get the fucking material

tardy delta
#

new ItemStack(Material.YOUR_MATERIAL)

pine island
#

yeah it for tp

#

event.getPlayer().teleport();

#

aight thx

jade grove
#

is it possible to set a material through #setItemMeta from the ItemStack class ?

tardy delta
#

no

jade grove
twilit wharf
#

or that ^^

tardy delta
#

wait

pine island
#

is the world End or is it a server management thing

tardy delta
#
@Utility
    public void setType(@NotNull Material type) {
        Validate.notNull(type, "Material cannot be null");
        this.type = type;
        if (this.meta != null) {
            this.meta = Bukkit.getItemFactory().asMetaFor(meta, type);
        }
        if (type.isLegacy()) {
            createData((byte) 0);
        } else {
            this.data = null;
        }
    }
pine island
#

tp

tardy delta
#

it does exist

jade grove
#

ty

pine island
#

i want to do overworld

tardy delta
#

overworld is Bukkit.getServer()getWorlds().get(0)

#

world isnt a location?

#

ah nvm

#

i understand

pine island
#

it wants me to create a method

jade grove
#

trying to do a double jump event using the playertoggleflight event, it doesnt work:

    @EventHandler
    public void onDoubleJump(PlayerToggleFlightEvent event) {
        Player player = event.getPlayer();

        if (player.getGameMode() == GameMode.CREATIVE) {
            event.setCancelled(true);
        }
        else {
            player.setAllowFlight(false);
            player.setFlying(false);

            Block block = player.getWorld().getBlockAt(player.getLocation().subtract(0, 2, 0));

            if (!block.getType().equals(Material.AIR)) {
                Vector vector = player.getLocation().getDirection().multiply(1);
                player.setVelocity(vector);
                player.playSound(player.getLocation(), Sound.FIREWORK_BLAST, 1F, 1F);
            }
        }
    }
pine island
#

which wont work i belive

tardy delta
pine island
#

ill send the code

tardy delta
#

yesh

jade grove
#

are you talking about the check for the player's gamemode being creative?

pine island
#
@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event)
    {

        String PlayerName = event.getPlayer().getName();

        Bukkit.broadcastMessage(ChatColor.RED + "for debugging ONLY ");
        Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),"execute as "+PlayerName+" run tp " +PlayerName+ " -206 71.500 47 -90 0");

        new Location(Bukkit.getServer()getWorlds().get(0), );

        event.getPlayer().teleport();
tardy delta
#

you dont need to make a new location

pine island
#

im replacing despatch with

jade grove
#

oh

pine island
#

entity.getPlayer().teleport();

tardy delta
#

but if you're trying to get the spawn location use Bukkit.getServer().getWorlds().get(0).getSpawnLocation()

pine island
#

no i have set coords

tardy delta
#

or you can make a new location if you want specific coordinates

pine island
#

but the world want me to make a new method

#

rota

tardy delta
#

what

pine island
#

rotation

tardy delta
#

the world has its own will

#

ah you need to set the rotation tho

pine island
#

yes

#

will this work?

#

1 sec

#

yeah LOL

round finch
quaint mantle
#

hello
im trying to create a plugin where instead of raw iron/gold being dropped from mining ores , it drops nuggets
i have three questions :

1 - how can i make fortune affect the nugget drops
2 - how can i stop nuggets dropping if a creative mode player breaks the ore
3 - how can i make the pickaxe take durability damage every time i mine iron or gold ore ?

ping me or reply with a ping if you have the answer for this 🙂

round finch
#

Bukkit.getWorld("Name")

jade grove
round finch
#

Bukkit.getServer().getWorld("World");

#

The world name is case-sensitive though.

quaint mantle