#help-development

1 messages · Page 1642 of 1

quaint mantle
#

What

reef wind
#

so you are putting in the jar and then reloading/restarting?

#

and nothing happens

quaint mantle
#

show your exported jar in the plugins folder

#

🤸 🏌️

#

🦽

reef wind
#

I just need to ask in case you are stupid, you are reloading/restarting the server right?

woeful prawn
#

Does anyone know how I can make an itemstack where the item (say a wooden pickaxe) has the nbt tag "canBreak ___" in spigot?

undone axleBOT
woeful prawn
#

I did, like for the past like hour

#

and I couldn't find anything, so I thought I'd ask

reef wind
quaint mantle
#

it has to be .jar

reef wind
quaint mantle
#

why tf is it uppercase

#

in spigot it does apparently

hasty prawn
#

Clearly it does

reef wind
#

lmao

willow widget
#

Hey, I used to follow a tutorial that used

onCommand(I dont remember this part){
  if(label.equalsIgnoreCase("mycommand")){
//  do something
  }
}

After learning some other things non spigot related I wonder if this is the right way to write the code for a command (i.e. the right way when talking about api docs), can someone confirm? (:

quaint mantle
#

correct

quaint mantle
#

setting the command executor removes that if statement

#
getCommand("hi").setExecutor(new MyCommand());
willow widget
quaint mantle
#

codedred right?

willow widget
willow widget
quaint mantle
#

he promotes bad practices and shit code

reef wind
#

youtube videos are a shit way to learn

quaint mantle
#

but sometimes hes useful

#

google > youtube

#

docs > youtube

woeful prawn
willow widget
#

Yeah, for what I've read/learnt/everything tutorials are bad bc of bad practices and other stuff

reef wind
#

youtube videos teaches bad practice they are a lot of the times outdated and they usually don't even know what they are doing.

willow widget
reef wind
#

using docs and google is the only option

willow widget
reef wind
#

change api in yml to 1.17

quaint mantle
#

then you have a startup error

reef wind
#

the latest api is for 1.17 (but works for 1.17.1)

quaint mantle
#

major.minor

willow widget
#

I mean... how'd I get the sender and that stuff? ||(again... I'm kinda rusty so I don't remember how it worked hehe)||

reef wind
#

/command(hello) args(..)

#

the arguments is not the command (if I understand you correctly)

willow widget
reef wind
#

if I make the command "hi <x>" respond with x I just pass "hi" in getcommand

willow widget
#

I mean...
when you use onCommand() you get the (label, sender, args, etc) stuff, how do I code that part when using .setExecutor(new MyCommand());?

reef wind
#

not the arguments

willow widget
#

aaaaaa

#

I'm just trying to figure how to get the sender and args lol

#

oh wait

#

MyCommand() is a class which extends something to get all the args and stuff??

reef wind
#

Command

 public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        
        sender.sendMessage(args[0]);
}

Main

this.getCommand("command").setExecutor(new ClassName());
#

that is an example of how it would look

willow widget
#

that kinda sounds like an enemy more than a friend hehe

willow widget
reef wind
#

yes.. methods goes in classes..

willow widget
reef wind
#

how do you even manage that? skript is like plaing english.

#

no

#

just use getCommand()

#

getCommand().setExecutor() will execute the command

willow widget
reef wind
#

what are you on?

#

just set the executor in main and make aliases in plugin.yml

#

you don't need some custom command handler

quaint mantle
#

/ConstantConditions/

vast sapphire
#

I don't know how to work with configs that well

#

How would I write a hash map to the config

native nexus
#

ConfigSections work similar to hash maps in theory

stone sinew
# vast sapphire How would I write a hash map to the config

Using bukkit serialization...

Map.entrySet().forEach(entry -> {
    String s = entry.getKey();
    Location l = entry.getValue();
    config.set(s, l);
});
saveConfig();

A bit cleaner but more methods to make your own seralization.

// Save to config
public Location stringToLocation(String s) {
    String[] data = s.split(",");
    if(data.length < 4) return null;
        
    Location loc = new Location(Bukkit.getWorld(data[0]), Double.valueOf(data[1]), Double.valueOf(data[2]), Double.valueOf(data[3]));
    if(data.length == 5)
        loc.setYaw(Float.valueOf(data[4]));
    if(data.length == 6)
        loc.setPitch(Float.valueOf(data[5]));
    return loc;
}
    
public String locationToString(Location l) {
    return l.getWorld().getName()+","+l.getX()+","+l.getY()+","+l.getZ()+","+l.getYaw()+","+l.getPitch();
}

Map.entrySet().forEach(entry -> {
    String s = entry.getKey();
    config.set(s, locationToString(entry.getValue()));
});
saveConfig()

// get from config...
ConfigurationSection cs = YamlConfiguration.getConfigurationSection("");
cs.getKeys(false).forEach(path -> map.put(path, stringToLocation(cs.getString(path))));
native nexus
#
private final Map<String, Integer> data = new HashMap<>();

public void deserialize(FileConfiguration configuration) {
    ConfigurationSection section = configuration.getConfigurationSection("data");
    if(section != null) {
        for(String key : section.getKeys(false)) {
            data.put(key, configuration.getInt("data." + key));
        }
    }
}

