#help-development

1 messages · Page 2017 of 1

earnest forum
#

i set it to white using dustoptions

young knoll
#

I think it also takes some data from the offset

#

Idk particles are kinda weird

earnest forum
#

no thats the firework effect i think

#

redstone takes color from dustoptions

vale ember
#

are nms versions for 1.18 and 1.18.2 different?

earnest forum
#

probably

young knoll
#

Yes

waxen plinth
#

Ok it's been long enough without me saying anything so I gotta ask

#

Why the stonetoss pfp

young knoll
#

The what

waxen plinth
#

Looks like stonetoss

#

A webcomic artist who is a known nazi

#

And that is not an exaggeration

earnest forum
#

if i wanted to make 2 different types of beacons

#

like 1 that has blue particles and one that has red

#

how would i do that?

#

listen to block place event, then add it to a list?

quaint mantle
#

@waxen plinth Some help: Im trying to be able to make it so that a value updates in my Confirm thingy when clicking confirm or deny, but I cant see to ever get it, any reason why?

devout canyon
#

amogus

waxen plinth
quaint mantle
#

ill send code if i have to

amber marsh
#

how

waxen plinth
#

good question

#

the answer is 42

amber marsh
#

how do you get spigot score from armor stand

#

pls

waxen plinth
#

spigot score?

#

what are you talking about

amber marsh
#

sorry, I have been at this for an hour XD

#

scoreboardManager.getMainScoreboard().getObjective("Time").getScore(cardStand).setScore(10);

quaint mantle
#

invClickDetector

Confirm.getMap().get(event.getClickedInventory()).Finish(true);
``` (yes static abuse dont cry)

Confirm thingy
```java
public static HashMap<Inventory, Confirm> map = new HashMap<>();
    private Inventory gui;
    private AtomicReference<Boolean> allowClose = new AtomicReference<>(false);
    private AtomicReference<Boolean> optionResult = new AtomicReference<>(null);

    public Confirm(Player p, ItemStack confirmItem) throws InterruptedException {
        gui = Bukkit.createInventory(this, 9*1, ChatColor.GREEN + "Confirmation");
        map.put(gui, this);
        allowClose.set(false);
        init(p, confirmItem);
    }

    public static HashMap getMap(){
        return map;
    }

    public void Finish(Boolean result){
        optionResult.set(result);
        allowClose.set(true);
    }

    public Constable getResult(){
        return optionResult.get();
    }
amber marsh
#

this bit of code throws an error because cardStand is an armor stand

young knoll
#

I think you need to us the uuid of the stand

#

As a string

waxen plinth
#

^

young knoll
#

Scoreboards are weird and use strings for everything

amber marsh
#

ok

quaint mantle
#

any reason why its not letting me get anything?

waxen plinth
#

Why are you using AtomicReference

quaint mantle
#

i have 0 idea why id be using them otherwise

waxen plinth
#

Also not sure what you mean by "not letting me get anything"

quaint mantle
#

in the invClickDetector

young knoll
#

Atomic references are for thread safety

#

But that all looks single threaded

quaint mantle
#

I'm querying db on a join/leave event, would I do it on a new thread or not?

waxen plinth
#

Probably a good idea yeah

young knoll
#

Do it async

sharp flare
#

New

waxen plinth
#

If it's sqlite then you can get away with sync queries if you do enough caching

quaint mantle
#

@waxen plinth help when opening the ui this happens:

13.03 06:47:27 [Server] Server thread/WARN Task #14135826 for EmeraldsPlugin v1.0.0 generated an exception
13.03 06:47:27 [Server] INFO net.minecraft.server.CancelledPacketHandleException: null

invClickEvent

}else if(holder instanceof Confirm){
                Material itemType = event.getCurrentItem().getType();

                if(itemType == Material.LIME_STAINED_GLASS_PANE){
                    Confirm.map.get(event.getClickedInventory()).Finish(true);
                }else if(itemType == Material.RED_STAINED_GLASS_PANE){
                    Confirm.map.get(event.getClickedInventory()).Finish(false);
                }
            }

confirm ui

    public void Finish(Boolean result){
        this.optionResult = result;
        this.allowClose = true;
    }

    private void init(Player p, ItemStack confirmItem) throws InterruptedException {
        ItemStack[] menu_items = {
                confirm,confirm,confirm,nin,confirmItem,nin,deny,deny,deny,
        };
        this.gui.setContents(menu_items);
        p.openInventory(this.gui);

        Bukkit.getScheduler().runTaskTimer(EmeraldsPlugin.jp, t -> {
            if(!this.allowClose && !p.getOpenInventory().getTopInventory().equals(this.gui)) {
                p.openInventory(this.gui);
            }else if(this.allowClose){
                p.closeInventory();
                map.remove(this.gui);
                t.cancel();
            }
        }, 1, 1);
    }
waxen plinth
#

But for mysql you can't

quaint mantle
#

all the code you need rlly

waxen plinth
quaint mantle
#

it errors at the scheduler

waxen plinth
#

I am already in the chat

young knoll
#

There’s a AsyncPlayerPreLoginEvent that exists for you as well

quaint mantle
#

i keep forgetting

#

but i have 0 idea why its doing this

quaint mantle
#

Did I even do the ui right?

quaint mantle
#
13.03 07:03:05 [Server] Craft Scheduler Thread - 62/WARN Plugin EmeraldsPlugin v1.0.0 generated an exception while executing task 14733871
13.03 07:03:05 [Server] INFO net.minecraft.server.CancelledPacketHandleException: null
#

Did i do msth wrong or smth

ornate patio
#

does BukkitScheduler#getPendingTasks() return a list of tasks from all plugins or just the plugin it was invoked in?

opal juniper
waxen plinth
#

Yeah it's nearly 4am and I ran out of steam for helping people

#

There's only so much of the same stuff I can help people with over and over before it drains me

#

Why does no one ever have cool algorithms questions 🙃

ornate patio
#

I'm trying to implement an asynchronous BukkitTask that will loop infinitely (yes, i know BukkitTask#scheduleAsyncRepeatingTask exists, however I'm planning to add random delays)

scheduler.runTaskLaterAsynchronously(main, new Runnable() {
    public void run() {
        if (hasGreaterThanDrunkPercent(player, 0)) {
            randomMove(player);
            
            scheduler.runTaskLaterAsynchronously(main, this, 20L);
        }
        else {
        
        }
    }
}, 20L);

I'm just wondering if the line:
scheduler.runTaskLaterAsynchronously(main, this, 20L);
will cause any infinite recursion errors

waxen plinth
#

Pretty sure that's gonna endlessly schedule itself and crash the server or something

ornate patio
#

I'm gonna add some logic for that dw

waxen plinth
#

Oh wait

