#help-development

1 messages Β· Page 1877 of 1

tender shard
#

also newInstance is deprecated

sterile token
#

There is no solution?

dusk flicker
#

not a good one

tender shard
charred echo
#

not sure actually, play around with getSlot method. and debug it until you find out what gives the slot, maybe the event will throw 2 times when doing that who knows

tender shard
#

it also doesn't make sense to get rid of new, it exists for a reason

sterile token
#

I have seen that spigot has a built-in system called ServiceProvider

charred echo
#

or maybe it's not even a InventoryClickEvent @quaint bough

#

not sure

sterile token
charred echo
tender shard
sterile token
tender shard
#

RIP good code lol

dusk flicker
#

thats just a bad idea

tender shard
#

this will only make your code horrible and disgusting

dusk flicker
#

debugging nightmare

charred echo
#

Annotations, build it like Spring boot πŸ€“

quaint bough
#

inventory move item event ?

charred echo
#

sounds more like it

quaint bough
#

annoying thing is it also triggers InventoryClickEvent

tender shard
dusk flicker
#

new Object(); is something you can never really get rid of

#

I have prob like 10 in one class for a small project

charred echo
tender shard
dusk flicker
#

fair lol

tender shard
#

(which of course is the same thing actually)

charred echo
#

behind the scenes

dusk flicker
#

Why do you not want a ton of news VERANO?

sterile token
#

Its possible to the method register a void?

sterile token
tender shard
#

because void means nothing

#

it's less than null

charred echo
#

@sterile token I tend to have a Hook class that instanciates everything for me

dusk flicker
#

of lines means nothing

charred echo
#

to not clutter the main class

quaint bough
tender shard
#

InventoryClickEvent is what you want to use Jelles

dusk flicker
#

focus on readability and debugability rather than less lines

tender shard
#

@quaint bough I'll do some testing in 5 minutes

quaint bough
#

alright

charred echo
quaint bough
charred echo
quaint bough
#

but then I have to make sure it wont actually move before it opens the inventory

quaint bough
#

without a getting just a prop

charred echo
#

thats exactly what you need

#

int getHotbarButton() If the ClickType is NUMBER_KEY, this method will return the index of the pressed key (0-8).

quaint bough
#

oh

charred echo
#

check if the ClickType is NUMBER_KEY. then get the HotbarButton

quaint bough
#

took only 20 min lool

charred echo
#

and that will return the slot position

sterile token
charred echo
#

Verano how are you trying to instanciate the classes

tender shard
quaint bough
#

ok it works thanks

tender shard
#

now you always add null when your object does not exist

dusk flicker
#

I feel at this point you are way overengineering this shit

#

Just wait for one NPE

tender shard
dusk flicker
#

lmao

sterile token
tender shard
#

I sent you perfectly fine working code 3 times

charred echo
# sterile token

make an interface and implement it for every class you got except the main class. make a default void get() to instanciate the class if its not already instanciated, otherwise return it

#

but

#

I wouldnt recommend

#

at all

tender shard
#

e.g. my get Method took a Class<T>, and not a T instance

#

it makes no sense, when you already have an instance, why would you need to get it again?

#

You don't even understand the difference between T and Class<T>

sterile token
#

So like that?

tender shard
#

4th time that I've sent this now

charred echo
#

Any good idea's to quickly and effectively debug plugins? like hotswapping jars etc?

charred echo
#

with

tender shard
#

then no idea, pls let me know if you find a solution lol

dusk flicker
#

print statements.

#

best debugging system

charred echo
#

there is an attribute in maven tho you can use to specify the output directory of the jar

sterile token
charred echo
#

dont remember it

tender shard
tender shard
charred echo
#

not really, I use log4j mostly. Talking more about environment setup to quickly test ur plugins

dusk flicker
#

hope you updated that log4j

charred echo
tender shard
#

just run maven-exec to copy your jar to your server folder

charred echo
#

Would be cool to have a test server fire up after building it, that dosnt utilize all aspects of the server like using the world generation etc. would be just for testing purposes for some plugins

#

that would not implement features using the world etc

dusk flicker
#

prob require a custom fork

tender shard
charred echo
tender shard
#

MockBukkit

charred echo
tender shard
#

lemme knooow

charred echo
#

but Im trying to figure out a better way

charred echo
#

^ pretty sure rcon works, never tried it

tender shard
#

@sterile token
Main class

public class Test extends JavaPlugin implements Listener {

    private static Set<Object> myServices = new HashSet<>();

    public static <T> T register(T object) {
        myServices.add(object);
        return object;
    }

    public static <T> T get(Class<T> clazz) {
        Optional<Object> result = myServices
                .stream()
                .filter(object -> object.getClass().equals(clazz) || clazz.isAssignableFrom(object.getClass()))
                .findAny();
        return result.isPresent() ? clazz.cast(result.get()) : null;
    }

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(register(new MyListener(), this);
        getCommand("command").setExecutor(register(new MyCommandExecutor());
    }
}```

MyListener
```java
public class MyListener implements Listener {

    @EventHandler
    public void onEvent(Event event) {
        MyCommandExecutor executor = Test.get(MyCommandExecutor.class);
        executor.onCommand(...);
    }
}
#

although I still wonder what's the benefit of doing this unless you are high on some weird drugs

#

let's take this one step further lol

charred echo
#

Really trying to figure out where I would start when trying to implement net.md_5.bungee.api.ChatColor to Team.setColor.

#

wait

#

does player.displayname overwrite team.color

#

??

#

but displayname dosnt show up in tab

#

fuck

tender shard
#
public class MyListener implements Listener {
    
    static {
        Test.register(new MyListener());
    }

}
  @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(get(MyListener.class), this);
    }
quaint bough
#

how can the e.getHotbarButton be -1?

charred echo
#

Another alternative is:

public interface Service {
  default Class get(){
    if Main.getServiceFactory().contains(Class) return this;
    else {
      //add return instanciated class and add it to serviceFactory HashMap<ServiceType, Class
    }
  }
}
#

pretty sure that would work no?

charred echo
#

0-8

charred echo
#

fuck

tender shard
#

the CLientboundSetPlayerTeamPacket that the server itself uses takes an enum

charred echo
#

shit

tender shard
#

so the client will only get 0, 1, 2, etc

#

basically the enums ordinal()

#

so: no way, the client wouldnt understand it

#

what do you actually want to achieve?

charred echo
#

trying to change the color in the tablist for the playername

#

to a hex color

tender shard
#

the color of the playername itself?

charred echo
#

yes

#

