#development

1 messages · Page 114 of 1

radiant brook
#

no. besides events there would not really be a way to detect someone clicking on a scoreboard

#

anyways @round sail (sry for the ping)
I found the problem and its incredibly stupid. There is a function blocking all openings of inventories not part of the game. I have seperate listeners for in- and pre-game and only changed the ones ingame while testing pregame. its 2am and I wanna kill myself. Thank you for your time though :)

dense drift
#

obvious

trail burrow
#

I guess I should of started with my issue, I thought I was attempting something and it was not done that way

#

When trying to hook into papi I get error in code

#

Inconvertible types; cannot cast 'org.bukkit.plugin.Plugin' to 'me.clip.placeholderapi.PlaceholderAPI'

hushed badge
#

what are u doing

#

PlaceholderAPI class doesnt exist Plugin, PlaceholderAPIPlugin class does rather

trail burrow
#

guess the way I hook into plugins will change for papi

hushed badge
#

what are u trying to do

#

im so confused

trail burrow
#

hook into Papi to use placeholders within my plugin for checks

hushed badge
#

PlaceholderAPI.setPlaceholders() ?

lyric gyro
#

shoulda read the docs smh

trail burrow
#

I want to use placeholders from other plugins and compare it to a set value in a config

lyric gyro
#

that's the method you use for papi to replace placeholders yeah

trail burrow
#

read docs and it said nothing about hooking just how to add in pom

lyric gyro
#

except the big section titled "Setting placeholders in your plugin"?

hushed badge
trail burrow
#

I did all of that, I might be doing more then I have too

lyric gyro
#

i mean all that's doing is

  1. checking papi is installed and enabled
  2. using the setplaceholders method 🌚
trail burrow
#

I will do a few test and see

hushed badge
#

😵‍💫

bold ridge
#

Hey, anyone know anything about Bungee API?

#

I've been trying to setup a test bungee plugin and I keep getting this every time I try to load it

#

I think its mainly that I'm not sure weather to use the Plugin object found in Bungee's API or the JavaPlugin Object found in spigot's

#

It loads correctly when I use the Plugin object, but there is no getServer() method with that, which is needed for many things

night ice
#

@bold ridge did u checked the java docs for bungee

bold ridge
#

I havent

night ice
bold ridge
#

Oh, thanks. let me try that

#

It might also be that I'm running on 1.8 bungee

formal locust
formal locust
topaz gust
#

Also your logic is a bit flawed

#

You aren’t checking if the gui is open in the event just if the item is correct

#

So it’s going to be really inefficient

neat pierBOT
#
📋 Your paste: Xy1o
https://paste.helpch.at/umefetinaw

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

topaz gust
# formal locust ok

Can you do a debug message called “trigger” or something to ensure that event handler is working

topaz gust
#

Cause from what I read it should be cancelling every click currently

formal locust
#

im new to coding

topaz gust
#

Bukkit.broadcastMessage(“trigger”);

formal locust
#

ok

topaz gust
#

Also your event should really be named something more precise

#

“Event” as a class name is really ambiguous

#

Same with “GUI” as it’s not a generic interface so should say what GUI it actually is

bold ridge
#

Does anyone know if its possible for a bungee server to listen in on PluginMessages?

icy shadow
#

ok

vapid shuttle
#

Does anyone have advice on how I can modify a loot table result for a block?

#

e.g. if you are breaking a named chest (named by a plugin) and want to remove the name.

vapid shuttle
#
    @EventHandler(priority = EventPriority.HIGH)
    public void onContainerBreak(BlockBreakEvent e) {
        final BlockState block = e.getBlock().getState();
        final boolean isNameable = block instanceof Nameable;
        if(isNameable) {
            if(isNamed(block)) {
                ((Nameable) block).setCustomName(null);
                block.update();
            }
        }
    }
#

is what I was trying

dusty frost
#

You can edit drops im pretty sure

#

A full stack trace would be useful

#

PlayerUtil.java:36 is the first lambda line?

dusty frost
#

Some of those attachments are null

#

do a nullcheck

#

uh

#

it would do nothing?

#

you're just clearing the set you got from getEffectivePermissions

#

permissionAttachmentInfo.getAttachment() at least one of those is null

#

just add a null check easy peasy

#

no clue

#

I am not very familiar with the whole Permission stuff

#

i just use luckperms lol

cinder forum
stone gust
#

Hi

#

How can I disable a event with a command?

#

I have this command with sub command

neat pierBOT
#
📋 Your paste: ItsZiuX
https://paste.helpch.at/uqalepusip

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

topaz gust
topaz gust
#

forcepackEnabled = true;

#

Well more a getter and setter way as it will be held out of class

stone gust
#

...

#

I don't understand nothing

topaz gust
#

You know you can store a variable right?

stone gust
#

No

topaz gust
#

Do you know what a boolean is?

stone gust
#

I only know is a expression returns true or false

topaz gust
#

It’s a variable that is either true or false

stone gust
#

What I need to do with this

topaz gust
#

Well you want to know whether or not “forcepack” is enabled or disabled

#

In coding terms what could we say that is?

stone gust
#

No

icy shadow
#

No...?

stone gust
#

With the command

topaz gust
#

XY problem

neat pierBOT
#
📋 Your paste: ItsZiuX
https://paste.helpch.at/kilerikivo

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.

stone gust
#

What is XY?

topaz gust
#

Please use pastes even for small parts of code

stone gust
#

Ok

topaz gust
#

Just makes people on phones have a nicer time too

stone gust
#

Oks

topaz gust
#

XY problem is the theory of you think you want one solution, but in reality the solution is something else. Hence giving us context allows us to help you better

stone gust
#

Ok

topaz gust
#

You want to disable the entire event, but that’s not really the best way to handle this

#

As you have it so it can be enabled/disabled on a dime

#

Unless I misread your code

stone gust
#

How can I disable and enable it?

topaz gust
#

You could define a variable as a boolean, as we know it would only be true or false

stone gust
#

How

topaz gust
#

We can then say if we mark it as true we want the event to run as normal

#

Otherwise we return and do nothing when the event triggers

#

?learn-java

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

stone gust
#

?

stone gust
topaz gust
#

These are very basic tutorials to Java as you aren’t currently understanding variables and this will be able to teach you far easier than I can

#

I personally started with SoloLearn, but you can forge your own path

stone gust
#

I think you don't understand what I want to do

#

I dont want to disable the event with the easiest way

#

I want to create a command for players to disable the force resource pack

#

And enable

wintry grove
#

but first you gotta store the variable

stone gust
#

How can I store the variable

wintry grove
#

so when the command is run you can store it on a custom .yml file because is so little of information

#

so that it can also be changed directly in the file

#

gotcha?

olive lodge
#

I wasnt sure in what channel this should be posted but I decided to put it here. Is there a way to use Excel and Yaml file together, where you can change a value in Excel then either link or export it and create a yaml file.

lyric gyro
winged pebble
#

getTitle() started belonging to InventoryView after a certain version

lyric gyro
#

Im confused 👀

winged pebble
#

What version are you in

lyric gyro
#

1.18

winged pebble
#

Yeah, access to the title now belongs to InventoryView

#

use e.getView().getTitle()

lyric gyro
wise steeple
#