public void serialize(FileConfiguration configuration) {
    for(Map.Entry<String, Integer> entry : data.entrySet()) {
        configuration.set("data." + entry.getKey(), entry.getValue());
    }
    // Save Config here with (saveConfig() or custom config)
}
``` Simpler example
stone sinew
ionic dagger
#

Would a 1.15 plugin coding tutorial work for 1.16

#

Or are there major differences between the two versions

quaint mantle
#
public Location deserialize(ConfigurationSection cs, String path) {
    if (cs.getLocation(path) != null) {
        return cs.getLocation(path);
    }
    return new Location(
        cs.getInt(path + ".x"),
        cs.getInt(path + ".y"),
        cs.getInt(path + ".z")
    );
}
stone sinew
ionic dagger
#

What abt 1,17

stone sinew
vast sapphire
ivory sleet
stone sinew
reef wind
ionic dagger
#

So what do u suggest

native nexus
reef wind
#

learning from videos is not an option

ionic dagger
#

I was just gonna use codedreds 1.15 vids as an intro and use my Java class in school to continue it

ivory sleet
#

I’d argue for that YouTube tutorials can be good as they might show a concrete way of addressing a problem however 99% of the YouTube tutorials miss a good solid code architecture, so yeah rather just understand the concept than copy pasting.

native nexus
#

Wait... is that a capitalized Variable...

stone sinew
reef wind
#

He teaches bad practice just like imagine said

#

Like I said earlier

#

youtube videos teaches bad practice they are a lot of the times outdated and they usually don't even know what they are doing. +they take more time to follow

ivory sleet
#

@ionic dagger do you have Java experience which is not directly derived from spigot related sources?

vast sapphire
# stone sinew Using bukkit serialization... ```java Map.entrySet().forEach(entry -> { Stri...

so from what i'm understanding, this goes into onEnable() ```java
hash.entrySet().forEach(entry -> {
String s = entry.getKey();
getConfig().set(s, locationToString(entry.getValue()));
});
saveConfig();

    // get from config...
    ConfigurationSection cs = getConfig().getConfigurationSection("locations");
    Objects.requireNonNull(cs).getKeys(false).forEach(path -> hash.put(path, stringToLocation(Objects.requireNonNull(cs.getString(path)))));

        hash.entrySet().forEach(entry -> {
            String s = entry.getKey();
            Location l = entry.getValue();
            getConfig().set(s, l);
        });```
reef wind
stone sinew
stone sinew
ionic dagger
stone sinew
#

There are 2 different ways of loading and saving data in that message.

ivory sleet
ionic dagger
#

For Java? Not too high, I forgot most of it since I went back to py over the summer

ivory sleet
#

Ah fair

#

Py’s object orientation is a bit too hacky imo

native nexus
#

I don't like python

ionic dagger
#

Me neither

#

It was weird to me

#

My teacher taught it weird

#

But do you have any links then for any docs or really anything I can use instead of the videos

native nexus
#

Universities are just bad at teaching programming languages.

ivory sleet
#

for Java

#

?learnjava

undone axleBOT
ivory sleet
#

If you understand Java

#

?jd-s will get you going

undone axleBOT
ionic dagger
#

Thank you

quasi stratus
#

How would one make a message hoverable/clickable in chat? java player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&r &e* &bUser Agreement"));

stone sinew
#

Anyone know if there is a way to disable the world loading messages in console? Like Bukkit.getWorld("WorldName", boolean displayMessages) (just example usage)

native nexus
vast sapphire
quaint mantle
#

hacky, but works

stone sinew
quaint mantle
#

try looking at stash

#

see what getworld calls

#

?stash

undone axleBOT
stone sinew
ivory sleet
#

Check CraftServer in CraftBukkit

stone sinew
#

Yeah checking it

quaint mantle
#

Im getting this error at

player.setPlayerListHeaderFooter(String.valueOf(new ComponentBuilder(bleepo.parseText(player, head.toString())).create()), new ComponentBuilder(bleepo.parseText(player, footer.toString())).toString());

And Im not sure why. anyone know?

stone sinew
# ivory sleet Check CraftServer in CraftBukkit
private final Map<String, World> worlds;
public World getWorld(String name) {
    Validate.notNull(name, "Name cannot be null");
    return (World)this.worlds.get(name.toLowerCase(Locale.ENGLISH));
}
```Not seeing where it creates a world from `Bukkit.getWorld(String)`
ivory sleet
#

The same

#

It’s the CraftServer

#

Spigot uses Bukkit.setServer(server)

stone sinew
#

No I'm saying that method doesn't create a world... so I think I'm missing something...

All I found was
Bukkit.getWorld(String) -> server.getWorld(String) -> (World)this.worlds.get(name.toLowerCase(Locale.ENGLISH));
Where is the world created if its not cached?

vast sapphire
# stone sinew yes

one more question, do I put this also where I want to define the location? I did that and it only spawns items 1 gen at a time.

#
                                        hash.entrySet().forEach(entry -> {
                                            String s = entry.getKey();
                                            Location l = entry.getValue();
                                            getConfig().set(s, l);
                                        });```
stone sinew
stone sinew
vast sapphire
#

alright, config still looking like this ```yaml
locations: {}

stone sinew
vast sapphire
#

I did here java ConfigurationSection cs = getConfig().getConfigurationSection("locations");

stone sinew
#
public void onDisable() {
    hash.entrySet().forEach(entry -> {
        String s = entry.getKey();
        Location l = entry.getValue();
        getConfig().set("locations."+s, locationToString(l));
    });
    saveConfig();
}
quasi stratus
#
                TextComponent user_agreement = new TextComponent(ChatColor.translateAlternateColorCodes('&', "&r     &e* &bUser Agreement"));
                user_agreement.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://bit.ly/halara-rules"));
                user_agreement.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click to view the User Agreement.")));
``` I apologize in advance I'm very new to this but I have no idea what i'm doing wrong here. No errors and the text simply does not appear in chat.
quasi stratus
#

I didnt send it to the user did i

stone sinew
#

Sending the message etc...

quasi stratus
#

I sure did apologize in advance lol thank you that solved it

stone sinew
#

👍

native nexus
#

Are you trying to create a world?

quaint mantle
stone sinew
ivory sleet
#

WordCreator

hasty prawn
#

As yes, love the WordCreator class NODDERS

stone sinew
stone sinew
# ivory sleet WordCreator

Yeah I checked there but as I look through Bukkit.getWorld() it only calls what I show in that message...
Bukkit.getWorld(String) -> server.getWorld(String) -> (World)this.worlds.get(name.toLowerCase(Locale.ENGLISH));

ivory sleet
#

Yea

#

It’s a query method

#

Not a command method

stone sinew
#

So where does it get called from??? thats what I am looking for lol

ivory sleet
#

it?

stone sinew
#

sigh If I run Bukkit.getWorld(String) it runs return server.getWorld(String) and that returns return (World)this.worlds.get(name.toLowerCase(Locale.ENGLISH)); but no where through these methods is WorldCreator called

ivory sleet
#

No

#

It’s a getter

#

Not a loader

#

Not a command method

#

Not a creator

#

It is just querying the map

#

WorldCreator has the logic of adding stuff to the map

#

A function should only do one thing

peak depot
#

whats the problem

stone sinew
#

Ok.................................. IDK how else to explain the question...

If I run Bukkit.getWorld(String) where in the fuck is it calling WorldCreator because thats what I want to access to see if I can tell it not to send the world creation messages.

ivory sleet
#

It’s not calling WorldCreator

stone sinew
#

Exactly!

ivory sleet
#

That’s done somewhere completely else

stone sinew
ivory sleet
#

Because that’s not what it’s meant for

#

Jfc

stone sinew
#

So fucking where is it being ran!

ivory sleet
#

During the bootstrap process?

stone sinew
#

Is it accessible via the api or would I have to find my own way?

stone sinew
ivory sleet
#

Wym by accessible? There’s a maximum of three worlds that loads everytime the server bootstraps which is the default ones. iirc they’re loaded in CraftServer or if it was MinecraftServer or one of its derivatives. I don’t know where exactly because it goes extremely deep down. However the worlds are loaded at the time your JavaPlugin::onEnable is invoked if that’s what you mean by accessible.

stone sinew
#

I load a world via Bukkit.getWorld(String) that causes the console to output the world settings... I don't want the world settings to show in console

peak depot
#

like for what you need to even do this

stone sinew
peak depot
#

no like whats the pupurpose

ivory sleet
#

What’s the map implementation of that Map<String,World> worlds field

stone sinew
native nexus
#

You could try log4j filter

ivory sleet
#

Oh at the start

quaint mantle
ivory sleet
#

That’s not the implementation

#

That’s the field

#

Anyways imaginedev probably got your answer

stone sinew
#

Not seeing any paths relevant to logged world settings

quaint mantle
#

i think its like debug-log: false

ivory sleet
#

Is the server version the same as you compile against

vast sapphire
#

@stone sinew when you're not busy, I am still in need of help here, I don't know how to save the locations to the config and the config only contains locations: {} https://paste.md-5.net/nivebasawa.java
Thanks for all of your help so far though.

stone sinew
vast sapphire
#

to stop a nullpointerexception

ivory sleet
#

It doesn’t stop it

stone sinew
#

^^^

ivory sleet
#

It just re throws it actually despite the name

stone sinew
#

And since you are looping through the entry set it wouldn't be null unless you somehow added a null

quaint mantle
#

nullableValue;

if nullableValue == null: throw NPE

vast sapphire
#

ok

stone sinew
#

Also you are saving the config loading the hashmap then saving again, then loading the config....

#

And you are always copying defaults in your loadConfig

stone sinew
vast sapphire
stone sinew
vast sapphire
#

ok

stone sinew
#
public void onEnable() {
    ConfigurationSection cs = getConfig().getConfigurationSection("locations");
    cs.getKeys(false).forEach(path -> hash.put(path, stringToLocation(cs.getString(path))));
}

public void onDisable() {
    hash.entrySet().forEach(entry -> getConfig().set("locations."+entry.getKey(), locationToString(entry.getValue())));
    saveConfig();
}
#

I edited my message. You don't use "locations." in cs.getString() because its already in the configurationsection

vast sapphire
#

nothing is going into the config now

vast sapphire
stone sinew
stone sinew
#

You are still copying defaults and then saving the config... you need to check if they are set already

native nexus
#

You just need to do saveDefaultConfig(); before you load anything.

vast sapphire
#

I did that

vast sapphire
hasty prawn
#

So I'm having a really weird issue with a resource pack. I'm generating all the JSON files and such in code for the pack, and then zipping it and it can be immediately applied, or atleast in concept.

Although something seems to go really wrong when I zip it. It just will not apply the textures properly right out of the box. If I unzip the generated zip, everything works flawlessly, and if I re-zip the folder using just the standard Windows Send To ->, it still works.

I also know that Minecraft is able to atleast open the generated zip file, since it can still apply it, and the pack.png is properly set.

The zipped file sizes between the Generated and Windows are different too, with the only difference being that one of the JSON files is slightly larger in the Windows zipped folder.

This is how I'm zipping the resources https://paste.md-5.net/cugiduxava.java

vast sapphire
native nexus
#

Is your map empty...?

#

Once you save it?

#

locations: {} normally means that yaml is aware that is is a collection of some sort.

timber whale
#

How do i check if a player has armor on

quaint mantle
#

how can I replace an object with another one for a few seconds when clicked in the GUI?

native nexus
#

Does anyone recommend using Guava Cache or is it quite hefty for Minecraft Servers?

#

I would rather have a simple library or class that can handle cache efficiently.

lost matrix
native nexus
#

Yeah just whenever I want to access my cache I was entries that are older than 5 minutes to be cleared.

lost matrix
native nexus
#

Yeah I am doing pagination for an inventory.

#

What would you recommend normal periods to be?

lost matrix
#

Depends a bit on the data you want to cache and how high your request frequency is. But for offline player data i would go for at least 45 - 60m

#

Usually you want to keep most of your data in your cache. Only really old data that doesnt get accessed anymore should be kept out of it.
Even if you keep data of 10k users in cache, its size probably wont exceed 50 - 100MB. And who hasnt that much memory to spare.

lost matrix
lost matrix
earnest spear
#

help me

#

plz

#

:<

lost matrix
#

Re-install mcdev

earnest spear
#

I have did the following things :-

  1. Restarted intellij
  2. reinstalled intellij and all plugins
  3. Restarted my pc
    nothing helps :<
#

am gonna die fixing it

#

help save my life

lost matrix
lost matrix
#

idk. Some firewall.

earnest spear
#

McAfee

#

I have the McAfee firewall

lost matrix
#

Disable your firewalls for a min and then re-try

earnest spear
#

ok

lost matrix
earnest spear
#

It didnt work

#

still the same error

lost matrix
#

Try getting us the error. There must be a log somewhere.

earnest spear
lost matrix
earnest spear
#

no

lost matrix
earnest spear
lost matrix
# earnest spear

Do you have a project named Heart2 ?
Because this one causes a ton of errors.

lost matrix
quaint mantle
#

Umm the website is not working properly, I just posted an update for my plugin and its not showing it and when I download its downloading older version.

quaint mantle
lost matrix
quaint mantle
rustic gale
#
    @Override
    public void onEnable() {
        new BukkitRunnable() {
           @Override
           public void run() {
                for (Player player : Bukkit.getOnlinePlayers()){
                    LOG.info(player.getName());
                }
            }
        }.runTaskTimer(this, 0L, 20L);
      }
  }

Why doesn't this runnable run? (i feel theres a super stupid mistake, I barely understand runnables)

#

Also this runnable is in my main classs

vague oracle
#

Try waiting 1 tick

paper geyser
#

whats an efficient way of checking when a player enters an area? I've thought of like on move, check if they're in an area but theres probably more efficient ways right?

lost matrix
lost matrix
rustic gale
#

and i think i properly exported it

#

I just Built the artifact

#

in intillej

lost matrix
#

/pl

rustic gale
#

alr i will try the second my server restarts

#

yeah my plugin is there

#

oh wait im so stupid

lost matrix
#

plugin.yml?

rustic gale
#

i was doing this thru the console

#

so no players were online

lost matrix
#

...

rustic gale
#

welp

#

uh

#

sorry

#

alr yeah it works

#

interestly though it didn't work if there wasn't the 1 tick delay

#

ty for the help

fluid cypress
#

is there any extension/plugin or something for itellij that do stuff about minecraft plugins? for example, telling me when im not declaring a command in plugin.yml, with code snipets of api things, like a class that implements CommandExecutor or some other interface, or to be able create the "a minecraft project" with spigot/paper as dependency, and the package and the main class created already created? extending from JavaPlugin and all that stuff

#

and another thing that idr if i already asked, I guess i did but idk, do i really, even today, 2021, have to restart the server every time i make a minor change to a plugin? or is there a way i can my a plugin "reload safe"?

#

i mean, i know that using /reload in "production" is bad, but when developing too? do you all restart your servers bc of a typo in a string?

eternal oxide
#

yes

fluid cypress
#

what about the extension/plugin for intellij

eternal oxide
#

There is an extension to help creating plugins, but I'd never recommend it.

#

Learning how to do things yourself improves your skills.

fluid cypress
#

dont you use any extension? or did you create your own snippets or something

eternal oxide
#

and once you have learnt it take but a couple of minutes to throw a basic plugin framework together

#

I use Eclipse. No extensions nor code suggestions.

native nexus
#

@fluid cypress Yes there is I am using it right now

fluid cypress
#

how is it called

lost matrix
#

minecraft dev plugin

native nexus
#

You can search for the plugin in IntelliJ

lost matrix
#

But what you described sounds more like you want to write a custom sonar rule checker for yourself.
Regarding the restarts: You can set up your dev environment allowing hot swapping. So making minor changes will be seen live without reloads needed.

fluid cypress
#

im using it, and since i installed it, it no longer tells me that the plugin class is not being used or that event listener methods are never called, which is good, but it does nothing about undeclared commands in plugin.yml. it wouldnt be too do that, and i would avoid having to use Objects.requireNonNull and some server restarts

lost matrix
#

The mc dev plugin mainly helps you set up a project with all dependencies and a plugin.yml including a main class which extends JavaPlugin already.

fluid cypress
fluid cypress
#

you mean using a config or something

quaint mantle
#

how do I check if the inventory is full?

lost matrix
quaint mantle
#

@lost matrix

#

how do I check if the inventory is full?

lost matrix
quaint mantle
#

yes

fluid cypress
quaint mantle
#

I need to place an item in the inventory and if there is no space in the inventory, do not place it. if there is the same item in the inventory, put

fluid cypress
#

using the debugger, right?

lost matrix
lost matrix
quaint mantle
#

no

lost matrix
# quaint mantle no

Then there are 2 approaches:
Lazy but more expensive: Clone the inventory and check if it overflows when you add an ItemStack
Labour intensive, complicated and error prone but possibly cheaper: Write your own method that iterates over the entire Inventory and keeps track of how much you could theoretically fit into the inventory.

quaint mantle
#

на русском пиши)

lost matrix
quaint mantle
#

Why no

eternal oxide
#

Inventory#addItem returns a Map of anything that won;t fit.

quaint mantle
#

Ah ya

#

You can

lost matrix
#
  1. It might just contain a slot that is null
  2. There could be a stack of that type which could still fit the items he is about to add
shut plaza
#
main: com.minco.plugin.mplg.Main
name: MyPlugin
version: 1.0
author: me
description: "An Example plugin"
commands:
    ping:
        description: "Ping Pong"

Why not working? (1.17.1)

quaint mantle
#

L

lost matrix
eternal oxide
#

doe he need to revert?

lost matrix
eternal oxide
#

ah

lost matrix
#

Honestly there should be a method for that in Inventory like Inventory#canFit(ItemStack...)

eternal oxide
#

I'd probably go with the addItem (one stack at a time). If they don;t fit, take the returned from what you wanted to add, then remove what was added.

lost matrix
eternal oxide
#

probably easier than checking for space

quaint mantle
lost matrix
#

I would just clone the inventory, add the items and see if there is overflow. Then return true or false.
Thats the lazy way of checking if an Inventory can fit certain items.

quaint mantle
#

I'm using that

quaint mantle
eternal oxide
#

I guess, so long as you are not doing it often

quaint mantle
lost matrix
quaint mantle
#

No, he can delete dropItemNat ..

quaint mantle
#

Just for

quaint mantle
#

сказать, что именно нужно

#

Text

lost matrix
#

Then you dont need to drop them in the first place lol

lost matrix
quaint mantle
#

I have all the resources placed in the chest, if there is no place there, they are thrown next to the entity

quaint mantle
#

I showed him just a for

#

that is, how to get those elements that did not fit into the inventory

#

I need to check if there is no space in the inventory but there is the same item that I want to add, add it. if there is no such item and the inventory is full, do nothing

#

Мне нужно проверить, нет ли места в инвентаре, но есть тот же товар, который я хочу добавить, добавьте его. если такого товара нет и инвентарь заполнен, ничего не предпринимайте

#

Inside my for , just set item.remove();

shut plaza
#
[15:44:04 ERROR]: Error occurred while enabling MyPlugin v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.minco.plugin.mplg.Main.getCommand(String)" is null
    at com.minco.plugin.mplg.Main.onEnable(Main.java:7) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugin(CraftServer.java:511) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.enablePlugins(CraftServer.java:425) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.reload(CraftServer.java:893) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.Bukkit.reload(Bukkit.java:675) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:776) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchServerCommand(CraftServer.java:761) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at net.minecraft.server.dedicated.DedicatedServer.handleCommandQueue(DedicatedServer.java:475) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:439) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1217) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1050) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[spigot-1.17.1.jar:3219-Spigot-b166a49-8c6d60c]
    at java.lang.Thread.run(Thread.java:831) [?:?]

```\
quaint mantle
#

Read error

#

Read reason

shut plaza
#

what

quaint mantle
shut plaza
#
getCommand("ping").setExecutor(new PingExecutor());
#

any problem?

quaint mantle
#

Command registered in plugin.yml?

shut plaza
#
main: com.minco.plugin.mplg.Main
name: MyPlugin
version: 1.0
author: me
description: "An Example plugin"
commands:
    ping:
        description: "Ping Pong"
#

v1.17.1

lost matrix
quaint mantle
#

if plugin.yml had not been exported, there would have been another error

lost matrix
quaint mantle
quaint mantle
#

@lost matrix

#

how to do it?

#

Learn java

lost matrix
# quaint mantle how to do it?

You need to write a method for that. Its a bit complicated, logic wise. Give it a try and if you dont figure it out ill provide you with some help.

quaint mantle
#

He doesn't know java

lost matrix
quaint mantle
#

I said

lost matrix
quaint mantle
#

¯\_(ツ)_/¯

shut plaza
# lost matrix Hm. Show your class pls.
// Main.java
package com.minco.plugin.mplg;

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {
    public void onEnable() {
        getCommand("ping").setExecutor(new PingExecutor());
    }
}
// PingExecutor.java
package com.minco.plugin.mplg;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class PingExecutor implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        sender.sendMessage("Pong!");
        return true;
    }

}