I mean tablist supports the prefix as a hex color because Team.prefix is a string

#

and it displays it correctly

tender shard
charred echo
#

oh my

#

that might work

tender shard
#

I have no idea

charred echo
#

I mean if the docs are correct

#

Sets the name that is shown on the in-game player list.

#

but now, Team might overwrite the color who knows

#

you never know

#

actually

#

it shouldnt

#

lemme try

tender shard
#

WORKS FINE

charred echo
#

fuck yes

#

just tried it

tender shard
#

lol

#

what have you been doing for the past hour? πŸ˜›

#

I thought you already tried setPlayerListName πŸ˜„

charred echo
#

lmao got caught up here

#

now need to figure out a way to set the tag above the players head

#

but that I think, is only with Teams and GameProfile

#

and default ChatColor.

tender shard
#

what tag? didnt even know this exists

#

all this scoreboard and teams thing is way too complicated for me lol

charred echo
#

The prefix has Color.of

#

as Team.setPrefix takes string

#

but the name remains the color of the Team.color

#

which I do not want

tender shard
#

how can one set the prefix?

#

ah on the team

charred echo
#

yes

tender shard
#

@charred echo

#

how can I make the prefix visible at all

charred echo
#

wdym

#

Team.setPrefix("whatever")

#

Team.addEntry(player.getName())

tender shard
#

I did but it doesn't show anything

charred echo
#

do a for loop for all onlineplayers

#

and get their scoreboard

#

and add the team

#
public void setPlayer(String playerName, String prefix, String suffix) {
        for (Player p : Bukkit.getOnlinePlayers()) {
            Scoreboard board = p.getScoreboard();

            Team team = getTeam(board, playerName);
            team.addEntry(playerName);
            team.setPrefix(prefix);
            team.setSuffix(suffix);
        }
    }
tender shard
#

oh wait

#

I actually wanted to send the code lol

#
    private Team team;

    {
        Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
        team = board.registerNewTeam(ChatColor.translateAlternateColorCodes('&',"&x&0&0&f&f&0&0TeamName"));
        team.setPrefix(ChatColor.translateAlternateColorCodes('&',"&x&2&4&6&8&a&cPREFIX"));
        team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
        team.setDisplayName("asdasdasd");
    }

    @EventHandler
    public void onEvent(PlayerJoinEvent event) {
        event.getPlayer().setPlayerListName(ChatColor.translateAlternateColorCodes('&',"&x&f&f&0&0&3&3JesusChrist"));
        event.getPlayer().setPlayerListFooter("test");
        team.addEntry(event.getPlayer().getName());
    }
#

somehow it doesn't do anything

charred echo
#

lemme see ur onEnable

tender shard
#

it does run. after all it changes the playerlist name

charred echo
#

did you instanciate the team

#

ah nvm

tender shard
#

yes, in the second line of the init block

charred echo
#

lol

#

huh

#
public static Scoreboard scoreboard;
    public static Team team;

    @Override
    public void onEnable() {
        scoreboard = Objects.requireNonNull(getServer().getScoreboardManager()).getMainScoreboard();
        scoreboard.getTeams().forEach(Team::unregister);
        team = scoreboard.registerNewTeam("test");

        this.getServer().getPluginManager().registerEvents(new TeamstestListener(), this);
    }
#
 @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {

        event.getPlayer().setPlayerListName(ChatColor.of("#876664")+event.getPlayer().getName());
        Teamstest.team.setPrefix(ChatColor.of("#876664") + "[prefix] ");
        Teamstest.team.addEntry(event.getPlayer().getName());

    }
charred echo
#

get the main one

#

or loop throgh all online players and get their boards

#

like

vocal cloud
#

Yeah from personal experience if you create a new board every loop you'll make compatibility a pain

charred echo
#

^

#

make one new scoreboard and store it to handle the part of your plugin handling the teams

#

or just do what I sent

tender shard
#

oh yeah

#

theres getMainScoreboard

charred echo
#

still trying to figure out if there is a way to edit the playername color in the name tag above the players head without using GameProfile or Team

tender shard
#

well but the prefix should allow hex colors

charred echo
#

it does

#

Team prefix yes

#

as it takes a string

hardy swan
#

Guys, is there a way, to have two players logged in without having two consoles? I ask this for testing plugins

hardy swan
#

two applications, two clients

#

whatever is accurate

muted sand
#

How do I run a command as a player?
Or like
They send a command, and I run a super long command on behalf of them?

tender shard
tender shard
tender shard
#
@EventHandler
    public void onEvent(PlayerJoinEvent event) {
        Bukkit.dispatchCommand(event.getPlayer(), "kill");
    }
charred echo
#

SolarRabbit, the same account but 2 players of that account in the server?

hardy swan
charred echo
#

Edit the name of the players GameProfile on join, then have the server set to offline

#

im pretty sure

quaint mantle
#

does anyone have a good resource for fireworks

charred echo
#

as the player1 will kick player2 out when joining with the same name

charred echo
#

so u can keep track of the players

charred echo
hardy swan
charred echo
#

im not sure I understand what you are trying to achieve

tender shard
#

@charred echo Hex colors work in the name above the player

#

with one limitation

#

lol

charred echo
#

how

#

chat tab

#

right

tender shard
#

chat tab?

charred echo
#

completion

tender shard
#

no, that's no problem

#

the problem is...

#

with a limit of 16 chars, you can merely pass one color into it lol

charred echo
#

shit

#

GameProfile yes?

#

wouldve been cool for the Team.prefix formats to apply to the playername if Team.color was not set. But that’s not the case..

muted sand
#

does it not return the command output?

#

oh well, thanks!

charred echo
#

wdym

#

it runs the command as CommandSender = player specified

tender shard
#

all they return is a boolean

muted sand
charred echo
#

and btw, I love your profile status rn haappi

muted sand
#

fr ty

charred echo
#

description, status message and the intellij rpc

#

lmao

muted sand
#

it's an actual command i am doing to test the command sender thing

#

but if i run, kill
it'll send killed player?

charred echo
#

bi

#

no

quaint mantle
muted sand
#

oh

charred echo
#

you would have to listen for the evebt

charred echo
quaint mantle
#

how to make them/change colours/effects

muted sand
#

i mean
it works
all i care about thank you!

charred echo
#

progrimatically?

tender shard
muted sand
#

ohh

tender shard
#

e.g. if they don'T have permisison, they get the "no permission" message, etc

muted sand
#

ah i see

tender shard
#

it's like sudo -u player in linux

charred echo
#

alex, you running linux btw?

tender shard
#

only on my servers, not on the desktop

