#development
1 messages · Page 114 of 1
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 :)
obvious
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'
what are u doing
PlaceholderAPI class doesnt exist Plugin, PlaceholderAPIPlugin class does rather
guess the way I hook into plugins will change for papi
hook into Papi to use placeholders within my plugin for checks
PlaceholderAPI.setPlaceholders() ?
shoulda read the docs smh
I want to use placeholders from other plugins and compare it to a set value in a config
that's the method you use for papi to replace placeholders yeah
read docs and it said nothing about hooking just how to add in pom
except the big section titled "Setting placeholders in your plugin"?
I did all of that, I might be doing more then I have too
i mean all that's doing is
- checking papi is installed and enabled
- using the setplaceholders method 🌚
I will do a few test and see
😵💫
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
@bold ridge did u checked the java docs for bungee
I havent
https://javadoc.io/doc/net.md-5/bungeecord-api/latest/index.html
There is a getProxy() in plugin
does anyone know why this is not execute the given action on clicking the item? the gui works fine but the actions are not working
these are my classes:
command: https://paste.helpch.at/fufejohide.java
event: https://paste.helpch.at/ajivenulap.java
Can you show main class
ok
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
A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
Can you do a debug message called “trigger” or something to ensure that event handler is working
like?
Cause from what I read it should be cancelling every click currently
im new to coding
Bukkit.broadcastMessage(“trigger”);
ok
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
Does anyone know if its possible for a bungee server to listen in on PluginMessages?
how to do this
?
Yes it is
ok
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.
@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
You can edit drops im pretty sure
A full stack trace would be useful
PlayerUtil.java:36 is the first lambda line?
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