vagrant galleon
#

Can I add second permission?

lost matrix
shut plaza
#

and what's the problem?

quaint mantle
lost matrix
lost matrix
quaint mantle
#

I started writing plugins for Minecraft with Visual Bukkit

#

¯\_(ツ)_/¯

lost matrix
quaint mantle
#

so I don't think that this is garbage, for beginners it will go just right

quaint mantle
#

✌️

lost matrix
# shut plaza and what's the problem?

Compile again and make sure that your newest plugin version is in the plugins folder. Then open the jar and look inside the plugin.yml to make sure the command is actually in there.

shut plaza
lost matrix
quaint mantle
#

IntelliJ ❤️

vague oracle
#

Is there a way to disable advancements for only specific players? The only event i can find for 1.17 isn't cancel-able.

quaint mantle
#

@lost matrix

lost matrix
quaint mantle
#

¯\_(ツ)_/¯

#

how to do it?

#

L

#

R

#

where to find the item names for different color wool in 1.8

lost matrix
quaint mantle
#

the nbames from 1.17 no work

lost matrix
quaint mantle
#

-_-

#

@lost matrix, how to do it?

#

🤣

#

Learn java

#

That's your answer

#

причем тут джава?

#

no china

#

engish ony

#

It's russian

lost matrix
quaint mantle
#

