#help-development

1 messages · Page 2032 of 1

rough drift
#

you'd need to store cooldowns

#

try using PDC

granite owl
#

no

#

i use the vanilla cooldown

#

like enderpearls do

rough drift
#

then use an enderpearl

#

and cancel entity spawning

granite owl
#

u know u can set this cooldown for any item right

rough drift
#

wait what

granite owl
#

every single item

#

has its own internal cooldown

rough drift
#

o shit

granite owl
#

like the enderpearl does

#

only thing is

#

its client sided

#

server tells client to set it on cd

#

so maybe an anticheat might be needed

granite owl
#

:P

rough drift
#

nope

granite owl
#

the onl

rough drift
granite owl
#

only disadvantage is that the client manages those cooldowns

#

yea this^

#

basically a cheat or logging off the server can set the cd to 0

rough drift
#

in fabric you'd do ItemManager.isCooldownOver(itemstack); or smt

#

i am sure there's something like that in spigot

granite owl
#

so practically any cooldown beyond 10s is useless

rough drift
#

or was it hasCooldown

granite owl
#

cause the guy will just logoff

#

and login again to reset it

#

hm

granite owl
#

so i would be well able to recreate such simple tasks

#

i mean ppl still call me out for developing low level solutions in java

#

🤣

#

but thats what im used to from C++ and assembly

quiet ice
#

Does anyone know any Deque implementation that allows to obtain the the element at the xth position (so kinda like a list)?

#

And Stack is not an option

outer steeple
#

what does the "PlayerEvent" do?

vale ember
#

e.g PlayerQuitEvent, PlayerMoveEvent, PlayerJoinEvent, ...

outer steeple
#

so it doesnt detect anything RIGHT? :)

vale ember
#

You cant listen to it

#
@EventHandler
public void listener(PlayerEvent event) {...}

won't work, it will throw exception

#

it's just abstract class which have a protected player field and a getter for it


/**
 * Represents a player related event
 */
public abstract class PlayerEvent extends Event {
    protected Player player;

    public PlayerEvent(@NotNull final Player who) {
        player = who;
    }

    PlayerEvent(@NotNull final Player who, boolean async) {
        super(async);
        player = who;

    }

    /**
     * Returns the player involved in this event
     *
     * @return Player who is involved in this event
     */
    @NotNull
    public final Player getPlayer() {
        return player;
    }
}
outer steeple
#

ok thanks

rough drift
#

Would this work?

#

i need to do some stuff with spec mod thats why i don't use player death

vale ember
#

don't see any reason why it shouldn't, but where are you checking that player is dead?

rough drift
#

forgot to put it there, wait lemme do that lmao

vale ember
#

well it probably should work

rough drift
#

yeah

mellow edge
#

so u can do Bukkit.getWorld().getEntities(), but that are all entites, can you get entites in specific block?

granite owl
outer steeple
#

ok

#

someone already said that

granite owl
#

is it possible to use package manipulation to apply custom skins to entities?

#

cause like

#

putting a 3D model on an entities head

rough drift
#

unless you use a texturepack

granite owl
#

or using tons of armor stands

rough drift
#

and put an item on their head

#

no

granite owl
#

isnt really an option

rough drift
granite owl
#

yea but the textured item

#

has no animation

rough drift
#

yes

#

mc java does not have that much customizability in those regards

granite owl
#

so best i can do with a 3D model

#

is an idle animation

rough drift
#

if you want that kind of stuff i suggest BE lmao

granite owl
#

BE?

rough drift
#

bedrock edition

#

it has fully custom entities and items

#

and blocks

granite owl
#

but no code

#

cant write custom commands

#

doing custom code

rough drift
#

iirc there's a way to use plugins and addons together

#

just check pocketmine's gh

#

