#help-development

1 messages · Page 2135 of 1

hasty prawn
#

That's what I said peepoGiggles

tender shard
#

nope, not in a normal for loop

hasty prawn
#

Pretty sure it does

tender shard
#

only in "enhanced" for loops

hasty prawn
#

Really? Interesting.

tender shard
#

yeah it makes total sense

mortal hare
#

what if its set

#

it should throw

#

wait

tender shard
mortal hare
#

set is without order

#

yea yea

#

i got it

tender shard
#

the normal for loop works like this:

#

you say "for int i = 0; i < size; i++" so it checks the size: it's now let's say, 2, so it executes your statement

#

you add something, now it calls "list.size()" again, now it's 3

#

etc

#

no problem, and no concurrent modification

#

just an infinite loop

mortal hare
#

im not sure what you're doing here, but what i'll do is to save lore.size() inside a variable int size = lore.size(); and use that variable inside for loop and i'll see if that fixes your problems

hasty prawn
#

Yeah that makes sense

#

Well it's infinite because he's calling lore.add() everytime because the string that's being added doesn't start with a space

#

It starts with a color

#

So it's just infinitely adding that Nightmare Infused line

tender shard
#

to insert a line at a certain point, you can just use List#add(int,T)

#

e.g. to add a line between line 2 and 3, you can do lore.add(2,"my new line between line 2 and 3");

harsh totem
#

how do i check if an inventory is an AnvilInventory

tardy delta
#

instanceof?

harsh totem
#

event.getClickedInventory() instanceof AnvilInventory

tardy delta
#

check what stuff AnvilInv extends

#

should work

harsh totem
#