Should i use the bukkit permission system through my plugin.yml, or should i just hardcode it into my plugin with if (plr.hasPermission())
I would have to learn how to bukkit system works

lyric gyro
#

Probably hard code it

wise steeple
lyric gyro
#

We’ll hard code it in a sense of adding it to the player. I thought there was already something for permissions like a hash set of strings for each player

small raptor
#
public class PrestigeExpansion extends PlaceholderExpansion {

    @Override
    public @NotNull String getIdentifier() {
        return "prestige";
    }

    @Override
    public @NotNull String getAuthor() {
        return "IkeVoodoo";
    }

    @Override
    public @NotNull String getVersion() {
        return "1.0.0";
    }

    @Override
    public boolean persist() {
        return true;
    }

    @Override
    public @Nullable String onRequest(OfflinePlayer player, @NotNull String params) {
        if(params.equalsIgnoreCase("amount"))
            return Main.getPrestige(player) + "";
        return null;
    }
}
new PrestigeExpansion().register();

Whenever I load my plugin the expansion does not appear in either /papi list or when using /papi parse, what did i do wrong?

broken elbow
#

does it show in the startup log as registered?

small raptor
#

what should the msg look like

broken elbow
#

also. pretty sure internal expansions don't show in /papi list

small raptor
broken elbow
#

1 second please

small raptor
#

alright, take your time :D

broken elbow
#

[PlaceholderAPI] Successfully registered expansion: prestige

small raptor
#

does not seem

broken elbow
#

can you do /papi dump and send the generated link over?

small raptor
#

wops, my plugin was not enabled as it had a dependency but it wasn't there

#

lemme try again

broken elbow
#

👍

severe heath
#

I don't know why, but currently my plugins aren't working, but another person used my code and it worked... could I send somebody my code, then could they send it back to me in an editable file so that it works? Thank you.

dusky harness
#

what's the error?

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

fiery sky
#

Hey, I've got deluxe menus running, and I'm trying to link to a menu that my own plugin makes. The DM menu click does run the command, I can see the command in console, but the menu does not open. When running the open command myself it does open though. Is there something I can do to make my plugin work with deluxe menus?

broken elbow
dusky harness
#

although unless deluxemenus has something in it to prevent this, it should work 🤔

broken elbow
#

ugh. they're opening their own menu from deluxemenus dkim