same thing\

#

Russian)

#

Ж

#

руський

#

what letter comes after i

#

tell

lost matrix
# quaint mantle <@!220605553368498176>, how to do it?

Ive given you all the infos you need.
You need to iterate over the inventories content and count up the amount of items you can fit in there by
either checking if the slot is null or if the ItemStack isSimilar and still has space.

lost matrix
lost matrix
quaint mantle
#

y

quaint mantle
#

Idiot

#

i farted

#

Ahhaha

#

pihui

lost matrix
quaint mantle
#

Very very fun...

#

Yiuf arted..

#

Clown

quaint mantle
lost matrix
# quaint mantle <@!220605553368498176>, how to do it?

You wont get more than this:

  public static boolean canFit(final Inventory inventory, final ItemStack itemStack) {
    final int amountToAdd = itemStack.getAmount();
    final int spaceForItem = 0;
    final int maxStackSize = itemStack.getType().getMaxStackSize();

    for (ItemStack slotItem : inventory) {
      
    }

    return false;
  }
quaint mantle
#

🤦

#

ya dolboeb

#

Of course

lost matrix
# quaint mantle can I have a little more?)

Nope.
Check if the slot item is null or air -> then add the maxStackSize to spaceForItem
else -> Check if slotItem is similar to itemStack -> then add the (maxStackSize - slotItem.getAmount()) to spaceForItem
Return true if spaceForItem is bigger than amountToAdd

