#help-development
1 messages · Page 315 of 1
minecraft is a nice visualization of what youve just done
I learned them at the same time simply because its easier to have ideas for making MC plugins
When you're doing basic Java you're kinda stuck with messing with the console or using Swing/JavaFX
i learnt both at the same time
you just shouldnt rely too much at the api itself
very much regret it
otherwise you cant think of something else than the api when you think of java
and once you have no api anymore, you wonder where the player go
and how to make a listener
"where's my onEnable?"
every selftaught spigotier once was at that point
Officialy spigotmc tuts are cringe?
they are just too bad to contribute to that
well there is no official tutorial
everything on the spigot wiki was written by members
hence the name "wiki" lol
youtube 🙏
I currently got this to parse an XML that looks like this:
public class ArchetypeMetadataParser {
@Getter List<RequiredProperty> requiredProperties = new ArrayList<>();
public ArchetypeMetadataParser(File archetypeMetadataFile) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(archetypeMetadataFile);
NodeList propertiesNodeList = document.getElementsByTagName("requiredProperty");
for(int i = 0; i < propertiesNodeList.getLength(); i++) {
RequiredProperty property = RequiredProperty.fromNode(propertiesNodeList.item(i));
if(property != null) {
requiredProperties.add(property);
}
}
}
}
I don't like this solution since my current code would also get <requiredProperty> tags from OUTSIDE of <requiredProperties>
Is there any way to get only the children of <requiredProperties> instead of from the whole document?
preferrably without XPath, but with the normal org.w3c.dom / javax.xml stuff?
basically, I only wanna get the green ones, not the red one
Check parent node
See if it's requiredProperties
@tender shard why don't you get requiredProperties and then get the children?
Because i am afraid itll break if theres two <requiredProperties>
Granted, that should never happen
Yeah thats a good idea
Should I learn Kotlin or java for spigot dev?
java
how to teleport the player synchronously?
player.teleport?
why
cuz kotlin looks cursed
pretty much everyone here uses java, you would be able to get help a lot easier
synchronously?
?scheduling
@primal goblet

its just fun myMethode