fiery sky
#
    - '[close]'
    - '[player] em'```
broken elbow
#

@fiery sky do you run a [close] action as well? if you do, then remove it

dusky harness
#

oh

dusky harness
#

btw whats the point of HumanEntity not being merged with Player?

proud pebble
#

npcs

#

they are under human entity but arent players

dusky harness
#

oh

#

but npcs can't have open inventories

#

🤔

proud pebble
#

afaik npcs can have an inventory

broken elbow
#

can't they?

dusky harness
#

or is it the villager trade thing

dusky harness
proud pebble
#

i think a npc is just a player with very little defined

#

i think the inventory related stuff are intended for players but its sub interface is player so not much point redefining it

night ice
# dusky harness what's the error?

He is not using maven or gradle... Last time when i checked his jar he had spigot and bukkit shaded into the jar.. I am not able to assist him, IRL things and all... Could u please help him if possible

hearty beacon
#

Hi there, I am hoping someone would be able to assist me with an issue I am having with Maven. (As I am new to it)
Basically, I am using the WorldGuard API and the FastAsyncWorldEdit API and the problem occurs when loading them both in at the same time as the code below becomes invalid.
(Although it works fine when using just the FastAsncWorldEdit API)

com.sk89q.worldedit.world.World faweWorld = FaweAPI.getWorld(temp.getWorld().getName());
clipboard.paste(faweWorld, BlockVector3.at(0, 0, 0), false);
clipboard.close();

Any help would be much appreciated and if you need I am more than happy to provide bits of my pom.xml
~RandomTomato tomatoheart

hearty beacon
# hearty beacon Hi there, I am hoping someone would be able to assist me with an issue I am havi...

Nevermind, A friend told me that in Maven you can use exclusions.
I think I fixed the above by doing the following. (If this is incorrect any feedback would be much appreciated)

<dependency>
  <groupId>com.sk89q.worldguard</groupId>
  <artifactId>worldguard-bukkit</artifactId>
  <version>7.0.7-SNAPSHOT</version>
  <scope>provided</scope>
  <exclusions>
    <exclusion>
      <groupId>com.sk89q.worldedit</groupId>
      <artifactId>worldedit-core</artifactId>
    </exclusion>
  </exclusions>
</dependency>
bold ridge
#

I want to die

#

I just spent 4 hours coding a minigame instance system using pluginMessage channels

#

Only to learn that messages cannot be sent or recieved with no online players

#

Anyone know a better way to do this?

hearty beacon
wooden loom
dense drift
#

make sure you don't create a new instance of your main class

#

new MainClass()

dusky harness
#

(and so you'll have to add a config file)

dusty frost
#

I mean at that point, it'd be easier to just add an actual message broker like RabbitMQ or Redis, or just use the SQL messaging system

graceful hedge
#

Yeah better off using something which is made to be a mq rather than a duct taped socket library.

dusky harness
#

lol

sand bobcat
#

Hello! I might be completly wrong but i am using Eclipse to install the PlaceholderAPI, but i do not seem to be able to use the API stuff for some reason.
I get this error: The import me cannot be resolved

Im probably being a dumbass, but all i did was go to the Project, Build path, Libraries, Add External Jar

fiery pollen
#

Why don't you use maven or gradle

sand bobcat
#

I have always developed in Eclipse and havent really considerd switching

#

Other API's work fine in eclipse

fiery pollen
#

maven or gradle isn't a editor

sand bobcat
#

Im a bit new too Java devlopment. Im a C# developer at heart

#

What is Maven or Gradle then?

#

Got any links for me to read?

fiery pollen
#

Its an easy way to add dependencies and reposetories

#

But there are some other things too

torpid raft
#

maven and gradle are build tools that can be used to create artifacts and manage dependencies

fiery pollen
#

^^

dusty frost
torpid raft
#

you can and should use them in place of whatever eclipse uses by default because they have text configs that can be commited to github so that other people can have easy access to the libraries you use in your projects

dusty frost
#

Eclipse is notorious for hard-to-reproduce builds and build tools like that were made to fix that

sand bobcat
#

Im a bit confused. How would i go and switch my work-in-progress plugin to this?

#

And is their any reason PlaceholderAPI would'nt work but other APIs would?

#

Any links or something?

severe heath
lyric gyro
#

whats your guys opinion on creating commands? should i just use the normal that implements commandexecutor or use someones command framework?

hushed badge
#

bukkits commandexecutor sucks, probably any framework is better than it

honest spoke
#

Hola, trying to set up tornadofx on openjdk, so I need to use openjfx, and then use the javafx task to specify two modules. I'm using the kotlin gradle build file, but I can't seem to make a MutableList. Am I being stupid?

lyric gyro
#

uh.. just call mutableListOf()?

severe heath
#

hey guys

#

can one of you send me a blank editable plugin please?

lyric gyro
#

kotlin is likely a task or config name or smth so trying to use it as a package is failing likely because of that

dense drift
lyric gyro
#

it does

lyric gyro
torpid raft
#

is nms the only way to go beyond the limit of 64 items to a stack

#

or is there some juicy hidden api method

honest spoke
lyric gyro
torpid raft
#

oh sweet

lyric gyro
#

why bring this up 🙃

dense drift
#

I was just curious about something ffs emily

lyric gyro
#

so you think I'm a liar

#

great

dense drift
#

🤭

torpid raft
#

ty fefo

lyric gyro
#

uh

#

no deadname pls

torpid raft
#

ah sorry 😮

severe heath
#

guys can somebody help me. i can't get my minecraft Intellji ide to work. It does simple things but just doesn't do the rest. plugins other people send me with my exact code in works though. can somebody send me a completely blank plugin so that i can edit it? because i think that'd work.
please?????

lyric gyro
lyric gyro
broken elbow
#

bcz you like lying probably

lyric gyro
#

I, in fact, do not

icy shadow
#

publications {
shadow(MavenPublication) {
publication -> project.shadow.component(publication)
}
}

lyric gyro
#

ok

broken elbow
#

well then they're wrong

lyric gyro
#

On that statement, yes

icy shadow
#

Have you heard of sugondese

lyric gyro
#

Yes

#

It's really sad all that's happening in that extremely poor underdeveloped country

cinder forum
#

BM why santa no december anymore

icy shadow
#

i cannot change my nickname

#

help

#

please

#

also

cinder forum
lyric gyro
#

or Mitts

broken elbow
#

Orrrrr Mr. Boobs

regal musk
#

Heyo, having some issues with serialization..

#

It works just fine, untill the config is reloaded

terse kelp
#

Hello folks

#

I'm trying to give effects when a player right clicks another player with a redstone

#

but for some reason it's not working, I'm not sure what I'm doing wrong.

#

The class itself doesn't get executed and I'm not sure whether the code is wrong or if I didn't properly add the event.

#

What's the command for the paste again

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

terse kelp
#

Main class and the right click event

broken elbow
#

most likely has something to do with this check. might want to debug it

terse kelp
#

Alright I'll look into it, thanks.

graceful hedge
#

Yes

#

use .equals

#

Not ==

robust flower
#

I'm getting these message while running my plugin on Paper 1.18.1, how can I get rid of them? I already tried shading slf4j-simple and slf4j-nop, but Paper still mad at me.

[23:05:52 INFO]: [Herbalism] Enabling Herbalism v1.0.2
[23:05:53 ERROR]: [Herbalism] [STDERR] [Server thread] INFO com.github.secretx33.dependencies.herbalism.hikari.HikariDataSource - HikariPool-1 - Starting...
[23:05:53 WARN]: Nag author(s): '[SecretX]' of 'Herbalism' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[23:05:53 ERROR]: [Herbalism] [STDERR] [Server thread] INFO com.github.secretx33.dependencies.herbalism.hikari.pool.HikariPool - HikariPool-1 - Added connection org.sqlite.jdbc4.JDBC4Connection@4459718d
[23:05:53 ERROR]: [Herbalism] [STDERR] [Server thread] INFO com.github.secretx33.dependencies.herbalism.hikari.HikariDataSource - HikariPool-1 - Start completed.
lyric gyro
#

don't relocate slf4j

#

might as well exclude it entirely, paper ships it already

robust flower
lyric gyro
#

paper good

robust flower
#

does spigot ships with a slf4j implementation, or slf4j-api at all?

lyric gyro
#

i'm fairly certain it does not

#

though minecraft nowadays it does

#

since err, 1.17?

#

so spigot inherently ships it now but paper originally introduced it when mc didn't

#

yeah minecraft ships it now

rigid mountain
#

Question, im making a block break even for sugar cane and i want to override the warzone claim in factions UUID how can i do this?

wise steeple
#
package me.silentprogram.betterbounties.jacksondata.files;

import java.util.*;

public class Data {
    //On every kill, check if player has claimed bounty in playerBountyMap if they do, loop through claimed bounties and check if the person killed was a bounty
    private Map<UUID, Bounty> activeBountyMap = new HashMap<>();
    
    private Map<UUID, List<UUID>> playerBountyMap = new HashMap<>();
    
    public void acceptBounty(UUID playerUUID, UUID bountyUUID) {
        List<UUID> bountyList = playerBountyMap.get(playerUUID);
        bountyList.add(bountyUUID);
        playerBountyMap.remove(playerUUID);
        playerBountyMap.put(playerUUID, bountyList);
    }
    
    public List<Bounty> getBounties(UUID playerUUID) {
        List<Bounty> bounties = new ArrayList<>();
        for (UUID i : playerBountyMap.get(playerUUID)) {
            if (!activeBountyMap.containsKey(i)) {
                removeBountyFromAll(i);
                continue;
            }
            bounties.add(activeBountyMap.get(i));
        }
        return bounties;
    }
    
    public void removeBountyFromAll(UUID bountyUUID) {
        activeBountyMap.remove(bountyUUID);
        for (UUID i : playerBountyMap.keySet()) {
            for (UUID bounty : playerBountyMap.get(i)) {
                if (!bounty.equals(bountyUUID)) continue;
                List<UUID> bountyList = playerBountyMap.get(i);
                bountyList.remove(bountyUUID);
                playerBountyMap.remove(i);
                playerBountyMap.put(i, bountyList);
            }
        }
    }
}

#

anythjing i can improve here?

#

it feels like its too complicated

#

ignore the comments btw

indigo plank
#

hello

#

can i ask about intellij idea problem here?, kinda related to spigot plugin

#

i cant compile my plugin, it tooks too long..

somber light
#

Strings with custom hex colors won't get properly displayed if you put them as the parameter in a nms ChatMessage constructor
Any way to avoid that?

sterile hinge
#

use the chat component system as it's intended

somber light
#

as in?

warm steppe
#

look up chat component api

torpid raft
# wise steeple ```java package me.silentprogram.betterbounties.jacksondata.files; import java....

I think this looks pretty fine for the most part, but there are a few things that caught my eye.

first:
your posted code never adds a new list of a player's bounties to the playerBountyMap before trying to access it so, assuming that you don't have that somewhere else:
you'll face a NPE whenever you try to playerBountyMap#get for a player who has just started and does not yet have an entry in the map.

i would fix this by adding some sort of registerPlayer(UUID player) function that adds a new List<UUID> to the playerBountyMap for that player uuid. call this whenever a player joins or when they meet whateverother criteria you might have before you start querying their accepted bounties.

another small thing related to the playerBountyMap is that you don't actually need

playerBountyMap.remove(playerUUID);
playerBountyMap.put(playerUUID, bountyList);

in your #acceptBounty method, since the same bountyList object you modified is still in the map.

second:
i think your #getBounties method is trying to do too much, you should remove the check for if the bounty still exists and rely on your #removeBountyFromAll method being called at the right times to ensure that players are not listed as having an invalid bounty.

This will prevent you from needing to loop through all players' active bounties unless you actually need it - when a bounty is claimed / removed.

#

third:
your for-each loop in your #removeBountyFromAll method is trying to modify the list of bounties, as well as the map of player bounties as it is iterating over them.
trying to do this will cause a ConcurrentModificationException, since you are editing a list as you are iterating through it with an Iterator (aka a for-each loop)

luckily this method is actually way over-verbosing what you are trying to do, and the simple fix is to just call #remove(bountyUUID) from each list of player bounties inside the playerBountyMap.