quaint mantle
#

okay

#

@quaint mantle, ti gei

#

I ya

#

Guys help

#

Go ebatca?

quaint mantle
#

how to use

#

dyeColor

#

it no work

#
.setData(DyeColor.RED);
#

no work

lost matrix
quaint mantle
#

1.8

lost matrix
# quaint mantle 1.8

Then search for ancient forum posts. This version is no longer supported since 2015 or so.

quaint mantle
#

i havew

#

but the person i make it for dont wnana be nice

#

they want 1.8

#

and it annoy me

#

bcuz i never done 1,8

#

b4

lost matrix
#

-> old forum posts

quaint mantle
#

j

#

u

#

st

#

gheklo

#

i havbe looked at fucking forum posts

#

it not fucking work

#

yall useless

lost matrix
quaint mantle
#

no

#

ur useless

tawdry cedar
#

Wait what you trying to do?

quaint mantle
#

useless definition

#

not fulfilling or not expected to achieve the intended purpose or desired outcome.

#

that u

quaint mantle
#

not work

tawdry cedar
#

To what though?

eternal oxide
#

DyeColor.RED.getData()

lost matrix
quaint mantle
#

still not work

eternal oxide
#

Go away then

quaint mantle
#

no

#

literally useless

tawdry cedar
#

What are you trying to set as Red?

#

An item stack?

quaint mantle
#

yea

#

wool

tawdry cedar
#

Send your code

#

Ok

quaint mantle
#

dont wannt to

#

i just use fucking glass panes instead

lost matrix
quaint mantle
#

u ugly

lost matrix
quaint mantle
#

bs

#

rlly

eternal oxide
#

dude learn some manners

lost matrix
quaint mantle
#

to lazy

tawdry cedar
lost matrix
quaint mantle
#

;p

tawdry cedar
#

And that will give you one red wool

quaint mantle
#

Ok

tawdry cedar
#

1 = amount
14 = Item data (so what makes it red)

quaint mantle
#

okk

crude charm
#

?learnjava

undone axleBOT
quaint mantle
#

r u fucking serious

#

i know fucking java

#

i jkust didnt know how to set the fucking wool color in 1.8

#

fuck sake

eternal oxide
#

seems not

quaint mantle
#

setting a fucking wool color

crude charm
#

^

quaint mantle
#

and fuckign knowing the languahe

eternal oxide
#

very simple task

quaint mantle
#

is 2 fucking different fuckiugn things

#

in 1.8

tawdry cedar
#

I mean the API has changed massively since 1.8 lol

quaint mantle
#

its fucjkign a pain

#

in the fucvking ass

eternal oxide
#

No, its just knowing what you are doing

quaint mantle
#

o my fucjking god

#

ok u fucjking do it then

#

go on

eternal oxide
#

and google shows you everything you need to know

crude charm
#

Middle clicking is a feature of the ide IntelliJ

eternal oxide
#

I have done it

#

many times

quaint mantle
#

just shut the fuck up

#

i asked a fucking question

eternal oxide
#

Why?

quaint mantle
#

never asked u to fuckign speak

#

thjatds fuckign why

crude charm
#

?learnmanners

quaint mantle
#

no

eternal oxide
#

I never asked you either.

quaint mantle
#

i did

eternal oxide
#

ah, so you are allowed to speak and I'm not

#

Seems fair

quaint mantle
#

i jsut asked a fduckign question]

eternal oxide
#

Two people here have already told you how to create colored wool in 1.8. You seems to not want to listen

quaint mantle
#

not a fuckign invitation for u to fucking piss me off

tawdry cedar
#

And you got an answer?

lost matrix
quaint mantle
#

shuit

#

the

#

fucjk

#

up

eternal oxide
#

what a rebel

crude charm
#

wrong gif lol

#

but that one works

quaint mantle
#

stop being a useless fuck omfg

crude charm
eternal oxide
#

You have your answer. Your question has been resolved.

quaint mantle
#

ok then why are u still tyalking abt it

eternal oxide
#

It seems you want something

lost matrix
quaint mantle
#

stopfcuucking pinging me

#

omfg

eternal oxide
#

lol

#

bust that vein

lost matrix
torn shuttle
#

so uh I got scammed by the bossbar#setVisible(false) method, is it broken or does it work in a way that I am not seeing?

quaint mantle
#

@lost matrix

#

@lost matrix

#

@lost matrix v

#

v

#

v@lost matrix @lost matrix

#

@lost matrix

#

@lost matrix

#

v

#

v

lost matrix
quaint mantle
#

v@lost matrix

#

v

#

v

#

@lost matrix @lost matrix @lost matrix

lost matrix
torn shuttle
#

hm

#

let me check

lost matrix
#

No idea.