#

It's not repeating

#

No that should be fine then

ornate patio
#

it's supposed to be repeating though

waxen plinth
#

Don't use new Runnable though

#

Use a lambda

#

`() -> {

}`

#

Much more compact

ornate patio
#

oh k

#

but how would i make the lambda call itself?

#

using this?

waxen plinth
#

Should still work

ornate patio
#

alright

waxen plinth
#

Kinda funky

sharp saffron
#

hey I dont know if anyone has any experience with this but i am aware that you can make custom items via the custom model data so does custom block data work for custom blocks aswell ?

waxen plinth
#

I have a library that lets you do custom blocks

#

It's not in base spigot

sharp saffron
#

is it public?

waxen plinth
#

Yes

#

Let me pull up the wiki page

sharp saffron
#

k ty

waxen plinth
ornate patio
#

yeah i might need to use runnable

waxen plinth
#

Show code please

ornate patio
#
scheduler.runTaskLaterAsynchronously(main, () -> {
    if (hasGreaterThanDrunkPercent(player, 0)) {
        randomMove(player);
        
        scheduler.runTaskLaterAsynchronously(main, this, 20L);
    }
    else {
    
    }
}, 20L);
waxen plinth
#

You might need to put Runnable.this

#

Instead of just this

ornate patio
sharp saffron
#

just a few questions

waxen plinth
#

Really?

#

That's odd

#

Well then I guess you do need the anonymous class definition

sharp saffron
#

so are the blocks like armor stands or something

ornate patio
#

alright

waxen plinth
ornate patio
#

but the code i had before won't cause recursion issues correct?

waxen plinth
#

It shouldn't

ornate patio
#

alrighty

quaint mantle
#

For some reason, it always returns as none. Any idea why?

public Confirm(Player p, ItemStack confirmItem) {
        gui = Bukkit.createInventory(this, 9*1, ChatColor.GREEN + "Confirmation");
        this.optionResult = "none";
        map.put(gui, this);
        init(p, confirmItem);
    }

    public void Finish(Player p, Boolean result){
        this.optionResult = result;
        map.remove(gui);
        p.closeInventory();
    }

    public Object getResult(){
        return this.optionResult;
    }
Confirm result = new Confirm(clickedPlayer, tempItem);

                    int set = Bukkit.getScheduler().scheduleSyncRepeatingTask(EmeraldsPlugin.jp, () -> {
                        clickedPlayer.sendMessage((String) result.getResult());
                        if (result.getResult() != "none") {
                            clickedPlayer.sendMessage(result.getResult() + "!!!!!!");
                        }
                    }, 0, 0);
sharp saffron
waxen plinth
#

I still don't know what you were asking about it

quaint mantle
#

Ill give detail rq

#

Basically, tryna make a confirm or deny gui

#

but its not working as intended

waxen plinth
#

Not you

quaint mantle
#

I want it to return true if confirm- oh

#

Damn

waxen plinth
#

Sorry I'm not in the headspace to look through big code blocks with a vague description of what's wrong with them and figure out what's wrong with them

fringe latch
fringe latch
#

this.optionResult

quaint mantle
#

o

quaint mantle
#

it was set to Object

elfin steppe
#
    @EventHandler
    public void onInventoryClick(final InventoryClickEvent e) {
        if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Center")) {
                Location main = new Location(Bukkit.getWorld("world"), 139.5, 8.0, 75.5, 180, 0);
                Player p = (Player) e.getWhoClicked();
                p.teleport(main);
                new Beast().giveKit(p);
                return;
        }
        e.setCancelled(true);

How do I refer to a certain armorstand in this event? I have different armorstands one called Beast, one called Runner n one called Axeman (for ffa kits).

#

Like i need an if statement (if the armorstand is called beast or something like that)

fringe latch
elfin steppe
#

I'm making an FFA plugin with ArmorStand kits system. I have an as for each kit.

fringe latch
#

like, you're inside an InventoryClickEvent, what armor stand are you even talking about?

elfin steppe
#

Because

#

I need to check

#

If it's the 'Center' item from the inventory that belongs to the beast armorstand that has been clicked

#

Or if it's the center item from the inv that belongs to runner

#

or axeman ^^

fringe latch
#

i see, so someone is clicking an armor stand which pops up an inventory?

elfin steppe
#

So when you right click the as u get an inventory where u can chose the spawns

#

Yes

#

Indeed

#

Now i want to check which of the as so i can give them the right kit

#

As you can see this line

#
new Beast().giveKit(p);
fringe latch
#

well, you could try creating a map where you would write the clicked entity when a player clicks it

#

and then you may retrieve it later by their name or uuid or sth

elfin steppe
#

Okay yeah

#

Isn't there a waay to

#

way to*

#

ok no nvm

quaint mantle
#
Bukkit.getScheduler().runTaskTimer(plugin, t -> {
  // do stuff
  if (shouldCancel) {
    t.cancel();
  }
}, 1, 1);
#

Can you make a looping task?

#

So it loops til its cancelled?\

ornate patio
#

am I able to use Player in a TreeMap?

#

private TreeMap<Player, TreeMap<Behavior, BukkitTask>> playerBehaviorTasks = new TreeMap<Player, TreeMap<Behavior, BukkitTask>>();

quasi flint
#

I would advise to use uuid

fringe latch
ornate patio
#

i'm getting an error when trying to access the treemap using Player

#
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer cannot be cast to class java.lang.Comparable (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer is in unnamed module of loader java.net.URLClassLoader @18769467; java.lang.Comparable is in module java.base of loader 'bootstrap')
#

so i'd assume not

quasi flint
#

You sir are casting something very wrong

ornate patio
#

im not casting anything

quasi flint
#

Show your code and change from player to uuid

ornate patio
#

TreeMap<Behavior, BukkitTask> behaviorTasks = playerBehaviorTasks.get(player);
this is causing it

#

where player is a Player

#

yeah i can just use UUID then

ivory sleet
#

How do you use the comparator

#

Since TreeMap is kinda sorted by the comparator

ivory sleet
quaint mantle
#

there is no way to use cancel

#

also as @ivory sleet stated

#

im tring to use the better way, but I want it looped

#

but cancelable

#

god I BADLY need help

#

somebody PLEASE

elfin steppe
#

@quaint mantle maybe create a thread n u'll get helped faster

quaint mantle
#

I need this fixed now however

elfin steppe
#

okay true

#

Well i'm a full beginner so I can't help you out sorry 🙁

ivory sleet
#

Use a BukkitRunnable in case you want it to be cancellable outside and inside

#

?scheduling does take this up

undone axleBOT
ivory sleet
#