public void removeBountyFromAll(UUID bountyUUID) {
  activeBountyMap.remove(bountyUUID);
  for (List<UUID> bountyList : playerBountyMap.values()) {
    bountyList.remove(bountyUUID);
  }

I don't really like the idea of looping through each player list for something like this, and i'm sure that there is a better way to remove a bounty from all of the affected players without needing to do that; good luck

terse kelp
broken elbow
#

equals

terse kelp
#

bruh mb

wooden loom
dense drift
#

d;spigot PlayerInventory#setHeldItemSlot

uneven lanternBOT
#
void setHeldItemSlot(int slot)
throws IllegalArgumentException```
Description:

Set the slot number of the currently held item.

This validates whether the slot is between 0 and 8 inclusive.

Parameters:

slot - The new slot number

Throws:

IllegalArgumentException - Thrown if slot is not between 0 and 8 inclusive

dense drift
#

@wooden loom

wooden loom
#

Okey thanks

proud pebble
#

Items display certain attributes of the item, such as attack damage, attack speed, etc. a diamond sword shows 7 attack damage and 1.6s attack speed, is there a way to get the values without having to use nms or predefining them?

#

ive looked on google and cant find anything about it

broken elbow
#

d;spigot ItemStack#getAttributeModifiers

uneven lanternBOT
#
@Nullable
Multimap<Attribute,AttributeModifier> getAttributeModifiers()```
Description:

Return an immutable copy of all Attributes and their modifiers in this ItemMeta.
Returns null if none exist.

Returns:

an immutable Multimap of Attributes and their AttributeModifiers, or null if none exist

proud pebble
#

already tried that

#

it only gets the added on attributes, not the default values

lyric gyro
#

uh, just, getAttribute(Attribute.BLAH)?

proud pebble
#

it doesnt look like you can get the base attributes without nms

lyric gyro
#

I'm certain you can

#

they have a getDefaultValue method

broken elbow
#

I kinda agree.

winged pebble
#

getBaseValue too iirc

sage thorn
#

anyone that can help me with votifierapi and their votifierevent?

for some strange reason, everytime i vote it doesnt fire the event

#

listener is registered in main class

livid crescent
#

Hey

#

@grim oasis

#

Sir I need help immediately

#

@grim oasis

void orchid
#

be patient, and state your question so any of us could help you

livid crescent
#

Hey my account got disabled for no reason I was just talking a guy to the server and he was bullying me so I reported him but he mass reported me and got my account disabled by discord Sir please help me I have spent money on that account
Account: Ben Entwistle #9757

#

I have just lost the capibility to use my account

hushed badge
#

?not-discord

neat pierBOT
#
FAQ Answer:

Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.

livid crescent
hushed badge
#

go to discord support

#

altho i doubt theyd do anything

#

but we literally cannot

livid crescent
hushed badge
#

¯_(ツ)_/¯

broken elbow
#

well we can't do anything

hushed badge
#

not my problem

livid crescent
broken elbow
livid crescent
livid crescent
#

Why you guys here for?

hushed badge
#

HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.

livid crescent
#

.ok

hushed badge
#

show code pls

wise steeple
wise steeple
void orchid
wise steeple
#

Lol I’m like why is there a whole command for it

dense horizon
#

Is there any conversion tool to convert deluxe menus 1.8-1.12 configs into 1.13+ ones?

dense drift
bold ridge
#

Anyone know a good way to hide a client from seeing all messages?

spiral prairie
#

Interrupt packets

bold ridge
#

Hmm

dusky harness
bold ridge
#

And what if I wanted to have a few messages bypass that?

spiral prairie
#

Just choose them

#

You can access the content

bold ridge
#

Ah

#

Let me see if I can go and find how to intercept the chat packets

dusky harness
#

it might be a bit buggy, I had to do a bunch of extra stuff on 1.8, maybe newer versions work differently 🤷

bold ridge
#

What kind of extra stuff?

dusky harness
# bold ridge What kind of extra stuff?

normally you just do packet.getChatComponents() but sometimes it didn't catch all messages

so I also had to manually check for NMS and spigot components 🤷

bold ridge
#

Hmm

#

That will probably be an issue

dusky harness
#

try with normal chat components first though

#

using PacketContainer#getChatComponents

bold ridge
#

Is there an event I listen to for the packets?

dusky harness
#

PacketType.Play.Server.CHAT

#

if u want ill write the basic code

#

also r u using adventure (or paper 1.16+)?

bold ridge
#

no

dusky harness
#

o

bold ridge
#

I was using adventure, but the dependancy just randomly broke a few months back

dusky harness
#

mine still works fine

bold ridge
#

Version?

dusky harness
#

1.8.8

bold ridge
#

Oh

dusky harness
#

im shading & relocating adventure

bold ridge
#

Could you send me the dependancy and repo for that

dusky harness
#

😮

bold ridge
#

Oh wow

#

Let me take a look at this

#

Oh this looks really useful

#

Thanks for finding this for me

spiral prairie
bold ridge
#

I was trying to mess around with bukkit ConversationAPI but I couldnt really get it and decided to look for a better alternative

#

Glad I did

spiral prairie
#

👍

dense horizon
#

I mean its just strings 🤷

rigid mountain
#

Questions so im trying to create placeholders with mdvw for an older version of featherboard, but this isnt working

                new PlaceholderReplacer() {
                    @Override
                    public String onPlaceholderReplace(PlaceholderReplaceEvent event) {
                        boolean online = event.isOnline();
                        Player p = event.getPlayer();

                        String placeholder = event.getPlaceholder();

                        if(placeholder.equals("tokens")) {
                            return db.getInt("players", "UUID", p.getUniqueId().toString(), "tokens") + "";
                        } else if(placeholder.equals("cane")) {
                            return db.getInt("players", "UUID", p.getUniqueId().toString(), "cane") + "";
                        }

                        return null;
                    }
                });```
proud pebble
#

I have an abstract class called FernItemStack, which is what im using as a base for my custom items where i can define certain things, including the drops based on what block i broke, now how would i go about returning the list of drops to my blockbreak listener so i dont have duplicate drops?

#

base drop -> modify based on itemstack -> modify based on enchantment -> give drops to player

#

im not even sure what to google to figure this out so im just asking here if anyone has any ideas for what i could do

proud pebble
#

PlankAxe - AbstractItemTool - AbstractItem - BlockBreakListener
how would i make changes to the blockbreaklistener's drops from plankAxe?

#

the reason is i dont want to make my calculatedrops have a switch case for all items ive defined and what changes are made

spiral prairie
#

I mean, you are not able to get drops without calculating anything

#

In case you have enchantments with boosts, like 2x drops

tender thicket
#

Can someone tell me how the hell to generate a gpg key for MavenPublication

#

I made a key and all that but it saves as an .asc file and when trying to define it in the gradle.properties and running the publication plugin it tells me the key file has an invalid header

proud pebble
spiral prairie
#

Just add a persistent data container with the key of the custom item if you dont have a way of getting them yet

#

Then you just go with a util method that calculates the loot for you

proud pebble
#

like i imaged like a method inside of the PlankAxe that makes changes to the default drops then it returns the new drops from that method to the calculate method

spiral prairie
#

Yep

#

If you have multiple items, just put modifiers in the class, and the utility method takes care of that

#

So you dont have duplicate code

proud pebble
#

the PlankAxe takes a log/wood and convert it to its plank form

#

with a bit of a boost so that its actually not complete shit

#

so 1 log/wood would be 5 planks

#

currently the code for the is being ran in the block break event class

#

well, the method is being run, the actual code is in a seperate class

#

i didnt really wanna overfill the blockbreak listener if i didnt have to

#

cause im going to end up with a switch statement for every item inside of the calculate drops and the blockbreak listener if an item breaks more blocks then it wouldve originally done, such as if i wanted to make "hammers" that break a 3x3x1 area in front of it

#

also i already have a handler for detecting if the item is one of my custom items

spiral prairie
#

Then use that method

proud pebble
#

i dont know how to passthrough the resulting items tho

spiral prairie
#

#getFernItemByKey(String key) // Returns the item, if it doesnt exist, null
FernItem#calculateDrops(BlockBreakEvent event) // Returns a list you should replace the vanilla drops with

spiral prairie
proud pebble
#

the drop list

proud pebble
#

i dont use that anyways

#

i already use my own drop system

#

i kinda wanted to modify the drops and do the code for the event for that item inside of the plankaxe class instead of directly in the blockbreaklistener

spiral prairie
#

Well where the issue then

proud pebble
#

i dont know how to make it so that i can do that

spiral prairie
#

Get the class, run it

proud pebble
#

thats where the problem of returning comes from

spiral prairie
#

But i dont know the problem

proud pebble
#

i tried to do that for my custom enchantments but had no idea how to passthrough the items so if i handle the items in the class then id end up with duplicate drops

#

when it comes to abstract classes and overriding i dont get it

spiral prairie
#

I have no idea where the issue is

spiral prairie
proud pebble
#

sorta

#

the class is unfinished

spiral prairie
#

Right, add an abstract function, that returns a list of item stacks

#

Every tool that extends from it, will now need to override function

proud pebble
#

BlockBreak -> FernItemStack -> FernToolItemStack -> PlankAxe

#

plankaxe is complaining that there are no default constructors

#

im not sure what constructor to put

#
FernItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable) {
        this.id = id;
        this.description = description;
        this.material = material;
        this.rarity = rarity;
        this.isStackable = isStackable;
        FernItemMap.put(id,this);
    }
#

thats the constructor in fernitemstack

#

and i want to passthrough the results from PlankAxe to this

#

i forgot public

warm steppe
#

why is there no space

spiral prairie
#

no space?

warm steppe
#

before that put()

spiral prairie
#

you want it to be FernItemMap. put(id, this)?

warm steppe
#

no

#

like a line

spiral prairie
#

new line?

#

yeah

warm steppe
#

yes

spiral prairie
#

that

warm steppe
#
FernItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable) {
    this.id = id;
    this.description = description;
    this.material = material;
    this.rarity = rarity;
    this.isStackable = isStackable;

    FernItemMap.put(id, this);
}
#

like this

spiral prairie
#

yeah

lyric gyro
#

Looks the same

spiral prairie
#

but it would be better if FernItemMap isnt static ig

spiral prairie
proud pebble
#

cus you cant instances the class and its for registering the itemstacks

spiral prairie
#

and?

proud pebble
#

the map isnt going to change

spiral prairie
#

as long as you add stuff it does lol

proud pebble
#

the only time stuff is added to the map is when they are registers when the plugin starts

#

and i cant think of another way to do it

spiral prairie
#

okay, do what you want lol

proud pebble
#

i do the exact same thing with my custom enchantments

spiral prairie
#

yeah i guess

lyric gyro
spiral prairie
#

yeah

#

i'd personally like that better

proud pebble
#

passing it around?

spiral prairie
#

constructors?

lyric gyro
lethal plaza
#

Is there a way to remove last send text?

spiral prairie
#

uhh what

lyric gyro
#

Cancel chat event

lethal plaza
#

Thans

proud pebble
lyric gyro
#

I don’t want you to do anything. I just recommend passing your hashmap

proud pebble
#

passing to what

spiral prairie
proud pebble
#

i googled passing something and it gave me getFromKey.

spiral prairie
#

you pass the hashmap

#
FernItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable, HashMap<String, FernItemStack> itemMap) {
    this.id = id;
    this.description = description;
    this.material = material;
    this.rarity = rarity;
    this.isStackable = isStackable;

    itemMap.put(id, this);
}```
proud pebble
#