tawdry cedar
#

I think you just have to remove people from the bossbar

#

Not entirely sure though

#

But try that I guess

torn shuttle
#

seems like this specific test environment is on paper 100 for 1.17.1 for whatever reason

#

I can test on vanilla spigot in a second if that changes anything

lost matrix
#

But setting it invisible should work. Thats expected behavior.

torn shuttle
#

setting players won't work for me because that's dynamic and I really don't want to keep a task up just for this

#

man what am I typing today

lost matrix
#

Did you test the visibility in a discrete invironment?

torn shuttle
#

wdym

#

you think it might be plugin interference?

fluid cypress
#

this is executing the else part, even when passable blocks is clearly greater than 2, and safeBlocks definitely contains END_STONE at the index 20

lost matrix
# torn shuttle wdym

Ill test it for you real quick

  private BossBar bossBar;

  @Override
  public void onEnable() {
    this.bossBar = Bukkit.createBossBar("§cTest", BarColor.BLUE, BarStyle.SEGMENTED_10);
    Bukkit.getScheduler().runTaskTimer(this, () -> this.bossBar.setVisible(!this.bossBar.isVisible()), 10, 10);
    Bukkit.getPluginManager().registerEvents(this, this);
  }

  @EventHandler
  public void onJoin(final PlayerJoinEvent event) {
    this.bossBar.addPlayer(event.getPlayer());
  }
fluid cypress
#

block.getType() should return END_STONE

#

so, what is happening? i cant see it

torn shuttle
lost matrix
torn shuttle
#

it's failing to hide even on the first tick

lost matrix
torn shuttle
#

can you try to do that specifically for the dragon

#

yeah confirmed

#

works for my custom boss bar

#

but not the dragon

#

well this is fun

tawdry cedar
#

Then you’re properly just gonna have to remove the player and add them back again :/

lost matrix
#

Then the active boss fight prevents the hiding of the bar

torn shuttle
#

so what, remove everyone on every tick?

wispy monolith
#

How do I check for an item by another plugin?

tawdry cedar
wispy monolith
#

I wanna make an if statement for an item not in my plugin

#

How?

lost matrix
wispy monolith
#

Can I do it or not?

tawdry cedar
tawdry cedar
fluid cypress
wispy monolith
tawdry cedar
tawdry cedar
lost matrix
wispy monolith
tawdry cedar
#

Send a link to their spigot page

lost matrix
#

so

if() {

} else {

}
tawdry cedar
#

Also are you using maven @wispy monolith

wispy monolith
tawdry cedar
#

See if they have a maven repo and add the KitPvP plugin as a dependency

fluid cypress
#

its not printing it when it should, does it have a delay of a couple of frames or something like that?

#

i dont know whats happening, the thing i see in the console is totally different from the debugger

#

like, the debugger says passableBlocks is 12, but the console says its 8, and its still failing the condition

#

ill do the bracket thing

torn shuttle
#

I can't even make the boss bar invisible when the boss dies, sadface

fluid cypress
#

println should be instantaneous or not?

lost matrix
torn shuttle
#

even #removeAll() isn't working, this is really annoying

fluid cypress
#

wtf is wrong with this thing

torn shuttle
#

especially since if you #remove a dragon the boss bar just stays up

#

very cool

lost matrix
# fluid cypress wtf is wrong with this thing

The only reason why the conditional statement could be false is if the collection you call contains() on doesnt have the Material in it. (If we can believe the debugger)
Did you check what type is actually produced by block.getType() ?

#

Oh yeah you did. Its END_STONE

fluid cypress
#

it was endstone on the first screenshot i send

#

now it could be anything

lost matrix
#

Just dig the player a hole to make some space XD

fluid cypress
#

also i click the build project button, besides the package script from maven, just in case idk

torn oyster
#

On the bungeecord PluginMessageEvent, how do I get the serverinfo of the server that sent the plugin message?

lost matrix
#

?jd

torn oyster
#

is it e.getSender()

#

or whatever

#

cuz thats a connection

lost matrix
torn oyster
#

it returns a Connection

lost matrix
torn oyster
#

oh lol

fluid cypress
lost matrix
#

From there just use Server#getInfo()

lost matrix
lost matrix
rigid otter
#

Hello! How can I get face of a sign? Face that contains text

lost matrix
lost matrix
#

Be careful there are 2 Sign classes. You need org.bukkit.block.data.Sign

rigid otter
#

Ok thank you!

#

What about getting block which is wall sign attached to?

lost matrix
rigid otter
#

Ohh thanks!

eternal oxide
#

You could just check if BlockData is Attachable, then getAttached

#

oh I guess not

#

Sorry thats for trip wires and things

quaint mantle
#

@lost matrix

#

it didn't work out

lost matrix
quaint mantle
#

throw it off?

#

public boolean isFullPlayerInventory(Player player) {
for (int i = 0; i < player.getInventory().getSizeInventory(); ++i) {
ItemStack slot = player.inventory.getStackInSlot(i);
if (slot == null) return false;
}
return true;

#

|

#

|

#

|

#

public static void check(Player player) {
boolean isEmpty = true;
for (ItemStack item : player.getInventory().getContents()) {
if(item != null) {
isEmpty = false;
break;
}
}
if(isEmpty) {
//code
} else {
sender.sendMessage("Please clear your inventory first.");
}
}

lost matrix
# quaint mantle public boolean isFullPlayerInventory(Player player) { for (int i = 0; i ...

Nope. Not even close.
Start from here:

  public static boolean canFit(Inventory inventory, ItemStack itemStack) {
    int amountToAdd = itemStack.getAmount();
    int spaceForItem = 0;
    int maxStackSize = itemStack.getType().getMaxStackSize();

    for (ItemStack slotItem : inventory) {
      
    }

    return false;
  }

Then follow this:

Check if the slot item is null or air -> then add the maxStackSize to spaceForItem
else -> Check if slotItem is similar to itemStack -> then add the (maxStackSize - slotItem.getAmount()) to spaceForItem
Return true if spaceForItem is bigger than amountToAdd

quaint mantle
#

Okay, I'll try

torn shuttle
#

huh I just realized that the top google result for my issue is a post I made in 2018 covering what I just recreated now

#

completely forgot i did that

vague oracle
#

Why do you want to check if its full? Do you not want to add some items and leave the rest?

lost matrix
tidal skiff
#

how do i use e.disallow() with AsyncPlayerPreLoginEvent? im tryna make it so it kicks them but idk what it means by 'Result' and then string

#

the result part

#

ik what the string is

vague oracle
#

You are just setting the result reason, either whitelsit, ban, full and so on

tidal skiff
#

yep

#

alr so do i just put 'kick'

vague oracle
#

Put what ever you want it to be

tidal skiff
#

im still confused what it wants

#

does it want a string?

#

what is a Result

vague oracle
#

(AsyncPlayerPreLoginEvent.Result, String)

#

an enum

tidal skiff
#

its so useless

#

i still have no idea what to do

vague oracle
#

Its not hard

#

event.disallow(AsyncPlayerPreLoginEvent.Result.KICK, "Kicked")

tidal skiff
#

oh

#

it just said blahblah.Result, String idk what it wanted me to do

#

ty

vague oracle
#

Its says AsyncPlayerPreLoginEvent.Result because its an inner enum inside the AsyncPlayerPreLoginEvent class.

fluid cypress
#
System.out.println("safeBlocks.contains(Material.NETHERRACK): " + safeBlocks.contains(Material.NETHERRACK));
System.out.println(safeBlocks);
[06:06:03] [Server thread/INFO]: safeBlocks.contains(Material.NETHERRACK): false
[06:06:03] [Server thread/INFO]: [GRASS_BLOCK, COARSE_DIRT, PODZOL, SAND, RED_SAND, TERRACOTTA, SNOW, SNOW_BLOCK, PACKED_ICE, ICE, NETHERRACK, GRAVEL, SOUL_SAND, SOUL_SOIL, CRIMSON_NYLIUM, WARPED_NYLIUM, BLACKSTONE, BASALT, NETHER_QUARTZ_ORE, NETHER_GOLD_ORE, END_STONE]

it makes no sense

eternal oxide
lost matrix
eternal oxide
#

if using strings

quaint mantle
#

@lost matrix

#

public static boolean canFit(Inventory inventory, ItemStack itemStack) {
int amountToAdd = itemStack.getAmount();
int spaceForItem = 0;
int maxStackSize = itemStack.getType().getMaxStackSize();

    for (ItemStack slotItem : inventory) {
        
        if(itemStack == null || itemStack.getType() == Material.AIR);
        
      
    }

    return false;
  }
}
fluid cypress
quaint mantle
#