Give it a read (:

smoky oak
#

question, if i make a class extend Event, can another plugin implementing it listen to that, and where in the event's execution would it trigger, also, do i manually need to do a check if the event is disabled?

quaint mantle
wheat abyss
#

Guys sorry im bad at this, Is this static abuse

smoky oak
#

I think thats normal practice though i just skip the null check since i know i need it anyways

ivory sleet
#
  1. Yes
  2. For every listener they have declared and register would it trigger given (you need to use PluginManager::callEvent)
  3. By disabled you mean cancelled? Yes you do
#

Moterius

ivory sleet
smoky oak
wheat abyss
#

Oh ok, thanks, Im not exactly knew to this (3 years) but I never really understood static abuse, or more like what isnt

ivory sleet
#

As there can ever only be one instance of PluginMain, but since you call new PluginMain(), you’re creating a new instance of it

#

Moterius basically

#

Well

wheat abyss
#

when it cancelled it should just stop right

ivory sleet
#

Not inside the Event

#

But where you invoke from

wheat abyss
ivory sleet
#

?event-api moterius did you read this?

undone axleBOT
smoky oak
#

ah no

#

im not aware yet of all the resources on spigot

#

mainly because half of the time i cant even access it

ivory sleet
#

Lol no worries

#

Ah, anyhow I believe they go through it how to use custom events there

#
class MainPluginThing extends JavaPlugin {
  static MainPluginThing instance;
  static getInstance(){ return instance;}
  @Override void onEnable(){
    instance = this;
  }
}```

@wheat abyss do it like this
#

In this way you’re not creating any new objects/instances/samples of MainPluginThing

smoky oak
#

?staticabuse

#

worth a try

ivory sleet
#

Lol

wheat abyss
ivory sleet
#

Myeah, static abuse is sometimes subjective tho

wheat abyss
#

Actually wait thats what I use to do before the thing I do now

#

dang now i feel dumb lmao

dawn hazel
#

me whos guilty of static abuse

wheat abyss
#

Honestly if it doesnt break anything I dont see anything wrong with it

dawn hazel
#

extremely guilty of static abuse

wheat abyss
#

WOA

ivory sleet
#

dataNotStatic do be vibin’

wheat abyss
#

Tru

wheat abyss
ivory sleet
#

But yeah, Skygamez it’s worth looking into a more robust approach in the conceivable future

smoky oak
#

Uh Conclure, where is the method body? I only see getters & a constructor

wheat abyss
#

But hey if it works

dawn hazel
#

honestly i dont really see a reason to fix it though because nothing has broken (yet) and i havent noticed any preformance issues

#

plus i have a large list of stuff i need to do before this server releases

wheat abyss
#

I used to do that, but honestly I just feel better/cooler when not doing it lol

crimson terrace
#

isnt static less performance heavy than having a getter?

ivory sleet
#

no

smoky oak
ivory sleet
#

static isn’t less performant in terms of speed at all

crimson terrace
smoky oak
#

there's not said which method gets executed

wheat abyss
#

lol

smoky oak
#

is it the constructor?

ivory sleet
#

In fact static is usually faster than non static

smoky oak
#

because that would be wreally weird

crimson terrace
#

double negation there

dawn hazel
#

ill fix it once being guilty of static abusing puts me in java jail

dawn hazel
#

aka when all my crappy coding finally catches up to me and starts causing issues on my server

ivory sleet
#

But given that static stubs out all possible abstractions

#

It’s pretty bad most of the times

dawn hazel
#

i dont rlly have time to fix it either lol

#

i have about 7 custom plugins i need to get done

crimson terrace
#

seems like youre guilty of accepting too much work at once

dawn hazel
#

cause i dont have time to refactor about 10 different classes

wheat abyss
dawn hazel
#

an entire network

wheat abyss
ivory sleet
dawn hazel
#

and i need to get done a reporting system, revamp my basics plugin, fix the slashhub plugin, configure a ton of plugins, figure out how to use webhooks in java, make a discord bot, and a bunch of other stuff

smoky oak
dawn hazel
#

aswell as fixing the issue with tabcompletion

smoky oak
#

hence my confusion

dawn hazel
#

so yeah i have a lot of work to do

wheat abyss
#

May I dm you Sky? I could try to help if you would like

dawn hazel
wheat abyss
#

pog

dawn hazel
#

but i dont exactly have the money to pay for developers at the moment

wheat abyss
#

Oh thats fine

ivory sleet
wheat abyss
#

I dont exactly have a bank account

ivory sleet
#

Given that ExampleListener is registered

smoky oak
#

thats not what i mean
it says this is the entire implementation
but there's only constructors and getter methods
there's nothing for the event to execute

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class ExampleEvent extends Event {
    private static final HandlerList HANDLERS = new HandlerList();
    private final String playerName;

    public static HandlerList getHandlerList() {return HANDLERS;}
    public ExampleEvent(String playerName) {this.playerName = playerName;}
    @Override
    public HandlerList getHandlers() {return HANDLERS;}
    public String getPlayerName() {return this.playerName;}
}
ivory sleet
#

What would it be to execute?

#

Event objects are just bundlers that have references to other objects

#

They don’t have any logic inside them (mostly)

#

The procedure then goes by passing the event object to the plugin manager

#

Which calls the registered listeners

smoky oak
#

so, you mean that the purpose of events is to give the ability to manipulate specific things in code through no direct interaction?

ivory sleet
#

Well idk what you mean by direct interaction

#

But yes

#

Sort of

#

It’s a way to have a collection of observers that gets called when something happens

smoky oak
#

ah thans

#

that cleared things up a bit

ivory sleet
#

In this case each observer is a listener

#

And it just so happen to be the case that when we call the listeners we also pass an event instance which the listeners can use

#

And sometimes this event instance is cancellable, so it would allow further manipulation in other words

#

But does necessarily not have to do anything at all with manipulation

smoky oak
#

what'd be a good naming way for wrapper classes containing the logic that runs after a event is called?

#

like

#

I would only call a event if something specific is happening, how would i name a class handling the event?

ivory sleet
#

Bukkit has a CraftEventFactory iirc

smoky oak
#

a what now?

ivory sleet
#

they call it event factory

#

But it’s essentially just a bunch of static methods iirc

terse ore
#

is there a method to add i value to y location?

smoky oak
#

well github is broken

ivory sleet
smoky oak
terse ore
#

thanks

crimson terrace
#

could do without the vector

#

ye, that

smoky oak
terse ore
#

:v

#

ik

#

world is represented as string?

crimson terrace
#

the world name is

terse ore
#

so it's the same if I use

  • "world"
  • world
ivory sleet
#

Tho that’s a yaml sequence

#

yes

terse ore
#

oki

ivory sleet
#

By the specifications they must be the same

terse ore
#

well I'll go to eat breakfast

#

brb <3

ivory sleet
#

Sounds yummy

onyx fjord
wheat abyss
#

when the css doesnt load

#

thats what my school laptop does with some websites

grim ice
#

Any library ideas?

molten hearth
#
    @Override
    public void onEnable() {
        this.instance = this;
        if(this.thread == null) {
            this.thread = new TCPServerThread(instance, clients);
            this.thread.run();
        }
    }``` ```java
    public void run()
    {
        try {
            this.sock = new ServerSocket(42068);
        } catch (IOException e) {
            e.printStackTrace();
        }
        while(true) {
            try {
                Socket client = sock.accept();
                ProxyServer.getInstance().getConsole().sendMessage(new ComponentBuilder("[CommunicationPlugin] Connect: " + client.getRemoteSocketAddress().toString()).create());
                DataInputStream in = new DataInputStream(client.getInputStream());
                DataOutputStream out = new DataOutputStream(client.getOutputStream());

                TCPServerReader reader = new TCPServerReader(in, out, client.getRemoteSocketAddress().toString(), this.clients, client, instance);
                reader.start();
                instance.addClient(client);
                ProxyServer.getInstance().getConsole().sendMessage(new ComponentBuilder(clients.toString()).create());

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public TCPServerThread(CommunicationPlugin plugin, List<Socket> clients) { this.instance = plugin; this.clients = clients;}```
#
    public void run()
    {
        while(running) {
                try {
                    Scanner input = new Scanner(inStream);
                    String temp = input.nextLine();
                    System.out.println("[SocketResponder] (CLIENT/" + ") >> " + temp);
                    plugin.broadcast(temp, client);

                } catch (NoSuchElementException e) {
                    ProxyServer.getInstance().getConsole().sendMessage(new ComponentBuilder("[CommunicationPlugin] Disconnect: " + this.clientAddress).create());
                    clients.remove(client);
                    System.out.println(this.clients.toString());
                    this.running = false;
                }
        }
    }

    public TCPServerReader(InputStream inStream, OutputStream outStream, String clientAddress, List<Socket> clients, Socket client, CommunicationPlugin plugin) {
        this.inStream = inStream;
        this.outStream = outStream;
        this.clientAddress = clientAddress;
        this.clients = clients;
        this.client = client;
        this.plugin = plugin;
    }```
molten hearth
#

it seems that the ```java
while(true)

#

but its in a thread so why would it matter

pulsar zenith
#

Use Bukkit runAsync

#

And bukkitrunnables

grim ice
#

Ur making lots of Scanners

#

Just use one and read the input

molten hearth
#

dont even have runnables

#

maybe cause its a bungee plugin

tardy delta
#

Calling Thread::run instead of Thread::start yummy

molten hearth
#

oh bruh

sweet pike
#

How can i spawn a coloured particle of type SPELL? i'm not able to figure out how to add the colour for it

earnest forum
#

I think

sweet pike
#

🧍

earnest forum
#

it could be 0 to 10

#

1.0

#

doubt it tho

sweet pike
#

so in the method i just use the offset params as my RGB?

earnest forum
#

yes

#

Wait it's a float from 0 to 1.0

#

@sweet pike

#

And the amount has to be 0

#

I couldn't find any resources that are updated on spell particle colouring

#

I found this

#

I guess just use the regular rgb and then divide each number by 255

#

If you want 255,0,100 it would be (1,0,0.39)

sweet pike
#

okay i'll try that out

grim ice
#

in simple terms

#

Its just something for other people or you to listen to

#

and you have to call the event yourself, then the code that's in the listener for the event will run

#

The logic should be when you are calling the event

#

Not the event itself

red sedge
#

is there anyway i can change the maxstacksize of a material

chrome beacon
#

Yes but that will always be a bit jank

red sedge
#

hm/

#

should i just not even try

desert tinsel
#

when i spawn an ender dragon, it doesn't move, why?

#

my code is

Location dragon_spawn = new Location(p.getWorld(), -670, 82, -275);
                    Entity entity = p.getWorld().spawnEntity(dragon_spawn, EntityType.ENDER_DRAGON);
                    entity.setGlowing(true);
                    entity.setCustomNameVisible(true);
                    entity.setCustomName(ChatColor.GOLD+"ENDER DRAGON");```
red sedge
#

ender dragons are generally weird

weary geyser
#

Did they remove #getDataWatcher from the Entity class in 1.18 NMS?

desert tinsel
#

hmm

tardy delta
#

When summonning Ender dragons in the overworld by command they don't move either

desert tinsel
#

but i have set biome the end with worldedit

#

it doesn't help?

misty current
#

if it was you can always try to get the field instead with reflections, since i guess that's still there

weary geyser
#

yeah I did that instead

#

how tf do you get the navigation

misty current
#

Mob class

#

has the getNavigation method

#

if you need a PathNavigation

#

oh btw thanks to you i have discovered something fun while testing to make a player's screen black

#

you can show the demo menu to a player or freeze the client if you force the client to show the end credits menu

#

didn't discover anything about making the screen black tho :c

#

oh really

#

how?

#

oh that's smart

#

too bad you require the resource pack

#

¯_(ツ)_/¯

celest lichen
#

Ayo ^^ Anybody got a clue how to tinker together the CPU Usage in % based on
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
double usage = (threadMXBean.getCurrentThreadCpuTime() - threadMXBean.getCurrentThreadUserTime() / 1000000);

? I cant get this to work, my math is too stupid and I fear Ive run into a hole of being too stupid to program after a 12 hour shift xDD

#

like beforehand I tried it over
double calced = 0;

        OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean();
        if (operatingSystemMXBean instanceof UnixOperatingSystemMXBean) {
            UnixOperatingSystemMXBean bean = (UnixOperatingSystemMXBean) operatingSystemMXBean;
            calced = bean.getProcessCpuLoad();
        }

        double cpuTime = calced * 100; 

and it worked but sadly that isnt supported in Java 17 it seems 😦

chrome beacon
#

You can use the scheduler to run sync

#

?scheduling

undone axleBOT
tardy delta
#

do all entities on the server have a different uuid?

#

or is there a way to sneak thro that?

chrome beacon
#

Yes, well they should

tardy delta
#

'they should' ._.

chrome beacon
#

You can spawn two with the same UUID with some hacky stuff

tardy delta
#

hmm assuming my users dont do that stupid things

#

ill take that as a yes :)

misty current
#

it's better they do else behavior could be pretty messed up

chrome beacon
#

Assume that there will only be one

tardy delta
#

i was wondering if i could compare players based on their uuid

misty current
#

i don't know if you've ever seen some videos about duplicate minecraft accounts

chrome beacon
#

Duplicate names you mean

#

Those are fun, breaks a lot of plugins

misty current
#

yes lmao

#

actually they don't have the same uuid but just the names break a lot of stuff

chrome beacon
#

There are also rare accounts with special characters like . in them

tardy delta
#

so should i use uuid's to compare players? :)

misty current
#

yeah that's a mess

chrome beacon
misty current
#

Player#equals does that

tardy delta
#

ok 🌝

misty current
#

actually i think thats the case for any entity

tardy delta
#

Player#equals also checks the id

#

the server gives each entity a id (int)

#

not persistent

misty current
#

yes i know what an id is

#

kinda weird tho don't think it's that necessary

tardy delta
#

this basically

#

i dont think its overkill to use that instead of comparing uuids

kindred valley
#

hey do anyone know what is this ava.lang.NoSuchFieldException: modifier

misty current
#

also weird enough, ServerPlayer doesn't have an equals method

misty current
frosty minnow
#

not many of us around these parts

kindred valley
frosty minnow
#

😱

visual tide
#

😮

frosty minnow
#

avantastirivus

tardy delta
#

is (a || b && c) the same as ((a || b) && c)?

#

or do they evaluate from the left to the right?

fossil lily
#

What does .getMount return?

visual tide
#

which is why you can do if (object != null && object.someMethod())

#

is npe-safe

sage dragon
#

I want to make some "custom mob ai", is it easier to just use armor stands to let them move to a specific location?

young dome
#

Can we detect if an inventory is not a default inventory in spigot with packets or else ? (an inventory created on the client side)

tardy delta
young knoll
#

Short circuiting

#

As soon as it sees true, it stops

#

Idk how that would ever be expected to return false, it has true hardcoded into it

tardy delta
#

true || false -> true && false -> false (left to right)

misty current
#

i don't see the issue

#

false && false gets executed first

#

then true || false

#

basically this is true || (false && false)

#

which is true

young knoll
#

Uhh yeah seems good

#

My brain hurt

tardy delta
#

mine too

lime jolt
#

anyone know how to remove the wrapper ("<Username>") around ur name
like it says ```

<PetarPotato> hello

but I want it to say ```

PetarPotato Hello

no <>

tardy delta
#

listen for the AsyncPlayerChatEvent and replace the default format

misty current
earnest forum
#

@lime jolt Do you know what an event is

misty current
lime jolt
tardy delta
#

-> %1$s %2$s

misty current
#

2nd, a listener is something spigot came up with to modify certain things that happen in-game

earnest forum
#

Do you know how to code in java

lime jolt
#

a bit

#

but never in minecraft

tardy delta
#

here we go again 🌝

misty current
#

like chat messages sent, block placements and breaking

earnest forum
#

find a tutorial on YouTube

#

how to set up project, events, commands

lime jolt
#

nnonono, but I think one of my plugins is overdidng the name display

earnest forum
#

I learnt off of CodedRed

earnest forum
lime jolt
#

I am using spigot

misty current
#

coded red is not bad but i'd not follow any of the java language things he says

#

i've noticed some of them not being very accurate

earnest forum
tardy delta
#

not good either in terms of storage solutions

misty current
#

api wise pretty solid

earnest forum
lime jolt
#

oH

fluid nacelle
#

Okay, so this is going to be an interesting one. I'm working on an ability where any players that are looking at the activator are forced to look at that player for 10 seconds, so if that player moves then the players that have seen the activator have their set locations constantly adjusted to be looking at that player (via a Runnable). How the heck would I calculate the yaw/pitch to set? 🤔

earnest forum
#

a lot more extra steps

lime jolt
#

oki

earnest forum
#

search up coded red on YouTube

tardy delta
misty current
#

may i introduce you to my great friend trigonometry

earnest forum
#

his tutorials are for 1.15 and 1.16 but they should work in 1.18

fluid nacelle
#

I suck at trigonometry

misty current
#

do you know what it is

#

very bad

earnest forum
misty current
#

do you know what sin and cos are

lime jolt
#

its all in 1.15 I am in 1.8.8

tardy delta
earnest forum
#

Do you mean without a plugin

lime jolt
#

unless

misty current
lime jolt
#

1.8.8 is above

earnest forum
#

Just materials

#

some enums have different names

misty current
#

use modern api to learn please and then if you decide to go through the pain go to legacy

fluid nacelle
misty current
#

open a thread and i'll explain a bit

sage dragon
#

Is it possible to play the attack speed animation in the off hand? 🤔

fluid nacelle
kindred valley
#
@EventHandler
    public void onGasp(PlayerInteractAtEntityEvent e) {
        Player p = e.getPlayer();
        Player clickedEntity = (Player) e.getRightClicked();
        if(p.getInventory().getItemInMainHand().equals(Material.NETHER_STAR)) {
            p.openInventory(clickedEntity.getPlayer().getInventory());
        }
    }``` this event is not triggering somehow, no errors on log
misty current
misty current
#

oh i know why

kindred valley
#

registering what

misty current
#

you are comparing a materual with an itemstack

young knoll
#

Try just the PlayerInteractEntityEvent

young knoll
#

That too

misty current
tardy delta
#

dont compare itemstack with material

misty current
#

on an itemstack

tardy delta
#

and npe

#

:)