why would i pass the hashmap?

spiral prairie
#

because having a static mutable value is technically bad practice/static abuse

#

afaik

proud pebble
#

its not mutable

spiral prairie
#

it is

proud pebble
#

atleast i wouldnt edit it

#

i just read from it

wheat carbon
#

yes

#

static and mutability don't go together

spiral prairie
#

as long as you are able to put and remove stuff, its mutable

spiral prairie
proud pebble
#

so passing the map is better then just doing put every time?

spiral prairie
#

do you understand OOP

proud pebble
#

probably not

#

took me weeks to figure out how to make my own object

spiral prairie
#

and the difference between an instance, that is connected to a class, and static modifiers, that disconnect them and make them usable without any class instance

spiral prairie
#

so is the rarity, the id and the description

#

everything you pass there is an object, except when we go about Class<T> or Enums

#

or something else you rarely need

proud pebble
#

i just needed something quick that would let me get ahold of the custom item

spiral prairie
#

hashmaps

#

but not static ones lol

proud pebble
#

static means its shared between all instances, i dont want to register the item to a new hashmap every time

#

cause then id have like 40 thousand different hashmaps with a single value in them

spiral prairie
#

no you wouldnt

#
public class SomePlugin extends JavaPlugin {

    private var itemMap = new HashMap<String, FernItemStack>();

    @Override
    public void onEnable() {
        initItems();
    }

    private void initItems() {
        new BlahItemStack("blah", List.of("This is a funny description!"), Material.DIAMOND_HOE, false, itemMap); // It addds the item to the map in the constructor. If we want to add another item to the map, just pass the SAME hash map.
    }

}```
warm steppe
#

yeah, he needs to learn some java basics before making plugins

#

it will be hard for him to continue

spiral prairie
#

yes

#

most common issue amongst plugin devs

#

then somewhere this:

int index = getIndex ();


String maxIndex = getMaxIndex ();
for ( ; ; ) {

  if ( index<Integer.parseInt( maxIndex)) {

    index = index + 1;
  } else {
    break;


  }
}


Main.getINSTANCE().sheepIndex = index;```
proud pebble
#

id isnt a number btw

spiral prairie
proud pebble
spiral prairie
#

yeah

#

it kinda is

#

but these arent the only ones

proud pebble
#

to put it back into the constructor

spiral prairie
#

why do you need that

#

i thought you only wanted it to get added

proud pebble
#

pass the hashmap, yet there is no way to get the hashmap outside of the class, i dont register the items inside of the abstract class

#

i register them in a function in the main class

spiral prairie
#

so you register them twice?

proud pebble
#

i register them once

spiral prairie
#

where

proud pebble
#

main class

spiral prairie
#

send it

#

or just the part where you register them

proud pebble
#

private void registerItems() {
        new PlankAxe("PLANK_AXE",null, Material.IRON_AXE, Rarity.UNCOMMON,false);
    }
spiral prairie
#

yeah exactly

#

but you add it to the hashmap in the constructor

#