is there an event to stop players from going out of their spectator target? (Similar to paper's PlayerStopSpectatingEntityEvent which allows you to cancel it to stop from going out of the target)

granite owl
#

tbh dont wanna swap to the bedrock edition

#

its always delayed

rough drift
#

no actually

#

it got allays before java

granite owl
#

i mean i think c++ is superior but it doesnt offer the same as spigot

quiet ice
#

Java is fun to mod, C++ probably not

rough drift
#

not c++

earnest forum
#

bedrock is made in c++

rough drift
#

yes but pocketmine aint

#

its made in php

#

lmao

midnight shore
#

From an entity to null

rough drift
#

the problem is

#

the player would see removing themselves from spec target

#

and tp'd back in

#

or not?

granite owl
#

so

#

who cares

#

u cant stop vanilla client behavior

rough drift
#

nevermind

granite owl
#

same as u cant stop cheats

rough drift
#

paper literally does it like that

granite owl
#

u can only counteract them

rough drift
#

and it works amazingly

#

so ill do that

#

thanks @midnight shore

midnight shore
#

Np 😉

rough drift
#

From a 2018 issue (explaining how it worked because someone didn't understand smt)

granite owl
#

am not at my pc rn

#

is injectNewEntity() a method from spigot?

#

and if so, does that cause the server to store custom entities with its custom nms modifiers?

vocal cloud
#

?jd-s

undone axleBOT
vocal cloud
#

Type in the search bar what you're looking for

granite owl
#

instead of re-instantiating them as vanilla entities

#

next startup

vocal cloud
#

If it's not there then you'll have to look at NMS

rough drift
#

nvm

#

lmao

granite owl
#

also has anyone found a solution since 1.16 to make custom entities(entities that inherit another) are restart-safe(persistent)?

#

other than destroying the instance and re-intantiating

outer steeple
#

hi does anyone know why this doesnt work?

package com.lions_lmao.tiktokchat.events;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerEvent;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import static org.bukkit.Bukkit.*;

public class Events implements Listener {
    @EventHandler
    public static void main(PlayerEvent event)
    {
        while(true){
            String filePath = "C://Users//nikol//Downloads//commentTXT.txt";
            String Transform = readAllBytesJava7(filePath);
            System.out.println(Transform);
            event.getPlayer().sendMessage(Transform);
        }
    }
    public static String readAllBytesJava7(String filePath)
    {
        while(true){
            String content = "";
            try {content = new String (Files.readAllBytes(Paths.get(filePath)));}
            catch (IOException e)
            {e.printStackTrace();}
            return content;
        }

    }
}
earnest forum
#

u cant listen to playerevent

#

its abstract

hardy swan
#

while(true)

chrome beacon
#

?learnjava Time for this

undone axleBOT
outer steeple
earnest forum
#

what are you trying to do?

granite owl
earnest forum
#

use a bukkit runnable

chrome beacon
outer steeple
# hardy swan `while(true)`

im trying to check when commentTXT.txt updates, and then send whatever is in commentTXT.txt in chat @earnest forum

earnest forum
#

how frequently

chrome beacon
earnest forum
#

do u want to check

#

?

outer steeple
earnest forum
#

make a runnable

#

and then use runtasktimer every 100 ticks

#

if u dont knwo what they are look into it

granite owl
outer steeple
#

wait will it work if i check every second

earnest forum
#

probably

outer steeple
#

kk

granite owl
#

if possible i want to inject it into the servers entity map

#

and make the server serialize it like any vanilla entity

earnest forum
outer steeple
#

kinda

chrome beacon
earnest forum
#

ok well

#

you make one

#

using ```java
new BukkitRunnable() {

}

#

it has a function

#

called run

outer steeple
#

kk

earnest forum
#

inside it

#

that runs every time you pick it to

outer steeple
#

but how do i send something in chat without an event

earnest forum
#
new BukkitRunnable() {
   
  @Override
  public void run() {

  }

}
chrome beacon
#

Yes ofc it's possible

granite owl
#

@outer steeple stop using absoloute paths

earnest forum
outer steeple
outer steeple
granite owl
#

if theres none id do it myself ofc

chrome beacon
#

oops not done yet

outer steeple
earnest forum
#

use what u used before

#

with the while

outer steeple
#

so while(Transform)??

earnest forum
#

no

#

the code inside

#

the while

outer steeple
#

ok

earnest forum
#

put it in the run

#

function

#

inside the runnable

granite owl
#

hm

#

well i hate going the easy way if its a sloppy solution @chrome beacon

earnest forum
#

im not familiar with the file stuff

#

gonna have to ask someone else for that part

chrome beacon
#

As I've said it's much easier to just spawn and save the entity yourself

granite owl
#

so ill deff try to get it working

#

but also more resource heavy

chrome beacon
#

Not much

granite owl
#

nah ill try to do stuff correctly this time

outer steeple
#

wait let's forget about the checking part, this should work right?
code:

package com.lions_lmao.tiktokchat.events;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerEvent;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import static org.bukkit.Bukkit.*;

public class Events implements Listener {
    public static void main()
    {
        while(true){
            String filePath = "C://Users//nikol//Downloads//commentTXT.txt";
            String Transform = readAllBytesJava7(filePath);
            System.out.println(Transform);
            Bukkit.broadcastMessage(Transform)
        }
    }
    public static String readAllBytesJava7(String filePath)
    {
        while(true){
            String content = "";
            try {content = new String (Files.readAllBytes(Paths.get(filePath)));}
            catch (IOException e)
            {e.printStackTrace();}
            return content;
        }

    }
}
granite owl
#

last time ive done way too much sloppy coding

chrome beacon
#

No

#

That won't work

#

You're still using while(true)

outer steeple
#

what shoud i use?

chrome beacon
#

Also you are trying to use a main method that's wrong

#

?learnjava Please just start here instead of copy pasting code that you find online

undone axleBOT
outer steeple
#

i know that but idk how to change the code so that it works :/

earnest forum
#

make a runnable

outer steeple
#

kk

earnest forum
#
public static void main()
    {
        new BukkitRunnable() {
          public void run() {
            //check
          }
        }.runTaskTimer(plugin, 0, 100);
    }
outer steeple
#

sry caps

earnest forum
#

u sent the while(true) code

outer steeple
#

so sry

tardy delta
#

whats the difference between

CompletableFuture<String> future = new CompletableFuture<>();
Bukkit.getScheduler().runTaskAsynchronysly(plugin, () -> {
  String result = getResult();
  future.complete(result);
});```
and
```java
CompletableFuture.supplyAsync(this::getResult);```
elfin atlas
#
public static ItemStack PlayerSkull(Player player) {
            ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1, (short) 3);
            SkullMeta meta = (SkullMeta)skull.getItemMeta();
            assert meta != null;
            meta.setOwnerProfile(player.getPlayerProfile());
            meta.setDisplayName(ChatColor.GOLD + "My Profile");
            meta.setLore(Arrays.asList(new String[] { "", ChatColor.YELLOW + "Click here to manage your Profile." }));
            skull.setItemMeta((ItemMeta)meta);
            return skull;
        }
``` does someone know why this is giving me this as player skull? And not my own?
ivory sleet
tardy delta
#

oh

ivory sleet
#

Tho I suppose new CompletableFuture<>().thenApplyAsync(o -> completeAndGetResult());
and
CompletableFuture.supplyAsync(::completeAndGetResult) is effectively equivalent

outer steeple
#
package com.lions_lmao.tiktokchat.events;

import org.bukkit.Bukkit;
import org.bukkit.event.Listener;

public class Events implements Listener {
    new BukkitRunnable() {
        @Override
        public void run() {
            Bukkit.broadcastMessage("asd");
        }
    }.runTaskTimer(plugin, 20L * 10L , 20L * 5L);
    }
}```
like this? @earnest forum
chrome beacon
#

No

outer steeple
#

...

#

how?

chrome beacon
#

?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.

chrome beacon
#

?learnjava Please

undone axleBOT
tardy delta
#

probably

earnest forum
#

the first number should be 0

#

the 2nd number is how frequently u want to do it

outer steeple
ivory sleet
tall dragon
#

although it does yea

earnest forum
#

learn java before bukkit

kindred valley
#

how can i get a key of hashmap

tall dragon
#

why would you wanna do that

#

thats not what hashmaps are intended for

earnest forum
kindred valley
earnest forum
#

what would u need that for?

tardy delta
#

stream the entryset and filter

vocal cloud
#

If you're getting the keys then you're doing something wrong. Unless you're saving the map or something

ivory sleet
#

limpeex I assume you want to map a value to a key

#

You got something called BiMap which can do that for you as its a Set <-> Set basically, or go with a linear search (either using stream or some loop)

grim ice
#

@kindred valley loop through values

#

I mean

ivory sleet
#

entry set

grim ice
#

Loop through keys

#

Check if the value of the key is the value you want

vocal cloud
#

If you're looking for a key to exist you can just do containskey lmfao

grim ice
#

Why is there no reverse hashmap option

#

It would be cool

ivory sleet
#

HashBiMap provides that

grim ice
#

O

ivory sleet
#

but it comes with a class of problems

vocal cloud
#

Wouldn't it require both the value and key to be unique

grim ice
#

just add .reverse() to hashmap

ivory sleet
#

what if A1 points to B1 which points to A2 which points to B2 and so on

tardy delta
#

😶

ivory sleet
#

tho a bijective map is one to one so it shouldnt allow that

grim ice
#

Idk whats that

ivory sleet
#

In case you're interested ||Well we have
Injective functions/mappings which are For every x contained in the key set, f(x) = f(y) then x = y must be true
Surjective functions/mappings which I dont remember the proof but its when the codomain of a functions value set equals the domain of the function value set
combining those two and you get a bijective function which is one to one||

sacred mountain
#

is there a way to create enum value aliases?

I want to create multiple values for my FIREBALL value.

opal sluice
sacred mountain
#

or should i just manually make more

ivory sleet
#

uh elaborate

sacred mountain
ivory sleet
#

If you mean like having multiple enum constant fields pointing to the same enum instance, then no I believe thats rather impossible

sacred mountain
#

to make multiple values point to the first one

ivory sleet
#

but technically

#
enum DodoType{
  DODODO;

  public static final DodoType EPIC_DODO = DodoType.DODODO;
}```
#

have u tried that?

#

idk if its possible (like if that would compile)

sacred mountain
#

ill give it a go.

lilac dagger
#

i modified a bit at it

ivory sleet
#

looks nice, a bit hard to read what is going on inside compileFromPages but thats all

#

hard is probably the wrong word

#

but non trivial

tardy delta
#

Class<T[]> heh

lilac dagger
#

i need a sample when i'm working with generics and arrays

#

it's not the end of the world

ivory sleet
#

lol hopefully not

rough drift
#

that works

ivory sleet
#

myeah, not very scalable depending on conceivable usage but sure works

rough drift
#

yeah

outer steeple
#

?learnjava

undone axleBOT
outer steeple
#

IT DOESNT HELP AT ALL. IT HAS NOTHING TO DO WITH MY ISSUE

tardy delta
#

what issue?

tardy delta
#

why while tru

outer steeple
#

ik

#

ik

tardy delta
#

use bukkit scheduler

outer steeple
#

ik

#

just ignore that

hexed cosmos
#

i created custom classloader,i want load compileOnly Lib.what should I do

outer steeple
#

but variables have nothing to do with that

hexed cosmos
#

Thread.currentThread.contextClassloader?

outer steeple
#

it just waisted my time

#

and now im gonna start ⭐ K I L L I N G ⭐

#

@chrome beacon you just wasted my time

#

not cool

errant narwhal
#

hi

#

someone help please

outer steeple
#

there is no point in asking

errant narwhal
#

how to make block by itemstack when place block or reload if we destroy block it will drop ItesmStack customitem

#

without drop normal item?

outer steeple
#
package com.lions_lmao.tiktokchat.events;

import org.bukkit.Bukkit;
import org.bukkit.event.Listener;

public class Events implements Listener {
    new BukkitRunnable() {
        @Override
        public void run() {
            Bukkit.broadcastMessage("asd");
        }
    }.runTaskTimer(plugin, 20L * 10L , 20L * 5L);
    }
}```
why doesnt this work
hexed cosmos
errant narwhal
hexed cosmos
#

modify the block drop

#

save to filesystem or database?

errant narwhal
hexed cosmos
#

arraylist works in memory

hexed cosmos
#

you can use Configuration

outer steeple
hexed cosmos
#

serialize your data

errant narwhal
errant narwhal
hexed cosmos
errant narwhal
hexed cosmos
#

my english is bad

errant narwhal
errant narwhal
#

my?

earnest forum
#

make it 0

#

and

outer steeple
#

first long?

earnest forum
#

the "plugin" variable has to be an instance to your main cl;ass

#

the number

#

}.runTaskTimer(plugin, 0 , 20L * 5L);