misty current
#

and also blind casting is bad

tardy delta
#

you noob i already said that

misty current
sage dragon
kindred valley
misty current
#

don't want to spam the chat with a math lesson

misty current
tardy delta
sage dragon
sage dragon
kindred valley
#

do i need to use isSimilar

tardy delta
#

do null check and getType() after that

#

wait no you can check for null with == and its an enum

misty current
#

i don't think you can specify what hand to swing

misty current
#

it's based on what does the playerhave in its hand

fluid nacelle
#

Trigonometry

sage dragon
young knoll
#

There’s API

#

LivingEntity#swingOffHand

sage dragon
# young knoll LivingEntity#swingOffHand

Thanks, now I don't need to use packets. Probably should look into the api first before running to nms next time.

But there's still no slow raise of the weapon, maybe it's not possible?

tardy delta
#

does it matter if i hide myself for myself?

minor garnet
tardy delta
#

are there also dead players?

young knoll
#

It’s called when the player right clicks any entity

fervent gate
#

Is it possible to work with persistent data in blocks that don't have a tilestate

#

like dirt or something

misty current
#

is there any naming convention for static methods that return a new "empty" instance of a class

#

basically this object is meant to store some game data and if you call the static methods it will create an object without any data

tardy delta
#

just finished 360 line vanish command

