#help-development

1 messages · Page 1652 of 1

grim ice
#

there is a sendMessage

#

i want the message he sents

#

to not be visible

eternal oxide
#

then remove all recipients

grim ice
#

event.getRecipients().removeAll(event.getRecipients());

#

or what lmao

lost matrix
#

Cancelling the event will work.

eternal oxide
#

either or

grim ice
#

like dis?

#

uh

#

i want only the message that i use for config to be hidden

eternal oxide
#

put your test before you remove the entry

grim ice
#

ye

#

@EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
if(this.waitingInputMap.containsKey(event.getPlayer().getUniqueId()))
event.setCancelled(true);
Optional.ofNullable(this.waitingInputMap.remove(event.getPlayer().getUniqueId())).ifPresent(consumer -> consumer.accept(message));
}

#

like dis?

#

ok it works

regal anchor
#

Hello, I did some debug and my code to close a trapdoor doesn't work

#

all my debug results are there after //

#

found some things on google to do it

plain scroll
#

how can i remove a plugin?

regal anchor
#

from your server ?

plain scroll
#

nah

#

from my resource page

#

i have a few that are so BAD

crude sleet
eternal night
#

should have already failed in 1.16 tbh

#

async access to worlds is not supported

plain scroll
crude sleet
eternal night
#

execute it on the main thread

crude sleet
#

I dont want to rewrite the class

eternal night
#

you will have to

quaint mantle
#

especially not in a range

quaint mantle
plain scroll
#

done

#

ty

fluid cypress
#

can someone please tell my why this ONLY works the first time??

public static void enableAutoSave() {
    Bukkit.getWorlds().forEach(world -> {
        // this only saves the chunks that haven't been blocked in the UnloadChunkEvent event
        world.save();
        // copy the seed and stuff from this world
        WorldCreator worldCreator = new WorldCreator(world.getName());
        worldCreator.copy(world);
        // chunks that have been generated but blocked from being saved in the UnloadChunkEvent event are kept saved somewhere
        // (God only knows where and why) so if we unload the world (with save = false), those chunks are lost, THAT'S WHAT WE WANT
        Bukkit.getServer().unloadWorld(world, false);
        // now load the world again
        World reloadedWorld = worldCreator.createWorld();
        reloadedWorld.setAutoSave(true);
    });
}

the event just in case

@EventHandler
public static void onChunkUnload(ChunkUnloadEvent e) {
    if (ChunksHandler.isUseless(e.getChunk()))
        e.setSaveChunk(false);
}

maybe Bukkit.getWorlds() is storing the old references or something like that? i really dont know, but it works as expected the first time after each server restart

#

context: after generating a lot of chunks with autosave in off, i call enableAutoSave to enable it again, but without saving all those useless chunks (trying to)

eternal oxide
#

What worlds specifically?

#

as Base worlds can not be unloaded

fluid cypress
#

what is a base world? and it could be any world in theory, but now im doing it with the end, not a new one, just the default one, world_the_end

eternal oxide
#

World, the end and nether can not be unloaded

fluid cypress
#

but now its working more than once, wtf, i only added comments

eternal oxide
#

its hard coded to block unloading of those worlds

fluid cypress
# eternal oxide World, the end and nether can not be unloaded

but its working, also i get this on console, maybe multiverse "unblocks" that?

[19:11:17 INFO]: [Multiverse-Core] World 'world_nether' was unloaded from Multiverse.
[19:11:18 INFO]: [Multiverse-Core] World 'world_the_end' was unloaded from Multiverse.
[19:11:20 INFO]: [Multiverse-Core] World 'test' was unloaded from Multiverse.
eternal oxide
#

Multiverse says its unloading but its not

fluid cypress
#

mmm

eternal oxide
#

only test is actually being unloaded

#

look at yoru GroupManager notifications

fluid cypress
#

but im loosing those useless chunks, which is what i want, so, i guess its fine

eternal oxide
#

it only picks up test on reloading

fluid cypress
#

yeah

#

mmm

#

but its definitely doing something, bc im not getting a lot of useless mca files now

#

which is good

eternal oxide
#

yep, you can probably block saving

#

just not unloading

fluid cypress
#

works for me

vague cypress
#

How do you properly check if a player right-clicks with a specific item in 1.16? I've looked all over the internet and can't seem to find anything that works, please help.

opal juniper
#

PlayerInteractEvent iirc

#

get the item in their hand

#

check that the action was a right click

vague cypress
#

Well, according to my checks, I seem to be struggling with checking the item, not the right-click. Here's what I have so far:

    @EventHandler
    public void selectMenu(PlayerInteractEvent e) {
        Player player = e.getPlayer();
        Action a = e.getAction();

        if(a.equals(Action.RIGHT_CLICK_AIR) || a.equals(Action.RIGHT_CLICK_BLOCK)) {
            player.sendMessage("Check One : Passed");
            if(e.getItem() == ItemManager.fireToken) {
                player.sendMessage("Check Two : Passed");
                SelectionScreen gui = new SelectionScreen();
                player.openInventory(gui.getInventory());
            }
        }

    }
}```

*check one fires every test but not check two
eternal oxide
#

== for comparing enums, .equals for comparing objects

vague cypress
#

I tried both, neither work

eternal oxide
#

getItem().isSimilar(ItemManager.fireToken)

vague cypress
#

ooh ok

#

lemme try

eternal oxide
#

If not null

#

you could reverse it to avoid a null check

#

if (ItemManager.fireToken.isSimilar(e.getItem())

lost matrix
#

I personally would always go for PDC for cusom item identification.

vague cypress
#

Ooh, it works, thanks! You have NO idea how long I've been trying to figure this out for

#

What's PDC?

eternal oxide
#

?pdc

vague cypress
#

Thanks, I'll check it out! For now though, I'm just happy that what I have works

shy wolf
#

how can i get all online players on bungee?

unreal quartz
#

?google

undone axleBOT
waxen plinth
#

You're not doing it correctly

#

You need to update the BlockData of the state first

#

Or just do it directly without BlockState

#
TrapDoor trapdoor = (TrapDoor) block.getBlockData();
trapdoor.setOpen(false);
block.setBlockData(trapdoor);```
regal anchor
#

thanks, but that function does not seem to exist for Block

#

ok found it, thanks I'll try that : )

rigid otter
#

Hello! where are players data saved?

paper viper
#

[base]/world/playerdata?

#

or something like that

#

let me check

rigid otter
#

I see usercache there, but idk about exactly playerdata

#

but it contains a bit information about player

#

uuid, name, expire date

#

idk what expire date mean too

quaint mantle
#

guys

#

how do u

#

put like

#

a 1.8 plugin and a 1.17 plugin in

#

together

#

and then when put on server

#

it uses the one for that version

#

i never done

#

i stupid

rigid otter
#

They use wrapper

quaint mantle
#

me stopid

#

explain

rigid otter
#

The developers create that method by themselves

quaint mantle
#

o

#

atm i have 2 seperate plugins

#

and its annoyiing me

rigid otter
#

Can say it is a trick

quaint mantle
#

i always gotta change shit

rigid otter
#

When any version possible, wrapper will wrap that version, use that version and leave others.

paper viper
#

You have pretty much two options. 1) Make an implementation for each version. Or 2) start with the 1.8 api and write all the methods modified/removed/added by yourself