outer steeple
#

OHHHH

errant narwhal
#

if you are using other class of main use this for plugin: private Plugin plugin = Main.getPlugin(Main.class);

outer steeple
#

ok makes sense

earnest forum
#

u need a reference to your class that extends JavaPlugin

errant narwhal
outer steeple
#

btw this is my code right now::
`package com.lions_lmao.tiktokchat.events;

import com.lions_lmao.tiktokchat.TikTokChat;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

public class Events extends JavaPlugin {
private Plugin plugin = TikTokChat.getPlugin(TikTokChat.class);
new BukkitRunnable() {
@Override
public void run() {
Bukkit.broadcastMessage("asd");
}
}.runTaskTimer(plugin, 0 , 20L * 5L);
}
`

outer steeple
#

`package com.lions_lmao.tiktokchat;

import com.lions_lmao.tiktokchat.events.Events;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;

public class TikTokChat extends JavaPlugin {

@Override
public void onEnable() {
    getServer().getPluginManager().registerEvents(new Events(), this);
    getServer().getConsoleSender().sendMessage(ChatColor.GREEN  + "ON");
}
@Override
public void onDisable() {
    getServer().getConsoleSender().sendMessage(ChatColor.RED  + "OFF");
}

}
`

earnest forum
#

ok so in TiktokChat

#

you need to make an instance of the class

hexed cosmos
#

someone help please
i created custom classloader, i want use it to load library on the network.
library is the option to use compile only at compile time.

errant narwhal
earnest forum
#
public class TikTokChat extends JavaPlugin {
    
    public static TiktokChat plugin;
    @Override
    public void onEnable() {
        this.plugin = this;
        getServer().getPluginManager().registerEvents(new Events(), this);
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN  + "ON");
    }
    @Override
    public void onDisable() {
        getServer().getConsoleSender().sendMessage(ChatColor.RED  + "OFF");
    }

}

#

basically

earnest forum
#

add a variable thats static

#

public static TiktokChat plugin;

#

and then in the onEnable()

#

set TiktokChat.plugin to this

#

actually wait

#

make the variable private

#

and then create a static getter

hexed cosmos
#

Singleton pattern is not recommended

outer steeple
earnest forum
#
public static TiktokChat getInstance(){
  return TiktokChat.plugin
}
earnest forum
hexed cosmos
#

You can pass the Plugin as a parameter

earnest forum
#

i prefer it over dependency injection

outer steeple
hexed cosmos
#