will this work? player.getOpenInventory().getTopInventory().getType().equals(InventoryType.ANVIL

tender shard
#

yes

#

but you can also use ==

#

no need for .equals

harsh totem
#

ok

#

thank you! it works

mighty bane
#

Okay so we're trying to store the data of a container inside an array however whenever we check for if the block is an instanceof a container, it doesn't detect any containers. This is the code for the check:

if(loc.getBlock() instanceof Container) {
    blocks.add(((Container) loc.getBlock()).getInventory());
}```
Does anyone know why this doesn't work?
P.S. blocks is an ArrayList of Inventories
tardy delta
#

the state is instanceof container

#

googled it

mighty bane
#

?

tardy delta
#

not the block itself

mighty bane
#

This: loc.getBlock().getState()

tardy delta
#

i guess ye

mighty bane
#

It's what our ide autofilled, so probably.

#

Thanks for the help.

lethal coral
last sleet
#

If I want to prevent vanilla crafts from using "custom" items (with, let's say a special PDC or something), do I have to check everytime a click happens in a crafting table and adjust accordingly, or do vanilla crafts not accept items with lore or such?

crisp steeple
#

preparecraftevent

#

go through the grid items and see if one is custom

last sleet
#

Ok thanks

wary harness
#

is there boss bar api in spigot ?

hexed hatch
onyx fjord
#

I think so @wary harness

#

Look in javadocs

hexed hatch
#

But cancelling the prepare item craft event if an ingredient has that particular PDC will work

hasty prawn
wary harness
arctic moth
#

how do you make the elder guardian "jumpscare" effect

hasty prawn
#

Play the MOB_APPEARANCE particle for them

crude loom
#

I'm trying to learn how to display the scoreboard text on the middle right of the screen
Is it per-player, or do I set it to the entire server?

wary harness
#

of multiple boss bars

mortal hare
#

Elder guardian effect is jumpscare by itself

hasty prawn
#

I'd assume it's just the order the Player is added in

wary harness
#

if you understand what I mean

mortal hare
#

but imagine if it was retextured

#

to some horrors

hasty prawn
#

Where new ones are on top I'd assume

mortal hare
#

that would beat the shit outta me

hasty prawn
wary harness
#

I asume there is no way

hasty prawn
#

Remove them and add them back

#

In the order you want them to appear

wary harness
#

problems is I got other plugin

#

adding theres to

mortal hare
crude loom
#

Oh I didn't mean putting it exactly in the middle I mean just the scoreboard thing at the side of the screen

mortal hare
#

Even if you manage to left align text, it wouldnt be accurate if the unicode font would be turned on for a player

#

oh

#

its time for sleep for me

#

i guess

#

i misread scoreboard as a tablist lol

crude loom
#

oh lol

mortal hare
#

iirc scoreboard header is only center aligned

brave trellis
#

does anyone have a link to an example of a console log filter for 1.18

crisp steeple
#

is it possible to make a plugin message listener in bungee?

#

ik about the default ones, but idk if there’s a way to make custom ones

vocal cloud
#

What would a custom one provide that the current doesn't already allow?

arctic moth
#

lol i just smh managed to flatten an entire class into one line

#

my listeners class

#

it looks scary

compact haven
#

what

#

that post has nothing to do with what he wants

#

well yes it does, but it's about the least helpful thing u could've linked lol

#

that's a security issue that got patched in Log4j

river oracle
#

What is the tag for all types of stone I can't seem to find it

#

if not is there a way i can make one with the Tag<? extends Keyed> Interface

arctic moth
#

how do i get a spot along a vector?

eternal oxide
#

multiply the vector

arctic moth
#

by what tho

hasty prawn
eternal oxide
#

a length

arctic moth
#

i tried doing player.getDirection().multiply(3).toLocation() but it doesnt seem to spawn anything

#

also how would i make it look at the player

eternal oxide
#

player.getLocation().add(player.getDirection().multiply(3))

arctic moth
#

oh

eternal oxide
#

would move the Location 3 forward

quaint mantle
#

whats the official FAWE download

#

page

subtle pewter
#

does this look disgusting?

arctic moth
#

how would i make smth not affected by gravity

#

like i dont want it to float

#

just not fall

hasty prawn
#

setGravity(false)

quaint mantle
arctic moth
quaint mantle
subtle pewter
hasty prawn
#

wdym float away lol

arctic moth
quaint mantle
arctic moth
#

also how would i remove an axis from a vector

quaint mantle
#

also use lexing and parsing

subtle pewter
quaint mantle
#

lol

#

google it

subtle pewter
quaint mantle
#

burh

vocal cloud
#

Then don't ask for help?

quaint mantle
#

^

vocal cloud
#

Also you have duplicate code so extract it

hasty prawn
quaint mantle
arctic moth
hasty prawn
#

You can't push armorstands anyways

arctic moth
#

just i dont want it to float away if it hits a slab or smth

#

because that moves them upwards

quaint mantle
#

thats not how it works

#

you arent taking away earth's gravity

hasty prawn
#

LMAO

arctic moth
#

oh

quaint mantle
#

you're taking away the blocks

arctic moth
quaint mantle
#

?!?

arctic moth
#

im confused why is Axis an enum

#

shouldnt i be able to set the value itself?

quaint mantle
#

i mean minecraft cant even do that

arctic moth
quaint mantle
#

minecraft cant rotate blocks

#

most ^

arctic moth
#

im not rotating a block

quaint mantle
#

?

arctic moth
#

im removing an axis from a vector

#

trying to make it so that the vector is 2d

quaint mantle
#

which way?

#

x y or z

arctic moth
#

x and z, removing y

quaint mantle
#

set y to 0

#

boom

arctic moth
#

how tho

quaint mantle
#

My guy

arctic moth
#

is it just vector.setY

quaint mantle
#

Yes

#

use the javadocs

#

?jd-s

undone axleBOT
arctic moth
#

and also how do eulerangles work like what are the min/max

#

because changing it doesnt seem to do anything

quaint mantle
#

The Euler angles are three angles introduced by Leonhard Euler to describe the orientation of a rigid body with respect to a fixed coordinate system.They can also represent the orientation of a mobile frame of reference in physics or the orientation of a general basis in 3-dimensional linear algebra. Alternative forms were later introduced by Pe...

worldly ingot
#

Just bear in mind that Euler angles are generally calculated in radians (as is the case with Bukkit's Euler angles)

#

So 2pi is 360 degrees, pi is 180, pi/2 is 90, you can extrapolate from there

arctic moth
#

ye i got it

#

i just dont get why the x, y, and z axes are different than the x, y, and z axes in gmae

#

like if i rotate it on x, it rotates upwards, as if on the y

#

also stand.setVelocity(player.getLocation().toVector().subtract(stand.getLocation().toVector()).normalize()); is zooming at the speed of light despite there being a normalize

#

and its from 3 blocks away

#

so whats happening

#

ok just multiplied it by a decimal that fixed it

#

and finally, how do i stop it from playing the equip noise when i set equipment?

#

im guessing theres a bool in there

#

yep

subtle pewter
#

URLClassLoader loader = new URLClassLoader(new URL[]{file.toURI().toURL()});
InputStream in = loader.getResourceAsStream("/block.yml");

#
URLClassLoader loader = new URLClassLoader(new URL[]{file.toURI().toURL()});
            InputStream in = loader.getResourceAsStream("/block.yml");```
#

why is the InputStream null?

wind tulip
#

Hey, how would I pass i as an index here?

I know it needs to be final, however I'm not sure how I would use arguments on a runnable, or have a way to store each iteration's index for its corresponding delayed task.

#

oh. just got an idea

#

nvm

arctic moth
copper sky
wind tulip
#

I don't think that would affect it

#

the problem is that the variable cannot be a constant

#

Integer is just a data type after all

maiden thicket
#

is it possible to access the bukkit config file through api or do i need to load it with yamlconfig

subtle pewter
#
            InputStream in = loader.getResourceAsStream("/block.yml");```
 
why is the InputStream null?
subtle pewter
subtle pewter
arctic moth
#

are u using the normal maven filestructure>

#

?

subtle pewter
arctic moth
#

its 38 villagers why

#

apparently NPC exists?

#

bruh i had just finished a plugin using nms to do that

arctic moth
quaint mantle
#

dude theres no audio

arctic moth
#

bruh discord

#

the original has audio

#

apparently foxes can attack players

#

i accidentally did setTarget on a player with a fox

quaint mantle
#

he he he haw

arctic moth
#

those little things are vicious

#

they do two and a half hearts

#

and theyre rlly fast

wet breach
arctic moth
#

why would it be on a sphere

worldly ingot
#

Think of it less as a coordinate on a cartesian plane where x, y, and z can represent a point in 3D space. It's more of a way to point a unit vector in a direction from 0 to 2pi on a sphere

#

They all share the same origin

#

If it helps you think about it better, consider x, y, and z as pitch, yaw, and roll

#

(you can see why the x axis, or "pitch", would rotate it up and down)

quaint mantle
#

cat rolls on its side, a pitcher is pitched to pour, a door is opened with its yaw

earnest forum
#

cool mnemonic

#

ima use that

trail oriole
#

Guys I'm so dumb

#

After 3 days of trying to understand what a hashmap is with complicated tutorials

#

I realized it simply was the equivalent to a python dictionary

#

Like my brain is so slow 😭

quaint mantle
#

bro its literally just a key value data store

#

3 days???

wet breach
#

lol

tardy delta
#

Lol

crimson terrace
#

Ya put in a key, ya put in a value, ya get stored data. Ya put in the same key again, it overrides. Thats the basics of a hashmap

quaint mantle
#

u guys replyquestions from beginner devs ?

flint coyote
#

Usually yes. But not if it is "pls send code for x" - as long as you tried your best, you will get answers :)

quaint mantle
#

how this plugin works ?

flint coyote
#

Not sure whether I understand your question correctly. Do you want to know how to use them inside your own plugin or do you want to know how the other plugin works even if you don't have those installed?

quaint mantle
#

this i a plugin?

#

if tabapi is a plugin how can i make tablist plugin without upload tabapi

flint coyote
#

It is an api that you can either provide as a plugin to your server (which is recommended) or you can compile it into your own source code with maven.

Uploading it as a plugin makes more sense since every plugin on your server can make use of it. Otherwise you have to compile it into multiple plugins.

Tabapi is not needed to do anything with the tablist. An api is also "just code". You can use it but you can also code everything yourself - whatever suits you best

wet breach
#

if you don't want to depend on an API you could just make a similar thing code wise yourself

#

but your line of questioning though however, means you have a bit to learn in regards to java especially when it comes to use of external libraries

quaint mantle
#

ohh thanks

quaint mantle
#

i need upload authme to my plugin's library ?

flint coyote
#

Learning to code can be fun. If it is demotivating for you, you won't get far^^

quaint mantle
flint coyote
#

You have to register authme as a dependency and use it as a library for your own plugin, yes. However you don't have to compile it into your own plugin since it is already on the server

quaint mantle
#

youtube tutorials doesnt make examples for spigot 😄

quaint mantle
#

for intellij ?=

#

project structure > libraries ?

wet breach
#

?learnjava

undone axleBOT
quaint mantle
#

ok i go to watch

#

youtube tutorial for learn java

flint coyote
#

also take a look at Maven. It will help you handle your dependencies

#

You can also add it directly in intellij but I wouldn't recommend that

harsh totem
#

Can I set the amount of an ItemStack to more that 64?

chrome beacon
#

Not sure if the api lets you do it but with NMS yes you can

harsh totem
chrome beacon
#

Client can display up to 127 items in a stack

harsh totem
#

im trying to make an ItemStack of a custom item and than give it with amount that may be larger than 64

#

so if it's inv.add() and not inv.set() i don't think that would be a problem

golden kelp
#

Add and set aren't that different, add just adds it to the next free slot while set adds it to the slot u provide

quaint mantle
#

How to override a default plugin command and replace it with a custom command ? with

#

bukkit have a execute command event ?

chrome beacon
#

If you want override their command you can set (soft-) depend and then register your command executor

crude loom
#

How can I display text above a block?

midnight glen
#
public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
        World fromWorld = event.getFrom().getWorld();
        World toWorld = event.getTo().getWorld();
        this.getLogger().info(toWorld.getName());
        this.getLogger().info(fromWorld.getName());
        if (event.getCause() == PlayerTeleportEvent.TeleportCause.COMMAND) {
            if(!fromWorld.getName().equals(toWorld.getName())) {
                event.setCancelled(true);
                this.getLogger().info("Cancelling TP");
            }
        }
    }

I am trying to cancel teleports from different worlds when done by a command.
The thing is, the event doesn't appear to be recognized at all because nothing prints.
I also added this line in the onEnable event:
getServer().getPluginManager().registerEvents(this, this);

#

yup

#

No errors / warnings in the IDE

#

Same with console

#

I added this line this.getLogger().info("TPChecker Enabled!"); on the plugin enable

#

Nothing prints out

#

But the plugin appears as green in /plugins

hybrid spoke
summer scroll
summer scroll
#

show full code

hybrid spoke
midnight glen
#
package net.retonix.teleportchecker;

import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class TeleportChecker extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        // Plugin startup logic
        this.getLogger().info("TPChecker Enabled!");
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    @EventHandler
    public void onPlayerTeleportEvent(PlayerTeleportEvent event) {
        World fromWorld = event.getFrom().getWorld();
        World toWorld = event.getTo().getWorld();
        this.getLogger().info(toWorld.getName());
        this.getLogger().info(fromWorld.getName());
        if (event.getCause() == PlayerTeleportEvent.TeleportCause.COMMAND) {
            if(!fromWorld.getName().equals(toWorld.getName())) {
                event.setCancelled(true);
                this.getLogger().info("Cancelling TP");
            }
        }
    }
}
midnight glen
hybrid spoke
#

and "TPChecker Enabled!" is not being print?

midnight glen
#

nope

hybrid spoke
#

are you sure you have the latest version of your plugin on the server?

midnight glen
#

I uploaded it like 5 times

hybrid spoke
#

otherwise build and try again

midnight glen
#

and reloaded the plugin 3 times

hybrid spoke
summer scroll
#

its impossible so rebuild it

midnight glen
#

Can I use build artifacts?

#

It is what I used for my previous plugin (it worked)

hybrid spoke
#

not what we meant

midnight glen
#

Anyways I rebuilt the plugin

#

and uploaded it

#

it says [TeleportChecker] Enabling TeleportChecker v1.0-SNAPSHOT but not what I coded it to say

earnest forum
#

thats just what spigot says

midnight glen
#

ik

#

ok so uhh

#

I made a new project

#

copy-paste

#

and it works

chrome beacon
#

Sounds like you forgot to recompile the jar

midnight glen
#

anyways it works now

#

thanks to everyone who helped

vestal dome
#

does anyone know how to listen in the netty channels of players?

prime kraken
#

Hello team hope you are all good, I'm trying to do that : When a player have diamons in there inventory and click on a special item in inventory, i would like to remove 1 of this diamond so if he had 3 diamonds, after clicking he just had 2 diamonds, how is it possible to do that ? thanks u for reading 🙂

prime kraken
copper dove
#

I'm working on a plugin for a server that im hosting for someone but i cant seem to figure out why the profession isnt working

this is the code im using to basically capture the Entity

if(player.isSneaking()) {
            if(entity instanceof LivingEntity) {
                NamespacedKey type = new NamespacedKey(EasyDetain.getInstance(), "easy_detain_type");
                NamespacedKey rez = new NamespacedKey(EasyDetain.getInstance(), "easy_detain_rez");
                NamespacedKey prof = new NamespacedKey(EasyDetain.getInstance(), "easy_detain_prof");
                ItemStack itemStack = new ItemStack(Material.TOTEM_OF_UNDYING);
                ItemMeta itemMeta = itemStack.getItemMeta();

                if(entity.getType() == EntityType.VILLAGER) {
                    Villager villager = (Villager) entity;
                    itemMeta.setDisplayName(entity.getName());
                            itemMeta.getPersistentDataContainer().set(type, PersistentDataType.STRING, entity.getType().toString());
                    itemMeta.getPersistentDataContainer().set(prof, PersistentDataType.STRING, villager.getProfession().toString());
                    itemMeta.getPersistentDataContainer().set(rez, PersistentDataType.STRING, "rez");
                } else {
                    itemMeta.setDisplayName(entity.getName());
                    itemMeta.getPersistentDataContainer().set(type, PersistentDataType.STRING, entity.getType().toString());
                    itemMeta.getPersistentDataContainer().set(rez, PersistentDataType.STRING, "rez");
                }

                itemStack.setItemMeta(itemMeta);
                player.getInventory().addItem(itemStack);
                entity.remove();
            }
        }

this is the code im using to spawn the Entity back into the world again

#
if(action.equals(Action.RIGHT_CLICK_AIR) && player.getInventory().getItemInMainHand().getType().equals(Material.TOTEM_OF_UNDYING)) {
            if(container.has(type, PersistentDataType.STRING)) {
                String getType = container.get(type, PersistentDataType.STRING);
                if(getType.equalsIgnoreCase("villager")) {
                    String getProf = container.get(prof, PersistentDataType.STRING);

                    Villager villager = (Villager) player.getWorld().spawnEntity(player.getLocation(), EntityType.VILLAGER);
                    villager.setProfession(Profession.valueOf(getProf));

                    player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
                } else {

                }

            }
        }

so right now i have only been working on the villager part as i figure that would be the hardest to get done but since im storing the profession into a pdc but it seems when i read it back its not working no matter what way i try to do it so im coming here for help with it

hybrid spoke
hybrid spoke
harsh totem
#

If I try to execute this line while the player has no inventory space left, this will not give or drop any items.
Does it also return some error or exception when it happens so that I can catch it?
player.getInventory().addItem(event.getCurrentItem());

hybrid spoke
#

whether the item has been added or not

#

nvm its a HashMap with the items which couldnt fit

harsh totem
#

ok

harsh totem
#

I can see that the console says false a couple of times

#

probably because of this

tender shard
#

pretty weird to declare it as hashmap instead of map, but so be it

kindred valley
#

Cant we just disable the fucking custom join message

harsh totem
kindred valley
#

Im not unable to code rn

harsh totem
kindred valley
#

Cant i disable it via bukkits own ymls

prime kraken
#

Hey, i just come back with my problems, so i have this code : ```if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase(deposit1)){
e.setCancelled(true);

            if (getAmount(p, diamond) >= 1){

                plugin.economyCore.depositPlayer(p.getUniqueId().toString(), 1);

                for (ItemStack i : p.getInventory().getContents()){
                    p.getInventory().removeItem(diamond);
                }

            } else {
                p.closeInventory();
                p.sendMessage("You need diamonds on you");
            }``` and there is the ItemStack ```ItemStack diamond = new ItemStack(Material.DIAMOND, 1);``` so how i would like to remove one diamond and not for exemple the 32 diamonds the player had in their inventory, i need help please! 🙂
harsh totem
#

How do I set a players inventory to another inventory?

#

I wanna save an inventory of the player and than if some condition is true I want the inventory to be back to the saved inventory

earnest forum
#

loop through first inventory

#

set each slot in player inv to the i'th slot of the stored inventory

tender shard
tender shard
#

It will try to remove 'as much as possible' from the types and amounts you give as arguments.

harsh totem
earnest forum
#

do what mfnalex did

harsh totem
#

i don't think it's supposed to be this long

#

k

midnight glen
#

Is there a way I could save a gamemode in a config?

#

Or convert a gamemode to a string?

earnest forum
#

just do like

#

c s a sp

#

and then make a method to convert string to gamemode

blissful pumice
#

if(gamemode == GameMode.CREATIVE){
string = c
}

midnight glen
#

Can I do Gamemode.tostring?

blissful pumice
#

i diont think so

earnest forum
#

probably

midnight glen
#

I can

earnest forum
#

u can do that with all enums

midnight glen
#

and then use valueof

earnest forum
#

and then use GameMode.valueOf

#

yea

limpid bronze
#

Hey i'm trying to run the gradle task "run spigot" but i'm stuck with this error :

Picked up _JAVA_OPTIONS: -Djdk.net.URLClassPath.disableClassPathURLCheck=true
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)
*** The version you have requested to build requires Java versions between [Java 8, Java 16], but you are using Java 17

I tried to change my java version in 16 but it doesn't work either

lost matrix
#

Make sure gradle is using java 17

#

Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle JVM select [17.0.3]

limpid bronze
#

Thanks it's working now!

winter leaf
#

Hallo, I need a developer for making me a new plugin for my server

#

I'll pay for the task

eternal oxide
#

?services

undone axleBOT
quiet ice
tardy delta
#

What kind of plugin?

quaint mantle
#

is there any way to encrypt a string in a yamlconfiguration for passwords

lost matrix
#

You can also just create sha256 hashes with guava (which is already provided by spigot)

#
String sha256hex = Hashing.sha256()
  .hashString(originalString, StandardCharsets.UTF_8)
  .toString();
brave sparrow
#

Definitely do not encrypt a password

#

You don’t want it to be decryptable

#

You want a one way hashed password with a salt and a pepper if you’re going to store passwords

lost matrix
#

Yeah hashing makes more sense.

#

What does "with a salt and a pepper" even mean?

visual tide
#

not sure what a pepper is supposed to be

#

but a salt is an extra string that is appended to the input before hashing

#

and stored

#

so an attacker cant precalculate hashes

golden turret
#

i think he want some encryption that uses salt

#

bcrypt and argon2 are good alternatives

brave sparrow
golden turret
#

you understand what i meant

brave sparrow
# lost matrix What does "with a salt and a pepper" even mean?

In cryptography, a salt is random data that is used as an additional input to a one-way function that hashes data, a password or passphrase. Salts are used to safeguard passwords in storage. Historically, only a cryptographic hash function of the password was stored on a system, but over time, additional safeguards were developed to protect agai...

In cryptography, a pepper is a secret added to an input such as a password during hashing with a cryptographic hash function. This value differs from a salt in that it is not stored alongside a password hash, but rather the pepper is kept separate in some other medium, such as a Hardware Security Module. Note that the National Institute of Stan...

brave sparrow
#

Always gotta salt and pepper your hashes

maiden briar
midnight glen
#

I already got an answer, but thanks anyway.

#

I do have another issue

#

I want to get the location of a /spawnpoint in a world

lost matrix
maiden briar
#

What is the best way to keep a cache on BungeeCord? (All data is on the MySQL database)

  1. Getting all the data from the database every second
  2. Getting all data if Bungee starts, and let Spigot add / remove from the cache via messaging. The database is fully updated by Spigot
  3. Sending new objects through messaging to Bungee (but saving them in MySQL is hard, because they all need other columns (there are base columns, but the extended class might want to save additional data)
midnight glen
lost matrix
midnight glen
#

I meant a spawnpoint of a player

#

that maps use as a checkpoint usually

maiden briar
midnight glen
#

Nope

#

Although pretty sure it is getBedSpawnLocation

#

I will try that

lost matrix
midnight glen
#

I am making a system where if you die you respawn in the same world

lost matrix
midnight glen
#

but I need to check if any parkour map did /spawnpoint

midnight glen
#

It spawns me in the regular world

midnight glen
#

Is there a way to load an inventory from an inventory variable?

golden turret
#

but i am not experienced

lost matrix
golden turret
#

with

maiden briar
maiden briar
lost matrix
lost matrix
maiden briar
#

What is load balancing? And what else is the best way to get an up-to-date view of all the servers?

lost matrix
#

Currently im a pretty big fan of redis for cross-server communication and/or caching.

lost matrix
# maiden briar How to use that?

I would use the Redisson library on the Java side.
Other than that redis is just an in-memory key-value database.
So a bit like a HashMap<K, V> that can be accessed by multiple applications at the same time.

maiden briar
#

Ok but my client uses external hosting. Will he have access to this?

lost matrix
#

Probably not

maiden briar
#

Then we cannot use it

#

Maybe I can also just select the data I need when a command is run on Bungee

lost matrix
#

What do you mean by "external hosting"? Doesnt he have root access?
If its a game-server then something like this is redundant anyways. Such a setup barely
gets more than 20 concurrent players.

maiden briar
lost matrix
#

Then he should have the liquidity to get at least a V-Server for 20 bucks a month.

#

Or a full dedicated for 50

maiden briar
#

Idk if he wants to, but I think I will go for the option above

brave sparrow
#

Redis is great

#

Definitely recommend it as a high speed cache

lost matrix
brave sparrow
#

I prefer jedis though

lost matrix
maiden briar
#

But you did not yet explain load balances

lost matrix
brave sparrow
maiden briar
#

Oh understainable

brave sparrow
#

And the bungee served to each player is based on their relative loads

maiden briar
#

Then I don't want to use MySQL as cache

#

But how do I send players then to the required server if that one is on another Bungee instance?

brave sparrow
#

Multiple bungees can point to the same server

#

The server has no concept of what bungee the player is on

maiden briar
#

Now I am confused

brittle lily
#

Should I use public ItemStack name{
//ItemStack Codes
}
to use ItemStack on another class?

lost matrix
maiden briar
#

Yes

brave sparrow
#

Say you have 4 minecraft servers 1 2 3 4

#

Now say you have 3 bungees A B C

lost matrix
brave sparrow
#

when a user connects to play.whatever.com, they get sent whatever bungee has the lowest utilization

#

Let’s say it’s bungee C

maiden briar
#

Ok

brave sparrow
#

If your friend is playing on bungee A, you can still both be on server 2 and see each other and interact with each other

maiden briar
#

Ok, but will the message from SPIGOT server 1 (Bungee A) land on the same place as the messages from Spigot 2 (Bungee C)?

brave sparrow
#

How are you sending the message from spigot

maiden briar
#

Just to the player

golden turret
#

plugin message?

brave sparrow
#

Wait wait wait

maiden briar
#

Yes

brave sparrow
#

Why are you saying spigot 1 and 2

#

They’re both connecting to spigot 2

golden turret
#

plugin message is not the best btw

brave sparrow
#

The message is sent via the player, so it ends up on whatever bungee that player is connected to

maiden briar
#

Ok, but if one is for example on spigot1, and the other on spigot2

golden turret
#

what if nobody is on the server

#

how can you send the mesaage

maiden briar
#

I know, and I only send messages when players are online

brave sparrow
#

Plugin messages are transmitted via the player’s connection

maiden briar
#

I know everything about plugin messaging, but the problem is that I need to know about load balancing

brave sparrow
#

So that message winds up on whatever bungee the player is connected through

maiden briar
#

But I can still send queries to the database if I need data

maiden briar
#

And that will be less frequent

brave sparrow
maiden briar
#

Of arenas (games)

#

I am making a network minigame

brave sparrow
#

That’s not useless then

#

Assuming each arena is a different server

maiden briar
#

Yes, but all settings are saved on the database

maiden briar
#

And they need to be able to join gamemodes on Bungee level

brave sparrow
#

I would suggest caching it in Redis or something similar if the bungee doesn’t need to know it at all times

maiden briar
#

That is why I need to know what arenas are there per server

brave sparrow
#

You can use a cache like Redis for that

maiden briar
#

Ok, but I have no idea if my client wants to use that

#

And if he can use it

brave sparrow
#

Well he definitely can

maiden briar
#

I think I will just query the database

maiden briar
brave sparrow
maiden briar
#

But I don't know how he hosted the server and if the hosting allows non-minecraft servers

brave sparrow
brave sparrow
#

It’s not difficult

maiden briar
brave sparrow
#

¯_(ツ)_/¯

dark arrow
#

i have created a custom mob and is it possible to customize their drops

small current
#

why players can be damaged by arrows if they are outside spawn region by players inside the spawn region

#

the isInRegion works fine, works on blockbreakevent and stuff

eternal night
#

I mean, the damager in that case is the arrow

#

not the player that launched the arrow

small current
#

ok so i need to cast it to an arrow and then check for the shooter ?

eternal night
#

Well yea but you'd also want to be able to run code if it is the player

#

so, eeek smth like

#
Player damager = null;
if (event.getDamager() instanceOf Player player) damager = p;
else if (event.getDamager() instanceOf Projectile projectile && projectile.getShooter() instanceOf Player player) damager = player;
else return;
lost matrix
#

You can also just tag an arrow by using their scoreboard tags or PDC.
Just give it an "PLAYER_ARROW" tag.

#

This way you dont need to get the shooter.

lost matrix
# small current 1.8 💀

Well... why do you use ancient software?
Anways, scoreboard tags should be available in 1.8 so something like this might work

    @EventHandler
    fun onShoot(event: PlayerLaunchProjectileEvent) {
        event.projectile.scoreboardTags.add("PLAYER_PROJECTILE")
    }

    @EventHandler
    fun onHit(event: EntityDamageByEntityEvent) {
        (event.entity as? Player)?.let {
            (event.damager as? Projectile)?.let{ projectile ->
                if (projectile.scoreboardTags.contains("PLAYER_PROJECTILE")) {
                    event.isCancelled = true
                }
            }
        }
    }
small current
lost matrix
tardy delta
#

kotlin aaaa

crisp steeple
#

you can also use metadata on 1.8

#

why do people not like kotlin

#

kotlin is great

lost matrix
#

I have a love/hate relationship with it. I think its 'neat'.

#

But i honestly prefer java

tardy delta
#

i thought i saw rust for a second

crisp steeple
#

i usually will use kotlin for a while and then do one thing in java and kind of drift back to java

#

still like kotlin though

#

so many utility things that java just doesn’t have

lost matrix
#

But i feel like java is way more explicit and has sturdier standards and constraints. (Which i like)

crisp steeple
#

well yeah, but sometimes the constraints can get in the way

#

it does make it more straightforward though

worldly ingot
#

Bukkit support for scoreboard tags wasn't added until 1.10

#

The downside of using outdated shit is that you don't get basic APIs

#

Keep track of a Set<UUID>

lost matrix
#

Nice PES_MmmSip one more argument against 1.8

crisp steeple
#

1.8 sucks

#

i hate having to work in it most of the time

vocal tundra
#

1.8 rocks!

worldly ingot
#

Been dealing with a lot of 1.8 threads on the forums lately, which is annoying. The worst part is, people suggest just terrible solutions

crisp steeple
#

yeah

worldly ingot
#

The amount of people that don't know about MaterialData is painful

crisp steeple
#

also since there is like no persistent data support in 1.8

#

people always resort to super bloated yml file stuff

vocal tundra
#

what are scoreboard tags tho

worldly ingot
#

Vanilla feature of scoreboards to attribute arbitrary string data to entities

#

Useful for datapacks to keep track of entities

vocal tundra
#

Oh I see

worldly ingot
#

Beyond that they have no use in plugins

vocal tundra
#

I feel like 1.13+ spigot complicated some stuff tho

#

mainly mojangs fault tho probably

lost matrix
worldly ingot
#

Yeah. I'd argue it made it far simpler

vocal tundra
#

datawatchers are a lot more annoying to work with

#

since now you have to reflect and grab some arbitrary named class to set a value instead of just passing in a simple byte

crisp steeple
#

you could argue that the byte is just as arbitrary though

worldly ingot
#

Entity classes generally abstract out their data watchers with simple getter/setters

lost matrix
#

So NMS has gotten more complicated. Because there is a lot more abstraction and data driven concepts like registries present.
But that doesnt have anything to do with Spigot... its only logical that more features and grater modularity make a system more complicated.

vocal tundra
#

not all of em

#

and the difference between the byte is that you can easily just look on the protocol metadata wiki page

#

and no reflection is required

#

both are just as magical

#

one is just 2x faster to use

lost matrix
vocal tundra
#

and how are you supposed to make birch wood for example without magic numbers I'm not sure

lost matrix
#

Material.BIRCH_WOOD

small current
#

why i can't pickup items that i added nbt tags to them

crude loom
#

How do I schedule a repeating async task?

vocal tundra
#

So did they add a bunch of new materials

small current
lost matrix
small current
lost matrix
#

Or the pickup delay is weird

lost matrix
small current
#

k wait

#

the playeritempickupevent is not even being called bruh

lost matrix
#

did you add a pickup delay?

#

What is a real life class?

#

You mean in the context of school?

#

Or in the context of ranking? Or a clase social

#

What does class refer to? A group of students? A course like math?

#

"math class" or "class A2"

tardy delta
#

public class Class?

lost matrix
#

Ok so a group of students. Then call it StudentGroup

crude loom
#

Is it possible to store a location in a config file?

quaint mantle
#

yes

lost matrix
crude loom
#

Ah, then I've been converting it to a string this whole time for nothing😅

hybrid spoke
#

ClassroomContent

lost matrix
#

lol. The students are the content? XD

eternal night
#

Lesson ? 😅

#

for like the active lesson

lost matrix
rocky bolt
#

Guys i have problem, before every message or ranks or npcs its ââ how to fix it
Cus it looks ugly

hybrid spoke
eternal night
#

sounds like a plugin

lost matrix
eternal night
#

oh

small current
eternal night
#

only their messages 😅

tardy delta
#

i once tried FileConfiguration#getLocation and it gave me a classcast exception and only manually casting worked lol

tender shard
#

hm

#

wtf is the difference between Class#getComponentType() and Class#componentType()

#

they both do the same thing as it seems

lost matrix
#

Call it a StudentFlock

visual tide
tender shard
visual tide
#

but i know alex is

tender shard
#
    @Override
    public Class<?> componentType() {
        return isArray() ? componentType : null;
    }
...
    public Class<?> getComponentType() {
        // Only return for array types. Storage may be reused for Class for instance types.
        if (isArray()) {
            return componentType;
        } else {
            return null;
        }
    }
visual tide
#

well

tender shard
#

otherwise I use my desktop pc lol

visual tide
#

well

visual tide
lost matrix
tender shard
lost matrix
rocky bolt
#

i just use spigot some plugins and thats it

visual tide
#

nice chäräctërs

worldly ingot
#

It's how a computer understands letters

rocky bolt
#

so how to fix it?

tardy delta
#

its a set of characters

visual tide
#

how letters are turned into bytes

tardy delta
#

lets get some sausage lol

tender shard
#

getComponentType() and componentType() is really so stupid, it's the same, and it has the same code twice

split light
#

is there a way to store PersistentData on a block that isn't a TileState? Like can I store data in a block of dirt?

tender shard
rocky bolt
#

@lost matrix so how to fix it bro?

#

what i need to do?

lost matrix
#

𝔑𝔦𝔠𝔢 ℭ𝔥𝔞𝔯𝔞𝔠𝔱𝔢𝔯𝔰

tender shard
split light
rocky bolt
#

bro cmn

#

help me

eternal night
#

@tender shard they are the implementation for Constable

#

getComponentType() existed prior

tender shard
eternal night
#

componentType() is implemented as Class implements Constable

#

I mean

lost matrix
eternal night
#

preferably the other way around

#

but it is a single line

#

lol

tardy delta
#

that was a very good sausage

split light
rocky bolt
tender shard
#

oh but Constable doesn't even declare componentType()

eternal night
rocky bolt
lost matrix
rocky bolt
#

++

lost matrix
rocky bolt
rocky bolt
#

i just uploaded files to panel

#

and i cant see characters

eternal night
#

oh it isn't constable but TypeDescriptor.OfField

#

mb

tender shard
#

I already thought I'm stupid lol

tender shard
#

I hate stuff like this. I see that both getComponentType() and componentType() exists, then I ask on Discord WHY, and in the end I lost 15 minutes of time without doing anything useful lol

rocky bolt
#

cmn just say what to doo mannnn

lost matrix
# rocky bolt what bro?

Ok so if you type in your code in notepad++ then you compile using the javac via the command line or what?

rocky bolt
#

wtf?

#

nah i will just continue with this problem i dont understand 1 word from you

lost matrix
quaint mantle
#

smile hes not coding

#

hes just using plugins

rocky bolt
#

i never coded or something i just installed plugins and thats it

#

yep

quaint mantle
rocky bolt
#

and i asking how to fix it

lost matrix
rocky bolt
#

no one responding there

quaint mantle
#

this isnt the right channel

tender shard
rocky bolt
#

cus no one respond on other

#

like 1 hour

quaint mantle
#

do not ask for help in this channel and not expect programming help

tender shard
#

and then you wonder why you don't understand a thing when you ask in the wrong channel on purpose?

rocky bolt
#

ok can someone come to help server?

quaint mantle
#

jesus

rocky bolt
#

why toxic

lost matrix
tender shard
rocky bolt
#

pvp system better there

quaint mantle
#

lmao

#

get out of this channel

rocky bolt
quaint mantle
#

holy shitr

tender shard
quaint mantle
rocky bolt
#

im going to help server bye

quaint mantle
#

about time

tender shard
#

hm did I forget any special cases? I think this should work fine, right?

    public static <T> T[] shiftArray(T[] original) {
        if(original.length == 0) return original;
        T[] shifted = (T[]) Array.newInstance(original.getClass().getComponentType(),original.length-1);
        if(shifted.length == 0) return shifted;
        System.arraycopy(original, 1, shifted, 0, shifted.length);
        return shifted;
    }
#

it's supposed to always remove the first array element

quaint mantle
#

why not just do this the normal way

lost matrix
tender shard
#

the original is only returned when it's already empty

lost matrix
#

If the original has a length of 0 then you return a reference to the original.
If not then you return a new reference.

tender shard
#

oh yeah, sure, that MIGHT be a problem, but not in this case as it's only to parse arguments, so the contents will never be changed

#

but yeah I should instead return a clone, thanks for the suggestion

#
    public static <T> T[] shiftArray(T[] original) {
        if(original.length == 0) return original.clone();
        T[] shifted = (T[]) Array.newInstance(original.getClass().getComponentType(),original.length-1);
        if(shifted.length == 0) return shifted;
        System.arraycopy(original, 1, shifted, 0, shifted.length);
        return shifted;
    }

okay how's this? 😄

#

oh wait

#

I only return the original when it's empty

#

so nothing can ever be changed anyway

lost matrix
#

Why do you shift an array (which is not exactly cheap) just to parse arguments?
Cant you just use an ArrayDeque and pop arguments?

tender shard
#

so actually the clone is useless

tender shard
#

since spigot is using String[] for arguments, I decided to do the same thing

#

(this is for a discord bot, nothing related to spigot)

lost matrix
#

Well... LinkedList and Deque both support removal on both head and tail in constant time.

tender shard
#

as said, it's for a discord bot, I don't really care if "shifting" the argument takes 2ns or 0.3ns so I guess I'm fine 🙂

echo basalt
#

I honestly feel like doing it the original way is better than creating a list, allocating tons of objects and all

lost matrix
round finch
#

Hello idk why my BuildTools makes no Jar? D:

tardy delta
#

exceptions?

round finch
#

ok i added echo

#

let see

#

oopsi i mean pause

#

?paste

undone axleBOT
echo basalt
tender shard
round finch
#

m5 pastebin isn't working

#

for me

tender shard
eternal night
round finch
eternal night
#

have you deleted the entire work directory and tried from a clean start ?

round finch
#

the folder with Build Tools`?

eternal night
#

Yea

round finch
#

i will try to give it a clean!

#

it froze

#

after installing git

#

like before

quiet ice
#

An empty array is de-facto immutable either way, no reason to return a clone there

tender shard
#

fun fact: you cannot ctrl+B to the .clone method of an array

safe notch
#

Did you use shaded artifact ?

#

Use buildtools

#

go to spigot-api/target

#

Folder

tardy delta
#

use maven/ gradle?

safe notch
#

yeah this is better way ^

tardy delta
#

or doesnt that longer work in 1.18

safe notch
#

It works

tardy delta
#

its weird in that version

safe notch
#

@kind patrol do you use IntelliJ ?

#

Okay it would have been a lot less of a work if it was IntelliJ cuz it has a minecraft development plug-in that auto created pom.xml for maven

eternal oxide
#

you are depending on Spigot.jar

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

safe notch
#

ok you need to use shaded jar as dependency instead of server jar

#

ye

#

?paste

undone axleBOT
tender shard
#

you should use maven or gradle

crisp steeple
#

graven or madle

quaint mantle
#

any idea how can i loop through this yaml file?

4255030d-bb79-3185-9265-1c21e4464bca:
  coins: 0
  tokens: 2
4255030d-bb79-3185-9265-1c21es4464bca:
  coins: 23
  tokens: 21
4255030d-bb79-3185-9265-s1c21e4464bca:
  coins: 123
  tokens: 223
tardy delta
#

getKeys(false)::foreach?

river oracle
#

FileConfiguration#getKeys(boolean deep)

tardy delta
#

i actually thought you needed a configsection to be able to loop

gray cloak
#

is there a way to add a command to tab completions without actually registering it?

quaint mantle
#

smth like this?

for (String users : this.config.getKeys()) {
            
 }
river oracle
tardy delta
#

false as parameter in getKeys

lost matrix
tardy delta
#

aah

quaint mantle
#

eeeh i would like smh need to like loop through the list and set for all the entries the coins to 0

tardy delta
#
for string k : getKeys(false) {
  config.set(k + ".data", something)
}
save()```
quaint mantle
coarse finch
#

but its not in a static context

crisp steeple
#

that method isn’t static

#

so you can’t use it in a static context

tardy delta
#

ah wait i thought it took a boolean

#

probably the one in ConfigSection then

coarse finch
crisp steeple
#

what you’re doing

coarse finch
#

so how would i do it

crisp steeple
#

referencing it by the class and not an instance (is what you’re doing)

coarse finch
#

oh ok

tardy delta
#

static stuff belongs to a class and not an instance

crisp steeple
tardy delta
#

and instance stuff cannot be accessed from the class

lost matrix
# quaint mantle any idea how can i loop through this yaml file? ```yaml 4255030d-bb79-3185-9265-...

This is how you can make this a really short process:

    class EconAccount(private val uuid: UUID, private val tokens: Long, private val coins: Long) : ConfigurationSerializable {
        companion object {
            fun valueOf(map: MutableMap<String, Any>) : EconAccount {
                return EconAccount(map["uuid"] as UUID, map["tokens"] as Long, map["coins"] as Long)
            }
        }

        override fun serialize(): MutableMap<String, Any> {
            val map = mutableMapOf<String, Any>()
            map["uuid"] = uuid
            map["tokens"] = tokens
            map["coins"] = coins
            return map
        }
    }
    
    // Then in another class:

    fun saveData(map: Map<UUID, EconAccount>, config: FileConfiguration) {
        config["accounts"] = map
    }

    fun loadData(config: FileConfiguration) : Map<UUID, EconAccount> {
        return config["accounts"] as Map<UUID, EconAccount>
    }
tardy delta
#

that syntax looks kinda ugh

coarse finch
crisp steeple
#

then get an instance of it 🙃

sinful tundra
#

Is there a way to check if a given ItemStack is an ItemFrame?

tardy delta
#

just dont use this then

crisp steeple
#

kotlin 😍

tardy delta
#

imajin ?docs command when

quaint mantle
#

?jd-s

undone axleBOT
tardy delta
#

wait

quaint mantle
#

?jd

coarse finch
crisp steeple
#

how so

tardy delta
#

best thing

coarse finch
quaint mantle
#

?learnjava

undone axleBOT
coarse finch
quaint mantle
#

yeah well not enough

tardy delta
#

?

crisp steeple
#

setPassenger

#

yeah

lost matrix
#

Yeah you can use that with any entity

#

even Items

#

addPassanger
setPassanger is deprecated because an entity can now have multiple passangers

#

addPassanger

coarse finch
#

so i have had this issue since forever, i cannot register/unregister a command outside of the onEnable. if i unregister it, it works but its ban command so it should return to vanilla ban command. if i register it, it wont register. but this all works if i do it during onEnable

midnight shore
#

What if I add a passenger that has already got passengers?

#

Would they add togheyer as the passengers of the main entity?

lost matrix
midnight shore
#

Or would they count differently?

harsh totem
#

Why does it say Condition 'player.getInventory().addItem(event.getCurrentItem()) == null' is always 'false' ?
If the action of adding this item isn't complete it should return a hashMap which wouldn't be null

eternal oxide
#

.isEmpty()

harsh totem
eternal oxide
#

use it instead of == null

crisp steeple
#

isn’t additem void or a boolean

harsh totem
#

no

#

it returns hashMap of the items it didn't add

crisp steeple
#

so use .isEmpty then

lost matrix
#

If you want to drop items on the ground when giving them to a player but his inventory overflows, then i would recommend something like

    player.getInventory()
            .addItem(item)
            .values()
            .forEach(overflown -> player.getWorld().dropItem(player.getLocation(), overflown));
tardy delta
#

it wont return null, it will return either an empty of a hashmap with stuff in

golden kelp
#

How can one make a CLI program like the spigot server CLI (printing info while giving the user a way to enter input)

golden kelp
#

Yep

lost matrix
#

Just make an executable jar file. Use Sysout to print into console and a Scanner to get console input.
All you need is an entry point public static void main(String[] args)

tender shard
#

does anyone know if JDA has a feature to replace emojis?
E.g. :) -> :slight_smile:

strong rapids
#

anyone know how i can fix "Could not connect to a default or fallback server. Incorrectly configured address/port/firewall? io.netty.channel.AbstractChannel$AnnotatedConnectException"

#

bungeecord

lost matrix
strong rapids
#

i did

#

and still the same

lost matrix
harsh totem
#

When I use if (player.getInventory().addItem(event.getCurrentItem()).isEmpty())
Does it only give me hashMap or does it also add the items?

tender shard
strong rapids
harsh totem
#

ok

strong rapids
#

yes

#

tried everything

#

not working

brave sparrow
#

I mean to me it sounds like you either configured it wrong or didn’t open the firewall

#

Is the bungee on the same box as the minecraft servers?

harsh totem
#

I has this problem so I tried to clone the item in the slot and set this slot to the cloned item after I add the item to the player but this problem isn't fixed for some reason

brave sparrow
#

You’ve discovered the difference between addItem and setItem

harsh totem
#

ItemStack clone = event.getCurrentItem().clone();
if (player.getInventory().addItem(clone).isEmpty()){
event.getClickedInventory().setItem(9, clone);

brave sparrow
#

Good god

harsh totem
#

?

brave sparrow
#

What do you think that code will do

harsh totem
#

clone, add, set

#

wouldn't it?

brave sparrow
#

Why are you checking if the hashmap is empty

harsh totem
#

because I want to check if it can be added and if not than remove the given items

quaint mantle
#

no

flint coyote
#

Wrong section and discord

quaint mantle
#

@quaint mantle this guy do be breaking rule tho

harsh totem
#

@brave sparrow are you here?

quaint mantle
#

?ban @turbid moth repeated breaking of the rules

undone axleBOT
#

Done. That felt good.

harsh totem
#

F

quaint mantle
#

thanks babe

#

np babe

flint coyote
#

tyty

brave sparrow
#

Let’s say you add 10 items and they only have space for 3

#

The hashmap won’t be empty but the inventory will now be full

harsh totem
brave sparrow
#

Well more likely 1 item with an amount of 7

#

But they’ll have gained 3 items

harsh totem
#

yes

harsh totem
#

i'll set this slot to what it was before

#

that's not the problem

#

the problem is in the video

#

it is a custom inventory

brave sparrow
#

Why don’t you just cancel the click event

flint coyote
#

because slot 9 is inside the custom inventory. You are setting it on that slot

harsh totem
flint coyote
#

But it's already there so why set it again?

harsh totem
harsh totem
#

as in the video

#

If i don't set it, the slot that has a stack is replaced with the slot of the items that were in the inventory

subtle pewter
flint coyote
harsh totem
strong rapids
#

anyone know how i can fix my bungeecord? pls dm

flint coyote
#

In that case you just take the clicked item and add it to the players inventory. Additionally you want to cancel the click event so it isn't actually getting removed from the inventory (more like duplicated)

harsh totem
flint coyote
#

yes that's what this method will do

crisp steeple
flint coyote
#

pseudocode:

  1. check if it's your custom inventory that is clicked
  2. cancel event
  3. get clicked slot
  4. get item in slot
  5. add item to players inventory
crisp steeple
#

i usually put it as early as possible just in case an exception gets thrown somehow

flint coyote
round citrus
#

Hello I have my proxy on asia and backened servers on Germany my launcher as well as default spigot ping shows asian ping but when I install any tab plugin it shows me backened germany ping can anyone help ?

flint coyote
#

Also edited the message for clarity

harsh totem
crisp steeple
#

the problem being?

#

why are you only canceling it if it’s empty

harsh totem
#

the slot with a stack becomes one and not stack

harsh totem
crisp steeple
#

yes…

#

so always cancel it

harsh totem
#

that's what I did

crisp steeple
#

no

#

you canceled it if the map is empty

#

which it isn’t always

harsh totem
#

no

coarse finch
#

so i have had this issue since forever, i cannot register/unregister a command outside of the onEnable. if i unregister it, it works but its ban command so it should return to vanilla ban command. if i register it, it wont register. but this all works if i do it during onEnable

harsh totem
#

in the end of the command

flint coyote
#

but it's inside an if, isn't it?

crisp steeple
harsh totem
#

wdym

crisp steeple
#

the event.setcancelled only happens if the map is empty

harsh totem
#

because you guys told me to just cancel and not clone

flint coyote
#

huh? How does that give any info about a custom inventory?

harsh totem
crisp steeple
#

dude what

harsh totem
#

its inside this

flint coyote
#

that isn't what you sent before

crisp steeple
#

that isn’t even the same if statement

#

what am i looking at here

#

the event only get cancelled if the map is empty

#

the map isn’t always empty

harsh totem
crisp steeple
flint coyote
#

so you have 2 ifs before cancelling? Why?

harsh totem
crisp steeple
#

oml

harsh totem
#

I know i could use switch

crisp steeple
#

you aren’t checking the inventory type in that if statement

#

you’re checking if the map is empty

#

the map isn’t always empty

flint coyote
#

You can put the cancelled statement in the beginning after the holder check an remove all other cancellations

steel swan
#

hey i am trying to use a plugin on my server, but when i try running it, this is whats happens

#
[19:30:27 ERROR]: Could not load 'plugins/ChangeSkin (1).jar' in folder 'plugins'
org.bukkit.plugin.UnknownDependencyException: ProtocolLib
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:219) [server.jar:git-Spigot-21fe707-741a1bd]
    at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [server.jar:git-Spigot-21fe707-741a1bd]
    at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [server.jar:git-Spigot-21fe707-741a1bd]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [server.jar:git-Spigot-21fe707-741a1bd]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
harsh totem
#

I starting to think that I should just delete this entire event and start over

crisp steeple
#

probably

harsh totem
flint coyote
#

I mean your code has a lot of duplication and could be shortened to like 1 10th

harsh totem
#

i'll just start over

#

:(

kind hatch
flint coyote
#

He wants to hand out items on click of a custom inventory