2 and 3 did not understand

lost matrix
fluid cypress
#

List

lost matrix
torn oyster
#

how do i make a getter using plugin messaging

#

like how do i do like

fluid cypress
#

the only thing i can think of is, im getting the list, and im using the contains method later, but if that was the problem, the thing printed in the console should be empty or different

torn oyster
#

getServerCount(server)

lost matrix
#

Super weird that this doesnt work. But try an EnumSet

fluid cypress
torn oyster
#

and make it return an int

fluid cypress
#

is there something wrong with lists?

lost matrix
lost matrix
torn oyster
#

how do i make a getter using plugin messaging
like how do i do like
getServerCount(server)
and make it return an int

lost matrix
#

Set yields a better performance and EnumSet even more so.

fluid cypress
#

ok, ill do that

#

but

#

this cant be happening

#

unless java is broken

#

Lists are from java, i mean, its not even my own collection class or something

lost matrix
fluid cypress
#

i use openjdk

lost matrix
#

Then there should be no problem.

lost matrix
#

You need to listen for +send a message

torn oyster
#

no like

#

i have a send

#

and a receive

#

how do i do like

#
public int getMinigamePlayersLeft(server) {
    return blahblah;
}```
lost matrix
torn oyster
#

then

#

how

#

how would i do this most efficiently

lost matrix
#
public void acceptMinigamePlayersLeft(Server server, IntConsumer consumer) {
  
}
#

delegate the function via a consumer

torn oyster
#
    public void findGame(ProxiedPlayer p, String minigame) {
        p.sendMessage(ChatColor.GREEN + "Server found!");
        
        List<ServerInfo> waitingServers = new ArrayList<>();
        for (ServerInfo info : foundServers.get(p)) {
            if (getMinigameState(info, not a real method yet).equalsIgnoreCase("PRE_GAME")) {
                waitingServers.add(info);
            }
        }
    
        matchmaking.remove(p);
        foundServers.remove(p);
    }```
#

how

#

idk

lost matrix
fluid cypress
#

how do i create an enumset?? i get 'EnumSet' is abstract; cannot be instantiated

EnumSet<Material> test = new EnumSet<>();

i dont remember too much about abstract classes

torn oyster
#

both

lost matrix
torn oyster
#

im trying to make a matchmaking thing

#

minigames

lost matrix
lost matrix
# torn oyster im trying to make a matchmaking thing

The proxy should hold game instances which the servers can register. Then the servers can send users to those game instances. When the queue us full, the proxy sends all players to the right server instance and starts the game.

tight sluice
#

hey guys ehh I'm fairly new to making plugins and I'm having trouble with dealing with packets
I'm trying to set the items in a inventory created with packets with the help of protocollib
but I can't seem to find a way to set a specific slot in that inventory to an item

lost matrix
#

The actual implementation strongly depends on your game setup and can get quite complicated fast. Be sure you know how to properly handle async requests and know
how to forward methods using Consumer<>

native nexus
lost matrix
tight sluice
tight sluice
lost matrix
#

The only reason why you would want packet based ItemStacks is so multiple people see the same ItemStack differently.

lost matrix
native nexus
#

The biggest purpose of ProtocolLib is for a player to see what other players don't see

tight sluice
#

I still kinda want to know how what I wanna done should be done even if I don't really need it now...

#

I kinda figured out that I'd just need to do this

        PacketContainer pc = main.pm.createPacket(PacketType.Play.Server.WINDOW_ITEMS);
        pc.getIntegers().write(0,1);
        List<ItemStack> l = new ArrayList<ItemStack>(0);
        l.add(new ItemStack(Material.GLASS_PANE, 1));
        pc.getItemListModifier().write(0, l);

for adding items

lost matrix
torn oyster
#

it works

tight sluice
#

but that only add items like uhh in order I guess?

native nexus
#

@lost matrix Have you worked with MongoDB much? If so would you recommend the POJO approach or just plain old documents?

tight sluice
quaint mantle
#

@lost matrix

tight sluice
#

having the first 2 itemstack in the list set to null just kicks the client

reef wind
#

Pojo is great.

lost matrix
tight sluice
#

and setting it to air removes the first 2 items

quaint mantle
#

@reef wind

reef wind
torn oyster
#

hey prouddesk

reef wind
#

I won’t help you again, last time was a pain and you didn’t even listen. @quaint mantle

torn oyster
#

me?

#

oh

#

lol

lost matrix
reef wind
native nexus
#

Yeah for sure, I have a soft spot for NoSQL databases

lost matrix
tight sluice
torn oyster
#

do you know how to make a method that gets a plugin message value
like if i made a custom plugin message thingy that gets a value from a server and returns it instantly
for example
i have a value which is 7 on my spigot pluign
i want to be able to do like getValue(Server) on my bungee plugin and instantly get the int using plugin messaging
is this possible? if so, how can i do it

tight sluice
#

do I have to resent the whole inventory if I just wanna change say the 3rd item?

quaint mantle
#

@reef wind

lost matrix
torn oyster
#