I think the singleton pattern is less suitable for maintenance in most cases.

earnest forum
outer steeple
#

k

#

i get an error

outer steeple
#

Cannot resolve symbol 'TiktokChat'

#

@earnest forum

earnest forum
#

what line

#

sned the line

outer steeple
#

line 9

#

package com.lions_lmao.tiktokchat;

import com.lions_lmao.tiktokchat.events.Events;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;

public class TikTokChat extends JavaPlugin {

public static TiktokChat plugin;
@Override
public void onEnable() {
    this.plugin = this;
    TikTokChat.plugin = this;
    getServer().getPluginManager().registerEvents(new Events(), this);
    getServer().getConsoleSender().sendMessage(ChatColor.GREEN  + "ON");
}
@Override
public void onDisable() {
    getServer().getConsoleSender().sendMessage(ChatColor.RED  + "OFF");
}
public static TiktokChat getInstance(){
    return TiktokChat.plugin;
}
earnest forum
#

make the variable private

#

and which line is it

outer steeple
#

9

earnest forum
#

which is 9 bruh

outer steeple
earnest forum
#

yes

outer steeple
#

public static TiktokChat plugin; <--- line 9

earnest forum
#

oh

#

shit

#

TikTok

#

i didnt realise the t was capitalized

#

replace it for all of them

outer steeple
#

k

#

works now

#

nvm

hexed cosmos
#

👍

outer steeple
#

my Events class requres Listener

earnest forum
#

?

outer steeple
#

nvm

#

nvm

#

fixed it

#

i forgot to implament Listener

tardy delta
#

?di

undone axleBOT
chrome beacon
outer steeple
chrome beacon
#

That's one step. There is a lot more

outer steeple
#

IT HAD NOTHING TO DO WITH MY PROBLEM

chrome beacon
#

You can't even write valid code so have patience and learn

tall dragon
#

dont start yelling now -.-

outer steeple
#

I spent like 1h - 2h to "learn" something i already knew

chrome beacon
#

You need to go through the entire thing. Just because you know some of it does not mean you should skip all of it

outer steeple
#

it still doesnt help me

chrome beacon
#

Knowing the programming language you're writing in does help

outer steeple
#

the problem i have is connected with bukkit

#

not with java

chrome beacon
#

Not really that code wouldn't work

#

Even if you removed the bukkit dependency and code related to it

#

It's just straight up broken. Now I'll leave this conversation here

earnest forum
#

it doesnt matter what ur problem is with

#

learning java helps u

#

i didnt learn it before and i struggled

outer steeple
#

so i have to spent 1mount learning java to just make this one project, knowing that i wouldn't use java again

tall dragon
#

how else are you gonna complete the project

chrome beacon
#

So you can't be bothered to learn Java so you want us to waste time writing the project for you

#

Just hire someone

tall dragon
#

im just gonna build a big website real quick. i dont know any html, css or javascript

#

lets gooo

outer steeple
midnight shore
#

Learning Java is always good. If you understand it you would learn it in less than 2 weeks

vocal cloud
#

Learning a programming language is something that takes months if not years for someone who probably doesn't have any prior experience

sacred mountain
# outer steeple package com.lions_lmao.tiktokchat; import com.lions_lmao.tiktokchat.events.Even...
public class TikTokChat extends JavaPlugin {

    @Override
    public void onEnable() {
        registerEvents();
        getServer().getConsoleSender().sendMessage(ChatColor.GREEN  + "ON");
    }

    @Override
    public void onDisable() {
        getServer().getConsoleSender().sendMessage(ChatColor.RED  + "OFF");
    }

    private void registerEvents() {
       getServer().getPluginManager().registerEvents(new Events(), plugin);
    }

in your Events:

public class Events {
    private final TiktokChat plugin;