i still dont understand where the issue is

proud pebble
#
public FernToolItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable) {
        super(id, description, material, rarity, isStackable);
    }
spiral prairie
#

yes and?

proud pebble
#

the constructor is red

spiral prairie
#

what did you change

proud pebble
#

because it requires a hashmap, which i cannot get

spiral prairie
#

?????

proud pebble
#
public FernItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable, HashMap<String,FernItemStack> hashMap) {
        this.id = id;
        this.description = description;
        this.material = material;
        this.rarity = rarity;
        this.isStackable = isStackable;

        FernItemMap.put(id,this);
    }

spiral prairie
#

you are not able to create a hashmap?

spiral prairie
proud pebble
#

you said to add it to the constructor

#

which i did

spiral prairie
#

and use it?

proud pebble
#

well how am i supposed to do that then

#

without overwriting the old one

spiral prairie
#

you dont know how to use a hashmap but use a hashmap?

spiral prairie
proud pebble
#

FernItemMap is now gray...

#

its no longer gray

#

tho the constructor in toolitemstack is still red

#

to fufill the constructor i need a hashmap which i cant get if no object exists right at the start

#

this makes no sense to me i cant logic this

spiral prairie
#

whatever, just use your static stuff, i wont explain the basics of OOP/how to inerhit correctly

#

do yourself a favour and learn Java

proud pebble
#

im learning java ive been learning it while trying to make something in minecraft cause i cant learn it without it because i cant figure out what to do

#

i dont have a usecase so i wont figure it out

spiral prairie
#

you need to know the basics to learn by doing

proud pebble
#

which is what im doing

spiral prairie
#

no

proud pebble
#

yes

spiral prairie
#

but as it seems, you dont really understand what is happening there

proud pebble
#

the hashmap doesnt exist

spiral prairie
#

oh wow

#

create one

spiral prairie
proud pebble
#

it tells me to remove redundant initilizer

spiral prairie
#

dont tell me, what your ide says

#

use your brain to understand what your ide says

proud pebble
#

I know what its saying

spiral prairie
#

You dont use the hash map

#

make use of it

proud pebble
#

dont use it but make use of it

#

ehh

spiral prairie
#

and saying what you should do

spiral prairie
#

and i already told you

proud pebble
#
private Map<String,FernItemStack> FernItemMap = new HashMap<>();

    private String id;
    private List<String> description;
    private Material material;
    private boolean isStackable;
    private Rarity rarity;

    public FernItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable, HashMap<String,FernItemStack> hashMap) {
        this.id = id;
        this.description = description;
        this.material = material;
        this.rarity = rarity;
        this.isStackable = isStackable;

        hashMap.put(id,this);
        this.FernItemMap = hashMap;
    }
#

thats what i did

spiral prairie
#

where did you get the rest of the constructor

proud pebble
#
public abstract class FernToolItemStack extends FernItemStack {

    public FernToolItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable) {
        super(id, description, material, rarity, isStackable,);
    }

    @Override
    public void onBlockBreak(BlockBreakEvent e) {
        super.onBlockBreak(e);
    }
}
spiral prairie
#

no

proud pebble
#

FernItemStack

spiral prairie
#

From where did you copy this from

proud pebble
#

i wrote it

spiral prairie
#

i dont believe that lol

proud pebble
#

i will happily send you my entire project files

#

or just make another repo and post it to github

spiral prairie
#

anyways, im begging you, learn Java, especially OOP/inerhitance, but im not able to guide you anymore with that level of knowledge, because we're going in circles

proud pebble
#

ive never used inheritence before today

#

i just had classes

#

i thought having an abstract class would make my life easier

spiral prairie
#

it does, but apparently you dont understand it

proud pebble
spiral prairie
#

new hashmap is an empty hashmap

#

but you create it once

#

and pass it to every single class that you register

worn jasper
#

Hi. So.. for a public Homes plugin for example, I was thinking on having per player yaml files and then on player join/quite & an interval, it would be loaded and copied into a map and then unloaded. Think this would help with performance a lot, the question is, how would it be with editing the file? Should I just load the file, edit it, save it and refresh the map again? If I did this, wouldn't it have to refresh the whole map every time someone edits a home?

Kinda different question, but thoughts on using json files instead of yaml?

worn jasper
spiral prairie
#

just use something like Gson

#

and make a class, that you serialize

#

on enable

#

you have all the data cached

worn jasper
#

yes but I also need to change the data

spiral prairie
#

and once it updates, youll just deserialize it on an async runnable again

worn jasper
#
  • never used gson
spiral prairie
worn jasper
#

still kinda unsure how you want me to do this but I am trying to understand it xd

#

give me a sec

#

I am kinda slow and dumb when it comes to these things

spiral prairie
#

and im not good at explaining

#

sorry yall

#

sooo

worn jasper
#

Okay, so Gson is just a lib to convert java objects into json and vice-versa

#

understood that part

spiral prairie
#

basically, you create a class, named HomePlayer, which extends from a ConcurrentHashMap with a String as key and Bukkit Locaiton as value

hard wigeon
#

It's a bit complicated to understand, but anyone have any clue what might be causing this? https://paste.fredthedoggy.me/SEaeE5.java

I'm trying to scale a world up to 4x, and a ton of wierd things are happening, like chunks seeming to be entirely out of place, and I have no clue why it's like that

proud pebble
# spiral prairie and pass it to every single class that you register

when you pass the map through the constructor and do hashmap.put(id,this), it modifies the original instance of the hashmap, the main class only gets called once and never again meaning it never refreshes so that the hashmap would just store the value, and setting the map inside of the constructor would just be copying the details, so input hashmap and abstract class hashmap would have the same values being anything that was inserted into the map.

#

i see

worn jasper
spiral prairie
#

not required, but good if you have async and sync access

proud pebble
#

if thats right then my idea of maps and how they worked was wrong which caused me confusion

spiral prairie
#

but you can just use a normal one

proud pebble
#

which broke my logic in head

spiral prairie
#

Then you create a class named Data or something, which extends from a HashMap with UUID as key and HomePlayer as value

spiral prairie
proud pebble
#

yh nw

worn jasper
#

Okay so you want me to save all the home data of a certain player in a hashmap using gson (json to java object), then whenever a user edits the hashmap, convert the map to json using gson?

#

I am just confused with the serialization part

spiral prairie
#

yeah, so, did you create the two classes?

worn jasper
#

oh no, pure theory here, didn't think about opening the ide and doing it now LMAO

#

I am kinda stupid mb

#

1s

spiral prairie
#

best in a package named serialization or smh

worn jasper
#

wait

#

but the way you are doing it, can I have multiple homes?

spiral prairie
#

yes

worn jasper
#

different names?

spiral prairie
#

yes

worn jasper
#

uh then I think I am totally confused rn

#

xD

spiral prairie
#

the home player, as you maybe saw, has a hasmap

#

String -> the name

#

and Location -> the location

#

the Data class then stores each player

hexed locust
#

Serialisation is disgusting 💀

worn jasper
#

yes but many players can have the same name for a home

#

uh

#

confusion

spiral prairie
#

you dont want that?

worn jasper
#

I want that

#

I am just confused af

spiral prairie
#

then it is fine

spiral prairie
worn jasper
#

no no

#

it's probably me

#

anyone else probably understood it