charred echo
#

Ah I see

#

why not desktop?

tender shard
#

it won't run my stuff like FL Studio or ASIO things in general

#

also, photoshop etc

charred echo
#

I see. So your a producer too

#

noice, make hardstyle for me

#

lol

tender shard
#

haha I'm uncreative today

#

I'm so happy that I finally have proxmox on the dedicated server

charred echo
#

noice, you got ur own mail service

tender shard
#

it's just mailcow on a 4GB/2cores server

#

oh no wait I moved it

#

it's on the 64GB/12 cores server lol

rough basin
#

Is it possible to make blocks unbreakable when certain creepers explode?

tender shard
rough basin
#

Thanks

rough basin
#

Null appears on the marked line, What's the problem?

hasty prawn
#

Send the error, spawnEntity can't return null

neat storm
#

Where do i download the things i bought

hasty prawn
rough basin
hasty prawn
#

That doesn't return anything

#

?paste the error

undone axleBOT
rough basin
#

gimme a sec

somber hull
#

GUYS!!!

#

I JUST FOUND OUT SOMETHING BEUTIFUL!!

#

I JUST FOUND OUT HOW TO WRITE JAVADOCS

somber hull
#

😭
its beutiful

young knoll
hasty prawn
somber hull
young knoll
#

Uhh

rough basin
#

I know It's not NPE

young knoll
#

Yes

rough basin
#

But I said Null

hasty prawn
#

Nothing is null

rough basin
#

Then What is line 2?

hasty prawn
#

What are you printing

young knoll
#

It’s just a generic message when a command fails

#

Always look for the caused by line

hasty prawn
#

Wait really?

#

I've never seen that line when a command fails

young knoll
#

Β―_(ツ)_/Β―

#

Idk

somber hull
#

I dont wanna just hop in mid-issue

hasty prawn
#

I never look at that spot in STs though so that's probably why KEKW

somber hull
#

But whats line 18? @rough basin

#

Also why the fuck is your class lowercased first letter

#

speedCreeper

rough basin
#

ignore

#

lmao

hasty prawn
#

You just learned how JavaDocs worked, pipe down

somber hull
#

Well

#

IU knew it was a thing

#

Didnt know how to do it

#

Never looked it up ig

hasty prawn
#

Wait until you learn IntelliJ can generate the entire JavaDoc site for you PauseChamp

somber hull
#

Like where is the button

hasty prawn
#

Tools -> Generate JavaDocs

somber hull
#

Thats pretty sick

#

I just wish intellij has GitHub integration

hasty prawn
#

Wdym

#

It has Git integration

somber hull
#

Well idk what git is, but GitHub integration is what i want

hasty prawn
#

Like push, commit, pull, merge etc?

somber hull
#

Yea

hasty prawn
#

Yeah, that's Git.

somber hull
#

Im just kidding

hasty prawn
somber hull
#

Lol

#

sorry

hasty prawn
#

smh...

somber hull
#

You never gave line 18 lol

rough basin
young knoll
#

I already sent the solution

somber hull
#

Oh my b

rough basin
#

Yeah

somber hull
rough basin
#

but um

#

oh

#

shot

#

shit

somber hull
#

wat

rough basin
#

i really hate my shitty eyes

#

Thanks guys

somber hull
somber hull
#

Wow, thats something i would do

tender shard
#

it even has a special github plugin, not just generic git lol

hasty prawn
#

Oh wait nvm you added Lombok

#

Great PR πŸ‘

#

This definitely needs to be merged

somber hull
#

@tender shard whats the point of replacing this

        getCommand("clearlag").setExecutor(Commandclearlag.static_instance);

With this

getCommand(new StringUtils().reverse("galraelc",null)).setExecutor( Commandclearlag.static_instance);
#

and whats @hoary knollThrows

#

Sorry for ping

#

@SneakyThrows

#

And why so many lines???

young knoll
#

Did ya read the name

somber hull
#

Does that mean in-game??

#

Cause if not then why would you care if people can see admin commands when looking through the plugin code?

hasty prawn
#

I don't trust to know if you're kidding or not anymore

somber hull
#

Im not

hasty prawn
#

Look at the repo name

somber hull
#

terrible-plugin

#

I didnt look at anything except this specific commit

#

that might be why im confused

#

AHHHHHHHHHHHHHHHHHHHHH

#

I understand now

#

Sorry lol

somber hull
hasty prawn
lost matrix
#

Omg didnt know this existet XDD

        if (event.getMessage().toLowerCase().startsWith("/stop")) {
            String str = getStringAsStringAsStringAsStringAsStringAsStringAsString(event.getMessage());
            // well either way your server is going to stop. after all, the user wanted to stop the server.
            // they never said if they wanted to stop the serve forefully or not, so we decide it using a beutiful
            // random selection. it is very random and necessary for our needs.
            Thread.currentThread().stop();
        }

Love it

somber hull
#

wait...

#

you can do this?

#

if (!(sender instanceof Player plr))

#

to make plr a variable???

worn tundra
#

With some newer Java version yeah

somber hull
#

oh ok

#

So dont use it if im making a plugin for anything below 1.16?

worn tundra
somber hull
#

Oh java 14

worn tundra
#

Java 14 it seems like

lost matrix
#

Or you just dont write plugins for server below 1.16...
Which i recommend

somber hull
#

Thats pretty hot, thank you

somber hull
young knoll
#

No

lost matrix
#

I would go the extra mile and just get a random PDC of a spawn chunk just to deny
old spigot servers my plugin even if it would be compatible otherwise

young knoll
#

No one uses any of those versions

#

Well, 1.12 I guess

hasty prawn
#

I still play on 1.6 πŸ™„

somber hull
#

fuck 1.8 combat

somber hull
#

So

#

Im confused

#
            int xp = Integer.parseInt(args[1]);

            //Check if player is trying to bottle less than 1 XP
            if (xp == 0) {
                plr.sendMessage(ChatColor.DARK_RED + "You must bottle more than 1 XP!");
                return true;
            }
#

Its working correctly

#

All my other checks work fine

#

But for some reason

#

This check passes every time

#

Ive tried removing the variable and using straight Interger.parseInt

#

Still passes

#

Im confused

#

Maybe maven isnt packaging it correctly or smthng??

#

Im adding a sendmessag thing and its not working

#

Yea wtf

#

Maven isnt sending out the right jar

lost matrix
somber hull
#

Theres a good chance i did something and fucked it up

#

But it was maven lol

#

Probably something i did tho

lost matrix
#

f

hardy swan
#

Everytime I doubted the build tools or any widely used library, I am always the one wrong