how do i make a way around it

lost matrix
tight sluice
#

cause the packet works with like only 1 item on the list

quaint mantle
#

it didn't work

lost matrix
reef wind
#

@ivory sleet would you kindly kick @quaint mantle ? He keeps pinging people and when you try to help he doesn’t even listen.

quaint mantle
#

public class ExperienceUtil {
public static void setTotalExperience(final Player player, final int exp) {
if (exp < 0) {
throw new IllegalArgumentException("Experience is negative!");
}
player.setExp(0);
player.setLevel(0);
player.setTotalExperience(0);

    int amount = exp;
    while (amount > 0) {
        final int expToLevel = getExpAtLevel(player);
        amount -= expToLevel;
        if (amount >= 0) {
            player.giveExp(expToLevel);
        } else {
            amount += expToLevel;
            player.giveExp(amount);
            amount = 0;
        }
    }
}

private static int getExpAtLevel(final Player player) {
    return getExpAtLevel(player.getLevel());
}

public static int getExpAtLevel(final int level) {
    if (level <= 15) {
        return (2 * level) + 7;
    }
    if ((level >= 16) && (level <= 30)) {
        return (5 * level) - 38;
    }
    return (9 * level) - 158;

}
tight sluice
reef wind
#

I don’t even know what you are trying to do. Stop pinging me, I am not helping you again.

reef wind
quaint mantle
#

I read that it was impossible to take away the experience from the players there

lost matrix
quaint mantle
#

set Total Experience does not work

#

@lost matrix

lost matrix
reef wind
#

@quaint mantle let me ask you a serious question. Are you five years old or do you just have the IQ of one? I have told you multiple times what to do and you won’t listen. Stop pinging people because you are a pain to deal with.

quaint mantle
#

😋

#

I was listening

#

kozel, pomogi

#

pidor

#

L

#

sam

#

zaebalca iskat

reef wind
#

you were not, I told you what too use.

quaint mantle
#

engl

fluid cypress
#

how do i clone the keyset of a map?

quaint mantle
#

setTotalExperience?

quaint mantle
lost matrix
quaint mantle
#

vb pomoika

#

polubomy

#

pryam kak tvoya mama

#

(

lost matrix
quaint mantle
#

poidy vskroyus

#

Don't get into the JAVA business without knowing JAVA

#

ya dlya sebya plugin delayu

lusty cipher
#

english might help too xd

tight sluice
#

is there any more efficient ways to go about creating an inventory that looks like https://imgur.com/a/qrGugId ?

        for(int i = 0;i<54;i++)
            if(i<9||i>44||i%9==8||i%9==0)
                daList.add(new ItemStack(Material.GRAY_STAINED_GLASS_PANE,1));
            else
                daList.add(new ItemStack(Material.AIR));
ivory sleet
#

?kick @quaint mantle English thanks

undone axleBOT
#

Done. That felt good.

fluid cypress
lost matrix
fluid cypress
#

omg i literally hate java, its so unconsistent

#

the clone method doesnt exist on a Set

#

i mean, its private

#

also, the Set class is abstract

lost matrix
fluid cypress
#

HashSet?? what is that

#

ok thanks

lusty cipher
#

the most common implementation of a Set (as Set is just an interface)

lost matrix
#

A hash based set.

#

Basically the key arm of a HashMap

fluid cypress
#

thats another question, why its always List x = new ArrayList instead or ArrayList x = new... or List x = new List, or Map<> x = new HashMap instead of Map = new Map

#

i mean, why is the type

#

different than the constructor

eternal night
#

In OOP you usually want to be as abstract as possible when defining variables

#

A var of type list can hold an array list, a linked list, or any other implementation straight from hell

lost matrix
#

List is the interface and ArrayList is the implementation. There are several implementations for List with very different properties.

List<String> someList = new ArrayList<>();
List<String> someOtherList = new LinkedList<>();

Both viable but with different properties

lusty cipher
#

because realistically, you don't really care for what implementation of the type it is. List is enough, as you most likely just want to access methods like add, size etc.

fluid cypress
#

right, the List interface is just telling "this object will have this shape, this structure"

#

thats why its green, its an interface

#

but, then i could be able to do ArrayList x = new ArrayList<type>()

ivory sleet
#

Liskov substitution principle (:

fluid cypress
#

idk, its confusing, im tired af, i need to sleep

lost matrix
#

If it was bordeaux it would still be an interface...

ivory sleet
#

🥴

lost matrix
#

But right

torn shuttle
#

so wait even using nms the only real way of stopping boss bars from active dragons from being sent is to prevent the packets from being sent?

#

maybe if I ignore this issue it will go away

lost matrix
#

chose one player at random and just delegate all that trash to him. See how his client handles all that.

torn shuttle
#

this is so cursed

lost matrix
#

Actually that sounds like a fun plugin. Randomly shuffling packets to random players.

torn shuttle
#

mine4packets

#

every block you mine you get a random packet

fluid cypress
#

btw i found the safeBlocks.contains problem. yes, it was a list of strings, not material, being casted to material when reading from the config in a lot of nested for loops

#

so dont worry guys, java isnt broken

#

but my question is

#

how can i cast a string to material??

#

without a runtime exception or something

torn shuttle
#

^

lost matrix
torn shuttle
#

how can I cast bad code to good code

native ruin
#

I'm having a problem getting my plugin to work on the server.
Logs say the error is in plugin.yml
More specifically at the " main"
I've read the documentation but I can't seem to make it work
Right now it is

main: xceing.plugin.main
main:[packagename].[main class name] 
fluid cypress
#

i mean, im not asking how to do it, im asking how can a just cast string type to material type without an error

#

or youre saying that java does that automatically?

reef wind
native nexus
#

Material.matchMaterial(string) ?

fluid cypress
#

im asking WHY isnt it throwing an error when i do (Material)String, im not asking how to do it correctly, i already fixed it

lost matrix
#

You cant randomly cast stuff around. You need to get the Enum from the String by using Enum.valueOf(String)
In Material its safer to use Material.matchMaterial(String)

native ruin
reef wind
#

what is the error?

native ruin
#

Cannot find main class

reef wind
lost matrix
fluid cypress
native nexus
#

Read javadocs

ivory sleet
#

Doesn’t throw

lost matrix
native nexus
#

Javadocs is your best friend

lost matrix
#

?jd

native nexus
#

It will literally tell you why the functions exists and what they do

torn shuttle
#

tbf if you're getting bad materials from strings odds are an error wouldn't be bad

lost matrix
thick tundra
#

Hello. is it possible to play a sound, and update the location of the sound every 3 ticks or so

native ruin
thick tundra
#

so it follows an entity

quaint mantle
#

@lost matrix

fluid cypress
#

ok ill use matchMaterial, didnt know about that, thanks

lost matrix
torn shuttle
lost matrix