spiral prairie
#

lets just leave the serialization part out for a sec

worn jasper
#

sure

spiral prairie
#

soo

#

Lemme just create an example Home Project

worn jasper
#

k

#

just opened the ide myself

#

also, kinda unrelated question but what's the best spigot-api version to use?

#

well, think it's obviously the latest

#

let me reformulate the question, what's the best spigot-api version to use, that also supports the most versions?

spiral prairie
#

when you combine it with something like XSerias that handles the Material, Biome and Sound parsing independence

worn jasper
#

Never used that either

spiral prairie
#

yeah

#

but its pretty good

worn jasper
#

Did you finish your example btw?

spiral prairie
#

almost

lyric gyro
#
        getServer().getOnlinePlayers().stream().filter(Bukkit.getPlayer(FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())).forEach(player -> TinyProtocolHandler.getInstance().addChannel(player));```
proud pebble
#

my idea of how maps and probably other data types work has been flipped on its head

lyric gyro
#

Does anyone know how to fix this? I'm trying to create my geyser anticheat

spiral prairie
#

what doesnt work?

proud pebble
#

also my thoughts of how the new keyword works

lyric gyro
spiral prairie
dense drift
#

filter takes a predicate, you would do pl -> filter logic here

spiral prairie
#

also, you have to create a variaböe

lyric gyro
#
        instance = this;
        this.tinyProtocolHandler = new TinyProtocolHandler();

        if (ProtocolVersion.getGameVersion().isAbove(ProtocolVersion.V1_12_2)) {
            //getServer().getPluginManager().disablePlugin(this);
            getLogger().warning("Tested on 1.8 - 1.12.2. If you wish to use on version higher than 1.12.2, use at your own risk");
            return;
        }

        this.configLoader.load();
        this.bukkitVersion = Bukkit.getServer().getClass().getPackage().getName().substring(23);
        this.keepaliveHandler = new KeepaliveHandler();
        this.userManager = new UserManager();
        getServer().getPluginManager().registerEvents(new BukkitListener(), this);
        player = Bukkit.getPlayer();
        getServer().getOnlinePlayers().stream().filter(Bukkit.getPlayer(FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())).forEach(player ->
                TinyProtocolHandler.getInstance().addChannel(player));

        //Resets violations after 1 minute
        this.executorService.scheduleAtFixedRate(() -> this.getUserManager().getUserMap().forEach((uuid, user) ->
                        user.getCheckManager().getCheckList().forEach(check -> check.setViolation(0))),
                1L, 1L, TimeUnit.MINUTES);
    }```
#

Here man whole code

lyric gyro
#

I got it as u can see

spiral prairie
#

ohh

#

okay

#

lemme get that

dense drift
#
getServer().getOnlinePlayers().stream()
  .filter(it -> FloodgateApi.getInstance().isFloodgatePlayer(it.getUniqueId()))
  .forEach(it -> /* do something with the player */);```
tender thicket
#

@dense drift

worn jasper
tender thicket
#

Do you know how to use a gpg key with maven publication

spiral prairie
#
getServer().getOnlinePlayers().stream()
  .filter(it -> FloodgateApi.getInstance().isFloodgatePlayer(it.getUniqueId()))
  .forEach(player -> TinyProtocolHandler.getInstance().addChannel(player));```
#

@lyric gyro

lyric gyro
#

Thanks bro

tender thicket
#

I cant figure out how to publish to my sonatype repo

spiral prairie
#

and remove player = Bukkit.getPlayer()

tender thicket
#

Set up signing but the reader says invalid header when trying to read the gpg key

dense drift
#

no

lyric gyro
spiral prairie
#

👍 @dense drift did help too

proud pebble
#

i am sorry skyslycer.

#

i misunderstood how variable continuity worked

spiral prairie
#

but good that you understood how it worked

#

sorry from my side too, i have up a bit early

orchid otter
#

Im trying to use SQL everything works, but only if i call it from the main class, so if i make a function in a different class then try to call it on enable it says this.xxxx is null
but if i define the function in the main loop and call it on enable it works fine

spiral prairie
#

Just a simple home plugin making use of JSON saving/loading

spiral prairie
orchid otter
#

the createtable function works but if i were to move it to a different class i would get exactly the same error, that is the only reason its in the main

proud pebble
#

my only issue now is getting a clone of the hashmap so i can iterate through it.

proud pebble
#

to get the FernItemStack object

spiral prairie
#

you can do that with the original one

proud pebble
#

ill have to move it out of the main class first which ill do now

spiral prairie
#

if you want to get by a specific key: HashMap#get(String key)

proud pebble
#

would getting a new instance of the class the hashmap is in clear the hashmap or does it stay the same?

spiral prairie
#

new instance is always empty again

proud pebble
#

its sorta why i originally used static so i would stay constant between instances

spiral prairie
#

yeah, but you can pass instances around

#

thats the point

orchid otter
#

@spiral prairieSorry to nag but could you have a look at my code

spiral prairie
#

wait

worn jasper
lethal plaza
#

Who returns mainhands items name?

spiral prairie
#

the home data contains every home of the player and its target location

#

the playerdata contains the uuid of the player and the corresponding homedata with the homes

worn jasper
#

ok but what if I want to add more information than just home name and location?

spiral prairie
#

and HomeData will be <String, YourClassName> instead

worn jasper
#

so it's like a stair

#

like

#
Player:
- HomeName:
  - Location:
    - Other:
      - Other2
#

you get one, by getting the other

spiral prairie
#

yeah

spiral prairie
#

player is a UUID

#

home is a String

#

and homedata is the location

worn jasper
#

oh no

#

I mean't if I wanted to add more data

#

per player

#

but yes I understand that

spiral prairie
#

well then you just edit HomeData

worn jasper
#

oh no

#

per home

#

fk

#

I want to add like

#

if a home is public or not

spiral prairie
#

yeah

worn jasper
#

for example

spiral prairie
#

then add a class

proud pebble
#

imma start eliminating all instances of static

spiral prairie
#

that holds all the data

#

including location

#

and replace that class with Location in HomeData

spiral prairie
worn jasper
#

so if I wanted to get if a home is public I would get like Player » HomeName » HomeLocation » HomePublic

worn jasper
#

the thing is... when does it save?

#

only on disable?

spiral prairie
#

look at the code

#

look at the usages of the save method

#

it saves once a player adds/removes a home and on disable

worn jasper
#

uh didn't see any save() in sethome or delete

proud pebble
worn jasper
#

correction: I found it only in delete

#

Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, plugin::save, 0L);

#

if this is even it

spiral prairie
#

yes

#

oh lmao

#

gimme a sec

#

my bad

worn jasper
#

several errors with var

#

this one just confused me lmao

spiral prairie
#

well thats your issue then

#

lol

worn jasper
#

wait I do

#

unless I am not using it in the project itself 🤔

#

where can I check it?

spiral prairie
#

I also updated it

#

with your idea

#

and renamed a few classes

#

double tap CTRL and type git pull

worn jasper
#

I mean, what if I also want to add more info to it besides publicHome?

#

then I would just create another class right?

spiral prairie
#

just add the information??

worn jasper
#

wdym just add information

spiral prairie
#

i think you know what variables are

worn jasper
#

yes

#

lol

spiral prairie
#

soo

#

wheres the problem

#