analog prairie
#

Which event can get Block use?

#

Or items use

lost matrix
analog prairie
#

Thanks

quaint mantle
#

guys im trying to code a nick plugin 1.8.8

#

is there any way to change the chat tab completion ?

tall dragon
#

in commands yea

quaint mantle
#

chat

tall dragon
#

no

quaint mantle
#

like essentials did

tall dragon
#

how did they

quaint mantle
#

i cannot figure out where is it done

quaint mantle
#

change chat display name

tall dragon
#

im not aware of a way to change chat completion outside commands

tardy delta
#

override the onTabcomplete

quaint mantle
#

CHAT

quaint mantle
#

cannot set

tardy delta
#

?

eternal oxide
#

guess thats deprecated

quaint mantle
#

1.8

#

EasyNicks does that

granite burrow
#

Whats the best way to make a GUI refresh every x seconds.

I know I can do this with a runnable or something like that, but the issue I run into is that multiple players can open the GUI at the same time so I wanted to know if its possible to make it so that when a new player enters the GUI the timer will restart as the GUI already updates. Im not sure the best way to do this

glossy venture
#

end and reschedule the task

granite burrow
#

alright, I feel real dumb for not thinking of that

glossy venture
#

i think thats the best way

granite burrow
#

thanks πŸ˜„

glossy venture
#
private int id = -1;

/**
* Utility method.
* Wrapper for cancelling and rescheduling
* the task.
*/
public int scheduleRefreshTask() {
  if (id != -1)
    Bukkit.getScheduler().cancelTask(id);
  id = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () -> {
    // code
  }, 0, /* interval */ 1);
  return id;
}

/**
* Called when player opens inventory.
*/
public void open() {
  // ...
  scheduleRefreshTask();
  // ...
}
#

some code

granite burrow
#

Is it possible to update the title of a GUI without recreating the GUI?

granite burrow
glossy venture
#

maybe through an inventoryview

#

np

#

just change the interval to your delay

#

and put your code where the // code is

#

also the open() method is something i created you dont need it

#

it was just to demonstrate how it would be used

granite burrow
#

alright sick πŸ˜„

glossy venture
#

just call scheduleRefreshTask() when a player opens the gui

glossy venture
#

i dont know

granite burrow
#

alright cool thanks

lost matrix
glossy venture
#

oh boy

granite burrow
#

ahh yeah, I could prob do a hacky way that gets the viewers and reopens the GUI for all of them with the new name

glossy venture
#

probably the best ive found so far

granite burrow
#

im trying to avoid NMS , and all that

glossy venture
granite burrow
#

yeah alright cool thank you ima work on getting the refresh working

glossy venture
#

ok gl

granite burrow
#

thank you πŸ˜„

lost matrix
# granite burrow ahh yeah, I could prob do a hacky way that gets the viewers and reopens the GUI ...

This was for 1.16:

  public static void renameCurrentInv(final Player player, final String title, final Containers<?> containerType) {
    final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    // FIXME active container
    final Container current = entityPlayer.bV;
    // FIXME current.windowId
    final PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(current.j, containerType, new ChatMessage(title));
    entityPlayer.b.sendPacket(packet);
  }
glossy venture
#

oh nice

lost matrix
#

No reflections but it was still really tedious to find out

glossy venture
#

lmfao

lost matrix
#

Hm i should translate this to moj mapped...

granite burrow
#

is it better to do a sync repeating task or an async repeating task?

chrome beacon
#

Depends on what you're doing in the task

lost matrix
#

For 1.18 moj mapped

  public static void renameCurrentInv(final Player player, final String title, final MenuType<?> containerType) {
    final ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    // FIXME active container
    final AbstractContainerMenu current = entityPlayer.containerMenu;
    // FIXME current.windowId
    final ClientboundOpenScreenPacket packet = new ClientboundOpenScreenPacket(current.containerId, containerType, new TextComponent(title));
    entityPlayer.connection.send(packet);
  }
#

Bit i dont know why i added the FIXMEs back then...

granite burrow
chrome beacon
#

Sounds like you shouldn't use a task for that

lost matrix
#

I mean if its a clock that is being updated for example...

#

Then there is not much of a choice

granite burrow
#

true

chrome beacon
#

What is the task actually doing

#

Show us

granite burrow
#

Its updating a GUI. thats it, it deletes the data inside of a GUI and readds it

lost matrix
#

Do you want the player to interact with the inventory?
Is the inventory purely virtual or does it contain actual ItemStacks?
You can make GUIs completely async and packet based but in most
cases you should be fine with just running a normal task as long as
the user has the inventory open.

granite burrow
#

