well anyone can do it, just have to understand the stuff you have at your disposal is all. There was a lot of information that was not saved because it was unnecessary, so for example only coords were saved because they are smaller, and they were saved in a similar fashion mojang does which is yxz because in terms of looping, y is smaller and that is good for your outer loop
#help-development
1 messages · Page 581 of 1
may I PM you for some more question about these stuffs?
also, they were able to apply error correction too
the nifty part I love about memory mapping is that the OS will take care of saving your file if the application just suddenly quits 😛
Ah error correction is something I should really start implementing in my plugins
i forgot how i can get a List of String from a configuration file like this:
test: 5
test2: 7
...
test82: 972
the list shold be like test, test2, ..., test82
iirc it was a configuration section or something
ConfigurationSection
getKeys()
false?
yeh
Well, this is not working for sure
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
Inventory draggedInventory = event.getInventory();
Inventory topInventory = event.getView().getTopInventory();
if(draggedInventory.getType() != InventoryType.PLAYER) return;
if(topInventory.getType() == InventoryType.PLAYER) return;
if(!KingUtil.isCrown(event.getOldCursor())) return;
event.setCancelled(true);
}
thanks
sure, but I think it would be better if you pinged me here for such things because I am not the only person knowledgable on this and I am not always available
so not only will I still see it, but it allows others to provide input as well
for now it need to know how these think work :l
groundUp":true,"bitMap":31,"chunkData
Well this is it. You also link that with using differential time stamps, you can actually squeeze an entire proper CoreProtect level action log down to 64bits
Thats Player, Action, Coordinate, Time etc
yep
that was the other thing I showed them, was how to utilize bitmasking
to squeeze info down
With my napkin maths and bumbling around, you could probs get a 10GB file down to less than 600Mb
well depends how much overall info is in that 10GB
*as in the current SQl based systems used by a lot of loggin plugins
most of the time its 10GB because there is too much empty space everywhere
like bytes having only half the bits of information stored in it and not using an entire byte
in that case, you could squeeze 2 pieces of info in a single byte
yup
This is sort of the bit im a wee bit upset about in our communities (including paper). Noone has sat down and just... done it...
We still working on "really respectable and renown" plugins that, in reality, could be 10x better
fyi, bukkit would have had auto correcting chunks if they accepted my PR some years ago when I was part of the bukkit dev staff 😛
they rejected it because they were lazy and didn't want to maintain it even though it wouldn't be difficult
shrugs
Is what it is.
Hey Frost! I noticed that you've been involved in discussions on similar topics before. Would you mind lending me a hand, please?
the only more part about them rejecting my PR wasn't just they didn't want to maintain it, it was that they acknowledged it was a good idea to have it and that it should instead of the current implementation of just crashing like they had it
you need to also listen for the click event
still have no idea how to load a chunk :l to modify its block
only thing that is annoying with messing with inventories depending on what you are trying to prevent lol
parity data go brr
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(event.getClickedInventory() == null) return;
if(event.getCurrentItem() == null) return;
if(event.getClickedInventory().getType() != InventoryType.PLAYER) return;
if(KingUtil.isCrown(event.getCurrentItem())) {
if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
event.setCurrentItem(null);
if (!KingCycleTask.isRunning())
new KingCycleTask((int) KingCycleTask.DEFAULT_DURATION.getSeconds(), false);
}
}
}
I'm currently working on preventing the specific item from being dragged to another inventory altogether
?
and you registered your events?
pretty sure I did some checks to move inv contents within their own invs
few months ago
I am thinking its probably going to be something to do with their static methods
but I am not entirely sure
Yes, the code prevents me from dragging using the Shift key directly, but when I try to do it manually, it still doesn't work
Also, you are testing while in survival correct and not in creative mode?
sweet
keyhole surgery?
no I had a tooth extraction
oh eww
yeah got to ask this now since many people been testing their stuff in creative and not realizing it causes things to not run the same
Its happened a lot more often ive noticed..
gotta do the math but the whole procedure was like 100 bucks
Oooft
yep
they let me listen to music for the half hour it took
even put a mask over my eyes so I was comfy
8/10
Ah yes, music helps me when some mad man is chunking into my gums with a drill
1000%, re-tried just now
Nah it was no drill
Oh shit they used an ice ccream scoop?
just anasthesia and some strong pliers
just making sure
Anyways, I would add some debug messages in your code for the events
they almost choked me out a couple times but I'm alive
their ice packs are garbage tho
Might end up adding the smallest sanity check in and put a universal "if you do a command in creative mode, the server sends you a big obnoxious title reminding you you are in creative" lol
so you can see what exactly is or is not being executed I would also temporarily just comment out your static methods so to be sure it isn't interfering
Oh shit yeah they could be failing.
Oh
Ohhhhhh
Frost we havent asked the first and most holy of questions
...
have you checked the console to see if you are getting errors
is shrek god?
Thats not a question. Its a statement
I gotta write a search index post about debugging and reading exceptions
I also gotta shave
and get some lunch
lol, I generally don't care because doing this helps them understand how to debug anyways 😛
aka literal soup because I can't eat anything else for the next couple days
MockBukkit plz ong 🙏 More people need to learn about our lord and saviour
Surely teaching them how to read stack traces of errors is better to how to debug lol
not everything generates a stack trace
or even an error
futures
True true.
MockBukkit it is then
lmao
how do i set the final dmg in a dmg event
setFinalDamage or something
cus i want to ignore armor aswell
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
Inventory draggedInventory = event.getInventory();
Inventory topInventory = event.getView().getTopInventory();
System.out.println("Dragged: 1");
if(draggedInventory.getType() != InventoryType.PLAYER) return;
System.out.println("Dragged: 2");
if(topInventory.getType() == InventoryType.PLAYER) return;
System.out.println("Dragged: 3");
if(!KingUtil.isCrown(event.getOldCursor())) return;
System.out.println("Dragged: 4");
event.setCancelled(true);
System.out.println("Dragged: 5");
}
even with mockbukkit there is still some code it won't catch because the code could actually be correct, but not correct in how you want it to check or run
I think the problem is not the static-methods usage
if you click an item into an inventory, event.getInventory will return that
but then you can put stops in and check the areas ur having problems in with debug mode
basically it returns the inventory that was clicked
Minecraft Chunk processing
OH HAHAHAHA
Get TOP inventory
Chief
buddy
pal
Ur top inventory is never going to be a player
I think I might see the problem
could just set the dmg and just set the health to current health - final dmg?
Inventory source;
Inventory target;
ItemStack item;
Inventory top = event.getView().getTopInventory();
Inventory bottom = event.getWhoClicked().getInventory();
if(event.isShiftClick()) {
source = event.getInventory();
target = (source == top ? bottom : top); // opposite
item = event.getCurrentItem();
} else {
target = event.getInventory();
source = (target == top ? bottom : top); // opposite
item = event.getCursor();
}
bit stupid
the inventory you are trying to prevent dragging is the inventory that isn't the players correct?
I'm trying to implement a restriction to prevent players from moving a specific item from their inventory to another one
And you are checking to see if the TOP inventory is not a player
Its always going to be not a player
so returns
without doing jack shit
if(topInventory.getType() == InventoryType.PLAYER) return;
==
yeah, it's useless, but I was desperate
lol ah so you caught this too
remove the checks where you are returning unnecessarily
would it be possible to make a 3x3 cube rotate
becuse this can cause the rest of the block of code to not run
I have my plugin.yml what?
Not in your jar it looks like
yh ik but why?
version: '${project.version}'
main: me.psikuvit.betterdragonfight.BetterDragonFight
api-version: 1.13
Yeah alos @green prism where is the crown code. I DEMAND CROWN CODE xD Lmao
How are you building the plugin
artifact
Use maven or gradle
doesnt work since now when u kill something/someone it doesnt give YOU kill credit
So you've used maven wrong for years?
ok done
,_,
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
Inventory draggedInventory = event.getInventory();
Inventory topInventory = event.getView().getTopInventory();
System.out.println("Dragged: 1");
if(draggedInventory.getType() == InventoryType.PLAYER) return;
System.out.println("Dragged: 3");
//if(!KingUtil.isCrown(event.getOldCursor())) return;
System.out.println("Dragged: 4");
event.setCancelled(true);
System.out.println("Dragged: 5");
}
no I never used Artifact I didnt know that it doesnt work like maven
oh yeah
welcome to InventoryDragEvent
where if you move a single pixel when dropping an item
it fuckin counts as a drag and clickevent doesnt fire
listen to the drag event and do crazy frog checks
Lemme rephrase,
How do i set the final damage in a EntityDamageByEntity event,
i want to ignore armor and stuff like that.
Setting the dmg to 0 and just setting the health doesnt work well
your type is incorrect
the current inventory in that gif, is a chest inventory not a player inventory
so you need to make use of the methods of checking bottom or top inventories
@livid dove see example right here where mockbukkit wouldn't catch this if this turns out to be the problem. The check coded is valid, just incorrect in what they need to check for 😛
do you have some code for us to look at?
?paste
what happens when you set the damage?
or is it that the damage being applied is being hindered by the armor?
this is the output when hitting someone with full netherite
so final damage needs to be higher?
yea
then it would appear your math is flawed in that then
I am not sure how much higher it needs to be, but if it needs to be higher then the initial damage I would add a check in there to ensure final damage isn't equal or less then the initial
ill show this
to help with your math
the math isnt wrong
its just that minecraft still applies modifiers after setting the damage
like armor and stuff
that means your math is wrong because you are not factoring the modifiers
you can easily get these modifiers and counter said modifiers
well without modifying armor stats, you need to
I want to make a custom player wrapper like this: public class CPlayer implements Player
But it wants me to implement all the methods.
Is there an easier way to make a wrapper for the Player object?
(So I can use CPlayer cplayer = (CPlayer) player)
also
completetly different thing (kinda):
How do i make a weapon have a longer hit cooldown
implement the methods it wants, just because you have to implement the methods doesn't mean you have do anything different with them, just plug the return stuff that comes from the player object or don't use those methods
it wants to implment all the methods in the player class
thats fine?
and all the methods return null when i implement it
also fine?
do you need them to return anything?
if so, make them return something
otherwise, leave them null lol
but you can just get those values from the initial player object
make your custom player object take in as a parameter the player object
weapons have a hit cooldown?
you mean the interval between swinging?
For example after the implementition:
@Override
public String getName() {
return null;
}
i mean more like the attack speed
yea that
you will have to modify the attributes or modifiers of the weapon to change its attack speed
attack speed should be higher I think to make it slower?
or maybe its lower, either way you need to change that
and I believe you will need NMS for that
if your custom player object takes in the player as a parameter, you can easily plug in player.getName() as the return
this should set the attack speed to 0 right? if its a wooden sword (default 1.6)
possibly, I haven't messed with attributes in a while
but I did forget that the API has some attributes related things
what odesn't work about your recipe you aren't even putting it inright it seems
im sure it is this model bcs i've putted this mode in gui
also
also there is no rename no lore
This is a default minecraft recipe
I assume they know that?
Sounds like youve wrote a bad unit test imo.
Youd write tests for each scenario
OH TRUE
true
any idea how i can hide player name tags with permissions?
player.hidePlayer();
the name tag on the players head right?
Teams
what about packets?
even wurse it doesnt do anything xD
Then teams using packets
well yes and the tests are only as good as the code used to check such things, but I was just saying there is at times where the code is correct and doesn't produce errors but its simply what it is being check is actually wrong lol
You don't need packets for teams though
yea right, thanks
Spigot api can do what you want
Oh yeah I agree. But as said, good unit tests set up are imo the best way to start a new project.
Like before you even write code, you write all the tests for a system as it gives you a good idea of what ur even wanting to do 😄
Its swings and round abouts though haha Not a hill I wanna die on
but there is a problem, am i be able to see the player names? i want to hide it for other players
?
I never make test units for my plugins lol
i want to see the player names with permissions, for example if i have test.test permission i can see the names
Its personal preference haha
but if i don't have the permission i can't see any name
Are you trying to make a traitor sorta game?
a roleplay based gamemode
Pitch it, sometimes there might be a better solution than the one ur tunnel visioning on ^_^
Have one scoreboard per player or group. Then in that scoreboard set everyone that you want to see in one team and people you don't want in another. Then simply toggle the nametag visibility for other teams
I call it "finding the triangle".
You're trying really hard to find the right shaped square to solve ur problem, when in reality, you might of been looking for a triangle all along
how can I stop the ender dragon from going to 0, 0
this is EnderDragon class from nms
?conventions
mine?
wait why im not using a valid namespaced key
They should be lower case and they can't contain spaces
It hurts to watch these names
#help-development message
any help in modify minecraft raw chunk data?
What part do you need help with
decode the chunk data :l
You've already gotten all the information you need for that though?
I want to remove the layer 0-5
:l yes
the reference above is every packet that player receive in a few seconds
How can I ensure that the InventoryDragEvent is consistently triggered?
Nope
It is
you just aren't being consistent with your clicks
you cannot move the mouse at all between mouse down and up if you don't want it to fire
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
Inventory draggedInventory = event.getInventory();
Inventory topInventory = event.getView().getTopInventory();
//if(!KingUtil.isCrown(event.getOldCursor())) return;
event.setCancelled(true);
}
Should be always cancelled
are you also listening to the click event?
cause the drag event isn't fired if the mouse doesn't move
any help pls :l
you have to listen to both events if you want to capture all inventory manipulation
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(event.getClickedInventory() == null) return;
if(event.getCurrentItem() == null) return;
if(event.getClickedInventory().getType() != InventoryType.PLAYER) return;
if(KingUtil.isCrown(event.getCurrentItem())) {
if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
event.setCurrentItem(null);
if (!KingCycleTask.isRunning())
new KingCycleTask((int) KingCycleTask.DEFAULT_DURATION.getSeconds(), false);
}
}
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
Inventory draggedInventory = event.getInventory();
Inventory topInventory = event.getView().getTopInventory();
if(draggedInventory.getType() == InventoryType.PLAYER) return;
if(!KingUtil.isCrown(event.getOldCursor())) return;
System.out.println("Dragged: 4");
event.setCancelled(true);
}
[18:38:08 INFO]: [CrownSystem] [STDOUT] Dragged: 4
right, and you are wondering why they aren't all canceled. its cause you aren't canceling the click event?
so its only cancelling the drag event
Click event cancels shift-drag clicks actually
I am trying to prevent players from dragging out of their inventory a specific item
yeah, I understand. but you also have to cancel the click event for that item, because they can move the item while only firing the click event
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(event.getClickedInventory() == null) return;
if(event.getCurrentItem() == null) return;
if(event.getClickedInventory().getType() != InventoryType.PLAYER) return;
if(KingUtil.isCrown(event.getCurrentItem())) {
if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
event.setCurrentItem(null);
event.setCancelled(true);
if (!KingCycleTask.isRunning())
new KingCycleTask((int) KingCycleTask.DEFAULT_DURATION.getSeconds(), false);
}
}
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
Inventory draggedInventory = event.getInventory();
Inventory topInventory = event.getView().getTopInventory();
if(draggedInventory.getType() == InventoryType.PLAYER) return;
if(!KingUtil.isCrown(event.getOldCursor())) return;
System.out.println("Dragged: 4");
event.setCancelled(true);
}
It works, sometimes
lmao
Any idea?
?paste
Probably an issue with the drag event
Add some debug messages
System.out.println("Dragged: 4");
It works 2 times out of 10
Because the drag event isn't a click event
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if(event.getClickedInventory() == null) return;
if(event.getCurrentItem() == null) return;
if(event.getClickedInventory().getType() != InventoryType.PLAYER) return;
if(KingUtil.isCrown(event.getCurrentItem())) {
if (event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY) {
event.setCurrentItem(null);
event.setCancelled(true);
if (!KingCycleTask.isRunning())
new KingCycleTask((int) KingCycleTask.DEFAULT_DURATION.getSeconds(), false);
}
}
}
A lot of what you're doing in that gif is clicking. The reason it only works 2 of 10 times is because you're likely accidentally sliding your mouse when placing it
if (!KingCycleTask.isRunning())
new KingCycleTask((int) KingCycleTask.DEFAULT_DURATION.getSeconds(), false);```
This screams bad design
lmao, you're right
How can I prevent any possible case?
Most things are covered by the click event with different actions
Though you really only need to be cancelling dragging and clicking
So... something like this?
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getClickedInventory() == null) return;
if (event.getCurrentItem() == null) return;
if (KingUtil.isCrown(event.getCurrentItem()) && event.getClickedInventory().getType() != InventoryType.PLAYER) {
//event.setCurrentItem(null);
event.setCancelled(true);
**Censored**
}
}
Is there a method to verify the destination inventory for the item being moved by the click action?
Well #getClickedInventory() would give you that
How you choose to verify that is up to you
(Don’t use holder)
I would like to do the reverse thing, block the item transfer from the player's inventory to another inventory of another type but still make it possible to move within one's own (armor slot included)
This code does exactly the opposite unfortunately
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getClickedInventory() == null) return;
if (event.getCurrentItem() == null) return;
if (KingUtil.isCrown(event.getCurrentItem()) && event.getClickedInventory().getType() != InventoryType.PLAYER) {
//event.setCurrentItem(null);
event.setCancelled(true);
}
}
how to check if an item has a tag ?
i wanna check if an itemstack has the org.bukkit.Tag.ITEMS_TRIMMABLE_ARMOR
Tag#matches iirc
oh i think i found https://i.imgur.com/yGZ4VmZ.png
Tag#isTagged
i'm unsure of what parameter i pass tho tbh
it's indicated a generic type
Do i put ItemStack, Material ?
i guess itemstack
i'll try and see
doesn't work
Material
ooo
thx
yeah im dumb
T refers to the type that is between <> for my specific tag
idk why sometimes my brain is in outer spac
Is SQLite good?
It all depends on what you want to do.
using it instead of hashmap
wdym
using a hashmap instead of a database?
thats a pretty weird comparison
better in what way? memory footprint? look up speed? code efficiency?
You do understand that SQLite is a binary file storage format and that hashmap is not a file format of anykind and is a collection that only exists in memory?
ok, thnx
Well as of late, we been having people who have been missing the obvious so just wanted to make sure it was understood
if you want permanent storage for a lot of data, use a database, if you just want to store some valuea at runtime use a hashmap
fair enough
ok
sometimes its hard to come up with obvious things that people have misunderstood though
well, you would use SQLite because you maybe want to save some information in a more permanent way IE if server restarts you can re-obtain it again
so SQLite for permanent big data storage.
hashmap for things that needed only for time
While you could definitely put big data into an sqlite file, it generally suffers when you do so because it isn't designed for super large data sets
ok
more like permanent "not-so-big" data storage
In my entityDamageByEntity event i now try to take care of modifiers like armor but it still doesnt output the correct dmg, so how would i have a dif way of setting the absolute final dmg of the event?
ignoring armor modifiers and stuff
Highly recommend just hooking an existing plugin and adding what you want
Why can't I cast ArmorMeta to ColorableArmorMeta ?
ColorableArmorMeta is a subinterface of ArmorMeta
ColorableArmorMeta only applies to leather armour
So if you're not doing it to leather armour, it won't let you
before assuming that you can cast to something, you should first check if its an instanceof
if it passes the instanceof check, you can cast it
otherwise if it fails you can't
ok could i make a class such as:
possible for non leather armour too, (i implement the methods specific to leather armor myself if they don't exist)
while still working for leather armor
I don't know what you're trying to do lol. You didn't give us a goal
uhm ok hold on,
its hard to formulate haha
I want a class which is extremly alike ColorableArmorMeta, but compatible with non leather armour too (I specify myself what the methods getColor and setColor should do if they are not leather armor,)
Okay, so like frostalf said, you can check if the meta is instanceof ColorableArmorMeta before casting and doing something with it
How do I get an instace of a EntityDataSerializer for a SynchedEntityData#register
public void setColor(Color color) {
if (meta instanceof ColorableArmorMeta colorableMeta) {
colorableMeta.setColor(color);
} else {
// Do something for non colorable armor if you want
}
}```
ah ok, thanks
so meta would be of type ArmorMeta
i see
in the first part (the if block), assuming its indeed instance of ColorableArmorMeta,
does meta (of type ArmorMeta) actually change ?
how do I make multiple types of the same item in one crafting slot?
meta does not change, no
colorableMeta is made as a new variable with type ColorableArmorMeta
how to make each material costs different quantry in the crafting table
No
if (meta instanceof ColorableArmorMeta colorableMeta) {
colorableMeta.setColor(color);
} else {
``` colorableMeta is only used in here
but whats the point of doing that if colorableMeta is lost after
Because meta will still have the changes
if (meta instanceof ColorableArmorMeta) {
ColorableArmorMeta colorableMeta = (ColorableArmorMeta) meta;
colorableMeta.setColor(color);
}```
Same thing, written differently
by doing changes to colorableMeta, meta changes too ?
I guess I should be more clear with this
Yes, it's still the same instance
It's like when doing ((Player) entity).sendBlockChange() or something
You're just casting it temporarily because you know it's that type
ah okok
You're looking for ExactChoice, https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/RecipeChoice.ExactChoice.html
That also checks all other meta
I wish we could make custom Recipe Choices 😔
Be the change you wanna see??
MD discussed this
Why I get this error? I am use mojang mappings
The problem is, what happens when said plugin gets disabled
the server and project version are 1.19.4
You didn't remap properly
How do I get an instace of a EntityDataSerializer for a SynchedEntityData#register
wdym
?nms
Does anyone know how to display a player's skin in the tablist when working on a fake players plugin? I'm using protocollib to create and send the corresponding packets, and everything works fine, apart from the fact that I see a black square where the player's head is supposed to be (as seen in the screenshot)
it only took me a week to before I lose my patience and symlinked my development plugins and rewired launching servers on my IDE so that I don't need 15 different windows open to make this
this correct?
mhm
what jar do I use?
What are the options
remapped-obf
thats impossible, you have 2 jars with the exact same name
Magic
Is it? I thought it was the obf one
show your pom, you probably messed up the shade plugin or sth else
wrong reply
ugh
its usually one with the default name
show your pom
you sure?
run mvn clean package -X and ?paste the whole log
but yeah also can't hurt to upgrade the specialsource plugin to 1.2.4
correct et réessayez.
Au caractère Ligne:1 : 1
+ mvn clean package -X
+ ~~~
+ CategoryInfo : ObjectNotFound: (mvn:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
``` dont know why the hell it is in french
btw the default one is getting built then getting renamed to original etc...
LANG=C mvn clean package -X
also close the target folder you have open before you build
wait, did you enter the command in powershell?
You need to install maven beforehand: https://maven.apache.org/
you are supposed to run it in IJ
However yeah, running it in IJ is probably the better play here
The bundled maven is outdated
I have to go now I will try later thanks
this is just a small style question
- my plugin will have a few manager classes, which are instantiated in the main plugin class
- i'm considering just passing the plugin instance and adding a getter to it for each manager, rather than passing each manager. is this problematic / bad style?
Managers are usually never instantiated
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
I am trying to use the remapped nms in 1.20.1, but it outputs error Could not find artifact org.spigotmc:spigot:jar:remapped-mojang:1.20.1-R0.1-SNAPSHOT in spigotmc-repo. I compiled the 1.20.1 buildtools.jar using java -jar buildtools.jar --remapped
i.e. all methods within managers should be static, unless you want to abstract away manager behaviour for certain purposes
I've found an exploit for RCE through Spigot Plugins on the host server, where do I report this to Spigot? PaperMC and Bukkit are also affected.
?jira
I'd rather report it in private due to it being an exploit, directly to a verified developer of Spigot.
Alright, thanks.
uh
is mc incapable of rendering some colors on models or something
teal is green
what are you doing mc
hi, i want to change a sword or any item's damage, but using attributes it will be like "When in main hand: +amount". I want it to be instead of plus, it just sets the damage literally. is there a way
Are you perhaps replacing an item that can have color?
Like leather horse armor, grass or potion?
it is leather horse armor
Try setting it to pure white
hm
is there a meta for that in the spigot api?
Yes
ColoredArmor or something
there's a leatherarmormeta but it doesn't list horse armor
looks like an emoji / custom font maybe
Yes but you'd have to create font with every item
is leather horse armor not being listed there an oversight or is it not covered
yeah it's rebooting with it rn
well idk any other way you'd do that, natively there's no way to do that without a resource pack afaik
i have this custom recipe but i want to make it each craft cost stacks how to do it
oh shit that worked, thanks
Support what?
alright just need to rescale it now
Doubt?
Again, just a custom font. Can be done in spigot as well.
Just need a resource pack.
can anyone help me
What folder?
Pretty sure you can create one bitmap for the whole font.
Not possible with normal recipes iirc.
Probably want some event.
Not sure if that makes any sense.
Are you sure there is no resource pack?
Then I have no clue. Ask them how they did it then.
If you are on the server you can check the resourcepacks screen to verify.
Cause it is weird that they can do it without RP
I really need that cool thing
Anyone know something cool i could? (probably with packets) i want something that looks crazy/never really done on servers
Make an enderpearl cannon which shoots 5 ender pearls which fly in random direction, explode on contact and after exploding teleport the shooter to where they are
Hmm
stuff like the patched rain/thunder packet bug
A wtf like: "Wtf oh my gosh" or "Wtf how?"
2nd one
if thats whats needed then sure
Tbh I have no idea
tis a very difficult question for sure
she's a beaut
I asked chatgpt and it told me "make wormholes which allow to transfer from any point to any other points and that can be shared with other players"
Portals:
there's literally a feature called wormholes in my plugin
Wait, if you put a chest below that block (chests are usually smaller than blocks) can you make a remodelled chest?
Lmao
sure or you can be a normal person and just make one of these models behave like a chest
i mean a portal of any type has been done to death
Lol yes
Wait, didn't you basically make tile entities but opposite way?
Obviously
Hmm, what about creating a completely chaotic dimension which will behave completely different from seed to seed and from client to client
I mean its good packet practise but an absolute nightmare
It is very nightmare
Whats the best way to add like a custom echest system? where would i save the items?
I would guess PDC? But idk, let the experts answer
u cant use stacks in recipes, would have to make a custom crafting system for that
i mean more like u can open it with a command
not saving it in a block or smt
Can't you save PDC for entities?
yea fair enough if i dont wanna use a database
that would reset if u leave no?
yea kinda
Would it?
I mean you would either save it in player pdc, in a file, or in a datbase
it doesnt
its called persistent
I think it will be saved in the player data file
alongside the actual ender chest probably
idk
i its just an additional echest then pdc should be good enough
your chat would be spammed to the horizon tho if u used that and used /data command
Actual ender chests save data to the player too afaik so ig pdc would be the most enderchest-like(?)
yea
its already getting spammed
like I cant fit the data on my screen already
can just get rid of someones storage just for the funny
Yeah
You can do that anyways ig
external files are more visible
or like easier to read/change
since its not in the player file
it doesnt matter just dont be a mean server owner
Everything comes with cons and pros
you shouldnt store plugin data in a player's pdc because even if the plugin is deleted the data will stay there unless manually removed
yea no i wont
okay step 1, remember how to save files and shit
In a way that could actually have a use, like, if you remove the plugin and add it back
yea but i dont know why you'd do that
if you want the plugin gone you want it gone
if you want the data to still be there, back it up before removing
yea
Players would like to retrieve their stuff
whats that
library with a lot of configuration stuff, it may be useful
IIRC You can reskin characters, theres a few vids on this
for this aswell?
Am I still supposed to use data watchers for npcs and stuff in 1.20? or is there a better solution
:O the read.me has a typo
im not surprised i havent updated it in a year
lol
wow thats a bad one
wtf xD
I've seen the description of a function in forge having a typo
Or method, whatever you call it
cant find the videos anymore hm
there it is
xd
@last temple
am i doing something wrong or is intellij tripping
make sure jitpack is a repo
hmmm any ideas
so it will be same thing here like you did with guis:))
dont use main use the latest commit
just add the font character to the action bar and should work 
it has no tags
main is the only one
what does your dependency look like
thats the first issue ngl
jitpack works best with tags
.
you can make a tag rn 😛
so?
<dependency>
<artifactId>BlueLib</artifactId>
<groupId>com.github.imajindevon:BlueLib:7492ac0f65</groupId>
<version>main</version>
<scope>compile</scope>
</dependency>
no
no
replace version with the commit he gave
groupid is com.github.imajindevon artifact id BlueLib version the commit
got it
ok so how do i use this
well what do you wanna do first
we can go to my dms
or not
idc
thing i wanna do first is create the custom enderchest system
cus i need to be able to save SOMETHING
Does an Inventory save the items?
you can save items into yml
using the yml lib it has
(considering he added support for ItemStack :p im sure there is)
item stack yaml is normal spigot kekw
anything serializable
well yea but i wanna also save the empty spaces in the storage
not JUST the items
if inventory is serializable then it works
cus i dont want them all to be sorted
so if slot is empty save air/save empty slot
act no i just save the slot of the items
What i need is to save the Items + Slot index
unless you wanna just store where theyre at by indexs, but imo storing air is just easier
nope just ItemStack[]
just indexes would work better no? less saving than also saving empty sltos
alr air it is
dms and explain please
null
null
null
I mean what else do you want us to say
because air is normally null 😛
if (itemStack != null && itemStack.getType() == Material.AIR) { // do stuff because its air }
you started
however a raw itemStack == null is more desirable, so saving null is better ^
fair enough
its also more memory efficient probably xD
so saving null > saving air
but if its an array it doesnt really matter
I have a few options:
- Save Slot Index + Item
- Save Air
- Save Null
but as you said null & air are easier/more efficient
public class PlayerEnderConfig implements ReflectiveConfig {
public ItemStack[] itemSlots;
public PlayerEnderConfig(int inventorySize) {
this.itemSlots = new ItemStack[inventorySize];
}
}
// when a player joins
PlayerEnderConfig reflectiveConfig = new PlayerEnderConfig(27); // assuming each ender chest has 27 slots
ConfigFile playerFile = ConfigFile.dumbLoad(plugin, player.getUniqueId().toString() + ".yml");
ReflectiveConfigInjector.getAndInject(reflectiveConfig, playerFile.getConfig(), true, true);
imajin
that wont store null/air slots
itll just be a list of contents from inventory if he passes getContents() into it
like that im better off storing slots aswell
okay then use Map<Integer, ItemStack>
ye
does this also load the enderconfig from the file?
the last two lines yes
well the entire thing
dumbLoad im guessing makes/loads the file
yea
getAndInject does what exactly?
takes the values from the loaded config and puts them into the object
in this case, reflectiveConfig
then you can access the data like reflectiveConfig.itemSlots
and how do i save it again?
to the file i mean
man I don't understand how blockbench is organizing texture IDs
if you're updating the object directly
ReflectiveConfigWriter.copyFields(reflectiveConfig, playerFile.getConfig());
playerFile.saveAsync(plugin);
I have a file where the ID of a texture is 11 but the texture listed for the uv is 0
im gonna go out for a bit dm me if you have any more questions but you should be able to figure it out just look at the source code its pretty complex but straight forward
ive told you basically everything you need to know
alr thanks
then whats the point of the id lol
so instead it uses the position in the texture list
it assigns ids as you add things to the list
but you can reshuffle textures in the list
so whether the id matches the place in the list is arbitrary
this sucks
now I have to reverse engineer this nonsense
which is a json map so I can't even use the literal order
guys im trying like 2 hours to find it i've made a custom recipe but i need each result cost stack of each material how can i do this
any idea please
will be mucth appriciated
that seems like a bug
🤨 i still dont get the point of the id
yeah neither does blockbench
the id is used for minecraft when you export it but I can't export this format
and blockbench has decided not to use the id in the first place it would seem
so it's a dead value
this is so dumb I'm going to have to test it more
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
set the required amount for each ingredient, which ig would be item.setAmount(item.getMaxStackSize())
i forgot how u make a custom inventory in 1.20.1
bukkit.createinventory
oh yea me was being messy and create a whole nother class
also blockbench does not cull any existing textures
im not sure but i think the Recipe request X stack but when craft still using one of each not?
if you generated 1000 textures while working on a model then your id will be 1000
even if you deleted all previous ones
but the uv will point to 0 because it's the first place in a 0-indexed list
idk but if thats true @dire bluff you can listen to https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/CraftItemEvent.html
declaration: package: org.bukkit.event.inventory, class: CraftItemEvent
i will send u the code
/code
umm
the most insane part of this is that it's a json map so while an order literally exists because it's written down in a json file I don't think I can read that order without doing custom parsing
it's not even a list
oh wait no I stand corrected it is a list of objects, thank god
alright that makes this easier
i just wrote like 100 lines of code without testing, im sure it will be fineee right
?paste
Discord
Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to d...
but also try debug when this happen what is the reason.. maybe can be a bug damages has a minor bugs since 1.19
@EventHandler public void onMeleeHit(EntityDamageByEntityEvent e){ if(e.getCause() == EntityDamageEvent.DamageCause.ENTITY_ATTACK){ e.setCancelled(true); Bukkit.getServer().getPluginManager().callEvent(new CustomDamageEvent((LivingEntity) e.getDamager(), (LivingEntity) e.getEntity(), 5, "Melee")); } }
Creates event, no logic in event
`//Custom Damage Listener
@EventHandler(priority = EventPriority.HIGHEST)
public void onCustomDamage(CustomDamageEvent e){
double x = 5;
e.getDefender().setHealth(e.getDefender().getHealth() - x);
}`
THIS CODE works when mobs attack players and when players attack mobs. This code does NOT work when players or mobs try to attack sheep, chickens, vexes, wolves, and maybe some other things I have not found yet. It is supposed to reduce the health of mobs when hit hence the event name "custom damage" but I cannot for the life of me figure out why it does not work when hitting the previously listed mobs. PLEASE help
this is 1.17.1
im using imajin's library
but getting this error, it doesnt seem to create the file anywhere
this is the place where it happens:
playerEnderConfig = new PlayerEnderConfig(54);
playerFile = ConfigFile.dumbLoad(TestPlugin.plugin, player.getUniqueId() + ".yml");
try {
ReflectiveConfigInjector.getAndInject(playerEnderConfig, playerFile.getConfig(), true, true);
} catch (Exception exception) {
exception.printStackTrace();
}
why
crazy
wrong channel for that
im from the nl tho
was that meant for me
same try add debug for know what is the DamageCause in teory need to be ENTITY_ATTACK but first try debug this
it is entity attack, the original hitting event is getting canceled
it works properly for everything except sheep, wolves, vexes and chickens
there is something about those mobs that i do not know about
also fish it doesnt work
the error is at the dumbload line
then the custom event is what not works?
it works on other things tho
it works on cows
but not on sheep
works on iron golems
not on chickens
thats the problem im having
and its very simple code
all of it i posted
in all cases the attacker is the same type of mob not?
the issue is when the "target" is chickens, sheeps, etc?
Hello, how can I change the size of a BlockDisplay? I'm doing this :java BlockDisplay blockDisplay = player.getWorld().spawn(player.getLocation(), BlockDisplay.class); blockDisplay.setBlock(Material.REDSTONE_BLOCK.createBlockData()); blockDisplay.setDisplayWidth(5F); blockDisplay.setDisplayHeight(2F);But I get this:
squeezing?
yes
how can I do this ?
there isn't any squeeze method
?:D
Width and height are only used for the clipping bounds
You need to set the transformation
One of the values in it is scale
found !
I used :java blockDisplay.setTransformation(new Transformation(new Vector3f(0, 0, 0), new AxisAngle4f(0, 0, 0, 0), new Vector3f(0.5f, 0.5f, 0.5f), new AxisAngle4f(0, 0, 0, 0)));
if I want to make a ticking block, how would I do it properly? I just want to make it run some code every tick and work even if I restarted the server
I can finally make what I wanted 
Does PrepareSmithingEvent keeps triggering every few ticks in a similar manner than PrepareAnvilEvent ?
Log it
i have a bad testing environment & my pc slow af
if anyone knows the answer it would be pretty handy
else i'll just tyas
Also, is there a way to allow to put anything in smithing table slots ?
I thought, maybe try to setCancelled(false) in InventoryClickEvent with the highest priority for when its the smithing table
But I'm not entirely sure, I could test but if someone knows the answer, or has a strong feeling, it would be very handy for me to know and would give me courage to actually test this
Hello . Wtf is that?
that's not even the right line
Those are uses, not declarations lol
Could be some remapping/access transformer issue, so yeah, if you have a getLevel() method instead, best to use it
Ok. Let me try
[ERROR] /home/sanya/govno/plugins port/Foxis/TamableFoxes/1_20_R1/src/main/java/net/seanomik/tamablefoxes/versions/version_1_20_R1/pathfinding/FoxPathfinderGoalSleepWithOwner.java:[45,49] cannot find symbol
[ERROR] symbol: method getLevel()
[ERROR] location: variable fox of type net.seanomik.tamablefoxes.versions.version_1_20_R1.EntityTamableFox```
💀
this shit uses nms
@noble lantern A redstone half slab? I hope that this disguisting witch craft is against the rules of humanity!
hate nms
is there no getter?
There is afaik. Just level()
Let us see
https://mappings.cephx.dev/1.20/net/minecraft/world/entity/Entity.html correct @whole surge there is a level() method in Entity
version: 1.20, hash: 7852c88aae
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
im just tryinng to port plugin for my smp 😭
these are the changes I make when I am working on a project on my own
Well, keep in mind that some of those fields are because of CraftBukkit
Access transformers are easier than reflection 😛
turns out making large custom models is all kinds of "fun"
Shh not the point
mc doesn't want to generate cubes that are larger than certain dimensions
Iirc the max size for a cube is 48x48x48
uh no
I don't think so at least
I'm trying to get some official info on it right now
but this seems to include cubes that have high start and end points
and I don't see a way to offset it
I guess I could maybe use the origin?
thanks bro
The :) was a nice touch
Interesting versions to support
No 1.16.5
that too I suppose
I'm dumb, my debug model was not at the scale I thought it was
Is it possible to play totem of undying animation with custom item when players die with custom item in their inventory
I’d like to play animation but with different texture
probably with packets
I could only find a forum post talking about modding, but maybe its relevant https://forums.minecraftforge.net/topic/84041-1152-solved-how-would-you-play-the-totem-of-undying-animation-with-other-items/
Forge Forums
I'd like to play the totem animation with a custom item. I've found this (https://www.minecraftforge.net/forum/topic/74941-solved-use-totems-animation/) answer, but I'm not sure how to implement EntityRenderer#displayItemActivation into my code. How would I go about playing this animation with a ...
Oh, I'm not sure about changing the actual animation itself. I would think it just uses the default totem item texture.
I don't see anything suggesting that any metadata would be attached to the packet event to say otherwise.
Alright thanks
Hey can i get some help
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Can we talk in private
no
Hi! I’m having some trouble making a new crafting recipe for a special item (don’t mind the actual item), and I’m wondering what may be wrong with this code because it’s not registering in the server as an actual recipe when put in correctly.
(Apologies if I don’t get the answer right off the bat, I’ve just started plugin development entirely not too long ago)
that's some cursed design
a static method that looks like a constructor? an init methods that just calls this constructor? and then it registers itself as recipe? idk
do you actually somewhere call Beer.Beer() or Beer.init()?
I will admit, it is very cursed. I plan on fixing it later down the line.
And I have something call Beer.init() (which I should really just, fix that by making the actual method “init” instead of having it separate, but oh well)
if you are sure you are calling Beer.Beer() or Beer.init() in onEnable() or something, then I don't see any reason why it wouldn't work
you do put in the items correctly? right now it will only work in the center slots
Yep, I do it exact. I set it like that for a reason, mostly for testing- I was going to remove it later when I confirmed it would work
But even when the recipe is input exactly as it should be, it doesn’t seem to output the correct item
@Override
public void onEnable() {
// PaperCommandManager acf = new PaperCommandManager(this);
// acf.registerCommand(new DebugCommand(this));
// getServer().getPluginManager().registerEvents(this, this);
registerTestBeer();
}
public void registerTestBeer() {
NamespacedKey key = new NamespacedKey(this, "testbeer");
ItemStack item = new ItemStack(Material.POTION);
PotionMeta meta = (PotionMeta) item.getItemMeta();
meta.setDisplayName(ChatColor.GOLD + "Test Beer");
meta.setLore(Arrays.asList("Yum"));
item.setItemMeta(meta);
ShapedRecipe recipe = new ShapedRecipe(key, item);
recipe.shape("S", "C", "P");
recipe.setIngredient('S', Material.SUGAR);
recipe.setIngredient('C', Material.SUGAR_CANE);
recipe.setIngredient('P', Material.POTION);
getServer().addRecipe(recipe);
}
works fine for me
it also correctly appears in the recipe book
Hm, alright. Thank you for your help! I’ll mess around with it tomorrow to see what may be the issue, but I’ll definitely keep your response in mind. Thank you for your assistance!
how can i create an empty persistent data container?
you need an existing PDC, then get the context, then you can create a new instance
Use PersistentDataType.TAG_CONTAINER
alright
PersistentDataHolder existingDataHolder = ...; // E.g. a player or chunk or whatever that already has a PDC
PersistentDataContainer newPdc = existingDataHolder.getPersistentDataContainer().getAdapterContext().newPersistentDataContainer();
then what do you need the PDC for?
if you don't have any holder, where are you gonna save your PDC to?
yea, pdc isn't some complete replacement for saving data
oh
no like, i just mean as in having a persistent data container in a variable, an empty one, and adding to it as preferred
not necessarily stored somewhere, just the variable
What would the point of that be though? Just store your data directly in your object.
im making a pdc skript addon and i want to include creating empty PDCs
it's just something that people would use, because it's a thing with the already present NBT addon
you can create a PDC out of nothing with craftbukkit classes
CraftPersistentDataTypeRegistry registry = new CraftPersistentDataTypeRegistry();
PersistentDataAdapterContext uselessContext = new CraftPersistentDataAdapterContext(registry);
PersistentDataContainer uselessPdc = uselessContext.newPersistentDataContainer();
oh it's nms
it's not NMS, it's craftbukkit
I'm confused why you would want an empty PDC anywhere that isn't relevant to ItemMeta
basically you can just add "spigot" instead of "spigot-api" as dependency
(or entities or chunks or whatever)
Right
yeah I also don't see any reason to do that
my addon will include adding pdc to blocks since there's a library for that
so there's that
but thats not the point
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
that's not even how persistent data holders work
Sure, but that still doesn't explain why you'd need a PDC field anywhere
WHAT COMMAND MANAGER!?!
T R A I T O R!
PaperCommandManager supports spigot
shoo troll
yeah thats what im using
yeah in that case you can use the chunk's PDC as context, or simply the context of the block's pdc
but I still don't understand what you need a new one for, new CustomBlockData(Plugin, Block) already gives you a persistentdatacontainer where you can get a context from
A PDC on its own is nothing more than an overglorified Map
yeah thats basically what im allowing here lol
wdym?
to the itemstack or to a flying one?
yeah sure. You can use the .addUnsafeEnchantment function
i wont go too deep into this, the nbt skript addon has this which creates an empty nbt and i just wanted to do the same thing but with pdc
i understand why you guys say it doesnt make sense, it's more about feature adding
Don't add "features" that don't make sense. And you're not thinking of it in the sense of a feature anyway, you're exposing it as part of your API. The PDC itself is more of an implementation detail.
anyway i've added this to my pom.xml and the CraftPersistentDataTypeRegistry class isn't found
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.19.4-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.19.4-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>```
yeah in that case just get it from the CBD's context
PersistentDataContainer blockData = new CustomBLockData(...);
PersistentDataContainer myPdc;
if(myPdc.has(myKey, PersistentDataType.TAG_CONTAINER)) {
myPdc = blockData.get(myKey, PersistentDataType.TAG_CONTAINER);
} else {
myPdc = blockData.getAdapterContext().newPersistentDataContainer();
}
ohhh
?paste