should i make a video of me adding a variable to a class? kekw

worn jasper
#

uh but before you said if I wanted to store something else

#

I would have to create another class

#

unless I misunderstood it

spiral prairie
#

because then i didnt have a seperate class for it

#

i only used Location

#

but now i have

#

so you should use that

worn jasper
#

oh Home.java

#

I see now lol

spiral prairie
#

yes yes

worn jasper
#

tysm then I also found out where I was confused

#

it was mainly the serialization part

#

but I now understand

#

thx for the example

spiral prairie
#

👍

spiral prairie
worn jasper
#

I mean, I was already planning on using maps

#

like, loading the file, and storing the data into a map

spiral prairie
# worn jasper tbh, unsure

Always load from file:
On every command execution, the file would be probably loaded sync, and with 100 players, it could lag
BUT: Bukkit uses cache too, so you would be safe

worn jasper
#

same thing happens with yaml right?

#

(any type of file I suppose)

spiral prairie
#

Separate files for each player:
Can be much and useless IG, like yay, 200 files!

spiral prairie
#

if you'd use another lib to do YAML or JSON or whatever

#

you have to cache by yourself

worn jasper
spiral prairie
#

Never used the YAML thing from Bukkit?

#

with loadConfig() and saveConfig()

worn jasper
#

yes

spiral prairie
#

Thats what Bukkit has

worn jasper
#

oh ok

spiral prairie
#

and its getting cached

worn jasper
#

oh I see, if we have like other config files we use another lib for those

spiral prairie
#

if you do FileConfiguration#getString, it doesnt directly load from file

worn jasper
#

and we have to cache them ourselfs

spiral prairie
#

yeah

#

and thats when serialization comes in handy

#

you have type safe stuff

#

like #getLocation

#

instead of using #getLocation("blah.location")

worn jasper
#

uh also about gradle

#

the version I am using doesn't support java 17 oof

spiral prairie
#

and change 7.1 to 7.3.3

#

and reload gradle

worn jasper
#

k ty

#

ok wtf?

#

plugin.yml is fine tf

#

ok so something is copying 1+ files to the same location?

rigid mountain
spiral prairie
#

are you using build.gradle or build.gradle.kts

worn jasper
#

srry for the delay btw

spiral prairie
#

gimme a sec

neon laurel
#

will deluxemenus add itemsadder support?

spiral prairie
#
processResources {
    from(sourceSets.main.resources.srcDirs) {
        duplicatesStrategy = DuplicatesStrategy.INCLUDE
    }
}```
spiral prairie
worn jasper
#

ty

lethal plaza
#

i am making plugin to show players item in hand but it will send me a string value meta display name etc in chat but not in hover window i am tryng to remove tostring

#
ItemMeta meta = player.getInventory().getItemInMainHand().getItemMeta();
            String output = meta.toString(); 
spiral prairie
#

what do you want to do

lethal plaza
#

When you move your mouse on invetory you can see a window where all stats i want to make the same window when he hovers on text

spiral prairie
#

Something with Bungee COmponents

#

or if you really want to go fancy, MiniMessage/Adventure

dense drift
#

Cmon docdex

#

What you want is called hover, Mentos

lyric gyro
#

it's in the chat javadoc, it's a separate javadoc from bungee

dense drift
#

d;bungee-chat TextComponent#hover

uneven lanternBOT
dense drift
#

Finally

spiral prairie
#

yess

lyric gyro
#

something's broken thonk

spiral prairie
#

something with BungeeComponents

spiral prairie
dense drift
#

Yeah, ive notice

echo briar
tight junco
#

showing code helps

wooden loom
echo briar
atomic echo
#

1.18 doesn't have PacketPlayOutTitle @echo briar

echo briar
shell moon
#

To do what? Send titles?

echo briar
shell moon
#

yes?

round sail
#

“Mhm” means yes.

shell moon
#

Answer him then.

round sail
#

I don’t know the answer. I was answering your question.

echo briar
atomic echo
echo briar
#

Okay should that be directly in the place of the original class?

atomic echo
#

Yes

echo briar
#

Kk thank you

echo briar
#

like this?

atomic echo
#

No, sendTitle is a player method

echo briar
#

Oh okay, how should i set that up then?

atomic echo
#

Well, where were you using the other method to send a title?

dense drift
#

Adventure

echo briar
#

Originally i had it like this: final Class<?> ppotClass = getNMS("PacketPlayOutTitle"); But becuase PacketPlayOutTitle doesn't work in 1.18.1 im stuck with the error, are you asking what other method im using to send the title or what is controlling what's being sent through the title?

atomic echo
#

Show me where you actually send a player a title

echo briar
#

https://pastebin.com/bF545KrC Here's the actual messages class. For what gets sent through the actual title is controlled in the config side by the player.

atomic echo
#

Send this class TitleUtil.java

atomic echo
#

@echo briar You can remove where you send the packets and do p.sendTitle(title, subtitle, 10, 10, 10);

night ice
#

you using spigot or spigot-api as dependency?

night ice
echo briar
night ice
spiral prairie
#

I mean, what should be better

#

this is the bare minimum

lyric gyro
#

Why isn’t cuboid in team then?

#

.

#

Or in some sorta map

#

Currently just making a cuboid without any purpose

wraith scarab
#

Output in console

[17:06:05 INFO]: [BountySystem] [STDOUT] 11c69c88-9b69-422b-8aa4-44c3d690734e
[17:06:05 INFO]: [BountySystem] [STDOUT] 11c69c88-9b69-422b-8aa4-44c3d690734e

Code:

            String Str = Config.getString("Logged." + i);
            System.out.println(Str);
            System.out.println(p.getUniqueId().toString());
            System.out.println("");
            System.out.println("");
            if(Str == p.getUniqueId().toString()) {
                System.out.println("eeeeeee");
                System.out.println(p.getUniqueId());
            }

Why its not printing : "eeeeeee" ?

#

pls

sterile hinge
#

don't use == for object comparison

spiral prairie
#

ouu Sirrr

wraith scarab
#

its a get string

sterile hinge
#

a String is an object

wraith scarab
#

so i compare 2 string

spiral prairie
#

use #equals please

night ice
#

this one is not printing

            if(Str == p.getUniqueId().toString()) {
                System.out.println("eeeeeee");
                System.out.println(p.getUniqueId());
            }
#

System.out.println(p.getUniqueId().toString());

#

its printing this one

spiral prairie
sterile hinge
#

that's exactly what I'd expect it to do :p

spiral prairie
#

lol

wraith scarab
spiral prairie
#

also, variables are named lowerCamelCase, please rename your variables to mach that convention

night ice
# spiral prairie yeah?

i meant like its not printing the thing inside the conditional statement rather there is a println above it

spiral prairie
#

like, what are you trying to tell me

#

why shouldnt it print

night ice
#

your last question mark felt like that it was a question.. 😂

spiral prairie
#

oh kekw

#

my bad then

night ice
#

nah..no worries

lyric gyro
#

You’re just calling new cuboid

#

Do something with it

#

Put it somewhere

sharp cove
#

Hey, i have a List<String> with Teams and i wanna divide players to equal teams.

#

What is the best way to do that?

#

It can be many teams, like from 3 to 6

#

But that cannot matter

proud pebble
#

what would the cutoff be for upping the max teams, eg 4 per team then make new team