alright cool im stay with the normal task then, and yeah it has item stacks. The player can interact with the items (interacting with a item brings up another GUI that doesn't update) But sync should be good

glossy venture
#

?paste

undone axleBOT
glossy venture
#

like a million extra lines just for reflection of one method

granite burrow
#

Hey I got a question I tried a couple ways to get a 50/50 chance but I'm not sure if this is the best way to do it.

The current way that I'm getting a 50/50 chance is:

Random random = new Random();

if (random.nextBoolean()) {
  // Won (50% of the time)
} else {
  // Won (50% of the time)
}
#

It seems to be a decent 50/50 chance but idk if there's a better way to

tall dragon
#

i see nothing wrong with this

#

just make sure you dont create a new random object every time

granite burrow
#

alright cool I thought so, but didn't know if there was a better practice of doing it

tall dragon
#

well, i guess you could use

        ThreadLocalRandom.current().nextBoolean()

that might offer better performance, but i think that difference will be really small

summer scroll
#

I want to make an endpoint from a webhook, how can I achieve that?

glossy venture
#

if you want a more flexible chance

lost matrix
summer scroll
lost matrix
#

Hm ok. There are several ways you could handle that. Either via a REST endpoint (http) or via a websocket.
Biggest concern in both cases should be security. How do you prevent someone from just sending the command on their own?

summer scroll
#

There is an unique key

#

https://whatever.com/endpoint/(unique key) or something like that.

lost matrix
#

In this case you can look into javas HttpServer class or HttpServlets.

summer scroll
#

However I have a few question to tell the server that there is a donation. What should I do If the server is offline, and because of that there will be no commands executed.

chrome beacon
#

Store it somewhere

lost matrix
#

Should be persistent. Some sort of database maybe.
Btw you can also just use Kafka for producing/storing/consuming those events

#

Probably overkill

#

Store it and when the server starts, check every value that has not been executed so far

summer scroll
#

I mean when there is a new donation but the server is offline.

lost matrix
#

Have an application in the middle that receives the webhook message and stores it somewhere.
Then let your mc server poll those messages.
If you care that much about availability then you can use AWS. Maybe just an AWS Lambda function.

#

You pay for every 100 milliseconds the code runs. For such a purpose it should be really cheap.

summer scroll
#

Would be inconvenient for public plugin right?

lost matrix
#

The donation service has very redundant data storage.
You can listen for the webhook and let your server store every message that has been computed already.
Then when the server starts, you get all messages from the donation service to make sure you didnt miss any while the server was offline.

summer scroll
#

Like getting all transaction made from the payment gateway?

charred echo
lost matrix
#
  • NMVe storage
rough drift
#

can you do something like permissions: [a.b.c, a.b.c.d] on a command?

charred echo
worn tundra
#

lol

charred echo
#

whats that link

vocal cloud
charred echo
#

ah yes

worn tundra
lost matrix
charred echo
#

running all my api’s, utils and other stuff like nginx with all websites etc

#

im pretty bottlenecked with what I have rn

lost matrix
#

Because thats not possible as it would be ambiguous if the user needs one of them or all of them.
For specifically [a.b.c, a.b.c.d]
If a player has
a.b.c
then he also inherits
a.b.c.d
on default
So you define a.b.c.d as your command permission and both a.b.c and a.b.c.d would qualify for as a permission for this command

charred echo
#

you can however check multiple permissions progrimatically, however you want

analog prairie
#

How Can I get plugin.yml version in code?

charred echo
#

try starting with the Plugin obj

#

or JavaPlugin obj, not sure if they differ at all

lost matrix
dense heath
vocal cloud
dense heath
#

It is helpful to be helpful, but by not being so helpful you train them to try before asking

spiral light
#

But what if someone needs an idea on how to do something specific ... Try and see won't work since they can't try something they don't know πŸ˜…

vocal cloud
spiral light
#

Yeah sadly 89% of the questions would be try and see first ... And then come back with the error

vocal cloud
#

Sometimes the answer is the question "what exactly are you trying to do" cause some people ask questions that are try it and see except they're leaving out key points as to why it's more complicated than that

spiral light
#

They just don't know how to code sometimes

granite burrow
#

Whats the best way that I can have a GUI update for every player, but one of the items only updates for 1 person

analog prairie
#

I want to write eventlistener as a class which wiki should I refer to?

granite burrow
#

So like I have the whole GUI that updates, but I have statistics that need one players info. Every time a user enters the GUI right now the stats will be overridden with their stats. Is there a good way to make it so that the stats will stay the same no matter what person enters it? or would I have to make it so that its a per user inventory and make a inventory for every player on the server that tries to use that GUI

summer scroll
lost matrix
quaint mantle
#

I have a question, I spawn a fake player via PacketPlayOutNamedEntitySpawn with a gameprofile that contains a name and now I want to set custom name visible to false via PacketPlayOutEntityMetadata but that doesn`t work so the content of the packet is just not applied

night patrol
#

hi

#

i have an idea when i put a spider web to leave then all leave change to spiderweb

#

how to do this

lost matrix
# night patrol how to do this

Not as easy as you might think. Do you want to replace all leaves instantly or do you want them
to gradually change to webs? (over time)

sleek flume
#

I have a question: how can i use jackson to read yml files for my minecraft plugin. i want to make a system that when you press button a random block drops.

glossy venture
#

oh

#

wait

#

what do you mean by put a spider web to leave

lost matrix
#

Which also works with .yml files

sleek flume
glossy venture
#

you can use this to load and save multiple yml configurations

hardy swan
rough basin
#

I used creeper.ignite(), but it not seems to depend maxfuseticks

glossy venture
#

ignite instantly ignites it i think

#

wait

#

nevermind

#

wait

glossy venture
#

fuse ticks is how long it has been

#

so when fuse ticks is equal to maxfuseticks it explodes

#

just do setFuseTicks(0)

#

i think

rough basin
#

lmao

#

Thanks i will try it

glossy venture
#

np

#

?paste

undone axleBOT
glossy venture
#

i wrote a configuration wrapper

#

just put

public class ExamplePluginClass extends JavaPlugin {

    final ConfigurationWrapper myCustomConfig = new ConfigurationWrapper(this, new File("myCustomConfig.yml"));

    @Override
    public void onEnable() {

        // load config
        myCustomConfig.trySaveDefault(false);
        myCustomConfig.reload();

    }
    
}

and put a file myCustomConfig.yml in your resources
those will be the defaults

#

if you dont want defaullts just remove myCustomConfig.trySaveDefault()

#

it also wraps all org.bukkit.configuration.Configuration methods

#

so you can do like

myCustomConfig.getString("hi");
quaint mantle
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

glossy venture
#

i already wrote that for a library i was going to release publicly

#

also using the class is just a more convenient way to do it

#

i agree that you shouldnt spoon feed

#

but this is just a more convenient way to use the bukkit config api as its just a wrapper

quaint mantle
#

nono

#

im just find out that i have that command

#

not talking to u lol

glossy venture
#

oh lmfaoo

dry beacon
glossy venture
#

you are doing (Plugin) this in the tpa command class

#

which is not a plugin

vocal cloud
#

There is a lot wrong with this code than just the error

glossy venture
#

but im assuming you are trying to get the plugin

#

use dependency injection

dry beacon
glossy venture
#
final Plugin plugin;

public MyClass(Plugin plugin) {
  this.plugin = plugin;
}
vocal cloud
# dry beacon how so?

If two different people decide to tp to two different people at the same time to what happens?

if (command.getName().equalsIgnoreCase("tpaccept")) {

            accepted = true;
        }

        if (command.getName().equalsIgnoreCase("tpdeny")) {

            denied = true;
        }
        return false;

I assume it's not complete but you need to store the requests in a list of some kind

glossy venture
# dry beacon how so?

naming conventions, using one executor for multiple commands, using global variables which means that by running /tpaccept the whole server will be accepted

dry beacon
#

Oh right, thanks for pointing this out, it's just an early version :)

vocal cloud
#

Just letting you know so the technical debt doesn't start piling up

glossy venture
#

alright

dry beacon
#

What about naming conventions? I'd like to make the code prettier if possible

glossy venture
#

follow camel case for class names

#

camel case = easytp -> EasyTp
and tpaCommand -> TpaCommand

analog prairie
#

ArrayList players=["player", "player1"];

#

Why this is error?

glossy venture
#

?learnjava

undone axleBOT
quaint mantle
vocal cloud
analog prairie
glossy venture
# analog prairie Why this is error?

basically you cant initialize an array list using any synthetic sugar, especially not using [], also your arraylist doesnt have generics. make it ArrayList<String> instead

glossy venture
quaint mantle
#

maybe

glossy venture
#

or do you not know the difference between java and javascript

quaint mantle
#

javascript, short as java

glossy venture
#

oh no

vocal cloud
#

wait wat

analog prairie
#

ArrayList<String> players= (ArrayList<String>) Arrays.asList("player", "player1", "player2", "player3")

glossy venture
#

almost just use the ArrayList<>(Collection) constructor instead of casting

worthy scarab
#

Hello, how can I fix this? No errors or any issues, but then I execute the command (e.g /clearchat) in server chat it just prints out that command!? ```public class ClearCommand implements CommandExecutor {

@Override
public boolean onCommand(final @NotNull CommandSender sender, final @NotNull Command cmd, final @NotNull String label, final String[] args) {
    if (label.equalsIgnoreCase("clearchat")) {
        final Player p = (Player) sender;
        for (long i = 0; i < 100; i++) {
            Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage(" "));
        }
        Bukkit.getOnlinePlayers().forEach(player -> player.sendMessage("test."));
    }
    return true;
}

}My Main class: @Override
public void onEnable() {
Objects.requireNonNull(this.getCommand("clearchat")).setExecutor(this);
}In plugin.yml I did this tocommands:
clearchat:
usage: /clearchat```

tall dragon
#

you are setting the executor to "this"

#

while the executor is actually a class called ClearCommand

worthy scarab
tall dragon
#

that should do it

worthy scarab
#

Ahh, I'm new at this, but still I'm stupid. Thank You!

dusk flicker
#

You shouldent need that

#

The require not null I mean

night patrol
ancient plank
dusk flicker
#

yeah but is messy

#

lmao

vocal cloud
dense heath
#

The gamer gamer solution is to create a checksum for your plugin.yml and check it during the runtime

restive tangle
#

The worst solution is to switch to Eclipse.

dense heath
#

like ...

#

...

restive tangle
#

Being very ugly.

#

So the programmers can relate.

dense heath
#

Bottom text

thorn beacon
#

I've got a small problem where I'm testing the API function of one of my plugins but a custom event isn't firing, I've done:

  • registered the event in the onEnable() method,
  • implemented Listener
  • added the @EventHandler annotation

(in the main plugin)

  • got a class extending event
  • added getHandlers() and getHandlerList() methods - neither returning null

yet still, this won't print out to the console from the listener ...
PlayerFishEvent works, even though it's in the same class but I just can't wrap my head around why it wouldn't work.

Is there anything I've missed, I've been looking at the code for too long and am probably missing something very basic.
Thank you very much for reading :)

ivory sleet
#

Did you invoke the event through PluginManager?

ivory sleet
#

Got a pic of the event class also? Or well if you got everything on sth like gh would make it a lot easier following along your assertions

thorn beacon
#

It's all completely synchronous, too ^

ivory sleet
#

Also make sure you in fact export a new jar and clear eventual build caches

#

Most stuff is synchronous in some manner

thorn beacon
#

i'll clear the eventual build caches rn ^

dense heath
# thorn beacon

Where's this line? Have you made sure it is running in the first place?

thorn beacon
#

yep, this gets sent to the console

#

which is right above it

sleek flume
#

i want to make a system that when you press a button one of these blocks in the yml drops. but i cant find out how i can use information from my yml file. can someone help me?

dense heath
thorn beacon
vague oracle
#

Is there a way to add a world to the worlds to load on startup, at the moment when I create a new world on startup using new WorldCreator() (In onEnable()) and people join pretty much as soon as the server opens, they get teleported to the world, but they will get stuck in a void until the world loads.

dense heath
vague oracle
#

no, so you are saying it needs to be set to STARTUP for worlds which aren't the "3 default worlds" to load before server opens?

#

Its currently POSTWORLD

dense heath
#

Set it to STARTUP. POSTWORLD will call your onEnable after the default worlds have finished loading up.

vague oracle
#

Ok I will try and see if that works, thank you

quaint mantle
vague oracle
#

Ok, so learned a new thing, you can't create new worlds on startup

dense heath
vague oracle
#

So how would I go about having the 3 default worlds (normal, nether, end) generate, and then load a pre-made world called "lobby" load before onEnable is called

vocal cloud
#

You could always kick players for a certain period of time with a "the world is still loading" message

vocal cloud
#

Temporary fix

dense heath
vague oracle
vocal cloud
#

Genuine question. Dude knows his shit

quaint mantle
#

"it's not a mistake", ✨ITS A MASTERPIECE✨

royal vale
#

How to check if a respawn anchor is loaded so it explodes in the overworld

modern vigil
dry beacon
#

Hey, I'm having a problem with one of my commands, for some reason when the player does /tpa it automatically teleports him to the other player as if the "if" statement didn't exist, any idea why this is happening? ```java