    public Events(TiktokChat plugin) {
        this.plugin = plugin;
    }
}```
tall dragon
sacred mountain
#

i think that would work

#

idk tho i wrote it in discord

tall dragon
#

i hate it so much when people register their event in the class constructor

#

idk why

ivory sleet
#

ye

sacred mountain
#

lol ok

tall dragon
#

i feel like its not clean at all

sacred mountain
#

well

ivory sleet
#

thats kinda coupled

sacred mountain
#

u can do it in the main class

#

i guess

ivory sleet
#

ye much better

vocal cloud
#

Yeah just use reflection

midnight shore
vocal cloud
#

Never register again

tall dragon
#

i always make a method in the main class to register a list of Listener classes

ivory sleet
#

reflection :/

sacred mountain
#

there fixed

lyric grove
#

Anyone know how i can achieve this in java? i tried Optional.of but same issue

ivory sleet
#

orElseGet iirc

lyric grove
#

thx

ivory sleet
sacred mountain
#

or is it a preference

ivory sleet
#

yes

#

its objectively worse

sacred mountain
#

welp time to go change that

ivory sleet
#

😅 I mean for spigot/bukkit it probably doesnt matter, but for constructors you only want to initialize necessary variables and such

#

rarely ever include logic or such things

#

it becomes important to isolate that once you start testing and creating layers of abstraction

vocal cloud
#

but with reflection kekw

sacred mountain
#

hy

sacred mountain
vocal cloud
#

I am too. That's why I use reflection. If I forget to register something it yells at me so I can't forget anymore

outer steeple
#

i think im going to just give up

sacred mountain
#

bruh

#

the only reflection thing ive done ever was a skull util to get custom skulls

vocal cloud
ivory sleet
#

oh its probably not that bad in terms of speed

#

but rather due to the coupling

vocal cloud
ivory sleet
quiet ice
#

looks fine to me

vocal cloud
#

I spent like 8h figuring out the fastest way to do it without using an external lib.

vocal cloud
#

Since people here complained that "reflections is such a big library"

ivory sleet
sacred mountain
#

just add the annotation and it would automatically regsiter it?

quiet ice
vocal cloud
#
        LoaderTool loaderTool = new LoaderTool(this, "com.miketheshadow.complexmmostats");
        try {
            loaderTool.defaultSetup();
        } catch (Exception e) {
            e.printStackTrace();
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

where com.miketheshadow.complexmmostats is your base package and this is your plugin.
Then all you have to do is annotate your commands with @CommandLoader(command ="commandName") and voila. It auto registers commands and listeners

sacred mountain
#

what if your class is just a listener

vocal cloud
sacred mountain
#

there isnt a command in my file its literally just an onJoin listener

vocal cloud
#

It automagically registers listeners. Commands need the annotation since they need an argument for the name.

sacred mountain
#

oh so i can just put whatever

outer steeple
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

sacred mountain
#
@LoaderTool.CommandLoader(command = "test")
vocal cloud
vocal cloud
midnight shore
#

?learnjava

undone axleBOT
sacred mountain
vocal cloud
shrewd sentinel
#

Why does it only execute "1" and not "2"

    @EventHandler
    public void onRightClick(NPCRightClickEvent e) {
        Player player = e.getClicker();
        NPC npc = e.getNPC();

        player.sendMessage(ChatColor.RED + "1");

        Human human = NinjeHuman.getInstance().getHumanManager().getHuman(npc);
        player.sendMessage(ChatColor.RED + "2");
    }
    public Human getHuman(NPC npc) {
        for(Human human : getHumanList()) {
            if(human.getNPC().equals(npc)) {
                return human;
            }
        }

        return null;
    }
lilac dagger
#

error?

sacred mountain
lilac dagger
#

or it hangs

shrewd sentinel
#

No error

vocal cloud
sacred mountain
#

thats pretty neat

vocal cloud
#

I have plans to make it into an actual library but it still needs some work and optimization.

lilac dagger
shrewd sentinel
sacred mountain
#

hmm ill give it a go

vocal cloud
#

It's pretty untested at the moment (only tried it on the project it's in atm). So good luck.

sacred mountain
#

hm it doesnt seem to be actually registering anything, but no errors

lilac dagger
#

that's why you gotta try

sacred mountain
#

do i need the forceLoadAllClasses for listeners? @vocal cloud

vocal cloud
#

I have a lot of optimizations I need to add

#

The forceLoadAllClasses is a WiP. Basically I open the jar to read all the class files from it. The issue is if you have a lot of libraries the poor thing spends a lot of time loading every class from them. The forceLoadAllClasses is an attempt to avoid this but might not work as intended atm.

shrewd sentinel
lilac dagger
#

Human human = NinjeHuman.getInstance().getHumanManager().getHuman(npc); this does something that intrerupts it

vocal cloud
#

Did it compile it into the jar? Unless an error occurs there isn't a whole lot of reasons why that message isn't sending

mortal cedar
#

Is there a bungeecord player quit event that fires after the spigot server handled the player leave?

wispy plume
#

Hey, what do you think would be the most optimised way to get player count on all bungeecord subservers from a spigot server?

#

Actually, I need it to update continuously

tender shard
#

there's no need to keep track of this manually

wispy plume
#

Would sending a plugin message every second and caching response would be the good way?

ivory sleet
#

mye

vocal cloud
#

Why every second?

wispy plume
#

The server selector items should update quickly 😄

vocal cloud
#

Why not player join -> update plugin with info -> player leave -> update plugin with info

#

That way you're not wasting time repeating the same number

wispy plume
#

It's not known from where did the player join specified gamemode. Could be different lobby or using a command

#

xd

wispy plume
# vocal cloud What?

You mean on lobby join (any player) update, and on lobby quit (any player) update?
If so, it's not gonna work properly.

vocal cloud
#

1s. Let me read the docs

#

?jd

wispy plume
#

I'm just asking for an advice, docs rather show how to code something

vocal cloud
#

And I told you my advice

wispy plume
#

Maybe there's a better way than spamming plugin msgs to the poor bungee

#

Alright then, we have the same one. I guess nothing better can be done

#

Thank you

vocal cloud
#

Bungee has events to keep track of all this information. You can then send update messages whenever a player joins/moves servers

shrewd sentinel
#

Why does it only execute "1" and not "2"

    @EventHandler
    public void onRightClick(NPCRightClickEvent e) {
        Player player = e.getClicker();
        NPC npc = e.getNPC();

        player.sendMessage(ChatColor.RED + "1");

        Human human = NinjeHuman.getInstance().getHumanManager().getHuman(npc);
        player.sendMessage(ChatColor.RED + "2");
    }
    public Human getHuman(NPC npc) {
        for(Human human : getHumanList()) {
            if(human.getNPC().equals(npc)) {
                return human;
            }
        }

        return null;
    }
vocal cloud
wispy plume
#

Yeah, is an error thrown in the console?

shrewd sentinel
#

Nop

shrewd sentinel
tender shard
#

you can easily obtain a list of players and on what server they are using bungee api o0

wispy plume
vocal cloud
shrewd sentinel
#

yes

tender shard
wispy plume
#

A Spigot doesn't know player count on another spigot

#

It needs to ask bungee about the playercount on another server

tender shard
#

oooh now I understand what you need

#

your previous messages suggested you needed that information on the proxy

wispy plume
#

No xD

#

Obviously it has that, why would I ask

tender shard
#

yeah sure you can send a plugin message every second

vocal cloud
#

Whenever a bungee event fires in relation to a player joining/leaving/switching servers just send a plugin message.

tender shard
#

I'd however just use redis

tepid jetty
#

Hello everyone, would it be possible to improve the ping by setting up 2 proxies that would shorten the packets?

So something like this:
Proxy 1: This proxy is located near me and shortens the client-server packets as much as possible (less big buffers) and encodes the server-client packets to the normal Minecraft format.
Proxy 2: This proxy is close to my target server and encodes the client-server packets to the normal Minecraft packet format and truncates the server-client packets.

I hope I could explain it a little bit understandable.

ivory sleet
#

pmc works fine pretty much

vocal cloud
#

I imagine that would cause even more delay with all that processing in between

tender shard
#

also the ping has nothing to do with the size of the data

#

whether you send a big package by post or a small package, the delivery truck takes the same time to deliver it

#

it doesn't go magically faster because the packet is smaller

tepid jetty
tender shard
#

Yes, so "this is true"

vocal cloud
#

True there is some processing involved but all you're going to do is add to that processing with proxies

tepid jetty
tender shard
vocal cloud
#

^

#

100%

tender shard
#

i'm out, you clearly don't care what people answer anyway

#

have fun with your 2 proxies

wispy plume
#

How adding 2 proxies would reduce ping (latency) XD

tepid jetty
vocal cloud
#

What that makes no sense at all

tender shard
wispy plume
#

Latency that matters is the latency between server (spigot) and the client (mc player)

#

Adding new proxies would rather use more processing between each, and make the latency even bigger

#

Just what every1 above said

tender shard
#

I am compiling craftbukkit right now 💀

vocal cloud
#

cya next year

wispy plume
#

100% cpu 🔥

tender shard
#

noone insulting me for using craftbukkit instead of spigot?

vocal cloud
wispy plume
#

And compile mc 1.4.0

tender shard
#

I want to check how many stuff I have to change to make my update checker work with craftbukkit

#

somehow sometimes people are still actually CB lol

vocal mirage
#

Hello!
I use ProxyServer.getInstance().getServerInfo(server).canAccess(player) method to see if I can send a player in my server (on bungeenetwork)
Nevertheless, if the server just started starting, it returns true, and as I put the send method in a while boucle to be sure he'll be sent (it stops when he's connected to the server), it keeps spamming me the connection.

Is there a more reliable method than that?

quiet ice
#

If I run a bandwidth intensive application (i .e. discord) on my 16 kbit/s connection the latency can go to up to 2 minutes where as usually it would be at under 6 seconds

#

However in their case reducing the bandwidth via proxies is going to make more harm than good

shrewd sentinel
#

Why does it only execute "1" and not "2"

    @EventHandler
    public void onRightClick(NPCRightClickEvent e) {
        Player player = e.getClicker();
        NPC npc = e.getNPC();

        player.sendMessage(ChatColor.RED + "1");

        Human human = NinjeHuman.getInstance().getHumanManager().getHuman(npc);
        player.sendMessage(ChatColor.RED + "2");
    }
    public Human getHuman(NPC npc) {
        for(Human human : getHumanList()) {
            if(human.getNPC().equals(npc)) {
                return human;
            }
        }

        return null;
    }
vocal cloud
#

The reason it doesn't is because there is an error in your code

#

You can keep posting the same thing over and over again but the answer is the same

shrewd sentinel
vocal cloud
#

You've narrowed it down so to speak

#

Run a debugger on it

shrewd sentinel
vocal cloud
#

Throw a log in the for loop

#

Does humanList return null

#

etc etc

#

Log actually useful info not 1,2,3,4 in case you've got those somewhere else

shrewd sentinel
vocal cloud
#

before human get attempt
after human get attempt
during human get attempt

#

etc etc

shrewd sentinel
#

Got it working, thanks

lime jolt
#

does anyone know how to place an item in a chest in a specific row and and column in the chest

#

this is what I got so far

#
        loc.getBlock().setType(Material.CHEST);

        Chest chest = (Chest) loc.getBlock().getState();
        Inventory inv = chest.getBlockInventory();

        chest.getInventory().clear();

        inv.addItem(new ItemStack(Material.STONE, 2));```
vocal cloud
#

?jd-s

undone axleBOT
lime jolt
#

cant find it

lime jolt
#

?!??!?!

vocal cloud
#

?

lime jolt
#

thanks, I think I just overlooked it

#

I only saw addItem

sharp flare
#

?learnjava

undone axleBOT
sharp flare
#

Stop copy pasting, check the docs

unique eagle
#

Hello ! i try to change a block client side for a player
i used Player#sendBlockChange but all player see the block change
it's very weird

worldly ingot
#

Well that's literally not how that method works 😛 If you called Player#sendBlockChange(), only that player will see the block change

unique eagle
#

it's weird

worldly ingot
#

So unless you did,

for (Player player : Bukkit.getOnlinePlayers()) {
    player.sendBlockChange();
}```
#

That's not the case

unique eagle
#

i want change the block for only 1 player

#

not all

worldly ingot
#

I know, and that method does that

#

but the only case where all players would see it is if you did it in a loop

tender shard
worldly ingot
#

yis. c0d3 pls

tender shard
#

c0derinho

tall dragon
#

any1 here work with Crunch before by redempt?

unique eagle
#
block5.setType(Material.AIR);
player.sendBlockChange(new Location(Bukkit.getWorld("world"),1386 ,4 ,1513),block5.getBlockData());```
vocal cloud
#

?paste it too so it doesn't look like a word salad

undone axleBOT
worldly ingot
#

I mean, all relevant code would be helpful because that on its own looks fine

tender shard
unique eagle
#

yes yes

worldly ingot
#

Actually no, it isn't lol

tender shard
#

hm I would check it out myself, but mojang now forces me to migrate all my alt accounts

worldly ingot
#

You're setting it to air then displaying to the player that you set it to air

tender shard
#

so I can't

unique eagle
#

i use worldguard event plugin on regionenter

worldly ingot
#

Block#setType() = server, all players are going to see that air change

unique eagle
#

hooo okay

#

i see haha

#

i will remove Block#setType()

tender shard
#

oh lmao I didn't even see that

#

yeah but your code is still pointless

red sedge
#

Do i need to set the players PDC back after changing it?

tender shard
#

you send a blockchange to the player with the material the block already has

red sedge
#

k

unique eagle
#

i will create a new block

tender shard
#

well currently you get the blockdata of XYZ and tell the player "block XYZ now is the same as block XYZ", nothing would change

olive lance
#

dude

#

what does the 'win' mean

#

apparently not window size

tender shard
#

am I the only one who can never remember this property name? ${settings.localRepository}

quasi patrol
#

So I am trying to include a webhook receiving something, but when I test it I get this error ��{"translate":"disconnect.genericReason","with":["Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: Bad packet id 79"]} I was told it was an MC related issue so that is why I am here. :P

rough drift
#

we need more info

#

what's this webhook

tall dragon
#

does any1 know how i can map a range of values to another range of values?, ik this isnt rlly spigot help but im shit at math

#

for example 1-100 & 100-1000, if i had an input of 50 that would be 500 i think

kindred valley
#

How can i equal an enums value to the next of iterator

lost matrix
woeful crescent
#

I have a static block that isn't running when my plugin loads, or ever for that matter. All it does is first print a line and then register something to a map. Do static blocks run normally on a spigot server?

agile solstice
#

question is there a way you could let users create private worlds through your server with their own mods/plugins and have it be connected to your main server?

lost matrix
woeful crescent
#

does something special have to happen for the class to be initialized?

lost matrix
kindred valley
lost matrix
kindred valley
# lost matrix cool
Staff p = new Staff("A GUY", Ranks.STAFF);
        ListIterator iterator = list.listIterator();
        p.getRanks().toString().equals(iterator.next());
        System.out.println(iterator.next());```
kindred valley
#

ah wait

agile solstice
lost matrix
agile solstice
#

im good at making projects, so its not a Problem

woeful crescent
lost matrix
woeful crescent
#

haha no, like what about the variables in an enum

#

and the constructor

#

i mean like

#

do enum values all get initialized immediately?

lost matrix
peak granite
#

how do i make it so when u click on a message "are u sure? [yes] [no]" when u click on [yes] or [no] it makes u execute a command

vocal cloud
#

?jd

river oyster
#

Isn't ItemStack can be casted to CraftItemStack whenever?
wtf is this?

java.lang.ClassCastException: org.bukkit.inventory.ItemStack cannot be cast to org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack

tender shard
vocal cloud
lost matrix
tender shard
river oyster
#

yes I think so but failed to cast

#

I've did it
(newItem as CraftItemStack).handle (I made handle to public)

lavish hemlock
#

What platform are you using? It should theoretically work on anything that uses CraftBukkit.

tender shard
#

I don't know how it works in 1.12, it's a hundred years old, but in 1.18 you can just directly cast it:

CraftItemStack obcItemStack = (CraftItemStack) bukkitItemStack;
peak granite
#
        message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/command"));
        player.spigot().sendMessage(message);```
how would i put a string before it?
tender shard
#

Use a ComponentBuilder

river oyster
#

Hmmm It's kind of weird.

tender shard
peak granite
tender shard
tender shard
# peak granite how?
GitHub

UpdateChecker for your Spigot plugins with only one line of code needed in your plugin! - Spigot-UpdateChecker/UpdateCheckerMessages.java at master · JEFF-Media-GbR/Spigot-UpdateChecker

#

check out lines 133+

peak granite
#

Required type: BaseComponent[]
Provided: ComponentBuilder

tender shard
#

show your code

peak granite
#

BaseComponent[] component = new ComponentBuilder(Color.translate("Hello "));

tender shard
#

it's builder, you have to call build() at the end

#

create()

#

not build()

peak granite
#

oh

tender shard
#

you can also just get a List of Components

#

then create an empty TextComponent and use addExtra like in the class I've sent above

peak granite
#

then how would i concat them?

tender shard
#

I am simply creating an empty component, then append all my other components that include links or not in a for loop

#

using addExtra on the original component

kindred valley
lost matrix
tender shard
storm garden
#

How can I check if a command has none arguments? Can't get i to work

crimson terrace
kindred valley
# lost matrix Show your code
Staff p = new Staff("A GUY", Ranks.STAFF);
        ListIterator iterator = list.listIterator();
        p.getRanks().i == iterator.nextIndex();
        System.out.println(iterator.next());```
tender shard
tender shard
crimson terrace
#

BUT HOW WOULD WE USE ENUMS

cosmic spear
#

Hi guys what Chat API do you recommend?

vocal cloud
kindred valley
tender shard
crimson terrace
tender shard
tender shard
viscid girder
storm garden
#

why doesnt if (args.length == 0) work?

tender shard
crimson terrace
storm garden
#

Not for me

tender shard
crimson terrace
#

if its just "/command" passed in it works

tender shard
storm garden
#
if (cmd.getName().equalsIgnoreCase("feed")) {

            if (args.length == 0) {
                player.setFoodLevel(20);
                player.sendMessage("You have been fed");
            }

        }
tender shard
#

well then show more code, the error must be above

#

also why are you checkin the commands name?

storm garden
#
package me.northymc.testplugin.commands;

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class PlayerCommands implements CommandExecutor {

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

        if (!(sender instanceof Player)) {
            sender.sendMessage("§cThis command can only be executed by players!");
            return true;
        }

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

        // FEED COMMAND
        if (cmd.getName().equalsIgnoreCase("feed")) {

            if (args.length == 0) {
                player.setFoodLevel(20);
                player.sendMessage("You have been fed");
            }

        }

        return true;
    }
}
crimson terrace
#

sadly

tender shard
#

so it throws an error

cosmic spear
#

The problem i have with BungeeChat API for TextComponents it say is Deprecated

storm garden
tender shard
#

and to be honest you could have showed us that error in the first place

crimson terrace
#

you dont need to check the name

tender shard
#

then access them

crimson terrace
#

you have to declare it in the plugin.yml tho i think, did you do that?

storm garden
#

So

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

should be below the if statement?

tender shard
#

you basically do this:

  1. Yo, player is the first entered word
  2. Were there any words entered? If no, heal the player from step 1
    This makes no sense
storm garden
#

Inside*

tender shard
#

You want to declare Player target = null. Then check if there are any args. If not, cast the CommandSender to Player and store it inside target. If there any args, get the Player with that name and store that inside player. Now heal the player

crimson terrace
#

your logic should probably be something like if(args.length == 0) target = sender;

tender shard
crimson terrace
#

is there a way to test Listeners?

storm garden
#

How can I make a method for ChatColor.translateAlternateColorCodes so I don't have to type it every time?

sacred mountain
#

is it possible to save the contents of a guava multimap to a file?

lost matrix
lost matrix
storm garden
#

Just forget it

vocal cloud
#

Gotta learn java if you want to write plugins

sacred mountain
storm garden
#

Spoonfeed

ivory sleet
#

You asked for it?

sacred mountain
#

bruh

storm garden
#

Yes, but I want to undestand what is happening

sacred mountain
#

erm

#

i cant really make it much simpler

crimson terrace
ivory sleet
#

Better off googling how methods work then

lost matrix
ivory sleet
#

Tho to elucidate methods, they're just instructions which can be called whenever you want in principle

crimson terrace
#

that moment when the method name length is the problem, but its not even that long XD

sacred mountain
#

when ur method name is longer than the code inside

kindred valley
lost matrix
pliant oyster
#

I'm stuck on something, when I open an inventory, I can still take stuff out of it even when I set cancelled to true in InventoryClickEvent

kindred valley
lost matrix
pliant oyster
quaint mantle
#

how do you explain to somebody stealing code is worse than learning to code it yourself

pliant oyster
#

and I can still take stuff out of it

crimson terrace
tender shard
#

which makes sense since inventoryName probably is a string

lost matrix
pliant oyster
tender shard
pliant oyster
#

Inventory inventoryName = Bukkit.createInventory(null, InventoryType.CHEST, ChatColor.GREEN + "" + ChatColor.BOLD + "Crates");

lost matrix
crimson terrace
#

what debug messages do you use for your plugins?
Im usually on the
sender.sendMessage("CP1");
or
Main.getInstance().getServer().getConsoleSender().sendMessage("CP1");
train

tender shard
#

System.out

kind hatch
#

I just sout most of the time.

tender shard
#

or Main.debug(String)

vocal cloud
#

Logger logger = LoggerFactory.getLogger(Class.class)

tender shard
#

where debug is this

public static void debug(String... text) {
  if(debug) {
    for(String line: text) {
      instance.getLogger().warning("DEBUG " + line);
fast path
#

Hm

#

What happened here?

#

What’s the problem?

cosmic spear
#
            final TextComponent textComponent = Component.text("You're a ")
                    .color(TextColor.color(0x443344))
                    .append(Component.text("Bunny", NamedTextColor.LIGHT_PURPLE))
                    .append(Component.text("! Press "))
                    .append(
                            Component.keybind("key.jump")
                                    .color(NamedTextColor.LIGHT_PURPLE)
                                    .decoration(TextDecoration.BOLD, true)
                    )
                    .append(Component.text(" to jump!"));

Did anyone know how i can send this textcomponent to player?

kind hatch
#

Player#spigot().sendMessage()

tender shard
fast path
ivory sleet
#

that looks like adventure

tender shard
#

quick, we need a fourth answer

fast path
#

yes that is

pliant oyster
cosmic spear
#

Yes its adventure

ivory sleet
#

so Player.Spigot::sendMessage wont work

#

because it takes the bungee chat component

fast path
#

hm

tender shard
ivory sleet
#

if you're on spigot

fast path
#

in fact that will work I think

cosmic spear
#

I'm using paper not spigot

ivory sleet
#

use the adventure bukkit platform's BukkitAudiences

pliant oyster
#

mfnalex has a hot voice btw, I heard it yesterday

fast path
#

Hm

ivory sleet
#

ah

fast path
#

Ah

ivory sleet
#

then just Player::sendMessage should work

vocal cloud
#

7333_cringe paper

tender shard
fast path
#

Then you can just use sendMessage

ivory sleet
#

as it takes ComponentLike, Component etc

fast path
#

Yeah

vocal cloud
cosmic spear
#

I don't know but it don't work

fast path
#

Hm

#

What’s the error?

#

Show me

cosmic spear
#

for Player.sendMessage(textcomponent) is because its not a string

ivory sleet
#

you have to rely on the paper api

vocal cloud
#

Well obviously. Does this component have no documentation?

fast path
#

Do you add paper as your dependency?

vocal cloud
#

Find the docs and read the docs

pliant oyster
sacred mountain
#

can i convert a guava multimap to a hashmap

fast path
sacred mountain
#

from MultiMap<String, String> to Hashmap<String, List<String>>

sacred mountain
ivory sleet
#

would need to be ListMultimap

#

but its possible

fast path
cosmic spear
#

these are mine dependecies:

    <dependencies>
        <dependency>
            <groupId>com.github.MilkBowl</groupId>
            <artifactId>VaultAPI</artifactId>
            <version>1.7</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-api</artifactId>
            <version>4.10.1</version>
        </dependency>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

Before working BungeeChatEvents and Spigot but now no, and i don't know why

sacred mountain
#

ah right ok

lost matrix
tender shard
vocal cloud
pliant oyster
ivory sleet
#

paper api has adventure as transitive

#

thus just depending on paper will get you adventure on the classpath

pliant oyster
sacred mountain
ivory sleet
#

it does

#

but it gives you a view

fast path
#

And register the event?

pliant oyster
#

oh

#

forgot registering events existed

#

mb

pliant oyster
#

and yes eventhandler is there

fast path
#

Let me check angin.

fast path
pliant oyster
#

Inventory mainGui = Bukkit.createInventory(null, InventoryType.CHEST, ChatColor.GREEN + "" + ChatColor.BOLD + "Crates");

fast path
#

Oh

#

Then I know

pliant oyster
lime jolt
#

can you have while (true) in your code or does it break game in minecraft

fast path
#

Yes you can

lime jolt
#

very strange

#

dont know where my bug is at then

fast path
#

If it’s not on main thread, that’s normal

lime jolt
#

okok

fast path
#

If it’s on the game will stucked.

cold pawn
#

Hey im having this issue were im trying to create a bossbar through the spigot API and set values for the bar ie: BarColor.Blue. The issue is it dosent recognize any of the values im giving it and the bar is always solid and pink, any reason for this?

pliant oyster
fast path
pliant oyster
#
public void onInventoryClickEvent(Player player, InventoryClickEvent e)```
#

that's where the event handler is

fast path
#

Oh

#

Not add there

#

You need remove player

#

And use e.getWhoClicked

sacred mountain
#

I'm creating an alt checker plugin, what would the best way of storing player ip's and then checking them on login be?

#

should i just store it all in one json file

fast path
fast path
#

Your file size will being bigger and bigger.

kind hatch
sacred mountain
#

well then whats the good way

tender shard
fast path
lime jolt
tender shard
#

and you could also always remove old entries

tender shard
#

I'd give the server admin an option to use either SQLite, JSON or mysql

tender shard
fast path
#

You know?
It will uses more time and more performances to save data.

fast path
tender shard
pliant oyster
fast path
#

You can

lime jolt
tender shard
fast path
#

But you need cast it

fast path
#

then it done

kind hatch
# pliant oyster fr?

AFAIK, the methods don't register properly if there are multiple parameters. Also, I have yet to see a plugin that has multiple parameters in one of their event handlers. Could open up some possibilities if it worked like that.

tender shard
fast path
#

If there still nothing log, you need change your check way.

lime jolt
tender shard
lime jolt
#

how would I change it then

tender shard
#

remove your weird while loop

fast path
#

Why you need to use while?

pliant oyster
lime jolt
fast path
#

You can just use timer and reput block in every 1 tick.

#

Hm

tender shard
fast path
#

Can you explain it more clearly?

kind hatch
#

You could just use a for loop.

fast path
#

What do you want to do

lime jolt
#

if (breakFree) {
break;
}

lime jolt
fast path
#

Wdym

tender shard
fast path
#

What the result you want

tender shard
#

your code is like

lime jolt
#

I want to check if a specific spot is available, if it is, it will break out, and if it is not it will pick a new spot

tender shard
#

move the breakFree = true into the loop

#

at the top of it

lime jolt
#

are u sure that will change anything

fast path
#

Hm

lime jolt
#

that is just writing it difrently, (writing it better)

tender shard