#

while making sure they are compatible with the current whatever api you use

waxen plinth
#

The latter is easier

paper viper
#

unless you are using NMS

#

🥲

#

then the first is the only option

gleaming wasp
#

Hello, I have been trying to figure out a way to save a villagers nbt data inside an item's PersistentDataContainer, but it gives me an error every time. What is the most efficient way of getting around this?

#

I tried researching this issue, however I couldn't find anything.

woeful moon
#

Hello, trying to make it so that spawners in the nether don't drop (you break them but nothing happens). Here's my code:

    @EventHandler
    public void onBlockItemDrop(BlockDropItemEvent e) {
        if(e.getBlock().getWorld().getName().equalsIgnoreCase("world_nether")) {
            if(e.getBlockState().getBlockData().getMaterial().toString().equalsIgnoreCase("SPAWNER")) {
                e.getItems().clear;
                e.getPlayer().sendMessage(ChatColor.RED + "Spawner breaking is disabled in the Nether!");
            }

        }
    }

Everything works except the e.getItems().clear;, but I couldn't find anything else to clear the drops. Any ideas?

bright quartz
#

can i add tags or metadata to placed blocks somehow? i want, if a player right clicks a certain copper slab, to get an item. but no other copper slabs, only this one

#

is there some way to uniquely identify this one block over all of the other types of that block?

waxen plinth
#

If so you could store the location in config or something

waxen plinth
#

Just store them in config

regal anchor
#
b.getState().setData(door);
b.getState().update();```
gritty haven
#

Hey for BungeeCord can I have it connect to a fabric, forge, and java server at the same time

regal anchor
#

@waxen plinth

ripe pawn
#

What are some other options for Bukkit.dispatchCommand(executor, command);the executor, I know I can use getConsoleSender, but it spams the console

waxen plinth
#

b.getState().update() will literally never do anything

regal anchor
#

someone suggested to do update(true)

waxen plinth
waxen plinth
ripe pawn
#

Yep

waxen plinth
#

Because b.getState() returns a fresh BlockState

#

You need to keep that instance

#

Call your methods on it to mutate it

#

And then call update on that BlockState instance

regal anchor
#

okay thanks

waxen plinth
# ripe pawn Yep

To my knowledge there is only one way to do this and it is extremely hacky

#

Basically only works because CommandSender is an interface

fluid cypress
#

i lost my patience trying to prevent chunks from being saved to disk. sometimes it works and sometimes it doesnt, and i dont know why. i think i will go back to the deleting mca files directly method. how slow/cpu intensive is the World#isChunkGenerated method? i mean, what does this method do internally? just checking arrays? is it feasible to save a set of all the chunks that are generated in a world? (obviously only x and y, not the whole chunk object)

waxen plinth
#

It's fast

#

I don't know the exact implementation but I do know that it's rather fast

waxen plinth
# ripe pawn Yep

You can create a proxy class at runtime which implements CommandSender and forwards all calls to the console command sender

#

Except for the sendMessage, method, which is ignored

#

I mean I suppose you don't need proxy classes for this but they make it much easier

#
CommandSender console = Bukkit.getConsoleSender();
CommandSender fakeConsole = (CommandSender) Proxy.newProxyInstance(CommandSender.class.getClassLoader(), new Class<?>[] {CommandSender.class}, (proxy, method, args) -> {
  if (method.getName().equals("sendMessage")) {
    return;
  }
  return method.invoke(console, args);
});
// You can now use fakeConsole to execute commands which it won't receive feedback for```
fluid cypress
#

any idea how to directly edit a mca region file? i mean, im not trying to paste a schematic or something like that, i just want to delete a whole chunk, it should be relatively simple, if its documented somewhere

waxen plinth
#

That won't be all that simple

#

I have no idea how to do it

fluid cypress
#

yea i know, messing with bytes is not simple, but maybe someone here has some experience with that

ripe pawn
waxen plinth
#

Huh

#

Just use that

#

Otherwise you'd need to place an actual command block and send a command from it

#

Which might not even work if command blocks are disabled

ripe pawn
waxen plinth
#

No

#

But I think creating a proxy instance is the simplest way

#

It's hacky but it's simple and it works

ripe pawn
#

Ok

regal anchor
#

is there still a problem with it cause it still doesn't work

waxen plinth
#

You shouldn't be using BukkitRunnable, first of all

#

Second of all, add debug print statements to make sure your code is actually being run

#

Third, call update(true, false)

regal anchor
#

just tried that and re-added debug in the runnable

#

it is called, does nothing :/

waxen plinth
#

Well man I dunno

#

You're using 1.12, that version isn't supported anymore

rustic gale
#

i think

#

i think thats the problem

woeful moon
#

But the equalsignorecase ignores the case

#

so spawner = SPAWNER

rustic gale
#

oh wait im stupid

rustic gale
paper geyser
#

they might be

#

im assuming you're not getting errors

woeful moon
#

The message is working

#

The only thing that isn't working is the removing the drop

rustic gale
#

i think

#

just use e.getPlayer.getInventory().removeItem();

woeful moon
#

what if he doesnt pick it up

rustic gale
#

man my brain cells

woeful moon
#

is there really no method for removing a block drop?

rustic gale
#

are not working today

rustic gale
#

maybe try clear()? or remove()?

woeful moon
#

I tried clear

#

didnt do anything

paper geyser
#

oh

#

what about e.setCanceled(true)

woeful moon
#

All that does is cancel the block breaking

#

Oh, what if I cancel the event and then remove the block

paper geyser
#

not block break

woeful moon
#

ohh right

paper geyser
rustic gale
#

Hey just quick question how do i check if the player head is under the water

#

.getLocation() returns the position of the player's feet so how do i add 1 to the Y axiss

#

ty

true nebula
#

maybe someone can help me with this multicraft installation! I have setup DB's multicraft_panel, and multicraft_daemon and initilized the database, and everything went good, and then went to startup my daemon, and refresh the list on the web install, and it doesn't show my daemon on the list? I made it 127.0.0.1, and setup my user, and password, etc.

tidal skiff
#

how do i load an Inventory from config?

stark marlin
#

Ah, it worked if I did the boolean check before initializing the array

rare cave
#

Hi, will PlayerDeathEvent be dispatched if the player used an undying totem?

vague oracle
#

I wouldn’t imagine so as there is an event for that

rare cave
#

What should I do if I want to damage a player and change the death cause if the player died

quaint mantle
#

how to make a specific mob

#

attack player

vague oracle
#

mob.setTarget(Player)

rare cave
#

oh i solved this

quaint mantle
#

set tatrget nio work

stark marlin
#

If I compile my plugin with Java 1.8, would it still be able to run on a 1.17 server? Seems that an API I'd like to use not supports Java 16 yet

vale ember
#

?paste

undone axleBOT
vale ember
quaint mantle
#

Use OfflinePlayers cause lag?

ivory sleet
#

? No

#

Using an OfflinePlayer does not inherently imply any lag

quaint mantle
#

ok thx

opal juniper
stark marlin
chrome beacon
#

Close project and delete .idea

#

Then reopen it

vivid temple
#

my warps.yml file isnt getting created