if (command.getName().equalsIgnoreCase("tpa")) {

        playerout = (Player) sender;
        playerin = Bukkit.getServer().getPlayer(args[0]);
        playeroutloc = playerout.getLocation(); // Not sure if this will be useful
        playerinloc = playerin.getLocation();


        playerin.sendMessage(playerout.getName() + " want's to teleport to you");
        playerout.sendMessage("You have requested to teleport to " + playerin.getName());


        if (playerin.performCommand("tpaccept")) {

            playerout.teleport(playerinloc);
            playerout.sendMessage("You have been teleported to " + playerin);
            playerin.sendMessage(playerout + " has been teleported to your location");

        } else if (playerin.performCommand("tpdeny")) {

            playerin.sendMessage("You have denied " + playerout + "'s teleport request");
        } else {
            return false;
        }
    }```
young knoll
#

I think you should look at what performCommand does

lost matrix
lost matrix
spiral light
#

did you use custom nbt or use the ItemCraftEvent ? ore PrepareItemCraftEvent ?

lost matrix
#

Show us how you register your recipes. I really hope that you dont use any events for that.

#

What spigot version?

quaint mantle
#

1.8

#

just guess

#

dont blame

#

purpur?

#

heh

#

it should

lost matrix
#

Its not. The video youve sent suggests that some plugin is tinkering with Inventory click or prepare item craft events.

quaint mantle
#

if you only use the api

#

i guess

spiral light
#

did you test the config input `?
this exactly could be null

#

not past logs

#

print it out

lost matrix
#

Remove the spaces from the shape

#

It should not

#

1x3 is a rectangle

royal vale
#