A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
Make it set a boolean either true or false and then reference that boolean within your event listener and handle it appropriately
huh?
Don't understand
forcepackEnabled = true;
Well more a getter and setter way as it will be held out of class
You know you can store a variable right?
No
Do you know what a boolean is?
I only know is a expression returns true or false
It’s a variable that is either true or false
What I need to do with this
Well you want to know whether or not “forcepack” is enabled or disabled
In coding terms what could we say that is?
No
No...?
With the command
XY problem
A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
What is XY?
Please use pastes even for small parts of code
Ok
Just makes people on phones have a nicer time too
Oks
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
Ok
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
How can I disable and enable it?
You could define a variable as a boolean, as we know it would only be true or false
How
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
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!
?
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
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
what he means is that you have a variable, like forceenabled, then on the PlayerJoinEvent you check if that variable is true or false, and if true you apply, if false you dont
but first you gotta store the variable
How can I store the variable
so when the command is run you can store it on a custom .yml file because is so little of information
https://www.spigotmc.org/wiki/config-files/ for custom config files I would check this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so that it can also be changed directly in the file
gotcha?
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.
https://gyazo.com/662a7e4822d610e8fcd92d4a22a23e3b
Why isnt getTitle working?
getTitle() started belonging to InventoryView after a certain version
Im confused 👀
What version are you in
1.18
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
Probably hard code it
thats what ive been doing
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
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?
does it show in the startup log as registered?
what should the msg look like
also. pretty sure internal expansions don't show in /papi list
?
1 second please
alright, take your time :D
[PlaceholderAPI] Successfully registered expansion: prestige
does not seem
can you do /papi dump and send the generated link over?
wops, my plugin was not enabled as it had a dependency but it wasn't there
lemme try again
👍
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.
what's the error?
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
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?
try Player#closeInventory first
although unless deluxemenus has something in it to prevent this, it should work 🤔
ugh. they're opening their own menu from deluxemenus dkim
- '[close]'
- '[player] em'```
@fiery sky do you run a [close] action as well? if you do, then remove it
oh
works like a charm, thanks!
btw whats the point of HumanEntity not being merged with Player?
afaik npcs can have an inventory
can't they?
or is it the villager trade thing
yea but what about an open one?
npcs arent villagers
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
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
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 
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>
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?
maven is the problem
haha
https://gyazo.com/12962fb1c4093ce9d9cd879b59a63d3d how do i fix this
https://github.com/Ivan8or/RadioScanner
note that it requires an extra open port on each server
(and so you'll have to add a config file)
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
Yeah better off using something which is made to be a mq rather than a duct taped socket library.
😎
lol
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
Why don't you use maven or gradle
I have always developed in Eclipse and havent really considerd switching
Other API's work fine in eclipse
maven or gradle isn't a editor
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?
Its an easy way to add dependencies and reposetories
But there are some other things too
maven and gradle are build tools that can be used to create artifacts and manage dependencies
^^
Repeatable, is the key there. Maven and Gradle allow anyone with a JVM installed to clone your project from git and build it without any hassle.
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
Eclipse is notorious for hard-to-reproduce builds and build tools like that were made to fix that
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?
no errors. just please send an editable file back thank you.
whats your guys opinion on creating commands? should i just use the normal that implements commandexecutor or use someones command framework?
bukkits commandexecutor sucks, probably any framework is better than it
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?
uh.. just call mutableListOf()?
kotlin is likely a task or config name or smth so trying to use it as a package is failing likely because of that
https://kotlinlang.org/docs/packages.html#default-imports this probably applies to kts as well
it does
google.com "spigot plugin template"
is nms the only way to go beyond the limit of 64 items to a stack
or is there some juicy hidden api method
🤦 I was using autocomplete for it, and it always resolved back to that. Doing it manually... works as expected. Thanks, why did I not try that
err Inventory#setMaxStackSize?
oh sweet
why bring this up 🙃
I was just curious about something ffs emily
🤭
ty fefo
ah sorry 😮
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?????
You are tho
because.. ?
bcz you like lying probably
I, in fact, do not
publications {
shadow(MavenPublication) {
publication -> project.shadow.component(publication)
}
}
ok
well then they're wrong
On that statement, yes
Have you heard of sugondese
Yes
It's really sad all that's happening in that extremely poor underdeveloped country
BM why santa no december anymore

Orrrrr Mr. Boobs
Heyo, having some issues with serialization..
It works just fine, untill the config is reloaded
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
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
most likely has something to do with this check. might want to debug it
Alright I'll look into it, thanks.
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.
thanks, excluding it from the classpath (and removing the relocation) worked like a charm! kt configurations.runtimeClasspath { exclude(group = "org.slf4j", module = "slf4j-api") }
paper good
does spigot ships with a slf4j implementation, or slf4j-api at all?
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
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?
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
hello
can i ask about intellij idea problem here?, kinda related to spigot plugin
i cant compile my plugin, it tooks too long..
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?
use the chat component system as it's intended
as in?
look up chat component api
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
equals
bruh mb
hey is it possible to say that the player that joins the server needs to spawn with this empty (third) inventory slot https://gyazo.com/ef291d52342a348ed1873d9b8f0de989 instead of the first one https://gyazo.com/67a7123ffb779ff4b04f8b26aa4a9d58
d;spigot PlayerInventory#setHeldItemSlot
void setHeldItemSlot(int slot)
throws IllegalArgumentException```
Set the slot number of the currently held item.
This validates whether the slot is between 0 and 8 inclusive.
slot - The new slot number
IllegalArgumentException - Thrown if slot is not between 0 and 8 inclusive
@wooden loom
Okey thanks
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
d;spigot ItemStack#getAttributeModifiers
@Nullable
Multimap<Attribute,AttributeModifier> getAttributeModifiers()```
Return an immutable copy of all Attributes and their modifiers in this ItemMeta.
Returns null if none exist.
an immutable Multimap of Attributes and their AttributeModifiers, or null if none exist
uh, just, getAttribute(Attribute.BLAH)?
it doesnt look like you can get the base attributes without nms
I kinda agree.
getBaseValue too iirc
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
be patient, and state your question so any of us could help you
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
?not-discord
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.
What should I do
Already sent my req there didn't respond
¯_(ツ)_/¯
well we can't do anything
not my problem
Like if a account got fake ban discord just ignores it
and what do you want us to do exactly?
Well I thought you guys were from discord and could understand my situation and recover it back
Well I have a question
Why you guys here for?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
.ok
Please help
show code pls
How common is it for@people to think this is discord support…
Why would they be from discord lol
Thank you so much 🙏
very common apparently
Lol I’m like why is there a whole command for it
Is there any conversion tool to convert deluxe menus 1.8-1.12 configs into 1.13+ ones?
No afaik, also #general-plugins
Anyone know a good way to hide a client from seeing all messages?
Interrupt packets
Hmm
you can use ProtocolLib
And what if I wanted to have a few messages bypass that?
it might be a bit buggy, I had to do a bunch of extra stuff on 1.8, maybe newer versions work differently 🤷
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 🤷
try with normal chat components first though
using PacketContainer#getChatComponents
Is there an event I listen to for the packets?
PacketType.Play.Server.CHAT
if u want ill write the basic code
also r u using adventure (or paper 1.16+)?
no
o
I was using adventure, but the dependancy just randomly broke a few months back
Version?
1.8.8
Oh
im shading & relocating adventure
Could you send me the dependancy and repo for that
https://github.com/eldoriarpg/messageblocker Here's an API for that
😮
Oh wow
Let me take a look at this
Oh this looks really useful
Thanks for finding this for me
Np
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
👍
I was asking because I wanted to know if it is only replacing ids, if it is then I could make one.
I mean its just strings 🤷
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;
}
});```
what isnt working.
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
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
I mean, you are not able to get drops without calculating anything
In case you have enchantments with boosts, like 2x drops
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
i would still have to calculate but i wasnt sure if there would be a better way of doing things
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
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
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
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
Then use that method
i dont know how to passthrough the resulting items tho
#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
The drop list or the FernItem
the drop list
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
Well where the issue then
i dont know how to make it so that i can do that
Get the class, run it
thats where the problem of returning comes from
But i dont know the problem
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
I have no idea where the issue is
So you have a FernToolItem abstracr class right?
Right, add an abstract function, that returns a list of item stacks
Every tool that extends from it, will now need to override function
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
why is the map static?
why is there no space
no space?
before that put()
you want it to be FernItemMap. put(id, this)?
yes
that
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
yeah
Looks the same
but it would be better if FernItemMap isnt static ig