private File warps;
    private YamlConfiguration modifyWarpsFile;

    private static Main instance;

    @Override
    public void onEnable() {
        // STARTUP MESSAGE
        System.out.println("<<-------------->>");
        System.out.println("QuagWarps Enabled!");  //shortcut -> sout tab
        System.out.println("<<-------------->>");

        // INSTANCE
        instance = this;

        // CONFIG
        this.getConfig().options().copyDefaults();
        saveDefaultConfig();

        // COMMANDS
        getCommand("setwarp").setExecutor(new SetWarpCommand());
        getCommand("delwarp").setExecutor(new DeleteWarpCommand());

        // INITIATE FILES ON START
        try {
            InitiateFiles();
        } catch (IOException e) {
            e.printStackTrace();
        }

        // CREATE FILE LOCATIONS ON START
        if (!getWarpsFile().isSet("warps")){
            getWarpsFile().createSection("warps");
            SaveWarpsFile();
        }
    }

    @Override
    public void onDisable() {
        System.out.println("<<-------------->>");
        System.out.println("QuagWarps Disabled!");  //shortcut -> sout tab
        System.out.println("<<-------------->>");
    }

    // MODIFY WARPS FILE
    public YamlConfiguration getWarpsFile() {
        return modifyWarpsFile;
    }

    // GET WARPS FILE
    public File getFile() {
        return warps;
    }

    // SAVE BANK FILE
    public void SaveWarpsFile() {
        try {
            modifyWarpsFile.save(new File(this.getDataFolder(), "warps.yml"));
            modifyWarpsFile.save(warps);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // INITIATE FILES
    public void InitiateFiles() throws IOException {
        warps = new File(this.getDataFolder(), "warps.yml");
        if (!warps.exists()) {
            warps.createNewFile();
        }
        modifyWarpsFile = YamlConfiguration.loadConfiguration(warps);
    }

    // INSTANCE
    public static Main getInstance() {
        return instance;
    }
stark marlin
#

That didn't change anything, thanks though. I think it's related to some change I might have made in the pom recently

stone sinew
stark marlin
#

Found out what it was

stone sinew
#

Why are you create a new instance of the warps file?
modifyWarpsFile.save(new File(this.getDataFolder(), "warps.yml"));
modifyWarpsFile.save(warps);

vivid temple
#

nvm

stone sinew
vivid temple
tidal skiff
#

can hackers access the config.yml file?

stone sinew
#

Its cleaner and uses the object you already variablized

vivid temple
#

okay

stone sinew
tidal skiff
#

on what

stone sinew
#

If they access your servers files then yes. But just from joining your MC server.... Highly unlikely.

tidal skiff
#

oh alr

#

thx

#

nobody should have access if the server is just on my pc right

#

when theyre joining remotely

stone sinew
#

But if you have editor plugins on your server and they gain op perms then yes.

vivid temple
stone sinew
#

Because you now have both

modifyWarpsFile.save(new File(this.getDataFolder(), "warps.yml"));
modifyWarpsFile.save(warps);
``` You only need `modifyWarpsFile.save(warps);`
vivid temple
#

oh

stone sinew
#

new File(this.getDataFolder(), "warps.yml") creates a new instance

quaint mantle
#

help

#

now

#

what to do instea dof service manager in bungeecord

#

never done bunghee befpre

vivid temple
#

still nothing...

stone sinew
#

?paste your updated code

undone axleBOT
vivid temple
stone sinew
#

Where are you saving the file? Cause you don't have it in onDisable()

#

NVM I see

vivid temple
#

yes?

stone sinew
#

Debug it make sure the methods are running

lost matrix
#

?jd

lost matrix
vivid temple
# stone sinew Debug it make sure the methods are running

i enabled my plugin but still nothing got send

private File warps;
    private YamlConfiguration modifyWarpsFile;

    private static Main instance;

    @Override
    public void onEnable() {
        // STARTUP MESSAGE
        System.out.println("<<-------------->>");
        System.out.println("QuagWarps Enabled!");  //shortcut -> sout tab
        System.out.println("<<-------------->>");

        // INSTANCE
        instance = this;

        // CONFIG
        this.getConfig().options().copyDefaults();
        saveDefaultConfig();

        // COMMANDS
        getCommand("setwarp").setExecutor(new SetWarpCommand());
        getCommand("delwarp").setExecutor(new DeleteWarpCommand());

        // INITIATE FILES ON START
        try {
            InitiateFiles();
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam Initiating Files");
        } catch (IOException e) {
            e.printStackTrace();
        }

        // CREATE FILE LOCATIONS ON START
        if (!getWarpsFile().isSet("warps")){
            getWarpsFile().createSection("warps");
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam setting warps section");
            SaveWarpsFile();
        }
    }

    @Override
    public void onDisable() {
        System.out.println("<<-------------->>");
        System.out.println("QuagWarps Disabled!");  //shortcut -> sout tab
        System.out.println("<<-------------->>");
    }

    // MODIFY WARPS FILE
    public YamlConfiguration getWarpsFile() {
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam get warps file");
        return modifyWarpsFile;
    }

    // GET WARPS FILE
    public File getFile() {
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam get File");
        return warps;
    }

    // SAVE BANK FILE
    public void SaveWarpsFile() {
        try {
            modifyWarpsFile.save(warps);
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam save warps File");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // INITIATE FILES
    public void InitiateFiles() throws IOException {
        warps = new File(this.getDataFolder(), "warps.yml");
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam setting warps File");
        if (!warps.exists()) {
            warps.createNewFile();
            Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam creating new warp File");
        }
        modifyWarpsFile = YamlConfiguration.loadConfiguration(warps);
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "msg kipteam making modifications possible");
    }

    // INSTANCE
    public static Main getInstance() {
        return instance;
    }
lost matrix
vivid temple
stone sinew
#

Please tell me you aren't reloading your plugin using /reload or plugman

#

It doesn't load new code.

vivid temple
#

nah i have restarted my server plenty of times now

lost matrix
#

They will break stuff.

vivid temple
#

okay

#

i will restart it again

quaint mantle
#

LOL

#

IMAGINE

lost matrix
#

What exactly isnt working?

quaint mantle
#

USING PLUGMAN

#

HAHAHAHAHHAHAHHAA

vivid temple
quaint mantle
#

well fix it

#

another happy customer

lost matrix
lost matrix
#

Ok lets see

stone sinew
lost matrix
vivid temple
lost matrix
#

saveDefaultConfig()

#

Only works with a file named config.yml

vivid temple
#

yes

#

but i dont use config.yml

lost matrix
#

Then why do you call saveDefaultConfig() then?

grim ice
#

This conversation is just making me laugh a bit lol

vivid temple
#

and i wanted to use it later on

grim ice
#

if you're not using config.yml and instead a custom one, look up the wiki for thay

lost matrix
grim ice
#

cant u just doplugin.getDataFolder

vivid temple
#

sorry

grim ice
#

Plugin.getDataFolder()

lost matrix
vivid temple
lost matrix
vivid temple
lost matrix
lost matrix
vivid temple
lost matrix
#

Pls add a logging message at the start of your InitiateFiles() method and tell us if it gets logged.

vivid temple
#

yes

#

give me a second

vivid temple
lost matrix
#

getLogger()

vivid temple
#

okay

#

YES IT WORKED

#

omg

#

thanks @lost matrix

#

and everyone else who helped!

stone sinew
#

So I literally copied the CraftServer.createWorld(WorldCreator creator) method yet when I use my own...
There is always something wrong... It can lag out the server, it won't teleport me, It will stay on "Loading terrain..." etc.... I just never not have issues with this method... Any ideas why?
WorldLoader.get().createWorld(new WorldCreator("TestWorld"));

lost matrix
#

And you made sure to not teleport to the world right away?

stone sinew
lost matrix
#

Wait. You copied the method from CraftServer? Why.

stone sinew
lost matrix
#

Yes. But why dont you just call Bukkit.createWorld() ?

stone sinew
#

And actually this time... I can teleport to the world but can't move or placeblocks or anything

#

but i can run commands, chat etc...

lost matrix
stone sinew
#

And the worlds map is just that lol... Map<String, World>

lost matrix
#

I was more looking at the Map<String, World>

#

Yes but do you actually use the Map instance that is inside the CraftServer singleton?

stone sinew
#
private DedicatedServer console;
private Map<String, World> worlds = new HashMap<>();
    
    public World getWorld(String name) {
        if(worlds.containsKey(name))
            return worlds.get(name);
        return null;
    }
lost matrix
#

-.-

#

Then at least try calling CraftServer#addWorld(World) after you created the world.

stone sinew
lost matrix
stone sinew
#

Just adds it to the map

lost matrix
#

Do you add it to that map already?

#

Or do you add it to a random map you created for yourself?

stone sinew
#

Actually... there is no add in that method. Let me add one xD

slim bough
#

Does anyone know of a plugin that scales health

#

so lets say you have 60 max health, and you are on 30/60 health, it displays your heart bar as 5/10

lost matrix
slim bough
#

oh sorry ill go to there

#

1.16.5

grim ice
#

wtfrick u saying

#

that's normal spigot?

stone sinew
# grim ice that's normal spigot?

No maxHealth is 20. He wants to set MaxHealth above 20 and count down hearts in the percentage of the maxHealth. Also hes looking for an already created plugin not the code for one.

grim ice
#

Yes i know

#

wait

#

Player#setHealthScale(20);

stone sinew
grim ice
#

fam

#

if someone makes a plugin for 5 lines of code

#

im gonna report that

lost matrix
#

I may have written and send it to him already

grim ice
#

that's assuming the thing will work

grim ice
#

but they could've done it themselves in a few minutes

lost matrix
#

Its literally just this

public final class ScaleHealth extends JavaPlugin implements Listener {

  private double maxHealth = 20;
  private double healthScale = 20;

  @Override
  public void onEnable() {
    saveDefaultConfig();
    reloadConfig();
    FileConfiguration configuration = getConfig();
    maxHealth = configuration.getDouble("PlayerHealth", 20);
    healthScale = configuration.getDouble("HealthDisplay", 20);
    Bukkit.getPluginManager().registerEvents(this, this);
  }

  @EventHandler
  public void onJoin(PlayerJoinEvent event) {
    Player player = event.getPlayer();
    AttributeInstance instance = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
    if (instance.getBaseValue() != maxHealth) {
      instance.setBaseValue(maxHealth);
    }
    player.setHealthScale(healthScale);
    player.setHealthScaled(true);
  }

}
grim ice
#

no that's better than what he asked for

#

find spaghetti code

lost matrix
#

I see you only have one ChatEvent instance now.

grim ice
#

yes

grim ice
#

why am i getting npe at

#

if (gui.getItem(53).getType() != Material.ARROW)

lost matrix
#

gui.getItem(53) may return null if no ItemStack is in this slot.

grim ice
#

OH

#

right lmao

#

but

#

thats dumb

#

spigot is dumb

#

or its java idk

grim ice
#

im setting the item to not be null

#

if (gui.getItem(53).getType() != Material.ARROW)
gui.setItem(53, next());
}

eternal oxide
#

then your code is wrong.

grim ice
#

w h a t

eternal oxide
#

lol, you are testing it before you set it

grim ice
#

ah right

#

gui.setItem(53, next());
if (gui.getItem(53).getType() != Material.ARROW)
gui.setItem(53, next());
}

#

LOL

#

mgiht as well just remove the checl

#

or wait

#

i need it

#

ok lemme test

fleet cosmos
#

p.setPlayerListName();
exists but is there a way to apply it to an
EntityPlayer
a fake one to be more clear

hollow shell
#

Hi im Proffesional Fullstack dev, is there anything i have to know about spigot ?

eternal oxide
#

Know Java

tame coral
#

ye

lost matrix
#

?jd

tame coral
#

I mean, if you're a web dev, knowing how to use spigot API won't be very useful for your job

tame coral
hollow shell
#

I want to write 4fun ingame/online shop

#

for friend server 😄 then im gonna upload api

lost matrix
#

The main thing you need to know is that spigot plugins are bootstrapped. Your entry point is a class that extends JavaPlugin.
But this should all be covered on the page ive sent you.

hollow shell
#

k

#

I've heard inventory shops are ugly is there another way to create it ?

tame coral
#

InventoryFramework is pretty good

lost matrix
#

Visualisation of shops can be done using several approaches.
Using an Inventory is one of them. Then there are chests with holograms above them which
provide the buyer/seller with information. ItemFrames are also possible.
Inventories just scale really well as the dont need any physical space.
I personally dont think that they are ugly.

tame coral
#

lets you import an inventory from xml files

eternal oxide
#

You could use map rendering to have custom UI's but that would be a nightmare

hollow shell
#

The map idea is cool

eternal oxide
#

maps in itemframes is doable, but its extremely advanced.

lost matrix
hollow shell
#

I want to make sth unique to make everyone use it, mainly im gonna focus on web store with control panel where u cant create your own ingame shops

fleet cosmos
#

the problem is that max char is 16
but with that method it becomes limitless

eternal oxide
lost matrix
hollow shell
eternal oxide
#

not quite. clicking is going to be harder

#

you would have to raytrace your target

grim ice
#

how do i make it so there can be multiple pages for my gui, that's my try here:

        for (String childSection : section.getKeys(false)) {
            if (i == 54) {
                i++;
                continue;
            }
            ItemStack item = new ItemStack(Material.PAPER, 1);
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(ChatColor.YELLOW + childSection);
            ArrayList<String> lore = new ArrayList<>();
            lore.add(ChatColor.GOLD + "Warp to: " + ChatColor.RED + childSection);
            meta.setLore(lore);
            item.setItemMeta(meta);
            if(i >= 55){
                getInventory().addItem(item);
                getInventory().setItem(53, next());
                i++;
                continue;
            }
                gui.addItem(item);
                if (gui.getItem(53).getType() != Material.ARROW)
                    gui.setItem(53, next());
                
            i++;
        }```
grim ice
#

it's not adding the items to the 2nd gui (getInventory)

#

ill rename it once it's working btw

quiet ice
#

because you hardcode the index at 53?

#

Also I believe that the player's inventory has less than 53 indexes, but I'm not too sure

unreal quartz
reef wind
#

there is no method that creates an explosion without the particles right? I have to make my own for that right?

quiet ice
#

53 will probably be some random magic inventory slot

grim ice
quiet ice
#

What even is getInventory()

grim ice
#

"getInventory().addItem(item);"

#

the 2nd page

#

i just said that in the message lmao

quiet ice
#

no you did not

#

It'S the second inventory, but I do not know if it is a clone or something else

reef wind
# grim ice cancel the packet

yeah I will have to do something, I just wanted to know if there was some createSilentExplosion() method or something.

grim ice
#

1s lemme show u the whole code

#

@quiet ice

stone sinew
quiet ice
#

it's a clone

#

You are creating 1 inventory for every itemstack

#

Everytime you call getInventory() it returns a new inventory

grim ice
#

frick me

#

im a total bozo

#

so uh

grim ice
quiet ice
#

Wouldn't a count%53 be faster and easier to read than the 54*pages.size()?

quiet ice
grim ice
#

wdym'

quiet ice
#

And you could likely make use of List<Inventory> instead of Map<Integer, Inventory>

stone sinew
# grim ice can u explain the math

I can barely explain it lol.

Basically the biggest inventory you can have is 54. So 0-53 is the slots. so the page number is gotten by the count divided by 53.
Slot is retrieved by getting the pages times 54 slots and then the count should be subtracted. Example if you have 3 pages thats 162 and if the count is 125 that would use slot number 37.

grim ice
#

me shit at math

eternal oxide
#

divide by 54. There are 54 slots on a page. They index from 0 to 53, but there are 54 slots

stone sinew
grim ice
#

why does everything need math

#

btw

#

can some1 help me

#

why is

#

the inventory getting cloned

#

public Inventory getInventory(){
Inventory gui2 = Bukkit.createInventory(null, 54, ChatColor.GREEN + "Warps: (Page 2)");
return gui2;
}

tall dragon
#

cache it

eternal oxide
#

What do you mean by "cloned"?

tall dragon
#

you are creating a new one everytime getInventory is called

grim ice
#

yes thats what i mean

eternal oxide
#

only the name is identical

grim ice
#

return Bukkit.createInventory(null, 54, ChatColor.GREEN + "Warps: (Page 2)");
is same thing right

#

idk why did i make a variable

#

but i need to access the inventory

#

from other classes

tall dragon
#

are you creating some kinda multi page gui system?

grim ice
#

yes

#

i need 4 pages in total

rancid cosmos
#

Is there a way to run console commands and getting command output back?

tall dragon
#

@grim ice i would create an abstract class called for example MultiPageGui and have everything cached in there

stone sinew
tall dragon
#

then you can just make an implementation of that for your gui

tall dragon
grim ice
#

the thing is HOW

stone sinew
#

hehehe

tall dragon
#

lmfao

#

hello Laggy server

grim ice
#

ANYWAY

#

i still dont have a clue

tall dragon
#

i can show you a little example maybe let me see if i have it

grim ice
#

yeah

#

btw how to cache

tall dragon
#

well thats just a variable

#

in a class

grim ice
#

yes

tall dragon
#

and not in a method

grim ice
#

OH

reef wind
#

what is the min and max of getHardness()? there is no info about it on the docs.

hybrid spoke
stone sinew
grim ice
#

how would i go about doing it tho

tall dragon
#

@grim ice

/**
 * An advanced menu listing items with automatic page support
 *
 * @param <T> the item that each page consists of
 */
public abstract class MenuPaged<T> extends Menu
{

    /**
     * The pages by the page number, containing a list of items
     */
    @Getter
    private final Map<Integer, List<T>> pages;

    /**
     * The current page
     */
    @Getter
    private int currentPage = 1;
}

this is how i would go about it

#

very basic example of course

grim ice
#

o

#

wait what

#

thats just a map and an int?

tall dragon
#

well yea

hybrid spoke
#

a map isnt really needed

stone sinew
#
Map<Integer, Inventory> pages = new HashMap<>();
int amount = section.getKeys(false).length();
int pageCount = amount/54;
for(int i=0; i <= pageCount; i++) {
    pages.put(i, Bukkit.createInventory(/*You're code*/));
}

int increment = 0;
int currentPage = 1;
for (String childSection : section.getKeys(false)) {
    Inventory i = pages.get(currentPage);

    i.setItem(increment, ItemStack);

    increment++;
    if(increment > 53)
    increment = 0;
}
```Here is a better visual of the code.
grim ice
#

o

stone sinew
tall dragon
#

how do you get it so smooth

stone sinew
tall dragon
#

i have bneen messing with this kinda stuff forever

#

never got it this smooth

#

yep i guess thats a good answer

#

Math huh :)

stone sinew
#

Lol one sec

#

It was made as an api that I release for sale. Never open sourced it though.

grim ice
#

btw

#

getKeys is a set

#

u cant get the length of it

#

well u can by making it an array

#

do i do that

hybrid spoke
#

#size()

stone sinew
# tall dragon Math huh :)
// Looping through all blocks and setting their velocity.
for(FallingBlock fb : movingBlocks.keySet()) {
    Location loc = fb.getLocation(); loc.setPitch(-90f); Vector vec = loc.getDirection();
                
    // Modifying the velocity and checking if the elevator should stop.
    if(paramUp) {
        if(fb == mFB && loc.getY() >= sl) {stopElevator = true;}
        vec = loc.getDirection().add(new Vector(0, finalSpeed, 0));
    }else {
        if(fb == mFB && loc.getY() <= sl) {stopElevator = true;}
        vec = loc.getDirection().add(new Vector(0, finalSpeed, 0));
    }
    fb.setVelocity(vec);
    fb.getLocation().getBlock().setType(Material.AIR);
}
wild reef
#

Yo short question. I want the player to teleport out of a chunk he is standing in. for example: he is stading on x: 2 / z: 3 (chunk locations) and I want him to teleport to x: 0 / z: 4 - but with normal world coordinates I am just not sure how to do it, cause I would need the distance from the current chunk position to the chunk border, so I can could teleport the player outside as much as he needs to be to.

#

My only idea would be to loop x and z back as long as a new chunk is coming, would be that the best solution for this problem?

tall dragon
#

really cool

stone sinew
#

Still not to difficult though

#

Honestly might remake this API and open source it

tall dragon
#

well i would enjoy looking through it and might even use it :D

orchid kindle
#

Hello, i have got a problem with Residence plugin. It says An internall error occurred while apptempting to perform this command
Console says about the plugin is disabled..
Can someone help?

tall dragon
#

show us the full error

orchid kindle
#

Ok

grim ice
#

how to access inventories from other classes?

#

like, i made an inventory in a class i want to use it in another class

tall dragon
#

you just need a reference to the class where the inventory is in

grim ice
#

w h a t

#

that will clone it tho

orchid kindle
grim ice
tardy delta
#

huuh

orchid kindle
tardy delta
#

bathroom

eternal oxide
tall dragon
#

well if i would make a system like this i would have some class called Menu and whenever i want to open a menu for a player i would create an instance of that class and pass in the player through the open method. like so

// created the menu
            QuotaMenu menu = new QuotaMenu();
            //display to player
            menu.displayTo(getPlayer());
            
            //now i can do whatever i want with this Menu object which contains all the data relevant to the menu
#

ignore the name of the class this is just from some old plugin i opened

onyx fjord
#

is it possible to set velocity with pitch and yaw?

#

i want velocity to work where player is looking

eternal oxide
#

no

#

pitch and yaw are a direction with no velocity

onyx fjord
#

then how could i do it

#

basically i want player to be pushed where he looks

eternal oxide
#

set pitch and yaw and apply a velocity

orchid kindle
#

Can someone help?

onyx fjord
#

should i touch velocity x and z or just y?

hollow shell
#

does hibernate works with spigot ?

eternal oxide
#

getDirection() of teh player, normalize and apply as a velocity

eternal oxide
#

?scheduling

undone axleBOT
orchid kindle
onyx fjord
#

why do you ping me?

onyx fjord
eternal oxide
eternal oxide
onyx fjord
#

alr

eternal oxide
#

setVelocity(player.getEyeLocation().getDirection().normalize())

onyx fjord
#

alright

eternal oxide
#

if its too fast or slow you can use .multiply on the normalized vector

stone sinew
#

@grim ice @tall dragon even more....

tall dragon
#

haha thats a good one

onyx fjord
#

how could i multiply it for example 10 times

eternal oxide
#

after teh normalize().multiply(10)

onyx fjord
#

ohhh i thought i can only multiply by another vector lol

onyx fjord
#

(the multiplied one)

eternal oxide
#

what do you mean? You want to move it up 100 blocks or you want it to always have an arc?

onyx fjord
#

hol up i think i found it

tall dragon
#

does anyone know why, when i kick a player it always sends this warn into console? [14:40:26 WARN]: handleDisconnection() called twice

tall dragon
#

1.14

lost matrix
tall dragon
#
  1. yes
  2. i dont know the guy that asked me to make something is on 1.14
grim ice
#

@tall dragon ujm

#

uhm

tall dragon
#

it doesn't really mess anything up but i keep getting the warn for some reason

grim ice
#

if i make a inventory in a class then make a getter for it will it still clone

lost matrix
grim ice
#

okay

tall dragon
grim ice
#

then why all that math shit

#

i can do it without all that i think

tardy delta
#

if i make a variable timeleft with value System.currentTimeMillis()
and call that a few times, will its value changes to the current time?

grim ice
#

?paste

undone axleBOT
grim ice
#

why are the items in gui 2 duplicated so and so buggy

#

like theyre sometimes 3 or 4x and in random slots

lost matrix
tardy delta
#

ah so i have to call System.currentTimeMillis() every time

grim ice
#

pls

quaint mantle
grim ice
#

@lost matrix do you have a clue?

opal juniper
#

you may have to actually debug something urself rather than ping people

grim ice
#

how

#

hgrguahrfuaorhg

halcyon mica
#

How do I access the AI and pathfinding processes of an entity?

vivid temple
#

how do i remove a section from my custom .yml file?

tardy delta
#

set it to null

lost matrix
vivid temple
grim ice
#

im s t r u g g l i n g

lost matrix
eternal oxide
halcyon mica
#

Of course it's not

#

ffs

eternal oxide
#

actually you have gui and a field for gui2

#

why?

grim ice
#

there are 2 pages

lost matrix
tardy delta
#

is this something?

public boolean checkCooldown(int secondsIfNotDefault) { // todo
        long time = secondsIfNotDefault == -1 ? 5 : secondsIfNotDefault;
        if (cooldowns.containsKey(p.getUniqueId())) {
            if (cooldowns.get(p.getUniqueId()) > System.currentTimeMillis()) {
                Utils.message(p, "§cPlease wait " + (cooldowns.get(p.getUniqueId()) - System.currentTimeMillis()) / 1000 + " more seconds!");
                return true;
            }
        }
        cooldowns.put(p.getUniqueId(), System.currentTimeMillis() / 1000 + time);
        return false;
    }
eternal oxide
#

i++ inside your for loop means you are skipping entries

grim ice
#

what

#

wtf

eternal oxide
#

and you are only ever setting slot 53 (last slot)

grim ice
#

if(i >= 55){
getGui2().addItem(item);
i++;
continue;
}

#

wdym

#

bruh?

#

im checking if the item being added is above the capacitity of the first gui so i can add it to the second

eternal oxide
#
if (i == 54) {
  i++;
  continue;
}```Skips item 54
lost matrix
grim ice
#

Yes, item 54 should not be changed

#

its the navigator between first and second gui

eternal oxide
#

no, item 54 is your first item in yoru next page. 0-53

grim ice
#

w h a t

eternal oxide
#

54 items on teh first page = item 54 is item 1 on page 2

#

you are indexing from zero

#

so index 54 is item 55

grim ice
#

o

#

but u,

#

um

#

when i close the second gui

#

i drop the next item

#

"next" thingy

eternal oxide
#

Your code is a complete mess. Scrap the lot and start fresh

grim ice
#

breh ok

#

but i have no clue on what to do

eternal oxide
#

Well so far all I understand is you want two pages, for some reason

grim ice
#

yes

#

i want 5 pages but

#

im starting with 2

eternal oxide
#

What is to be listed in these pages?

grim ice
#

items that represent the names of the sections in config.yml

eternal oxide
#

are they different per player?

grim ice
#

no, they're locations

eternal oxide
#

so same pages for all players?

grim ice
#

Yes

#

so

#

?paste

undone axleBOT
grim ice
#

uhuhrughrughrguhrguh

eternal oxide
#

one sec

rigid hazel
#

Hello.
I have a construction of 3x3 gold and above that a beacon. This gets built when you enter /guild create Test...
When you try to break a block, there is written, that you don't have the permission to do that. - Everything correct, till:
When you teleport far away; like to the spawn and then teleports back, you can destroy the spawn without any message and the menu, I created doesn't pop up when you interact with the beacon.

#

Here is the code

#

What did I wrong?

#

Please ask, if you have questions.

grim ice
#

@eternal oxide i feel like i can do it with inventory click event, or do u have another idea?

grim ice
#

o

crude charm
eternal oxide
#

You don;t there is a specific message to send to get a player count

#

You don;t respond to it yourself, Bungee handles that

crude charm
grim ice
#

Condition 'i == 53' is always 'false'

#

@eternal oxide

eternal oxide
#

after currentPage.addItem(item); add i++;

crude charm
#

but I want to get what it returns as an int

eternal oxide
#

that shows you how to get the player count as an int

crude charm
#

ok

grim ice
#

elgar, how do i get the starter page

eternal oxide
#

pages.get(0)

grim ice
#

o right

tardy delta
#

is it possible to remove the flight from the player in spectator?

grim ice
#

cuz the open inv thingy was removed

#

i added player.openInventory(pages.get(0));

eternal oxide
#

yep, that would work

grim ice
#

thank you so much, ill try it

eternal oxide
#

I would use if (!pages.isEmpty()) player.openInventory(pages.get(0));

grim ice
#

o

#

@eternal oxide

#

but the "next page" thingy in my click event

#

do i just check if the inventory clicked has a number in it

#

but how do i get the number

#

ahfauwghaugbauegbauabgereg

eternal oxide
#

Theres many ways to do it

#

you could add meta to it when you get teh new page

#

so add meta to teh old next button when a new page is called for

#

or, don;t add the next until you are adding a new page

grim ice
#

yeah i think i know it

#

wait

#

bruh lol

#

pages.IndexOf()

#

will work I think>

#

if(!e.getClickedInventory().getTitle.contains(ChatColor.GREEN) return;
int num = GuiMenu.pages.IndexOf(e.getClickedInventory);
player.openInventory(GuiMenu.pages.get(num + 1);

#

unless this throws a null or a index out of bounds or smth i should be fine

halcyon mica
#

How do I get a nms PathEntity from a regular spigot entity?

eternal oxide
#

look at that. It should give you an idea how

grim ice
#

ah yeah that's the GuiMenu

#

thingy

#

not the click event

eternal oxide
#

yes, set the size of pages on it as meta so you can read that off in yoru click event

grim ice
#

Oh

#

doesnt that kill java principles or smth

#

like depending on strings or something idk

shy wolf
#

how can i reload an config on bungee?

grim ice
#
public final ItemStack next(int number){
        ItemStack next = new ItemStack(Material.ARROW);
        ItemMeta nextMeta = next.getItemMeta();
        nextMeta.setDisplayName(ChatColor.DARK_PURPLE + "Next Page (Page" + number + ")");
        next.setItemMeta(nextMeta);
        return next;
    }
inven.setItem(53, next(Integer.parseInt("%d")));```
@eternal oxide
#

yeah using meta is almost impossible

#

cuz idk how to check in click event what inventory is it being clicked on

grim ice
#

ah yes, PDC on 1.8.8

#

lol

eternal oxide
#

modify getNext to store it however you want

grim ice
#

Yes

#

thing is

eternal oxide
#

store a value and retrieve it in your click event

grim ice
#

the parameter

#

if(event.getCurrentItem().isSimilar(GuiMenu.next(now what lol)))

#

i have to get the index of the inventory

#

the "next" item is in

eternal oxide
#

why?

halcyon mica
#

Are NMS names mojmap?

eternal oxide
#

you get the value it points to

grim ice
#

yes that's easy once i get the value it is in

eternal oxide
#

you have the value its in by the title

#

as you are on 1.8 and no PDC

lost matrix
halcyon mica
#

I am talking about the unmapped class names

grim ice
#

how do i filter

#

ints from strings

#

from a string containing both

lost matrix
halcyon mica
#

You have yet to answer my question

#

I did not ask what is obfuscated and what not

eternal oxide
lost matrix
#

Then you need to explain to me what you mean by "mojmapped"

eternal oxide
#

"\\d+"

halcyon mica
#

What are the unmapped classes named after

grim ice
#

o

#

what does that mean

halcyon mica
#

it is Mojang Map, MCP, Yarn or did someone just make them up

tardy delta
eternal oxide
#

how to extract a number from a string

lost matrix
#

There are no mappings applied. NMS literally contains the source content of the vanilla server jar.

regal dew
#

\d is regex shorthand for [0-9], which means match anything between 0 and 9. The plus means "one or more", so numbers with string length 1 or more

halcyon mica
#

So it's Mojang Map

#

Was that so hard to say

grim ice
# eternal oxide how to extract a number from a string

ItemMeta meta = event.getCurrentItem().getItemMeta();
Pattern p = Pattern.compile("\d+");
Matcher m = p.matcher(ChatColor.stripColor(meta.getDisplayName()));
while(m.find()) {
int num = Integer.parseInt(m.group());
}

regal dew
grim ice
#

is that fine

shy wolf
#

how can i reload an config on bungee?

vivid temple
#

how to retrieve a float from a config file?

eternal oxide
minor garnet
#

how can I create a 2D graph where it has two axes, x and y, where it will have a force that will make this point go up to a specific value and it will go down based on gravity equal to minecraft projectiles

    private final float[]  
      velocity = new float[]{0, 0}, acceleration = new float[]{0, 0},  position = new float[]{0, 0};

    public void applyForce(double[] force) {
        if (force.length != 2) throw new IllegalArgumentException("Force must be a 2D double vector");
        for (int i = 0; i < 2; i++) acceleration[i] += force[i];        
    }

    public void tick() {
        for (int i = 0; i < 2; i++) {
            velocity[i] += acceleration[i];
            acceleration[i] = 0;
            position[i] += velocity[i];
        }
    }```
grim ice
#
        ItemMeta meta = event.getCurrentItem().getItemMeta();
        Pattern p = Pattern.compile("\\d+");
        Matcher m = p.matcher(ChatColor.stripColor(meta.getDisplayName()));
        int num = 0;
        if(m.find()) 
            num = Integer.parseInt(m.group());
        
        if(event.getCurrentItem().isSimilar(menu.next(num)))
            player.openInventory(menu.pages.get(num));```
#

@eternal oxide i changed

#

is dat better

eternal oxide
#

try it and see

grim ice
#

u had a chance to use that

#

and u missed it

#

lol

eternal oxide
#

you can compare to next as it doesn;t change

#

its teh same item on all pages

grim ice
#

wait

#

i changed it

#

to return;

#

if !m.find()

lost matrix
grim ice
#

also do i make pages public

#

it cant be private

eternal oxide
#

no, add a getter

#

everything private and add getters for external access

grim ice
#

and

#

private ItemStack next(int number){
ItemStack next = new ItemStack(Material.ARROW);
ItemMeta nextMeta = next.getItemMeta();
nextMeta.setDisplayName(ChatColor.DARK_PURPLE + "Next Page (Page" + number + ")");
next.setItemMeta(nextMeta);
return next;
}

shy wolf
#

any one can help me??

eternal oxide
grim ice
#

what

eternal oxide
#

if they clicked on next in inventory page 1, you get pages.get(1)

#

pages index on zero

grim ice
#

thats why i told u

#

we can use

eternal oxide
#

so the number in teh title will be the index of the next page

grim ice
#

pages.IndexOf

eternal oxide
#

no

grim ice
#

wait

#

right

eternal oxide
#

you need to know your current page

grim ice
#

we can just use the regex thingy

#

ok right

eternal oxide
#

yes, regex the title

grim ice
#

but it won't make a difference at this point

eternal oxide
#

it would keep everything much simpler not messing with next

grim ice
#

WAIT IT WILL

#

yah i will do ur thing

halcyon mica
#

Alright, how would I map spigot internally

#

Preferably yarn instead of mojmap

eternal oxide
#

its just, if they click next ItemStack, regex the title and pages.get(regex result)

grim ice
#

Matcher m = p.matcher(ChatColor.stripColor(event.getClickedInventory().getTitle()));

#

yes

#

also why is this weird website using one letter variables

eternal oxide
#

because its old

grim ice
#

man making a tutorial of how to break java principles

#

/j

#

ok ill test now

golden turret
#

i would like to know how to add the glow effect to items

#

without addind an enchantment and using the hide flag

#

in 1.8 i can add the empty nbt tag "ench" among with any random tag

#

but in 1.16 it is not possible (the item dont glow)

vague cypress
#

I think in 1.16 you have to do something along the lines of adding an enchantment(say, luck) and then hiding the tag

golden turret
#

🤔

vague cypress
#

I don't think it's that big a deal since luck doesn't do anything anyway

minor garnet
grim ice
#

Caused by: java.lang.NumberFormatException: For input string: "%d"

eternal oxide
#

why have you got a %d in your title? That was replaced with String.format

#

Inventory inven = Bukkit.createInventory(null, 54, ChatColor.GREEN + String.format("Warps: (Page %d)", pages.size() + 1));

grim ice
#

uh yeah

#

1s

#

i gotta regex

#

to get the title inside of the GuiMenu

eternal oxide
#

you get the title of the open inventory

#

when they click

grim ice
#
private Inventory newPage() {
        
        Inventory inven = Bukkit.createInventory(null, 54, ChatColor.GREEN + String.format("Warps: (Page %d)", pages.size() + 1));
        Pattern p = Pattern.compile("\\d+");
        Matcher m = p.matcher(ChatColor.stripColor(inven.getTitle()));
        int num = 0;
        if(m.find())
            num = Integer.parseInt(m.group());
        inven.setItem(53, next(num));
        pages.add(inven);
        return pages.get(pages.size() - 1);
    }```
#

^ this is what i mean

#

now it should not error

#

why do u have %d in the format tho @eternal oxide

eternal oxide
#

wth, thats horrible

#

stop messing with next

grim ice
opal juniper
#

I have a BukkitRunnable which is on runTaskTimer - is there a way to delay the next iterations of the loops?

eternal oxide
#

on sec

grim ice
#

im not

eternal oxide
#

next(num)

grim ice
#

i got the title of the inventory

eternal oxide
#

and new page

grim ice
#

That's the parameter of the Item

eternal oxide
#

theres no need for any of that

grim ice
#

Why??

#

It's for the item meta

eternal oxide
#

one sec

grim ice
#

in here nextMeta.setDisplayName(ChatColor.DARK_PURPLE + "Next Page (Page" + number + ")");

#

i dont see what i sent is horrible

halcyon mica
#

Are you kidding me

#

So I am trying to use Minecraft's internal debug plugin message channels

#

But spigot does not let me send the data unless I register it

#

But when I try to register it, it throws because it's a reserved channel

#

Despite the spec clearly saying they do not need to be registered

#

wtaf

eternal oxide
#

?paste

undone axleBOT
quiet ice
#

which spec?

halcyon mica
eternal oxide
halcyon mica
#

Since 1.3, Minecraft itself uses several plugin channels to implement new features. These internal channels use the minecraft namespace. They are not formally registered using the register channel. The vanilla Minecraft server will send these packets regardless, and the vanilla client will accept them.

quiet ice
#

Spigot's spec can differ from minecraft's soec

halcyon mica
#

Spigot literally wraps around the vanilla server

quiet ice
#

It modifies it quite intensively

grim ice
halcyon mica
#

So then why are they marked as reserved

eternal oxide
#

yes, not needed

halcyon mica
#

If spigot does not respect them

grim ice
#

oo ok

eternal oxide
#

you only need the basic next ItemStack

quiet ice
#

you may need to ask that to the person that changed this (probably dinnerbone)

halcyon mica
#

The fuck does dinnerbone have to do with this

#

This is spigot bs

quiet ice
#

He most likely implemented the interface

halcyon mica
#

This... is not a interface

#

Do you even know what I am talking about

quiet ice
#

API = Application Programming Interface, I would consider plugin channels APIs

opal juniper
#

woah calm down vatuu

quiet ice
#

plus, bukkit has some more abstraction

halcyon mica
#

wh

#

What are you even talking about

#

You are just saying fully unrelated stuff

hexed hatch
#

Gotta love when someone here doesn’t know what the fuck they’re talking about

grim ice
#

everyone learns

#

not like you know everything

quiet ice
#

The thing is that I am pretty sure that this behaviour has been like that for years, perhaps even for a decade now

#

Which is why I said that it is most likely (but not 100%) that this behaviour originated from dinnerbone, who maintained bukkit at that time

halcyon mica
#

A: Minecraft does not have a API spigot utilizes, it's built on top of a patched vanilla server
B: Plugin channels have a register system which spigot enforces, but the debug channels do not require it.
C: Spigot recognizes these debug channels and prohibits registration of those because they do not need to be registered
D: And yet spigot still demands that sending data on those channels has to have it registered first

hexed hatch
#

So just drop it and let someone who knows more see if they can provide the information he’s requesting

quiet ice
#

It's an flaw with the implementation of the API, I am simply saying that this flaw likely has been there for years

halcyon mica
#

This just sounds like shoddy api design on spigot's side

quiet ice
#

I would say bukkit is at fault

halcyon mica
#

I guess I'll be sending raw packets then

#

ffs

vale ember
#

?paste

undone axleBOT
vale ember
halcyon mica
#

fuck it, I am mapping this

#

Mojmap is better than this mess

quiet ice
#

Mojmap is the recommended way to go actually

grim ice
#

@eternal oxide it it supposed to not set the "next" item if the inventory is not full yet

eternal oxide
#

if the inventory is not full you will have no next

grim ice
#

alr alr

eternal oxide
#

you my have to change if (i == 53) { to 54

#

It won;t break anything but it may leave one slot empty

#

test it and find out

grim ice
#

ok

#

but it works fine rn

#

?paste

undone axleBOT
grim ice
#

i have this working for the first gui

#

the second gui, it doesnt work

#

why

#

they both have the title Warps

lusty cipher
#

Can I modify a block's drops in a BlockBreakEvent?

plain scroll
#

make it air then get players location then do a natral drop

#

natural drop

lusty cipher
#

yeah I'm doing that right now but if another plugin cancels it or does something else that leads to duping

#

thought there might be a better way, integrated into the API

plain scroll
#

hm

eternal oxide
lusty cipher
#

will just check if its already cancelled or sth, idk

plain scroll
#

not really?

#

yea

grim ice
#

and theyre the legit same

#

except the title

#

so what could it be

#

some1 is gonna tell me to use debugs lol

vale ember
#

please help i really need fast help with this https://paste.md-5.net/ecibacaqej.cs i call this method 3 times but armor stand spawns only once and first PLS HELPPPPPPPPPPPPPPPPPPPPPPPPpp

eternal oxide
#

Yep, debug and find what test is failing

plain scroll
#

Ok so im my plugin i use an array list that gets online players gets there heads then fills the inv, How can i make like a "page-2 / unlimited "
So people with more then 45 players online can use my plugin ?

#

well there would be an arrow on slot 44 that would then take them to page 2 Exetra

grim ice
#

i asked him a similar question

#

also why 45

#

use 54

#

its 9 slots more

plain scroll
#

good point

plain scroll
grim ice
#

yes look thru the convo

#

but rn im having a differnet issue

plain scroll
#
public static void openBanMenu(Player p) {
        ArrayList<Player> list = new ArrayList<>(p.getServer().getOnlinePlayers());

        Inventory bangui = Bukkit.createInventory(p, 54, ChatColor.WHITE + "[" + ChatColor.RED + "Player List" + ChatColor.WHITE + "]");

        for (Player player : list) {

            ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
            SkullMeta sm = (SkullMeta) playerHead.getItemMeta();
            sm.setOwningPlayer(player);
            ItemMeta player_meta = playerHead.getItemMeta();
            playerHead.setItemMeta(sm);
            ItemMeta meta = playerHead.getItemMeta();

            meta.setDisplayName(ChatColor.WHITE + player.getDisplayName());
            ArrayList<String> lore = new ArrayList<>();
            lore.add(ChatColor.GOLD + "Player Health: " + ChatColor.RED + player.getHealth());
            meta.setLore(lore);
            playerHead.setItemMeta(meta);

            bangui.addItem(playerHead);
            {
                p.openInventory(bangui);
            }
        }
    }```
opal juniper
#

you need to paginate it

#

there is probably an api / lib for this

plain scroll
#

oh noice