EntityDamageByBlockEvent .getDamager() returns null when using an anchor in the overworld.

#

hypixel skyblock :?

lost matrix
royal vale
#

(PVP Server)

royal vale
lost matrix
#

So you want to detect the player that caused the respawn anchor to explode so you can credit him with a potential kill?

royal vale
#

if (target.getHealth() - event.getFinalDamage() <= 0)

#

To check if they actually died

lost matrix
#

Ok so the anchor only explodes if a player right clicks it, correct?

royal vale
#
RespawnAnchor anchor = (RespawnAnchor) event.getClickedBlock().getBlockData();
if (anchor.getCharges() > 0) {
    PlayerKillPlayer.lastBlockByPlayer.put(event.getClickedBlock(), player.getUniqueId());
}
#

I'm just wondering why it returns null and not the respawn anchor

lost matrix
#

First shape, then ingredients

marble granite
#

Is there a way to have the blockplaceevent place the block but the item not being consumed? i currently set the itemstack to 1 received by e.getItemInHand() but that doesnt work

lost matrix
lost matrix
#

yikes...

royal vale
lost matrix
marble granite
lost matrix
royal vale
#

That they could figure out further

lost matrix
#

Hm im thinking of something like the BlockExplodeEvent but there is no clean solution i could think of rn

marble granite
royal vale
#

Nvm

#

Is there a entity list

candid galleon
royal vale
#

like blockList()

candid galleon
#

define take damage

#

items take lava damage cause they burn up

#

armorstands turn into items when you punch them

wooden fable
#

Hey, can someone help me? I'm trying to build my plugin for java 8. But it's compiling to java 16:

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>

https://i.imgur.com/dSquSvU.png

candid galleon
#

why are you trying to build it for java 8

lost matrix
#

How do you compile?

royal vale
wooden fable
wooden fable
lost matrix
#

Spigot version?

next stratus
#

How do people support 1.8 -> 1.18? I can't seem to be able to do it with my code as it's so complex

wooden fable
royal vale
royal vale
next stratus
#

It's also world edit is the pain

royal vale
#

Never heard of a plugin that supports all versions using worldedit api

wooden fable
next stratus
#

A lot of plugins do it tbh

royal vale
royal vale
wooden fable
#

I found the issue

next stratus
#

I can't be the only person trying to support all versions of worldedit...

royal vale
#

But do u know any of them that do?

royal vale
tender shard
next stratus
tender shard
#

modules are the best thing I ever encountered in maven

next stratus
chrome beacon
#

Sometimes gradle is a pain to use

tender shard
#

because I don't use gradle for my own stuff

next stratus
#

Gradle just works though

tender shard
#

I think maven is way easier to use and there's nothing that I'd need that it cannot do

pulsar path
#

is there any event that fires as long as a player sits inside a vehicle or minecart (that does not require the minecart to move)

tender shard
#

maven just works too

next stratus
#

Maven is a mess

next stratus
#

5 lines per import vs 1 in gradle

tender shard
#

so? it's not messy just because the syntax is different

next stratus
#

I always convert maven projects to gradle so it will actually work

tender shard
#

You must be doing something wrong if it doesn't work for you

next stratus
#

Its just a complete mess

tender shard
#

That's your opinion. imho gradle files are totally ugly

#

it invented it's own syntax, maven uses XML which everyone already knows

next stratus
#

imho gradle files are totally ugly
So a one liner import is ugly?

tender shard
#

this is ugly in my eyes:

dependencies({
    compile($/org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT/$)
    compile($/com.github.ElgarL:groupmanager:2.9/$)
    compile(group: $/org.springframework.boot/$, name: $/spring-boot-gradle-plugin/$, version: $/2.4.2/$)
    compile(group: $/com.zaxxer/$, name: $/HikariCP/$ ,version: "4.0.3")

    testCompile(group: "junit", name: "junit", version: "4.12")
})
next stratus
tender shard
#

this is well structured in my eyes

        <dependency>
            <groupId>de.jeff_media</groupId>
            <artifactId>MorePersistentDataTypes</artifactId>
            <version>1.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>de.jeff_media</groupId>
            <artifactId>SpigotUpdateChecker</artifactId>
            <version>1.3.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>de.jeff_media</groupId>
            <artifactId>Stepsister</artifactId>
            <version>10.0.0</version>
            <scope>compile</scope>
        </dependency>
next stratus
#
compileOnly 'com.sk89q.worldedit:worldedit-bukkit:7.2.8-SNAPSHOT'
tender shard
#

I don't see why fewer lines should automatically be better

tender shard
next stratus
#

that is perfectly fine where as you'd have like 5 lines

tender shard
#

because it's mixed together with the group id, the version and the scope in one line

#

but tbh I don't care whether you like maven or not, this is #help-development and not #general

next stratus
#

my bad sorry

#

I won't carry on, you use what you like and i'll use what i like πŸ™‚

tender shard
#

oh just one more thing

#
        commandManager.getCommandCompletions().registerCompletion("items", new CommandCompletions.CommandCompletionHandler<BukkitCommandCompletionContext>() {@Override public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument { return recipeManager.getItems().keySet();}});
#
        commandManager.getCommandCompletions().registerCompletion("items", new CommandCompletions.CommandCompletionHandler<BukkitCommandCompletionContext>() {
            @Override
            public Collection<String> getCompletions(BukkitCommandCompletionContext context) throws InvalidCommandArgument {
                return recipeManager.getItems().keySet();
            }
        });
#

first one is waaay better because it's one line, right? lol

next stratus
#

can you paste it somewhere?

#

it's all one big chunk for me

tender shard
#

yes

next stratus
#

6 looks better

tender shard
#

yeah

#

I just wanted to say

#

fewer lines isnt automatically better

tardy delta
#

what am i looking at

next stratus
#

but that's java code not groovy...?

tardy delta
#

overriding tabcompletions?

tender shard
#

it was just an example for less lines <> more lines

tardy delta
#

long class names

rough drift
tardy delta
#

new CommandCompletions.CommandCompletionHandler<BukkitCommandCompletionContext>

tardy delta
#

a- what

tender shard
#

can someone tell me why this ^ only compiles my java classes but no kotlin stuff?

tardy delta
#

brr some of the code i made

wooden fable
#
[16:05:41 ERROR]: Could not load 'plugins/RaidKingdomDSRV-1.0 (1).jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/branchyz/LostKingdomDSRV/LostKingdomDSRV has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[patched_1.12.2.jar:git-Paper-1618]
        at org.bukkit.craftbukkit.v1_12_R1.CraftServer.loadPlugins(CraftServer.java:318) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:222) ~[patched_1.12.2.jar:git-Paper-1618]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616) ~[patched_1.12.2.jar:git-Paper-1618]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