#

🥶😈

fossil lily
#

Anyone know why this wouldn't work?

dusk flicker
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

fossil lily
#

Im trying to detect when a player has 1 blaze powder, every ten ticks. Im running that in the main class on startup. When I set it to check for at least 1, it doesnt work. When I set it to 0, it constantly runs. No error.

tardy delta
#

why are you creating an itemstack if you never use it?

fossil lily
misty current
#

dont use that method, it's deprecated and i think it doesn't even work nowadays

pulsar zenith
misty current
#

use runtasktimer or similar

pulsar zenith
#

Also u should use that ^^^

misty current
#

also running it async is pointless

#

such an easy check

fallen sandal
#

hi

#
        scheduler.scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                // Do something

                Bukkit.broadcastMessage("Dont Forget Join Our Discord Server! type /discord");

            }
        }, 0L, 300 * 1000);``` in this code how to add more broadcast message?
#

like it will give serial by serial after 5 miniutes?

pulsar zenith
#

?paste

undone axleBOT
pulsar zenith
#

Use that pls for code

fallen sandal
#

ok

wheat abyss
misty current
#

learn java please, this question is pointless

fallen sandal
fallen sandal
#

i want to add more message

#

like it will broadcast a message then after 5 miniutes then a different message

misty current
#

oh you want to cycle through messages

#

you could store an integer in the global field of the Runnable you create

wheat abyss
#

yeah then loop through an arraylist or smth

#

I was thinkin that too

misty current
#

and add 1 to it each time the thing runs

lapis widget
misty current
#

then get a message based on the number

#

nice but add a space between Total and Worth

#

and so on

dusk flicker
#

^

#

personally id have the footer be Made by x, but thats just me

fallen sandal
#

oh

#

cant i do it like this?

#

sry

dusk flicker
#

no

tardy delta
#

never do new RUnnable

fallen sandal
lapis widget
#

Its a Minecraft plugin made with discord JDA with placeholderapi support

dusk flicker
#

?learnjava

undone axleBOT
fallen sandal
#

oh

misty current
red sedge
wheat abyss
#

^

misty current
#

with runnable not much

tardy delta
#

not really for schedulers

misty current
#

but with BukkitRunnable it is useful

#

you can call cancel inside the run method

wheat abyss
#

yeah

misty current
#

and assign global fields in BukkitRunnable

#

while you can't with lambdas

tardy delta
#

scheduler.runTask(plugin, task -> { task.cancel(); })

misty current
#

what about the global fields

tardy delta
#

why fields?

misty current
#

they could be useful

red sedge
#

cuz you may need them?

wheat abyss
#

Yeah like if you needed to access a timer int to count it down every sec or smth

misty current
#

^ and not only

#

also if you want to put more methods

wheat abyss
#

yeah

misty current
#

how many chances are there that 2 random UUIDs are the same?

tardy delta
#

i just make an inner class which extends bukkitrunnable

sage dragon
#
    private LivingEntity getTarget(Player player) {
        Vector direction = player.getLocation().getDirection();
        Location eyeLocation = player.getEyeLocation();

        for (int i = 1; i < 3; i++) {
            Collection<Entity> entities = eyeLocation.getWorld().getNearbyEntities(eyeLocation.clone().add(direction.multiply(i)), .3, .1, .3);

            entities.removeIf(entity -> !(entity instanceof LivingEntity));

            entities.removeIf(entity -> entity == player);

            Entity entity = entities.stream().findFirst().orElse(null);

            if (entity != null)
                return (LivingEntity) entity;
        }

        return null;
    }

Is there a better way to check for the entity a player is looking at?

wheat abyss
#

Hey guys, what would the best way to store a method and then run it later be?

tardy delta
#

runnable?

wheat abyss
#

hm?

#

oh sorry I didnt phrase my question good

#

what would the best way to store a method in a var be?

tardy delta
#

runnable

misty current
#

runnable

wheat abyss
#

there is not a set time between when I store it and when it runs

misty current
#

dude

#

you don't need to create a task

#

save the method as a runnable

#

and call .run when you want it to be run

wheat abyss
#

oh yeah smart thinking

misty current
#
        Runnable runnable = () -> Bukkit.broadcastMessage("hi");
        runnable.run();
#

invoke run() when you want it to execute

tardy delta
#

or just make a method

echo basalt
#

RayTraceResult result = player.raytraceEntities(...)

#

it will probably result the player to use the predicate to your advantage

sage dragon
echo basalt
#

Yeah it grabs the direction, takes into account the bounding boxes etc

raw ibex
#

any hologram generator api already made
i know IkeVoodoo is making me one but it's taking forever ;((

echo basalt
sage dragon
echo basalt
sage dragon
raw ibex
echo basalt
sage dragon
echo basalt
#

RayTraceResult result = player.getWorld().rayTraceEntities(player.getEyeLocation(), player.getEyeLocation().getDirection(), 5.0, (entity) -> !(entity.getUniqueId().equals(player.getUniqueId()));

#

You probably messed up the range

#

result can be null, so can hitEntity sometimes

echo basalt
#

Yeah that's too much

#

It returns true for items, arrows

#

lots of entities

sage dragon
#

Or 3.2

echo basalt
#

are you sure it isn't returning the player?

#

Just try the code

sage dragon
#

Okay

#

Weird 🤔

Now it's working. Probably messed up something when I tested it.

But if it returned myself, I'd have taken damage

#

Thanks though 👍

tardy delta
#

is it possible to give a bossbar a hex colour in 1.17?

lost matrix
tardy delta
#

hmm i was going for the bar itself

lost matrix
#

Still defined by an enum 🤷

tardy delta
#

ye unfortunately

lean gull
#

anyone know a good tutorial for making something like this?

tardy delta
#

i guess get string from the config and replace things

lost matrix
#

Configs should be your least concern. Write everything in memory and worry about serialization later.

tardy delta
#

im not understanding your question completely

lean gull
#

i wanna make it so i can easily input stuff for the bot in a config file though

#

or a better solution than a config file if u have any

lost matrix
lean gull
#

wat dat mean

lost matrix
#

What is your overall goal?

lean gull
#

i wanna make a sort-of custom language for it

#

like a place where you can input an input and an output for the bot, and whenever the input occurs, the output is sent

#

and with custom expressions

lost matrix
lean gull
#

idk how to do that

lost matrix
#

Its also quite complicated if you havent fully mastered an existing language yourself.

lean gull
#

i'm learning my own way cause i have a learning disability

#

this is my way of learning, asking, watching tutorials and trying myself

lost matrix
#

You would have to define a background compiler pipeline.
Lexing -> Parsing -> Type Checking and then depending on your specs one of [Code generation, Interpretation]
In your case its def Interpretation

lean gull
#

i don't understand any of that and i think you know that

dusk flicker
#

you are acting like smile knows exactly what you know and don't know

#

They are explaining it as someone with full java experience will understand, which is good

lean gull
#

he's seen me quite here quite a few times, i think he knows that i have no understanding of those words

lost matrix
lean gull
#

i don't want to make a whole language, i just want to know how to split the message

#

look at the example i made in the original message

rough drift
#

but i guess if you want an actual language you'd need a proper tokenizer with parser

#

and an interpreter or AST walker

dusk flicker
#

actual langs are a nightmare lmao

lean gull
#

i need to know what the input means, like the one from my example. how would i do that?

desert tinsel
#

Why i have a problem with placeholderapi dependency??

rough drift
dusk flicker
#

you forgot the version

desert tinsel
#

what version i need?

rough drift
#

if you use some language for initial compiling (such as js) and ten bootstrap it, it can be very nice

desert tinsel
#

to put

dusk flicker
#

check their wiki

#

or google it for that matter

desert tinsel
#

thx

dusk flicker
rough drift
#

in js you can make a really nice ast

#

like

desert tinsel
dusk flicker
#

remove the v more than likely

rough drift
#

{type: 'NodeType', something}

lost matrix
#

But parts of the message mean something.
And you would have to define actual codeflow for those elements:
@lean gull

desert tinsel
#

i tried

misty current
#

my head hurts

#

too many generics

misty current
lost matrix
desert tinsel
rough drift
dusk flicker
#

Can you send your pom.xml in a paste?

#

?paste

undone axleBOT
desert tinsel
dusk flicker
#

Looking at their example I guess it would be v2.11.1, but thats interesting

#

you are refreshing maven correct?

desert tinsel
#

the errors are refreshing

dusk flicker
#

?

lost matrix
desert tinsel
#

ah

#

it works now

#

ty

misty current
lean gull
#

i don't know where to start

misty current
fringe latch
#

i am quite sure you can't pull it off atm, try something easier now and get back to it later

misty current
#

can't I

lost matrix
lost matrix
# misty current 💀

For once you could put your method annotation not in the middle of the declaration but above it, where it belongs.

#

lul

lean gull
#

do you have a good tutorial on lexing and parsing? i also need to know what they are*

lost matrix
misty current
lost matrix
#

The consumer is typed

misty current
#

yeah, i kinda need to use them

#

because i need to put the bi consumer as the way i want data to be put in the document

#

let's say the value is an enum, i'd call entry.getValue().name()

#

example

ancient plank
#

bold of u to think im awake at midnight

lost matrix
#

But this still looks a bit weird. I feel like there are better approaches

misty current
#

i have 3 maps with enum keys and int values i need to save so i do this

misty current
#

i have never used generics much to be honest, im messing around

#

it would be cleaner to just put the for in the place where i need it

lost matrix
#

Btw. You can also just throw an Object into Gson and then translate it to a document.
Saves you all the serialization work.

misty current
#

wait so if i slap an hashmap into it what happens?

dusk flicker
#

?bing

undone axleBOT
misty current
#

as the value

lost matrix
misty current
#

and if i call .get and cast it to a map with the correct generics it will just go back to be a normal map

lavish hemlock
misty current
lost matrix
misty current
#

wow i wish i knew earlier

#

this saves a lot of time

#

so let's say i call .get("myMap") and the object i inserted with .put("myMap", ...) was a Map<Enum<?>, Integer>

lost matrix
# misty current this saves a lot of time

Here is an example where i just used Jackson to serialize whatever object i wanted:

  public <T extends IndexableObject<?>> void persist(final String collectionName, final T object) {
    final String json = JacksonProvider.serialize(object);
    final Document document = Document.parse(json);

    final MongoCollection<Document> collection = this.database.getCollection(collectionName);

    collection.createIndex(Indexes.hashed(object.getIndexedField()));

    final ReplaceOptions options = new ReplaceOptions().upsert(true);

    final Bson filter = Filters.eq(object.getIndexedField(), object.getFieldValue());

    collection.replaceOne(filter, document, options);
  }

The IndexableObject is not needed but i wanted to index keys for performance.

misty current
#

ooh i get it

#

you serialize the map to json, then to bson

patent horizon
lost matrix
#

And T can be literally anything you can serialize with Jackson or Gson. As long as you register type adapters for things like Location, ItemStack and whatever

patent horizon
#

why is everything breaking when i put this variable in here

lavish hemlock
#

Because that's not a proper lambda

#

() => {}, not {}

#

{} represents a block

patent horizon
#

oh

misty current
lavish hemlock
#

also yeah why the fuck are you using the primitive wrappers lol

patent horizon
#

Long?

lavish hemlock
#

Yes

#

long is preferable

misty current
patent horizon
#

dont know, im just translating someones code from kotlin to java

misty current
#

and i make the wrapper class implement the interface

lavish hemlock
#

Using wrappers everywhere is slow

lavish hemlock
misty current
patent horizon
#

oh probably because of this

tardy delta
#

Long

misty current
#

leave the wrapper in the map

lavish hemlock
#

Yeah type parameters are like the only situation where you have to use the wrappers

lost matrix
misty current
#

java auto packages and unpackages primitives to their wrapper class when needed

#

(i think it's called packaging)

lavish hemlock
#

It's called autoboxing

misty current
#

or something similar 🤔

#

ah yes, forgot the word

lavish hemlock
#

Autoboxing was added back in Java 5 iirc and it literally automates the conversion between int and Integer, and etc/vice-versa.

misty current
lavish hemlock
#

For instance, passing an int to a method that takes Object is valid because it does a Integer.valueOf(i) beforehand.

#

(Meanwhile, Integer -> int AKA unboxing, is integer.intValue())

lost matrix
misty current
#

autoboxing used to confuse me when i started, didn't know why stuff changed by itself so i just ignored it

lavish hemlock
misty current
#

yes

lost matrix
lavish hemlock
#

There are internal "let expressions."

lost matrix
#

Which ones? never seen them

misty current
#

can you send me the maven import for the json lib you use

lost matrix
lavish hemlock
#

Isn't Jackson also just slower?

misty current
#

aight

lavish hemlock
#

I've seen charts that say so.

ivory sleet
#

Thought it was the opposite

lavish hemlock
#

The problems with having an ultra-extensible system :)

lost matrix
patent horizon
#

would anyone know what the java equivalence of .iterator() would be?

lavish hemlock
#

Well, Java has an iterator method.

#

For maps though? I think there's something like mapIterator lemme check.

misty current
lavish hemlock
#

.entrySet().iterator()

misty current
#

i'd just run an enhanced for, i think it's cleaner

lavish hemlock
#

Well sometimes you need to do .remove() calls so

#

I dunno what Wally's use-case is

misty current
#

readibility wise, at least

#

hm yea

#

also what do I see? main class named Main and static getter?

lavish hemlock
#

All hail the ConcurrentModificationException

misty current
#

never

lavish hemlock
#

:)

misty current
#

i remember i used to clone the object i was iterating to work around it

#

not sure how efficient it was lol

quiet ice
misty current
#

i've been developing for a while, yet i still make the same mistake as i used to

#

underestimating the time something will take to code

lavish hemlock
patent horizon
lavish hemlock
#

And uhh

#

In Kotlin, the default access modifier (AKA which one applies when none are specified) is public, not package-private

lavish hemlock
#

Kotlin's version of package-private is internal

misty current
# patent horizon whys this bad?

naming your main plugin class Main is considered bad because 1) a plugin main class is not code that can run by itself, so naming it main is not explicative and 2) imagine if every plugin named their main class Main and you needed to call some methods from a plugin main class, it would be painful to find the right Main class

#

and static abusing... do i really have to talk about static abuse

lavish hemlock
#

Not to mention that

lost matrix
misty current
#

you can probably dependency inject there

lavish hemlock
misty current
lean gull
#

to a book, that'll make it 100% harder

half hare
#

I am getting

invalid target release -> 1.18.2

Even though this morning I successfully installed multiple times

lavish hemlock
lavish hemlock
lean gull
#

i need a video tutorial with words that are for beginners

misty current
#

what you want to do is not for beginners

lavish hemlock
#

Yeah

lean gull
#

then what do i need to learn for it

lavish hemlock
#

Lexing/parsing is difficult

misty current
#

from what i understood, you want to code an interpreter

lost matrix
# lean gull anyoneee?

Search online. This is something quite specific and you will most likely not find step-by-step tutorials but
rather trade readings that go into the technical details but not implementations.

lavish hemlock
#

I mean, in a lang like Java it's easier

lavish hemlock
misty current
#

java has some useful tools yes

half hare
lean gull
misty current
#

such as matchers

lost matrix
lavish hemlock
#

Either way, CraftingInterpreters is one of the best guides for... well, crafting interpreters.

misty current
lean gull
misty current
#

learning to understand something is not a straight path

#

we can't really guide you

quiet ice
misty current
#

you need to accept your limits and go back to code something easier

lean gull
#

i wanna work my way up to it

#

but for that i need to know what i need to learn

lost matrix
# lean gull what do i need to learn for it

There is quite a bit of meta knowledge like tree data structures that is mandatory for this and there is
transitive knowledge like reflections that will def help you understand but is not needed.

misty current
#

i can't make a language parser nor i want to learn to right now so i can't guide you

#

i've seen you very often come here and asking things out of your reach and then asking what should you learn

#

you need to ask it to yourself not us ;-;

lost matrix
meager arch
#

Can i put questions for a scoreboard plugin thingy here too

quiet ice
#

Why not?

patent horizon
#

is there any ways to declare multiple variables on one line like in python or kotlin?

lost matrix
meager arch
meager arch
#

i have no idea how to do that

meager arch
#

alright

fallen sandal
#

how to reduce jar file size? my plugin size becames 10 mb with only 14 jar file

lost matrix
lavish hemlock
#

inb4 "I use 1.8.8"

lapis lark
midnight shore
#

Hi! how can i make a bossbar?

slate pendant
#

Hello! Does it matter how many event listeners I register? Is it better to have just a couple large ones or I can make a bunch of small listeners?

fallen sandal
river oracle
#

Yea don't shade every dependency

#

I would exclude every dependency you can depend on at run time eg vault

#

An example of something you would have to shade would be guice

midnight shore
#

ty

dire salmon
#

Is there a way to make gradients in strings other than Minimessage or lots of ChatColor.of()?

slate pendant
#

just maybe it was a thing, in other api's it happens

ivory sleet
#

But it gets rather verbose

river oracle
dire salmon
#

Thx

lean gull
#

how do i do a chance of something? like 25% chance to run some code

quaint mantle
ivory sleet
river oracle
ivory sleet
#

Through code Team::hasEntry can be used to determine whether a player (by name) is contained within a team

rough drift
#

iirc that should be 25%

river oracle
#

Use ints :!

ivory sleet
#

Yup

rough drift
#

using nextBool gives a 50%

lapis lark
rough drift
#

and the chance of getting both true is 25% iirc

ivory sleet
#

I mean a nextInt(4) == 0 works as well

lapis lark
#

Because /team command not seems really connected to scoreboard

river oracle
#

What if you want a 23% chance in the future or something along those lines

ivory sleet
#

then they simply just change the implementation

river oracle
ivory sleet
#

Yes

#

That’d be fine 🙂

river oracle
#

I'd assume the line would be depending on another payed dependency

ivory sleet
#

Yeah

river oracle
#

Ahhh ok thx

quaint mantle
#

I got listener and scheduler for player movement event but problem is when i type something in run() it shows error ( block.setType(type); )
https://pastebin.com/JX1yf2Kk (scheduler)
https://pastebin.com/4h7NcMSP (listener)

lean gull
#

wat
String splitMessage = message.split("\"");

misty current
#

String[] splitMessage = message.split("\"");

lean gull
#

isn't that an array

misty current
#

yes, when you split a String you get multiple Strings depending on how many matches of the splitter you have

lean gull
#

ooo riet

quiet ice
#

You probably are looking for message.substring(message.indexOf('\"') + 1)

#

or message.substring(0, message.indexOf('\"')), depending on what you want to do

lean gull
#

i wanna make it so you can make the "bot" say something, with an input like this:

derpbot say "hello"

#

though i just realised, that means the player can't use quotation marks in the message

#

how do i fix that

quiet ice
#

Escaping, html entities and whatnot

lean gull
#

huh

cosmic fjord
#

i found a server where you can use the command /feed and you get heal effect and saturation but theres no minecraft "effect" like blc and lunar dont show potion effects when you use that command

#

how does that work?

quiet ice
#

try reformulating your question, I am not sure that I understood it correctly

lean gull
#

i think they mean that they're currently using a potion effect to feed the player

#

focus, you can just set the player's hunger

cosmic fjord
#

with player.setFoodLevel?

lean gull
#

yes

cosmic fjord
#

i tryed this already

#

I set the parameter to 20 but you get no regeneration

quiet ice
#

Oh so you just want to feed a player

#

?jd-s sigh

undone axleBOT
quiet ice
cosmic fjord
#

ty

quiet ice
#

The player is only healing fast if it is saturated, see HumanEntity#getSaturatedRegenRate

vivid cave
#

how to put 1.8 attack speed pvp

#

i mean

#
       AttributeInstance instance = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
        if (instance != null) {
            instance.setBaseValue(WHAT DO I PUT HERE);```
lost matrix
quiet ice
#

Integer.MAX_VALUE?

lean gull
#

this doesn't make a new line?
prefix.replaceAll("\\n", "\n");

quiet ice