¯_(ツ)_/¯
cus you cant instances the class and its for registering the itemstacks
the map isnt going to change
as long as you add stuff it does lol
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
okay, do what you want lol
i do the exact same thing with my custom enchantments
yeah i guess
Try passing the map around or whatever
passing it around?
constructors?
Yes many solutions
Is there a way to remove last send text?
uhh what
Cancel chat event
Thans
i still dont know what exactly you want me to do
I don’t want you to do anything. I just recommend passing your hashmap
passing to what
to your item class, so you can add it
saying passing a hashmap means nothing to me
i googled passing something and it gave me getFromKey.
just like you pass the id of the item
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);
}```
why would i pass the hashmap?
because having a static mutable value is technically bad practice/static abuse
afaik
its not mutable
it is
as long as you are able to put and remove stuff, its mutable
and from my understanding, FernItemMap.put adds/edits
so passing the map is better then just doing put every time?
do you understand OOP
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
a new HashMap<String, FernItemStack> is an object too
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
i just needed something quick that would let me get ahold of the custom item
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
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.
}
}```
yeah, he needs to learn some java basics before making plugins
it will be hard for him to continue
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;```
id isnt a number btw
where did i say this
that, looks like describing all problems in one block
since the hashmap is stored in the abstract class, how am i supposed to get the hashmap
to put it back into the constructor
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
so you register them twice?
i register them once
where
main class
private void registerItems() {
new PlankAxe("PLANK_AXE",null, Material.IRON_AXE, Rarity.UNCOMMON,false);
}
yeah exactly
but you add it to the hashmap in the constructor
i still dont understand where the issue is
public FernToolItemStack(String id, List<String> description, Material material, Rarity rarity, boolean isStackable) {
super(id, description, material, rarity, isStackable);
}
yes and?
the constructor is red
what did you change
because it requires a hashmap, which i cannot get
?????
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);
}
you are not able to create a hashmap?
you dont even use it here wtf
and use it?
you dont know how to use a hashmap but use a hashmap?
hashMap.put(id, this);
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
whatever, just use your static stuff, i wont explain the basics of OOP/how to inerhit correctly
do yourself a favour and learn Java
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
this is not really learning
you need to know the basics to learn by doing
which is what im doing
no
yes
you just have to apply the same method to the hashmap as you did with id, description etc
but as it seems, you dont really understand what is happening there
the hashmap doesnt exist
literally sent you an example
it tells me to remove redundant initilizer
I know what its saying
im saying what you currently do
and saying what you should do
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
where did you get the rest of the constructor
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);
}
}
no
where did you get this from
FernItemStack
From where did you copy this from
i wrote it
i dont believe that lol
i will happily send you my entire project files
or just make another repo and post it to github
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
ive never used inheritence before today
i just had classes
i thought having an abstract class would make my life easier
it does, but apparently you dont understand it
new Hashmap != empty hashmap?
new hashmap is an empty hashmap
but you create it once
and pass it to every single class that you register
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?
why per player?
because I don't think loading a whole big ass file everytime someone joins, leaves and every x amount of time is very optimal lol
you dont load it every time
just use something like Gson
and make a class, that you serialize
on enable
you have all the data cached
yes but I also need to change the data
and once it updates, youll just deserialize it on an async runnable again
- never used gson
very easy
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
Okay, so Gson is just a lib to convert java objects into json and vice-versa
understood that part
basically, you create a class, named HomePlayer, which extends from a ConcurrentHashMap with a String as key and Bukkit Locaiton as value
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
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
wait what's a concurrentHashMap? never heard about it
concurrent save hashmap
not required, but good if you have async and sync access
if thats right then my idea of maps and how they worked was wrong which caused me confusion
but you can just use a normal one
which broke my logic in head
Then you create a class named Data or something, which extends from a HashMap with UUID as key and HomePlayer as value
ill get back to you in a sec
yh nw
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
yeah, so, did you create the two classes?
oh no, pure theory here, didn't think about opening the ide and doing it now LMAO
I am kinda stupid mb
1s
best in a package named serialization or smh
yes
different names?
yes
the home player, as you maybe saw, has a hasmap
String -> the name
and Location -> the location
the Data class then stores each player
Serialisation is disgusting 💀
yeah?
you dont want that?
then it is fine
sorry for my bad explanation
lets just leave the serialization part out for a sec
sure
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?
latest
when you combine it with something like XSerias that handles the Material, Biome and Sound parsing independence
Never used that either
Did you finish your example btw?
almost
getServer().getOnlinePlayers().stream().filter(Bukkit.getPlayer(FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId())).forEach(player -> TinyProtocolHandler.getInstance().addChannel(player));```
my idea of how maps and probably other data types work has been flipped on its head
Does anyone know how to fix this? I'm trying to create my geyser anticheat
what doesnt work?
also my thoughts of how the new keyword works
which player do you want?
filter takes a predicate, you would do pl -> filter logic here
also, you have to create a variaböe
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
I'm trying to get generally player that's using bedrock through floodgate
I got it as u can see
getServer().getOnlinePlayers().stream()
.filter(it -> FloodgateApi.getInstance().isFloodgatePlayer(it.getUniqueId()))
.forEach(it -> /* do something with the player */);```
@dense drift
K, I mean, no need to do it all, just small examples
Do you know how to use a gpg key with maven publication
getServer().getOnlinePlayers().stream()
.filter(it -> FloodgateApi.getInstance().isFloodgatePlayer(it.getUniqueId()))
.forEach(player -> TinyProtocolHandler.getInstance().addChannel(player));```
@lyric gyro
Thanks bro
I cant figure out how to publish to my sonatype repo
and remove player = Bukkit.getPlayer()
Set up signing but the reader says invalid header when trying to read the gpg key
no
I appreciate your help 😄 ❤️
👍 @dense drift did help too
oh no worries
but good that you understood how it worked
sorry from my side too, i have up a bit early
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
code please
https://paste.gg or something
@worn jasper here's the whole project: https://github.com/Skyslycer/BasicHome
Just a simple home plugin making use of JSON saving/loading
do you understand now what we meant with passing the hashmap around but creating it only once
i believe so yes
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
my only issue now is getting a clone of the hashmap so i can iterate through it.
why do you need a clone?
to get the FernItemStack object
you can do that with the original one
ill have to move it out of the main class first which ill do now
if you want to get by a specific key: HashMap#get(String key)
would getting a new instance of the class the hashmap is in clear the hashmap or does it stay the same?
new instance is always empty again
its sorta why i originally used static so i would stay constant between instances
@spiral prairieSorry to nag but could you have a look at my code
wait
ty will check it out, question, why do you have to create 2 classes for homedata and player data?
Who returns mainhands items name?
like a player has home data
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
ok but what if I want to add more information than just home name and location?
then create another class, that contains location, and the other information of a home
and HomeData will be <String, YourClassName> instead
so it's like a stair
like
Player:
- HomeName:
- Location:
- Other:
- Other2
you get one, by getting the other
yeah
PlayerData - player1 - home1 - homedata1
- home2 - homedata2
- player2 - home1 - homedata1
- home2 - homedata2
- player3 - home1 - homedata1
- home2 - homedata2
- home3 - homedata4
- home4 - homedata5
player is a UUID
home is a String
and homedata is the location
oh no
I mean't if I wanted to add more data
per player
but yes I understand that
per player? i thought per home?
well then you just edit HomeData
yeah
for example
then add a class
imma start eliminating all instances of static
that holds all the data
including location
and replace that class with Location in HomeData
not every static variable is bad, but still good
so if I wanted to get if a home is public I would get like Player » HomeName » HomeLocation » HomePublic
yeah
look at the code
look at the usages of the save method
it saves once a player adds/removes a home and on disable
uh didn't see any save() in sethome or delete
since you cant initalize enums what about methods inside that are static?
thats fine
correction: I found it only in delete
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, plugin::save, 0L);
if this is even it
you dont use Java 17 huh?
well thats your issue then
lol
File > Project Structure > Project >
I also updated it
with your idea
and renamed a few classes
double tap CTRL and type git pull
I mean, what if I also want to add more info to it besides publicHome?
then I would just create another class right?
why?
just add the information??
wdym just add information
i think you know what variables are
soo
wheres the problem
should i make a video of me adding a variable to a class? 
uh but before you said if I wanted to store something else
I would have to create another class
unless I misunderstood it
because then i didnt have a seperate class for it
i only used Location
but now i have
so you should use that
yes yes
tysm then I also found out where I was confused
it was mainly the serialization part
but I now understand
thx for the example
👍
do you understand why its not that good to always load it from file and have separate files for each player
tbh, unsure
I mean, I was already planning on using maps
like, loading the file, and storing the data into a map
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
Separate files for each player:
Can be much and useless IG, like yay, 200 files!
Bukkit only has YAML implemented
if you'd use another lib to do YAML or JSON or whatever
you have to cache by yourself
wait that means bukkit does it my himself?
yes
Thats what Bukkit has
oh ok
and its getting cached
oh I see, if we have like other config files we use another lib for those
if you do FileConfiguration#getString, it doesnt directly load from file
and we have to cache them ourselfs
yeah
and thats when serialization comes in handy
you have type safe stuff
like #getLocation
instead of using #getLocation("blah.location")
go into your gradle-wrapper.porperties
and change 7.1 to 7.3.3
and reload gradle
k ty
ok wtf?
plugin.yml is fine tf
ok so something is copying 1+ files to the same location?
When i put the prefix {harvesterhoe_cane} it just says the placeholder
you have to set the duplicate strategy
are you using build.gradle or build.gradle.kts
.gradle
srry for the delay btw
gimme a sec
will deluxemenus add itemsadder support?
processResources {
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}```
wrong channel, use #general-plugins or #general-plugins-2 please
@worn jasper
ty
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();
I dont understand
what do you want to do
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
thats... something completely different
Something with Bungee COmponents
or if you really want to go fancy, MiniMessage/Adventure
d;bungee-chat TextComponent#hover
public setHoverEvent(HoverEvent hoverEvent)```
The action to perform when this component (and child components) are hovered over
Finally
yess
something's broken 
something with BungeeComponents
DocDex not good :(
Yeah, ive notice
https://pastebin.com/Jn3PMfY9 Any Idea how to fix this? I've tried all that i know but nothing is working.
Can you share the class code where the error is from because we only see now the error that the class is not found
posted here. forgot to send it
1.18 doesn't have PacketPlayOutTitle @echo briar
What should I use as a replacement?
To do what? Send titles?
Mhm
yes?
“Mhm” means yes.
Answer him then.
I don’t know the answer. I was answering your question.
Yup
You can just do player.sendTitle
Okay should that be directly in the place of the original class?
Yes
Kk thank you
No, sendTitle is a player method
Oh okay, how should i set that up then?
Well, where were you using the other method to send a title?
Adventure
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?
Show me where you actually send a player a title
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.
Send this class TitleUtil.java
@echo briar You can remove where you send the packets and do p.sendTitle(title, subtitle, 10, 10, 10);
you using spigot or spigot-api as dependency?
and this is better way to implement..stay with the API rather than NMS
Okay thank you!
can you show exactly where? i'm getting erros where im putting it and im wondering if im doing something wrong
show the code where you want to send the title
p is player
Why isn’t cuboid in team then?
.
Or in some sorta map
Currently just making a cuboid without any purpose
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
don't use == for object comparison
ouu Sirrr
its a get string
a String is an object
so i compare 2 string
use #equals please
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
yeah?
that's exactly what I'd expect it to do :p
lol
thx
also, variables are named lowerCamelCase, please rename your variables to mach that convention
i meant like its not printing the thing inside the conditional statement rather there is a println above it
yeah?
like, what are you trying to tell me
why shouldnt it print
your last question mark felt like that it was a question.. 😂
nah..no worries
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
what would the cutoff be for upping the max teams, eg 4 per team then make new team