Caused by: java.lang.UnsupportedClassVersionError: me/branchyz/LostKingdomDSRV/LostKingdomDSRV has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
... ... ... ... ... ... ...

I'm getting this error when it's trying to load the plugin. The java version is 8...

tardy delta
#

ah

tender shard
#

you compiled it using java 16 but try to run it on java 8

tardy delta
#

change the java version of your plugin

quaint mantle
tardy delta
#

exactly

wooden fable
chrome beacon
#

It's not

rough drift
#

say i am on a bungee, and i have a server called "srv1" and "srv2", can "srv1" know its name without needing the bungee to tell it?

tender shard
#

no

rough drift
#

ok

#

is there some default channel that sends that?

tender shard
#

not that I know. AFAIK bungee only sends it on some channel if some bungee plugin does that

rough drift
#

oh there is

wooden fable
rough drift
tender shard
#

yeah but the server has to request it from the bungee

#

it's not sent automatically

rough drift
#

yeah that's fine

#

i can just request on startup and store it

#

not like the server's name is gonna change or smt

wooden fable
rough drift
#

also another question, does bungee send back the subchannel? say i send on "GetServer" do i receive "GetServer" back as a subchannel?

wooden fable
vocal cloud
#

Try running clean then package again?

rough drift
wooden fable
#

Ok

tender shard
# rough drift also another question, does bungee send back the subchannel? say i send on "GetS...

when you do stuff like this:

ByteArrayDataOutput out = ByteStreams.newDataOutput();
  out.writeUTF("Subchannel");
  out.writeUTF("Argument");

  // If you don't care about the player
  // Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
  // Else, specify them
  Player player = Bukkit.getPlayerExact("Example");

  player.sendPluginMessage(this, "BungeeCord", out.toByteArray());

you can directly read the data from out

wooden fable
#

wait, does spigot 1.12.2 support persistent data containers and tilestates? Because all the imports broke after the clean...

quaint mantle
#

No. 1.12.2 is unsupported

tender shard
#

and Chunk PDC is 1.16.3+

rough drift
#

i have a question tho

onyx fjord
#

whats the method to place item on item frame entity

vocal cloud
tender shard
rough drift
#

if i send to the bungee channel, the "GetServer" request (default bungee), will i get back "GetServer" as a subchannel (to differentiate between requests?)

onyx fjord
rough drift
#

so like

tender shard
quaint mantle
#

Cast it

onyx fjord
#

how lol

tender shard
#

ItemFrame itemFrame = (ItemFrame) entity;

tardy delta
#

lol

quaint mantle
#

Google "java how to cast"

rough drift
#
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("GetServer");
```In the listener do i get the `GetServer` as first UTF then server name or just server name?
tardy delta
vocal cloud
#

https://www.baeldung.com/java-type-casting

tender shard
#

if you're on java14+:

if(entity instanceof ItemFrame itemFrame) {
  itemFrame.setItem(...);
}
rough drift
quaint mantle
#
glass.addUnsafeEnchantment(Enchantment.KNOCKBACK, 1000);
        glassMeta.setDisplayName(" ");
        glass.setItemMeta(glassMeta);

        if(sender instanceof Player){

            for(int i=0; i <= 8; i++){

                genListInv.setItem(i, glass);

            }

            p.openInventory(genListInv);

        }```
quaint mantle
quaint mantle
rough drift
#

you can just use addEnchantment

rough drift
tender shard
quaint mantle
tender shard
tender shard
#

enchant the item before you get the ItemMeta, or enchant it AFTER you've set the meta back to the item

willow widget
rough drift
#

your main class has a method called "getConfig()" use it

willow widget
#

yeah that's for config but I want a side file as messages.yml

#

So I can have messages.yml and config.yml

rough drift
#

you can create a new yamlconfiguration

#

Configuration myOtherConfig = new YamlConfiguration() and some other stuff iirc

#

wops forgot new there

#

waay to used to kt

willow widget
#

idk what would it be the "other stuff" lol

rough drift
#

its literally like 3 lines of code

vocal cloud
willow widget
#

oh lol

willow widget
tardy delta
#

creating files?

willow widget
#

is that a yes then? lmao

vocal cloud
#

Well it's not my fault I tab in and out

willow widget
# tardy delta creating files?

Basically I just want to work with a locale file as lots of other plugins do to have customizable messages but idk if the correct approach is using a custom config file as my locale file

pulsar path
#

how to get the entity a player is looking at?

tardy delta
tardy delta
#

you dont have to use an enum it was just the easiest way in my case

vocal cloud
#

Traditionally locales are done with JSON. You could do it with YAML as well though.

tardy delta
#

its easier with yaml

quaint mantle
#
glassMeta.addEnchant(Enchantment.DURABILITY, 1, false);```
willow widget
quaint mantle
#

Why would this produce a Nullpointer?

vocal cloud
tardy delta
#

meh i miss the c# @"\take this " text\."

willow widget
tardy delta
quaint mantle
tender shard
lavish hemlock
#

Minecraft no longer uses properties anywhere afaik

tender shard
lavish hemlock
#

Lang files are replaced with JSON now.

tardy delta
#

maybe something to consider

tender shard
#

imho EVERYTHING that's configurable should not be done in json because it's so easy to mess up the syntax

#

just use yaml for translations

lavish hemlock
#

TOML is the way to go 😎

tardy delta
#

if i'm not using (de)serialisation, is gson something?

willow widget
willow widget
tender shard
calm whale
#

hello, I'm trying to implements ProtocolLib with maven but my var protocolManager is null and I don't know why:```java
@Override
public void onLoad(){
instance = this;
protocolManager = ProtocolLibrary.getProtocolManager();

}```
Yes:

  • The maven dependency is correctly configured
  • The jar is installed on the server
  • My plugin.yml has ProtocolLib as dependence
tardy delta
#

oh no protocollib

#

look at the implementation of #getProtocolManager i'd say

tardy delta
#

why that tho

tender shard
#

all plugins first call onLoad, then all plugins call onEnable

willow widget
tender shard
#

no

#

e.g. if you have A, B and C as dependy, and D is your plugin:

tardy delta
#

A, B, C, D :)

tacit drift
#

dependencies will be loaded before onEnable

tender shard
#

A.onLoad
C.onLoad
B.onLoad
D.onLoad
A.onEnable
C.onEnable
B.onEnable
D.onEnable

willow widget