why would it need it
so i have to do
new BukkitRunnable(){
run(){
// teleportThePlayer?
};
}.runTask();
``` ?
Yes
are you in an async context?
only if you arent already on the main thread
If you're already async
and for the sake of god dont create a bukkitrunnable but use the scheduler
If you're not async you can just do player.teleport
thats what the anticheat told me to do cuz when i use player#teleport it gives me false info so banned members for no reason
java is the most basic shit you can do. with java you can expand in so many more directions. kotlin just goes its own way and abusing java on it
be a cool kid, use java
ok
rather screw that anticheat lol
kotlin is confusing
In java if you want something to be a certain way, you do it yourself
In kotlin, things are there by default and you need to disable it
Altho some things in kotlin are nice
Like null safety
optionals, defaults and placeholders goes brrr
PaperLib
no
but it's an easy way to use async features on paper without breaking support for spigot
can someone tell me if it is possible to make the zombies not raise their hand when they see the player?
i'm gonna do it
but you still want them to attack the player?
then you need NMS and remove the "raise hands" goal, if there is any
if there is none, you gotta rewrite the attack goal and only remove the raise hands part
then you need NMS, do you mean make a custom entity?
no
you can remove the "raise hands" goal from an existing entity
basically, you get the NMS entity like this:
((CraftZombie)zombie).getHandle()
and then you have an NMS zombie
that one has a public field "goalSelector"
hm
we dont have any casting format
and then you look for the raise hands goal and remove it
someone go email discord
?
when they spawn
if you wanna permanently remove it
after server restart, it'll be back though
yeah then, listen to EntitySpawnEvent and remove it there
do you use mojang mappings?
because if not, you're gonna have a bad time
?nms a cough cough
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
why?
eclipse or intelij
intelli
didn't work out
Hello i'm trying to do some custom smithing recipe and i need to check inside PrepareSmithingEvent if my recipe is correct otherwise i can't get my item with custom name and AttributeModifier
In my recipe i use a custom item and i try to use isSimilar to compare the current itemStack in the inventory with an other ItemStack comming from an Enum but isSimilar return false.
Here it is what i get when i print the two ItemStack and the two itemMeta:
I dont understand why isSimilar is false
you can create recipes with custom name and attributes just fine, without listening to any events
I know but the result get his name and attribute erased cause smithing table take them from the source item
oh huh, it always worked fine for me
https://paste.md-5.net/bokazicogu.java
why the zombie continue climbing ur hands?
Here some of my code:
public static void registerRecipe(){
ShapedRecipe ChromatinScrapRecipe = new ShapedRecipe(new NamespacedKey(Main.instance,"chromatin_crap"), CUSTOM_ITEMS.CHROMATIN_SCRAP.getItem());
ChromatinScrapRecipe.shape(" X ","YZY"," X ");
ChromatinScrapRecipe.setIngredient('X', Material.IRON_BLOCK);
ChromatinScrapRecipe.setIngredient('Y', Material.DIAMOND_BLOCK);
ChromatinScrapRecipe.setIngredient('Z', Material.NETHERITE_INGOT);
Bukkit.addRecipe(ChromatinScrapRecipe);
ShapedRecipe ChromatinShardRecipe = new ShapedRecipe(new NamespacedKey(Main.instance,"chromatin_shard"), CUSTOM_ITEMS.CHROMATIN_SHARD.getItem());
ChromatinShardRecipe.shape(" X ","XYX"," X ");
ChromatinShardRecipe.setIngredient('X', new RecipeChoice.ExactChoice(CUSTOM_ITEMS.CHROMATIN_SCRAP.getItem()));
ChromatinShardRecipe.setIngredient('Y', Material.AMETHYST_SHARD);
Bukkit.addRecipe(ChromatinShardRecipe);
SmithingRecipe ChromatinSwordRecipe = new SmithingRecipe(new NamespacedKey(Main.instance, "chromatin_sword"), CUSTOM_ITEMS.CHROMATIN_SWORD.getItem(), new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD), new RecipeChoice.ExactChoice(CUSTOM_ITEMS.CHROMATIN_SHARD.getItem()));
Bukkit.addRecipe(ChromatinSwordRecipe);
}
public enum CUSTOM_ITEMS {
CHROMATIN_SCRAP(() -> new ItemBuilder(Material.PAPER, false).addName("§rChromatin Scrap").construct()),
CHROMATIN_SHARD(() -> new ItemBuilder(Material.PAPER, false).addName("§rChromatin Shard").construct()),
CHROMATIN_SWORD(() -> new ItemBuilder(Material.NETHERITE_SWORD).addName("§rChromatin Sword")
.addAttribute(Attribute.GENERIC_ATTACK_DAMAGE, AttributeModifier.Operation.ADD_NUMBER,8, EquipmentSlot.HAND)
.addAttribute(Attribute.GENERIC_ATTACK_SPEED, AttributeModifier.Operation.ADD_NUMBER,-2.4, EquipmentSlot.HAND)
.addItemFlag(ItemFlag.HIDE_ATTRIBUTES)
.addBonusDurability(500)
.addLore("","§fWhen in Main Hand:"," §29 Attack Damage"," §21.6 Attack Speed","§fBonus Durability: 500")
.construct()),
private Supplier<CustomItemStack> item;
CUSTOM_ITEMS(Supplier<CustomItemStack> item){
this.item = item;
}
public CustomItemStack getItem(){
return item.get();
}
}```
And the result in game:
Lol that colors? Its new?
As you can see my Item dont have his custome name, ...
am I stupid, or is there literally NO information about how to load the log4j config xml / how this file is supposed to be called? https://logging.apache.org/log4j/2.x/manual/configuration.html#XML
how can i set a new direction to a sign?
how would I create a hittable NPC ?
It's what you get when you write code between
the colours changed recently
^
log4j sucks
and log4j2 is even worse
intellij's code completion is objectively better than eclipse's
and I also find it way easier to use
So yeah the only difference in my print are the itemStack size, the doc say :
This method is the same as equals, but does not consider stack size (amount).
Params:
stack – the item stack to compare to
Returns:
true if the two stacks are equal, ignoring the amount```
And i get a false result i dont undersant what is the issue
yeah
How would I create a hittable NPC?
Hello i m trying to do some custom
Is slot 40 from player inventory, OFF HAND one cuz i have been testing a plugin and looks like its not being cancelled
oh, lmao
But bukkit right? Because NMS is diff
Anyone here know how to use a HexCode to name items that are given via a plugin?
I did some looking and saw someone said to use this but I don't see how to use it to color text with a hex code: https://www.spigotmc.org/wiki/the-chat-component-api/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
§x§f§f§f§f§f§f
for #ffffff
Spigot doesn't have component api for items names
Paper does though if you're using that
My plugin relies on spigot but the server I use is paper😆
If it's a private plugin you can just switch to the paper api
Where i am momment
how can i stop players from using color codes
Depends on where they're using them
For example, signs or chat
If you're making a plugin you can just strip all color codes from the chat message
Is it possible to update a menu title without reopening a menu
Sort of
You can use the open window packet with another title but the same inventory id
Just chat, i am not making a plugin i just want to disable it from players cause we have ezcolors for chat colors
If you're not making a plugin use #help-server
ChatColor#stripColors() is really intensive a client use to have lot of memory leaks cause of that method
What about size
Assuming not since it needs a rerender client side
Just re open the inventory, dont reinvent the wheel when its already exists
🤔
I mean no need to reopen a menu for paginated menu when I could just update the title and clear the buttons and put new buttons in
Whe menu change page, they are always re opening the inventory
Because each page its a diff inventory
Not if I check the next page tho if it’s the same size I can just do nothing
What, context please
I didnt understand
Never mind I gotta head to class 👋👋
Then you can just reopen a new inventory
bump
To prevent problems with the cursor don't call the inventory close method
oh really? I have that issue tho and never find a solution
All you need to do is open a new inventory
It will replace the old one without moving the cursor
if it was just a menu with like clickable options you can just replace the inventory contents with the new contents
That is not the correct way i think
why not
When you coding you cannot mix the your logic with your view
wdym
you will have to do that at some point anyways
at some point you need to to have logic for what items to show at what time in what inventory
oh ok
what is the best way to change a name of a player? Because I think ```java
player.setDisplayName(nickname);
player.setCustomName(nickname);
player.setPlayerListName(nickname);
is it complicated?
which api methods?
do you mean I should use an external api?
The ones you sent
If you want you can do that
Doesnt make sense, trying to use a library or an api without knowing how to code
but with them it doesnt change the name above the player
how is that possible?
?jd-s
You can read the javadocs, to see everything from an api, what methods its contains, what params needs, etc
best GUI ever
Someone experienced had said on internet everything done from sun is shit
And i actually agree hahaha, looks that gui tho
Learning to read the docs will be invaluable, i promise. A quick search can get you this straight from the docs:
void setDisplayName(@Nullable
String name)
Sets the "friendly" name to display of this player. This may include color.
Note that this name will not be displayed in game, only in chat and places defined by plugins.```
you do realize that it's my fault that it looks like this right?
oh lmao
But still java guis horrible
GUIs always suck, no matter the language tbh
no at all guis, html ones doesnt suck
Html + Sass guis >>>
ugh I spent 20 minutes debugging
until I noticed I just forget to pass the GridBagConstraints to Container#add
only 20 🙏
unlikely
no
it's a standalone app that reads an archetypes archetype-metadata.xml file, turns it into a GUI, lets you fill in the values (automatically inserts the default values) and then you can use it to generate a maven project from it
41 is not offhand
also why dont you use getEquipment().getItemInOffHand()
using slot numbers is nasty and not needed
Oh you can do that?
that's possible since at least 8 years
lmao never realize
How to create working scoreboard (1.16.5) , because my code is not working
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Events.java:
package pl.playgroundhc.playgroundhc;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scoreboard.Scoreboard;
public class events implements Listener {
Scoreboard s;
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
//brodecast - global
s.createScoreboard(event.getPlayer());
Bukkit.broadcastMessage(ChatColor.AQUA + "[PlaygroundHC.pl]" + ChatColor.WHITE + " Użytkownik " + event.getPlayer().getDisplayName() + " dołączył do gry");
}
}```
s is null
Please i suggest reading about java conventions
Scoreboard.java
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
public class scoreboard {
public static void createScoreboard(Player p) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
org.bukkit.scoreboard.Scoreboard board = manager.getNewScoreboard();
Objective objective = board.registerNewObjective("Stats", "dummy");
objective.setDisplayName(ChatColor.YELLOW + "PlaygroundHC");
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = objective.getScore(ChatColor.GRAY + "Gracze online " + ChatColor.WHITE + Bukkit.getOnlinePlayers().size());
score.setScore(3);
Score score1 = objective.getScore(ChatColor.WHITE + "www.playgroundhc.pl");
score1.setScore(1);
Score score2 = objective.getScore(" ");
score2.setScore(2);
Score score3 = objective.getScore(ChatColor.GRAY + "Twój nick " + ChatColor.WHITE);
score3.setScore(5);
Score score4 = objective.getScore(" ");
score4.setScore(4);
p.setScoreboard(board);
}
public static void updateScoreboard() {
for(Player player : Bukkit.getOnlinePlayers()) {
createScoreboard(player);
}
}```
Can you correct my code?
Please use paste md5
why creating an instance if youre going to static abuse it anyways
?paste
Also read about conventions
verano answer to what i said
What? i didnt see it because this guy sent thousans of lines
.
so no t on gh?
no i dont have a base code for publishing it
lol
THANKS
Oh sorry i forget i had cups enabled
Also he is creating an instance for then abusing static
Neither using field modifiers nor following conventions, seems coding without first learning Java
welcome to #help-development
we told you
It's all?
s is null
And it's all of errors?
idk what error you get
I get non specified error
and whats a non specified error?
Not wondering to be rude, but said the truth you never learn java before working with spigot api?
Hi i have the following code and for some reason when the if (event.getSlot() != 40) if statement runs, it sends the message to the player saying "You should not have this" but it doesn't delete the item, anyone konw why this may happen.
@EventHandler
public void onMoveItem(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if(event.getClickedInventory() == null)
return;
if (/* Validation */)
return;
if (event.getSlot() != 40) {
ItemStack item = event.getCurrentItem();
item.setAmount(0);
player.sendMessage(ChatColor.RED + "You should not have this!");
} else {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + "You cannot move this item!");
}
} ```
setting amount to 0 does not remove it
Set to air
Ive used it many times elsewhere in my code and it does remove it..
ill set it to air and see if it fixes it
It does not.
obviously not, I mean you yourself just said that it doestn work
You are trying to cancel putting items on the OFF_HAND?
ive also tried putting event.setCancelled(true) in place of the setAmount(0) and that also doesnt run but the send message does
event.setCancelled(), will just cancel the event, he wont care about the item amount
What your fianl goal?
if the clicked item is not in the offhand slot remove the item
okay, mainly cancel using OFF HAND
What i having issues too
no, theres a validation block above, so its only for certain items
why dont you ijust do Inventory#setItem(40,null) ?
ill do that
Well yeah its more efficient than cancelling the whole event, isnt it?
itemstack air with amount 10 hehe
what about Inventory#setItem(40, new ItemStack(Material.AIR)) ?
did not work
wait
doesnt matter thats not even what im trying to do
What are u trying to do so?
then use whatever slot number you wanna "reset"
set the clicked item to 0 not the item in the slot
"not the item in the slot", please be more descriptive
after a tick then
Read the code. Set the item that was clicked to 0
or remove it i mean
set the current item or whatever to air
Didnt work
@EventHandler
public void onMoveItem(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if(event.getClickedInventory() == null)
return;
if (Validation)
return;
if (event.getSlot() != 40) {
ItemStack item = event.getCurrentItem();
item.setType(Material.AIR);
player.sendMessage(ChatColor.RED + "You should not have this!");
} else {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + "You cannot move this sword!");
}
}```
The "You should not have this" is being run just fine but it doesnt remove the item
Is it the one in the cursor or in the slot you are trying to remove
yeah he doesnt really describe exactly whats he want
clicked on
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
@EventHandler
public void onMoveItem(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
if(event.getClickedInventory() == null)
return;
if ()
return;
if (event.getSlot() != 40) {
event.setCurrentItem(new ItemStack(Material.AIR));
player.sendMessage(ChatColor.RED + "You should not have this!");
} else {
event.setCancelled(true);
player.sendMessage(ChatColor.RED + "You cannot move this sword!");
}
}```
still no
I learned but not many time
Because you must first learn the whole lang where you coding and then start using 3rd party libraries or apis
If not its really diff to code
Can you recommend any channel to learn java?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
give us a short video of it not working
Yeah because not working is really useless
Nah, but I wish to see it.
Well in my case im still having issues while cancelling OFF HAND
Lmao cancelling putting items via off hand slot its really painful
cuz i already cancelled putting items via keyword F, but cannot find via the slot itself on the player inventory
its slot 40
damn this is the first time I got some actually decent GUI working
nice
and it has dark mode!!!
record software?
windows 11
swing
Yes i know but its still doesnt block it
Interesting.
Isnt a tool for debugging apis?
Nah lol
💀
javax.swing is the GUI lib
my bad its called Swagger
Well java.awt is the og GUI lib, but javax.swing is ontop of it
what is a Conversation
I've worked with swing in the past. In the end I always ditched it though
It's always a high-maintainance project and usually has little benefits
idk it's the only thing where I found something like a table that supports sth like html's "colspawn"
GridBagLayout
Are there any tools to parse ItemStacks from config with support for enchants and potion effects, other than the default ConfigurationSerializable
potion:
==: org.bukkit.inventory.ItemStack
v: 3218
type: POTION
meta:
==: ItemMeta
meta-type: POTION
custom-effects:
- ==: PotionEffect
effect: 5
duration: 60
amplifier: 3
ambient: false
has-particles: false
has-icon: false
I can't expect someone to actually type/know what the different meta types are and everything ;c
If you see the bottom left corner you can see the chat message when the item is clicked
hello, I got some performance issue with my Plugin. Whenever im shooting with my gun, there is a path(superfast bullet) getting traced for a far distance. Now, the issue is that this takes insane amounts of performance since it has to load about 65 Chunks for each trace to get the range fully
@remote swallow is currently writing sth like that
you can't do shit in creative
i am
and JeffLib got something similar but it doesnt support attributes and stuff
creative menu is so different than survival that it has it's own event
it works, not with books
or attributes iirc
its been like 2 days since i wokred on it
is it public atm?
Oh that why i cannot cancel putting items on OFF_HAND slot while im on creative
Heh, brings up memories of my stupid ass using table-layout (https://github.com/Starloader-project/table-layout) for a long while. A library whose source is almost lost to time and is over two decades old.
Finding out about how to use the GridBagLayout correctly was enlightening to me
currently on github, i can probably push it as a snapshot onto a repo somewhere
omfg i feel like an idiot now. ive wasted an hour of my life, tysm tho😭
I can do that, ty mate I'll check it out
Np, creative inventory has always been super annoying to do stuff for.
(or really jitpack would work)
fuck jitpack
Also me too, because im like a clown trying to cancel the ability for putting items on that slot
ive got an account on alex's community reppo
Use repositlite, you can self host
give me like 2 min
I usually set people to survival, flying and godmode if they're in creative and need to use my guis.
cant host it 24/7
If it is maven I can just publish it to my ftp repo
u are all good, I got a reposilite instance that I use
i dont even need them to be in creative i was just in creative for testing purposes, so it worked perfectly fine after all
So? Its possible to cancel or not, because i must cancel putting items on off hand slot while being in creative
want me to keep you updated on when stuff changes?
You can try https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryCreativeEvent.html
declaration: package: org.bukkit.event.inventory, class: InventoryCreativeEvent
But creative inventory is messy.
It doesnt exists on 1.9 tho
Sure, do you versioning scheme though?
It does.
bump
my brain isnt working enough to understand what that means
It existed all the way back in 1.7.10
like do you just push everything as 1.0.0 or do you increment as necessary xd
ill probably increment as necessary
@tender shard whats the url i set, is it just https://hub.jeff-media.com/nexus/#browse/browse:jeff-media-community or am i not braining
url to upload?
Nop, same issue still not cancelling the event
should that be community for my stuff
As i said, you can try.
oh community
Creative is weird, don't try to do anythign with it.
change public to community
I must fix this tho
ohhhh
were u host nexxus?
on a vm in proxmox
oh ok
okay i think its setup
lets test
Received status code 400 from server: Repository version policy: RELEASE does not allow metadata in path: me/epic/BetterItemConfig/1.0.0-SNAPSHOT/maven-metadata.xml @tender shard
very confused
oh seems like it only allows released
one sec I'll change it to snapshots
or wait
thanks
never tihihihih
Login into the dashboard, and delete it from the repo
I already did
thanks
for everyone who asks me for an account
right, thanks
ry to upload a -SNAPSHOT now
stil getting the error
okay
ill just release this as a full version for now
so @compact haven can use it
you use gradle or maven?
<dependency>
<groupId>me.epic</groupId>
<artifactId>BetterItemConfig</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<repository>
<id>jeff-media-community</id>
<url>https://hub.jeff-media.com/nexus/repository/jeff-media-community/</url>
<repository>
hope thats correct
wait
epic
upload again, snapshot should work now
I recreated the repo so 1.0.0 is gone
ah ok
Could not GET 'https://hub.jeff-media.com/nexus/repository/jeff-media-community/me/epic/BetterItemConfig/1.0.0-SNAPSHOT/maven-metadata.xml'. Received status code 403 from server: Forbidden
uugh ok wait
ah I see, it removed the perms from the role
try again
I'll have to check which permissions I need to give
same error
now?
You should give admin to that repo?
gross why would you ever do that
do you also run your MC server as root? lol
one sec im gonna restart my ij
Not for production, but yes for staging
yikes
my brain barely works on a good day, i wouldnt even give myself admin
i would probably fuck something up
My staging severs locally runs processes as root
Even more i have seen a bot nets where their machines runs as root
💀
yeah even after restart nothing
can you publish now?
actually this SHOULD be enough I hope
nothing, just restarted ij again
did you change your password?
okay so you now have all permissions except delete
try again
oh wait
1.0.0-SNAPSHOT is there
just went throug
published
alex, small additional problem
guests don't have read permissions to the artifacts, it would seem
o

yipee
ill add attributes or that if i havent already tomorrow and then we play the painful game of trying to serialize the json from book pages
Guys this works? (plugin.yml and maven)
🤔
oh thanks :))
thats funny
Possibly system theme
Guys, using the getDataFolder().getParent() has supposed to return me the plugins/ folder, right?
Yes
how can i modify how much an item is damaged?
item.setDurability(10);
FlatLightLaf, FlatDarcula theme
Thats cool, i've heard about that themes a time ago
yeah it's awesome
Any reason why this isn't working? https://i.gyazo.com/9304258d90ac7be43421555fa5b896af.png
?paste full file
isnt repo down?
no
sk.. whatever repo
yeah but that's enginehub
that's the correct repo, and it also has version 7.0.7-SNAPSHOT
should work
Don't know if it matters but when I'm typing in it auto suggests 6.2 https://i.gyazo.com/c945dfb036d8ef31e91dde93f64a56c7.png
yea, but why would it only bring that up? Shouldn't it bring all the world guards up
its jank sometimes
it probably only shows what's already in your local repo
yeah
No, How would I download worldguard to my local repo and tell it to use that instead?
if you got maven installed, you could easily do it with mvn dependency:get
mvn dependency:get -DartifactId=worldguard-bukkit -Dversion=7.0.7-SNAPSHOT -DgroupId=com.sk89q.worldguard -DrepoUrl=https://maven.enginehub.org/repo
this would get worldguard 7.0.7 and install it to your local repo
Hello! Is anyone here familiar with towny?
why do people always ask for plugin help in help-dev
i think you maybe
is anyone here familar with any of my 21 spigotmc resources?
Apologies, I’ve just joined. I think I found the correct location.
Nah ur gucci mate
yes actually'
ive studied the entire code base for 3 weeks
Oh sick, thank you
I know several plugins where the devs themselves are actually just huge nerds who love talking about their shit
Do you happen to have a link?
if elgarl was online, i would ping hi,
.
judging the fact he used to be the dev for it
IMO btw Advanced portals plugin Dev is a really cool dude. Very happy to always support
Even gave me free reign to edit the plugin in anyway I wanted and actively helped me out adding an XP cost per distance between portals system
For a portals plugin that includes bungeee capability + a load of other cool stuff, very very unprecendentally cool of em
THANKS @tender shard That fixed it
np
im getting mad
wtf
I add the repository and dependency to pom.xml
and after repair ide, invalidate caches, etc
I still can't import BetterItemConfig
did i break something
nah its not you
I even went and downloaded the jar from nexus and decompiled
my IDE is just bricked, I fixed it
anyone know how I can pack() a JTable?
so that e.g. the checkbox column isn't unnecessarily wide by default
I tried to set the column's width to getPreferredWidth() but that didnt change anything
oh @compact haven to make sure it works BetterItemConfig.init(useMiniMessage)
just remembered about that
@tender shard can u also add an option in the archetype to have an api module. That wpuld give them a an api module, build module and the implementation module. Ofc if they want nms, those will also be included in the build module
well that'd be false by default im guessing
so I don't believe I need to call it 🤷♂️
(am looking at src atm)
well no im looking at src xd
@Getter
public static boolean useMiniMessage;
/**
* Initialize the library
*
* @param useMiniMessage decides if to use minimessage support, you must provide the library
*/
public static void init(boolean useMiniMessage) {
BetterItemConfig.useMiniMessage = useMiniMessage;
}
thats smart
ive got a lot to fix
@remote swallow is betteritemconfig urs?
it is
Oo
Sorry for saying
But it should be renamed😂
tell me anything that should be changed/add/removed
theres 1 person that uses it
i can probably just remove it
i shouldnt even say "uses"
might use
🤣Life of a small dev
it will most likely just be used by me or alex
@remote swallow I might even PR this, but perhaps refactor the thing and separate it into an instance of ItemConfigFactory or something, then BetterItemConfig would just have a default Factory with minimessage false. If you do that, then you can separate all of your ItemMeta handlers into separate classes (could be an inner class, doesn't matter) and register that as a processing part of the Factory
well considering I have a grand total of about 8 or 9
refactoring stuff
ect
once i got it finished
and hopefull working with every possible item that could exist
would be neat
got it working with a custom TableCellRenderer
what would you say is the better way to fix the effect stuff, make an enum that converts it to its correct type that would break on new potions or do i leave it as it is
open an issue on github please. Also for your other suggestion. Because first of all, I wanna get the generic gui archetype generator working, before I expand the actual spigot archetype
i.e.
ItemConfigFactory factory = new ItemConfigFactory<ItemStack, ConfigurationSection>()
.setComponentProcessing(new MiniMessageProcessor())
.setBaseProcessor(new BaseItemStackProcessor()) // Will turn ConfigurationSection -> ItemStack (type & amount)
.addHandler(new AttributeHandler())
.addMetaHandler(new PotionMetaHandler())
.build();
ItemStack item = factory.from(configurationSection);
ConfigurationSection section = factory.to(item);
---
public class PotionMetaHandler extends MetaHandler<PotionMeta> {
public boolean doProcessing(Material material) {
return material == Material.POTION;
}
public PotionMeta read(PotionMeta meta, ConfigurationSection source) {
potion.addCustomEffect ..
return meta;
}
}
public class AttributeHandler extends ItemStackHandler {
public boolean doProcessing(Material material) {
return true;
}
public ItemStack read(ItemStack item, ConfigurationSection source) {
item.addAtrribute ... source.getSection ...
return item;
}
public ConfigurationSection write(ItemStack item, ConfigurationSection target) {
return target ... set String ;
}
}
that's what I was thinking of
definitely an overcomplication for a simple utility, but if it organizes & you like it 🤷♂️
(would also debate just removing doProcessing altogether, an early return in read/write would work fine)
ive got no idea what that does
gradle plugin when
also if your questioning the reason i convert the config section on fromConfig to a Map<String, Object> its mainly for the .containsKey
lol I just thought "yaaay it's basically done!" Then I realized, there's no "Start" button lmao
@compact haven if you wanna pr anything go ahea, ill probably attempt to fix and organize that more tomorrow probably
ive been putting off having to deal with json stuff
Why is your item config factory generic with configuration and item
Also it's weird that factory has some state
Assuming it's some kind of factory pattern
Hello is it possible to edit an item before pickUp ? I have try that, i know the function "editItemsAttribute" work well cause i use it at other time and everything seem fine but it seem i still get the origin item
@EventHandler
private void onGetItem(EntityPickupItemEvent event){
if(!(event.getEntity() instanceof Player)) return;
ItemStack[] itemStacks = new ItemStack[1];
itemStacks[0] = event.getItem().getItemStack();
editItemsAttribute(itemStacks, event.getItem().getWorld());
event.getItem().setItemStack(itemStacks[0]);
}```
Why the array
dunno if it returns a copy or what
Cause my function take an array for other usage
just do ItemStack[] stacks = { event.getItem().getItemStack() } then
is it actually modifying the 0 ith element?
Just make funct take varargs
...smth
Still yes it's strange to make an array of 1 element but it's not what i'm trying to understand here
.
@EventHandler
private void onGetItem(EntityPickupItemEvent event){
if(!(event.getEntity() instanceof Player)) return;
Player player = (Player) event.getEntity();
ItemStack[] itemStacks = new ItemStack[1];
itemStacks[0] = event.getItem().getItemStack();
editItemsAttribute(itemStacks, event.getItem().getWorld());
player.getInventory().addItem(itemStacks[0]);
event.getItem().remove();
event.setCancelled(true);
}```
This work, so yes element 0 is edited.
Just dont know why the element on the ground seem not take the changes, so add manually the item to the inventory and remove the item from the world seem to fix the issue
just show the editItemsAttribute method
asCraftMirror() returns a CraftItemStack backed by an NMS ItemStack. Changes made to the stack will apply without having to re-set it
asCraftCopy() returns a copy
Things like player.getInventory().getItemInMainHand().setType(Material.POTATO); for instance just works
Internally it returns a mirror
so a mutable view, ok
Basically, yeah
It was super weird recently someone else had the same issue and couldn't edit the itemstack properly.
Instead he just removed the itemstack and added it to the inventory himself.
what
I agree. What?
He's talking about creative inventories
uh oh
I told him it's difficult to do just about anything with them.
Yeah Jan told us that is really diff to cancel putting items in OFF_HAND via inventory slot
That why i asked you that question
Verano
You need to give people contexts before asking a question
?askgoodquestion
Lmao i really explained what i need
I just need to cancel putting items on OFF_HAND via inventory slot, its not so diff to understand
🤔
Most people would assume the normal inventories given that sentence alone. Not a creative inventory.
You need to give proper context, letting them know it's a creative inventory for example would be useful context.
Context is key.
Now i have been some hours trying to solve it
Im currently writting j-unit code because i must fix this issue for the next week. Cuz i need to continues working on my others projects haha
I think that jUnit will make me lost less time
Lmao definitly its something weird, the logs messages are not apearing
Fairly sure that the issue actually lies down in client -> server interaction, the client isn't really nice in playing with the server when you're in creative in to how much it sends to the server, as well as the nms code for handing such stuff not really playing too nicely either as the server doesn't really care too much about what a creative person does... (hence why all the creative mode hacks exist...)
From MD5 below
In creative the client just sets slots, it doesn't actually click or anything.
As I aaid, you can't cancel creative clicks because the client controls creative. Its not server side
okay, to conclude that definitly wont be posible
Not with events, you can probably just make a scheduler that clears everyones offhand slot, but seems suboptimal.
Suboptimal and working is better than not working at all
The obvious solution is to not put them in creative mode in the first place. Is it absolutely necessary in this case?
Its for like a build mode
That why its put the player in creative, that the reason of putting in creative
how can I align the contents of this jpanel to the top of the tabbedpane D:
Yo mean the big spaces right?
You should padding, but take care you will have to care on each parent nodes
Atleast in version 5
Version 5 of what
Html 5
This is swing.
doesnt swing use Html?
I thought that swing was a tool for creating a panels based on html components
Totally diff from C# interfaces, where they use directly html 5
Swing can do some html stuff, but no.
Yeah C# interfaces are mainly html components, like androin does for example
No they're xml components
I have seen some apk, that contain a resource.jar which inside contain a MVC (View Model Controller)
Maybe you refers to blazor?
Swing is more like C# Forms library
Oh right, now i understand, thanks for being pacient and explaint it
Any another will going to quit me alone 😂
can't you use setAlignmentX?
oh u mean u wanna move it up
note that the contents are a GridBagLayout
yes, Y is usually height
at least that's the case in a gridbaglayout
hm I'll try x align
but where? on the tabbedpane, or the inner jframe?
nah x won't make sense
Why dont you just use Flexbox, its better than grid layout
Cause this isn't css. xd
weird, flexbox is not a css thing or yes?
can u send the repo link so i can have a look?
isnt just a view design?
i dont use any gridlayout
sure
it's a GridBagLayout
class is Dialog.java
I like your commit messages
"updated" 
as if I'd remember what I added half an hour ago
it's true, though
usually I commit "."
if it's only stuff for myself
Why many ppl dont follow, conventional commits
Because thats a lot of effort
I think that repo will look better using them
Especially if it's a private repo
Weird me that work with clients i use them always, just for private project too
Because its really useful to guide your self
I mean yeah but it's just preference
because I don't commit every single change. I commit stuff before I do stuff that might break everything
But I do not criticize obviously, there are colors for every taste.
so I commit when I think "hm maybe I need to go back to this state"
You should be able to anchor your gridbag layout, alex
It may be center by default
Sorry for asking this, but is spigot stash public software?
PAGE_START should be top middle, although I don't know what GUI framework you're using
He uses Swing
I dont see any anchor method or field
what's it called?
Mmmm, maybe I'm thinking of constraints
Yeah, it's constraints. Disregard
Alternative would be to wrap your gridbag in an anchor pane
Does swing even have anchor panes? Surely it does
I'm more of a JFX kinda guy
Isn't swing obsolete because of JFX?
hm AnchorPane doesn't have any add(Component) method
and the constructor also doesnt take a Container
i dont know
Not really.
They're useful for different things.
Pretty sure tons of projects still rely on spring anyways.
Yeah that looks far better than the default lol
Not that looking better than the default swing theme is a challenging task
I just always use whatever shows up first on google when I google gui stuff
java fx has a gui builder etc and supports css.
what about creating subpanel?
I have a plugin saving a bunch of data to a config when it disables so that my data isnt lost from the plugin if the server shuts down: ```world: []
hashmap:
advancementNumber: 0
worldborderSize: 8
playerNumber: 1
netherBoolean: false
strongholdLocation:
==: org.bukkit.Location
world: world
x: 7.154603860631729
y: -27.88128824248659
z: -49.485469014625224
pitch: 0.0
yaw: 0.0
array:
players:
- !!java.util.UUID '7231340b-015c-4b08-b539-8c126a90fcd0'
advancementName: []
its giving me a constructor exception on this line:- !!java.util.UUID '7231340b-015c-4b08-b539-8c126a90fcd0'saying this in the server console:org.yaml.snakeyaml.constructor.ConstructorException: could not determine a constructor for the tag tag:yaml.org,2002:java.util.UUID``` it starts up fine the first time but after disabling the plugin, if it saves a player uuid at all, it does this and isnt able to enable the plugin, is there a way to make it not do this?
Just save the uuid as a string.
the first bit of code is the config it saves after i join the server and disable it
thatll fix it?
ye
why does it do that when i save the uuid?
Cause UUID is not serialized properly.
oh alr thanks
yo @compact haven you working on a pr atm? just wondering before i do anything just to get a new pr when i finish
almost works
align it to the left
how
has alex became jacek
setAlignmentX does not works
No, it probs wont be for atleast a day if I do, I'll let u know if I start one
alright, have fun with it
i wont
i wonder if i should add atribute stuff and fix book pages now
or do that after
GUIs are a pain
yes
yeaa
also why the heck does this happen
darfrick?
players:
- - 7231340b-015c-4b08-b539-8c126a90fcd0
- 7231340b-015c-4b08-b539-8c126a90fcd0``` when i reload the stop the server after joining the game a few times, the config saves the uuids as this, its pulling the whole line when i get the uuid string for some reason, how do i remove the - from the string or just stop it from saving like this entirely?
it must have sth to do with the dependencies tab, because without it, everything works as expected
what's your code to save the UUIDs?
public void onDisable() {
getConfig().set("hashmap.advancementNumber", advancementNumber.get("advancementNumber"));
getConfig().set("hashmap.worldborderSize", worldborderSize.get("worldborderSize"));
getConfig().set("hashmap.playerNumber", playerNumber.get("playerNumber"));
getConfig().set("hashmap.strongholdLocation", strongholdLocation.get("strongholdLocation"));
getConfig().set("hashmap.fortressLocation", fortressLocation.get("fortressLocation"));
getConfig().set("hashmap.netherBoolean", netherBoolean.get("nether"));
getConfig().set("array.players", players);
getConfig().set("array.advancementName", advancementName);
saveConfig();
}```
idk if theres a more efficient way to do it or not
what is "players"? a string list?
this
then you must have added a string that starts with "- "
how do you load the UUID list?
everytime a player joins, i run this in my player join event CaptiveMC.players.add(join.getPlayer().getUniqueId().toString());
that should work fine
and before i run that, i check if their uuid is on the list
I'd load save a UUID list like this:
// save
getConfig().set("array.players", uuids.stream().map(UUID::toString).collect(Collectors.toList()));
// load
List<UUID> uuids = getConfig().getStringList("array.players").stream().map(UUID::fromString).collect(Collectors.toList());
so i kinda need the list
i save the uuids to an array cause i want all players who have ever joined the server
why do you use an array if you already got a list though
does this get all the uuids who have ever joined the server? not just ones online?
and wym
no, that gets all the UUIDS that you have saved inyour config
to get the UUIDs of everyone who has ever joined, you can use Bukkit.getOffilnePlayers
oh yeah i forgot that was a thing
well theres still this issue
it doesnt let me save uuids for some reason
altho your method might work cause i just saved the array of uuids i saved before
List<String> items = RoleplayItems.getPlugin().getConfig().getStringList("items");
for (String i : items) {
Bukkit.getLogger().info("Printed " + i);
items:
- DIAMOND_SWORD
- NETHERITE_SWORD
- STONE_SWORD
any reason why this only gets diamond_sword and nothing else?
List<UUID> uuids = Arrays.stream(Bukkit.getOfflinePlayers())
.map(OfflinePlayer::getUniqueId)
.collect(Collectors.toList());
is that config from your .jar file or from the plugin data folder?
.jar file
then you probably have a config in your data folder that only contains diamond sword
items:
- DIAMOND_SWORD
- NETHERITE_SWORD
- GOLDEN_SWORD
- STONE_SWORD
this is the one in my data folder
and it still only prints out diamond_sword
wack
oh wait i just looked at the spigot docs for getOfflinePlayers, its exactly what i need lmao i am stupid
for some reason i just assumed that it gets the offline players rather than online players
what does map and collect do
map basically turns an object into another
in this case, an offilne player into their UUID
map converts to stream from OfflinePlayer to UUID, collect collects them into a List<UUID> for u
oh thats neat
Stream API 👍
so in this case i would do uuids.map and uuids.collect for these?
wasnt there someone in this discord that hated streams? was it imajin?
for example:
String[] names = new String[] {"mfnalex", "jesus"}
List<String> UPPERCASE_NAMES = Arrays.stream(names).map(String::toUpperCase).collect(Collectors.toList());
map now turns the string into an uppercase string
and collect(Collectors.toList()) turns the Stream<String> into a List<String>
map must be called on a stream
oh alright
okay ill try this and then save my config a few times to see if i clone myself in the plugin again brb
should i be using a list when it comes to this? or am i not calling the config file correctly
What are you trying to do?
Copílot be like
i have a command that gets an item specified in the argument, a list gets the contents of the "items" category in config.yml and then a for loop goes through all of it
inside the for loop there is an if statement that checks if the item specified in the argument is listed in the config file
i just understand you have a command which takes an argument
i want the command to check if the argument inputted is listed within a config file
oh ok
Your input will be a string?
If yes, you can use Config#getStringList("path") and check if List#contains(input)
List already have the posibility of doing List#contains() for checking if something is inside of it, rather than looping over it
Contains do same for loop internal anyway
Right i was trying to tell that
and how do i not check for case sensitivity?
List#contains() will check if the input equals to any value in the list, it wont check for upper case or thins like that
Make your own loop and use .equalsIgnoreCase
"not check"
I would assume "how do I not check for case sensitivity" means check with case insensitive
So let say:
input is "hello"
List is: "Hello"
if you do List#contains("hello") will return false, because it just will check if any of the properties equals to your input
Gettomg the name of an inventory in 1.19?
player.openInventory.topInventory.title
``` isnt a thing
name is in the view
no thats kotlin...
get the InventoryView
from there you can get the title
Whats the method for that?
or does Player#openInventory only return an open chest inventory
player.getOpenInventory().getTitle()
openInventory(Inventory) also returns the newly created InventoryView
Also is there a way to compare a component and string
is there a way of giving an advancement without using Bukkit.dispatchCommand(player, command)
Yes, via spigot api itself, not running a cmd
get the player's AdvancementProgress, then get the remaining criteria and award those
how so
do i just get the progress of the advancement i wanna award?
{
Player player = null;
Advancement advancement = null;
AdvancementProgress progress = player.getAdvancementProgress(advancement);
progress.getRemainingCriteria().forEach(progress::awardCriteria);
}
also is the criteria the "minecraft:story.root" stuff or is that the advancement
or with a normal loop:
AdvancementProgress progress = player.getAdvancementProgress(advancement);
for(String remainingCriterium : progress.getRemainingCriteria()) {
progress.awardCriteria(remainingCriterium);
}
oh wait that just awards it without getting the criteria
so i dont need to list the criteria i want awarded?
How would i cancel opening inventories, which are not player inventory? Because i have cancelled the menu open but when you open chest it still makes the sound*
you just award the remaining criteria
alright ill try it, thanks
cancel the playerinteractevent when rightclicking a chest
Hmn, okay, and what about i need to cancel every gui interaction?
Because i simply need to cancel any way of putting/taking items from any inventory, which is not the player one
how do i get the advancement to check the progress? im using Bukkit.getAdvancement() but idk how to format the key in the () to get the right advancement
which advancement do you want to get?
eye spy
story/follow_ender_eye
so ik theres minecraft:story/follow_ender_eye
one sec
alright
Bukkit.getAdvancement(NamespacedKey.minecraft("story/follow_ender_eye"))
that should do it
alright ill try it
hehe it works, that was the last thing i needed to fix in my plugin
i now have a working beatable plugin version of the captive minecraft map from like 1.12 i think
Is posible to execute code when you clikc a component? Instead of running a command
just create a command executor and then make that one do your stuff
@tender shard found a bug
yes kinda
let is run a command that is like /<uuidhere>
or /safkjgenw <uuid here>
thx, will be fixed in 20 seconds
fixed
then use the command pre process event to intercept the command, parse the uuid and then you know what to run
ty
also how do i use the gui ur making?
also i think mockbukkit was set to false but it still set it up
gonna double check
it's true by default
it's the only thing true by default, since the default maven archetype also generates unittests
looks good to me 
what is a Conversion
what are you asking about?
that
ik i just found the method yday
ohh conversation
it's done using the chat
and it's like /msg
No
where you reply
it has nothing to do with normal messages
