#help-development
1 messages · Page 1435 of 1
read the dox
its player.getLocation() thingy
yes, that returns a Location
what does the ? do
? is a ternary operator
it's basically a mini if statement
print(alive ? "You are alive" : "You are dead")
you mean temporary?
no, I mean ternary
hey there so i just setup my redispubsub listener class and was wondering if there is any way that i could for example when 2 players are on server 1 run a public void on server 2?
you'd want to use Messaging Channels and Bungee Chili
i heard that it wouldn't work if no players are on server 2
so like
print(hello)
is the same as isTrue() ? print(hello)
correct, i guess sockets then would be an alternative
if (first thing) then you use (second thing) otherwise (third thing)
you have to have both options
not exactly, ternary is only for assignment, not declaration
ie you can't do alive?alive() : dead()
oh
yea that's why im using redis/jedis since conclure recommended it
print(isTrue() ? "yes" : "no");
oh wow thats so nice
python's is fucking ugly
yea its not friendly
hehehe welcome
lmao
would be a bit difficult to read
very
but its worth it right
so @candid galleon do you know how to work with jedis/redis?
once you learn how to read it
nope chili
you can do (alive) ? alive() : dead()
but both alive and dead must return something
that said it is still an operator so you need something for the value to end up in
im still trying to understand return a == b ? a > b ? 1 : -1 : 0;
lmao
it broke my mind
it doesn't need to be assignment, though
it could be as input to a method as a parameter, or return, or switch, or whatever
lmao
dunno, i think ternary is still cleaner in this particular case
if formatted legibly, anyway
if (a == b) return 0; else if (a > b) return 1; else return -1;
who says it has to be 1:1
if (a==b)
{
return 0;
} else if (a>b)
{
return 1;
} else
{
return -1;
}
return Math.signum(a - b);
ok but like does anyone know how to populate with loot and how to use LootContext
you need to use some builder somewhere to add the necessary elements to the context
and then use the context
and there is no fucking documentation on which ones are required for which kind of loot table
declaration: package: org.bukkit.loot, class: LootContext, class: Builder
you just have to go by trial and error until it doesn't explode with an illegible and impossible to decipher nms exception when trying to generate the loot
imagine if there was like API to programmaticly see which loot tables required which parameters
i couldnt even get it to work lol
how would I go about making an item shoot a projectile? like if a stick shot fireballs, ik how to make the item do something when you click but I have no clue how to do projectiles
ok do u know the api on where to place a certain block in x,7,z location
nope
new Location().getBlock().setType()
read the documentation in the future
?
i'm not going to answer your every "how to do very simple thing" and "what does this method do" question
nor is anyone else
also are u talking about the java docs thimgy?
yes, the spigot api documentation
there is also a forum with like a million beginner questions one search away
so here not the place to ask for kinds useless questions?
anyon know how to do projectiles?
LivingEntity or something has a shootArrow or shootProjectile method, or something
ProjectileSource::launchProjectile
nah, what my friend tryin to say is
- google first
- if googling doesnt help then peek into the javadocs into the class youre looking to call something from
- if that doesnt help/too hard, ask here
does anyone know the height at which a player's head starts
when they're standing normally
Player.getEyeLocation?
i think thats like the center of their head
How do i get the directory with server.jar? I want to create a .yml there
I mean you should probably keep files in your plugins own folder
But Bukkit.getWorldContainer.getParent should work
ok thanks and this is just something for me im going to end up removing it
i just wanted to test something
there is no guarantee that the world container is in the server directory
the user can set an arbitrary world container
there is no guarantee that the plugins directory is in the server directory, either
nor is there any guarantee that even the server jar is in the server directory
Hello, does anyone know how to send blank lines in chat? Couldn't find anything online sadly
player.sendMessage(“ “)?
hey there so recently i have been working on remastering my manhunt plugin. right now im working with jedis and i have just set it up. Right now i have a JedisListener class which extends JedisPubSub. The thing i want to do is for example when a player comes into server 1 it starts to run a public void on server 2. Im assuming i have to connect to server 2 using PubSub and then be able to send requests or run public void's on server 2 while the player is on server 1
I think you are asking what you would do, if so you would send a string through publish and pick it up via sub and then once its picked up on the sub you would run the method with whatever data you provided over the pub
anyone happen to remember off the top of their heads what's the best way of listening to when a block goes from a falling block to a solid block so I can prevent it from getting placed?
that would be the only one?
I don't know what channel to ask this in; is there a way to display color formats in the chat without the color format displaying? (sorry if that's hard to understand)
thanks
You can display stuff such as &6 normally
Not sure if it’s possible to display the colour character directly
Maybe you can escape it somehow
How would I do that 😆 sorry if this is a dumb question.
Just don’t run it through translateAlternateColorCodes
Oh.. I am talking in the actual chat.
Like you want to say &6Hi and in chat it will show Orange Hi?
I just want the &6 to show no color.
oh
Then like I said
Im confused
Yeah I saw.
Just send it directly without translating
Sorry for the confusion.
If it is showing and you dont want color you may need to strip the color from it
A lot of shitty chat plugins dont have stuff like that in lol
I always throw a ChatColor.stripColor in my chat method just for safety
im really trying to find out if a player is NOT in a specific schematic
i just don't know how to do it
i have 0 ideas/clues
Do you have the coordinates of 2 corners
yes
Just invert a check if they are inside it
thats the issue
Coordinates below the lowest x/y/z or above the highest
You can easily determine which is which using math.min and math.max
i'm still thinking of it 0_0
x&y dont depend or above or lower? right?
wait no im stupid
Y is height for mc
i know
what's an optimized way to temporary grant something? such as a custom database variable, and then revoke that a month later or sum
only thing that hits my mind is a scheduler checking status of sum every so often
but what if i need it to expire at an exact moment
Anyone here looking to be a dev I need one ASAP dm me for more info for spigot btw
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
K
I would use a time stamp to set the expiry time and then check it every so often
You could be able to check it fairly frequently async and then sync back to the main thread to do the actual removal
hm
how do i transition between async to sync
o
call a method w a runTaskLater in it
have you guys ever seen ItemMeta null
there's a first time for everything
line 53 PersistentDataContainer itemPDC = evt.getItemInHand().getItemMeta().getPersistentDataContainer();
only nullable thing is getItemMeta
Air
that's what happens when you mess with nms
Air returns null for item meta
Would anyone know how to remove the glow/glint from items without removing the actual enchantment? I understand I'll need to use NMS or Protocolib but I'm having trouble figuring out how to approach this.
Is there a way to change a mob enough so that the player doesn't notice it but i can register the mob as a diffrent mob?
for example an nbt tag or something
To remove the glow you hide enchants. Its still enchanted but they are hidden. https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/ItemFlag.html#HIDE_ENCHANTS
The item still glows, all that does is hide the enchantment lore
you'd probably have to intercept the packets and remove the outgoing enchantments
Quick question: how do I get the brewer for BrewEvent
Short answer: you don’t
Long answer: store the last player to interact with the brewing stand in a map or something
You could always see who takes the items from teh brewing stand
That works too
Unless you are using hoppers
Also you need to consider they can put them back in again
Is there a way i can make a costom mob the exact same in the out side but diffrenciatabe in the code?
Yes
If you want simple stuff you can assign a PDC value to it and read that in events and whatnot
If you want something more complex you can make a custom entity with NMS
ok Thanks I'll look in to that
The javadocs tells you
and why is it null when im looking straight at the ground
perhaps the most important question
what distance did you set?
5
so, are you looking at a block within 5 range?
yep
seems to be working now
i only raytrace in interact event with block
so it shoulddd be in range
You raytrace the block you click on?
is there some odd reason you need to raytrace to a block you already have from the interact event?
ah
Story of my life
bro you dont understand
new PlayerInteractManager(world).a(player, world, nmsBlock, hand,
MovingObjectPositionBlock.a(new Vec3D(player.locX(), player.getHeadY(), player.locZ()), EnumDirection.valueOf(evt.getBlockFace().toString()),
new BlockPosition(location.getX(), location.getY(), location.getZ())));```
and best of all it makes the item in hand disappear for some reason
What’s the goal
place a block
as a player
it works in creative since the item doesnt get used up
but in survival the original item disappears
it all works, except for that
yep... even when i cancel the build event, the interacting removes the item
hmmm
outsmart life
that seems crazy to use NMS just to place a block
I'm not exactly sure what you are trying to achieve
placing a block at distance?
Funny you shoudl say that...
let me show you what it's for
?paste
This is a class, needs nothing more than registering it as a Listener. https://paste.md-5.net/levahedeyu.java
Does saving a value in a static fields count as static abuse?
hold a stick in hand and you can place blocks at range.
Basically I want to save a value from config
nah i have a Config class and all the values are static
Its just a demo class. I think right click to place dirt
like this? https://paste.md-5.net/itedoleyes.java
The place is just the last method in teh class
sure thats fine
aight, thanks
in fact, redlib provides some methods to make that easier
mainly I use enums, but you can only put one type i guess
then i can have java @ConfigValue("rarities") public static Map<CustomEnchant, Double> rarities = ConfigManager.map(CustomEnchant.class, Double.class);
really nice
yea that's kinda cool
but how do you calculate whether the block can be placed there
like seeds on farmland
here's the result of my work though
teh code above raytraces to find the last air block
Placing blocks from a shulker box
Neat idea
I suppose you could use the NMS method for said block to see if it can go there
https://paste.md-5.net/wawizosojo.java all it took lol
No idea what it’s called on spigot
But that method looks reasonably clean
An API for placing and breaking blocks would be nice
paper has the PlayerInteractEvent#getInteractionPoint, very nice in this case
not needed, you only need the BlockFace from the Interact event
placing from a location would be ideal
not exactly elgar
or at range, as I said the target method
Thankfully the breaking method is just one simple NMS call
The code I showed is just a demo, but you could easily expand it to allow you to place a block at any distance. And it allows other plugins to cancel the placement
its only a demo, but none of that would be difficult, and it uses no NMS
i think it's having the work done for you that's so appealing about nms
Shame the client assumes block placing will succeed
Makes me wonder what else you could make usable from a shulker box
interesting, i guess i need to manually do wheat/carrots/potatoes
especially since wheat has the same item name as the block crop so when i right click with wheat inside it uses up the wheat :P
same with sugarcane but that places correctly
oh it uses up the item even if the block fails
hmmm
I want to be able to eat out of a shulker box
Use tools from a shulker box
with 1.17's tags, maybe
👀
damn they really removing everything from the update
kek
Unless you use the datapack
me on my way to CONSUME enumerators
Hey everybody, how do I pass data from one class to another when there's multiple instances of the first class running?
I can't call the method from the second class from the first
Get first class instance?
ok you do that
holy shit someone actually made a hacked client in C++ with JNI lol
tweaked the code so it only removes the item if it was placed successfully https://paste.md-5.net/ikicutukeg.java
CustomCustomEnchant
mhm
Btw are you using some lib for custom enchantments
yeah just made a class that extends it
named it CustomCustomEnchant
once i get ShrekClient compiled
ah yes nice embed
fun fact
the original name for realms was MinecraftOnline
How can I connect my plugin with my discord bot? Like the bot in #spigotcraft
afaik its just discordsrv
So its a api for spigot?
jda
you download the jar, put it on your server
if you want to do it yourself use jda
if you wanna do it from scratch, yeah go use JDA
Ok
ideally you would use java
what
haaaaaaahahahaha
xD
yes
and they named it ShrekClientYeet
yes
it has 9 stars too
yo who remembers this
when will we be able to create spigot plugins in scratch 😠
wanna know the funny thing?
is that what 'snooper' always meant 🤣
you know how it was made in 2019?
i only started playing during 1.7.10
what
no idea when it was added but it was still there in 1.7
he has 2 commits both called Initial commit
that client was made in 2019, targetting 1.7.10
thats what happens when you're set on no lag
shuruk421
Too old! (Click the link to get the exact time)
anyways it doesnt even compile
then it would become outdated
u can
Not in scratcb
But a similar thing yeag
No
who made these
i would like to award them
It's a tool, made by a skript dev iirc
doesnt exist
a lot of those dont exist for some reason
anyways that must be expensive to host
LMAO
i wil lget anned
Imagine needing to enter your credit card to see how long MC versions has been out for
actually there was some site i went to that redirected me to one
uhhhhhhhhh
im gonna buy a domain like pastethistopeopleusing1.8.net and it will route an embed to an image of a timer
8.net is probably hard to buy
did it end up to be real
wait whwere is java 8
been looking for years
can you even join on 1.7.10
never found him
i think so
i dont think ive booted 1.7.10 since when i first got the game
and what version is jni.h from anyways
check and lmk
mc? yes. hypixel? no idea lemme check
im gonna main hypicon with shrek client yeet
at least they slightly evolved
understandable
Hi guys, quick question. The packet https://wiki.vg/Protocol#Entity_Head_Look does the Head Yaw parm must follow the classic trigonometry roles?
how do I get specific player's value in specific scoreboard?
how do i increase Mobs Movement speed ? I tried the code below but its not working
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntitySpawn(CreatureSpawnEvent event){
LivingEntity entity = event.getEntity();
AttributeInstance attribute = entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
double baseValue = attribute.getBaseValue();
if(baseValue != 2.1){ //If basevalue is not 0.7 default, set it back
attribute.setBaseValue(2.1);
}
}
Any help?
Is there any vanilla method that override default speed when i run this plugin?
i'm not sure.
usually adding a delay will works, for example if you want to change gamemode player on join.
and maybe set the EventPriority to HIGHEST if you want to result to always to be like that.
okay thanks i will try
bugs from 1.8 or bugs from future versions?
🤔
also what about forks that solve lots of problems?
So, I have a problem.
If I try building a project using the gradlew.bat file, it says it's complete but I can't see the "build" folder. Any way I can fix this?
Uhm, one second
Hmm well, that's weird. Mine is in build\libs
Maybe check your build.gradle and settings.gradle for a different output directory?
give me a sec
Try deleting your .gradle folder as well, can work wonders sometimes.
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntitySpawn(CreatureSpawnEvent event){
LivingEntity entity = event.getEntity();
AttributeInstance attribute = entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
double baseValue = attribute.getBaseValue();
if(baseValue != 2.1){ //If basevalue is not 0.7 default, set it back
attribute.setBaseValue(2.1);
}
Runnable runnable2 = new Runnable() {
@Override
public void run() {
try {
Thread t = Thread.currentThread();
System.out.println("Runnable: " + t);
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
Thread t = new Thread(runnable2);
t.start();
}
I want to change the Mobs Movement Speed but its not working. Any Help ?
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntitySpawn(CreatureSpawnEvent event){
LivingEntity entity = event.getEntity();
AttributeInstance attribute = entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
double baseValue = attribute.getBaseValue();
if(baseValue != 2.1){ //If basevalue is not 0.7 default, set it back
attribute.setBaseValue(2.1);
}
Runnable runnable2 = new Runnable() {
@Override
public void run() {
try {
Thread t = Thread.currentThread();
System.out.println("Runnable: " + t);
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
Thread t = new Thread(runnable2);
t.start();
}
What is the runnable for?
if(baseValue != 2.1){ //If basevalue is not 0.7 default, set it back
attribute.setBaseValue(2.1);
}
2 second delay
Just set it to attribute.setBaseValue(2.1);
That's blocking code and will make your performance go kill itself
done
I know cstmth that's why I pointed it out
I just wanted to explain to Jackwasd why it's an issue 🙂
👍
How can i change speed then?
I don't know actually, haven't worked with Spigot in a long time. Hopefully someone else can help you with this issue.
@violet depot that's not how you add a delay.
so I'm trying to spawn an NPC with Citizens by using myNpc.getNPC().spawn(player.getLocation()) and the NPC is spawning like 20 blocks above the player on top of the tree, is there anything I can do about this lol
Bukkit.getScheduler().runTaskLater(plugin, () -> {
// code here..
attribute.setBaseValue(2.1);
}, 2L); // delay for 2 ticks
I saw a post someone pointed out that if you want to change the mobs movement speed to lets say 2.1 (3*Times) it will change the mobs speed back to base value that is 0.7
Thanks i wil try and sorry i am new to Minecraft Spigot Plugins.
all good
my coordinates seem to be matching when I print them but the npc still spawns way up lol
maybe try to do something like myNpc.getNPC().setLocation(player.getLocation()); after you spawned it (not sure if thats a method because I dont use Citizens, just a thought)
still didn't work rip oh wait, hold up
its not working. Spawned Mobs Movement Speed does seems to change no matter what i do...
ah, i don't know then, never mess with attribute
Okay but thank you for your help much appreciated
no problem
your code
yay someone is typing
Yeah, idk what to use
show us console logs
logs/latest.log
i'm guessing indexoutofbounds
might be just the plugin is disabled 🤷 i can't watch that damn video is buffering too much
yeah man, same haha
wont let me send file too big
wdym
ah, i'm wrong xd
and what does that mean?
apparently not
Here is one line of code
player.getInventory().addItem(ItemManager.wand);
here is where i add it private static void CreateWand() {
ItemStack item = new ItemStack(Material.STICK, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§6Stick Of Reality");
List<String> lore = new ArrayList<>();
lore.add("§7This wand goes back in time. Into the times the villagers could talk.");
lore.add("§7They left this behind them for us to use. Be careful it shoots out tnt.");
meta.setLore(lore);
meta.addEnchant(Enchantment.LUCK, 1, false);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
item.setItemMeta(meta);
wand = item;
ItemManager.wand is null
it is?
don't static abuse 👀
abuse?
hit women
istg gecko
hold on
how do i define the wand?
is that what you are asking
ItemManager is a javaclass
:|
if (cmd.getName().equalsIgnoreCase("givewand")) {
player.getInventory().addItem(ItemManager.wand);
}
that is what i put
do you call the CreateWand method though
hmm lemme check
best capitalization
i think i set it to item*
i didnt mean to reply
oh no i didnt
this is confusing
make sure to call the method first before getting the item
ok
but call it just once, on plugin enable for example
i have been warned for saying ok
no you should call it every time as often as possible
okay
this is very very confusing
perfect 👌
when will he realize
realize what?
you have to be using paper api for it to work
and your main class shouldn't extend JavaPlugin
but the tutorial said i should do it
Here is the tutorial https://www.youtube.com/watch?v=5npPUMrYaYE&t
yes your main class should extend JavaPlugin
I have a feeling you are being trolled
you have to include this video in your plugin
yeah i suck
Gecko bully👀
just at some point the solution becomes more of "you need to learn java" instead of "here's how to fix this"
Oh i see.. well thats not rly bully
but yeah, you'll want to create and set the item when the plugin enables so that when you add it to the player's inventory there's an item to add
they couldn't handle my awesomeness ¯\_(ツ)_/¯
Indeed
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
guys, which jvm should i use, Hotspot or Openj9 (Java 16)?
for plugins it makes no real difference
you still won;t notice a difference
what's about graal?
no clue
ok thank you
How are offline/cracked uuids generated?
should probably use java 16 now since 1.17 will be
Offline: prefixing the players name
Offline as in, online-mode=false
no, just the text, uuid from string
Sorry, I'm so confused lol
I want to generate the UUID they would get when using cracked/pirated
string -> uuid
yes 21w19a released and they announced that
public static UUID getOfflineUUID(String s) {
return UUID.nameUUIDFromBytes(("OfflinePlayer:" + s).getBytes(StandardCharsets.UTF_8));
}```
bit old, but you should use Hotspot, OpenJ9 is known to cause issues (it crashed BT a while back, not sure if that has been fixed)
i just download adoptopenjdk 16
form arch repo
seems it doesnt show which jvm is it, may it's hotspot
I have used both Hotspot and Openj9. No noticable difference and I've had no issues running anything
Confirmed that Java 11 didnt have anything difference but 16
it's because you're unverified
unverifieds are generally treated as lesser
yea that’s what I’m wondering how would I go about sending data over pub/sub
suckets
i am trying use gwarps but when i use nobody can use says not enough perm
you know what's beautiful
that twitter is full of liberals who are saying that hitler was right
lmao
turns out genocide is a double edged sword
post in one fucking channel. does anybody even read the channel names?!
we need a purge
thanos was right
a holocaust
no just a good ol movie-style purge
come to think of it
has anyone written an anti dupe plugin that assigns an UUID in the pdc of each itemstack
and then uses protocol hacks to filter them out
and inventory listeners to merge stacks with differing uuids
because that would make dupes of any kind impossible
plugin or not
probably kind of annoying to implement
Haha
and costly with having to listen to hopper move events and shit
only made one for vauchers
well beside the vanilla events
for unstackables it'd be ezpz
you have to also consider plugins giving items
I have a lot of ideas that I don't work on
I will get a working prototype for you by tomorrow
lol
tomorrow never comes
wait what
liberals?
yeah
Twitter is unholy ground do not enter that site under any circumstances
or, well, liberal and conservative are overused and aren't really used to mean what they actually mean
I mean like the BLM and trans acceptance and all these progressive people
what are they saying about it
what the fuck
yea
they're not BLM they're just stupid lmao 🤣
they just got with the trend of everyone gettign a BLM pfp
being stupid and being blm isn't mutually exclusive
does anybody have new spotify theme?
no
weird just woke up to some new theme
Material#matchMaterial for 1.12? (to match material from string)
does anyone with experience in Packets have 20 min to help me? I need to remove all players from the tablist, while still keeping them visible
because rn when I remove them, and they leave my render distance and re-enter it, they are just invisible
(which is normal behaviour, but I need to fix it)
ig try Material#valueOf and then check for if its null
use matchMaterial or getMaterial which will handle the exception for you
0.0 - 4 isn't one number
It's likely the - 4
double x = ishome.getBlockX();
double lvl1wallsloc1x = Double.parseDouble(config.getString("options.level-1.coords.walls.loc1.x").replace("%x%",String.valueOf(x)));
x: "%x% - 4"
🤔
The type double isn’t a mathematical expression of some sort
Yeah it needs to be a single number it can't be an expression
oh
idk, i thought it was like in c++
:))
There is a math method for calculating expressions
Alternatively you can use @waxen plinth's Crunch
np
Is there a way to get a users username
player.getName
Is there any way i could place a sign on the face of a chest?
shift
i mean with code
hmm
Is there a specific way to get the block in front of the chest? (where it's facing)
You’ll have to get the chests block data to determine that
Can't find anything ._.
get block
block.getData
I have a chest, and I am looking to get the direction it is facing. I have attempted to get the block from the world, and cast it to the type...
@eternal shoal
and then, getFacing
here is a better explanation
I know how to do that, I'm stuck at getting the location of where to place the sign
Since it has to be a block over
or it would be inside the chest
south: +1z
north: -1z
east: +1x
west: -1x
and you should set durability of the sign depending on the direction (at least that's how you do it in pre 1.13 i think)
@waxen plinth what version should i put in maven for crunch 🤔
Damn, imagine had this issue too
Hold on a sec
Try this
<dependency>
<groupId>com.github.Redempt</groupId>
<artifactId>Crunch</artifactId>
<version>a53fb84a67</version>
</dependency>```
works, thx
How to find if a mob is left handed?
I didn't even know that was a thing
I mean I made the mob left handed I just need to get that information
with java this.isLeftHanded();
hum, instanceof?
Hello, I'm trying to get the dycolor from a banner but I get NullPointerException and I don't know why. First of all the error isn't on the Banner class and second, when I sout the ItemStack I don't get the dyecolor into the metadata but when I set the item I receive it.
Banner banner = new Banner(DyeColor.WHITE, new ArrayList());
if (event.getCurrentItem().getType().equals(Material.BANNER)) {
ItemStack itemStack = getInventory().getItem(49);
BannerMeta bannerMeta = ((BannerMeta) itemStack.getItemMeta());
switch (editingStage) {
case BASE:
this.banner.setColor(bannerMeta.getBaseColor());//Error on getbaseColor and i'm sure that the banner has a base color
editingStage = EditingStage.PATTERN;
break;
case PATTERN:
this.lastPattern = bannerMeta.getPattern(bannerMeta.getPatterns().size()).getPattern();
editingStage = EditingStage.COLOR;
break;
case COLOR:
//Do stuff
}
}```
that line would only throw a NPE if either this.banner or bannerMeta are null
the base colour can be nullable
So how can I get the Banner BaseColor, the bannerMeta and this.banner are ok
And they don't throw error
The error is on getBaseColor
🤔
if the error is on getBaseColor the item at slot 49 is air
because that is afaik the only material that gives a null item meta
if (event.getCurrentItem().getType().equals(Material.BANNER)) {
ItemStack itemStack = getInventory().getItem(49);
not the current item
you are fetching the item meta from item at slot 49
are you 100% certain the error is caused by the getBaseColor call ¯_(ツ)_/¯
Yes, I'll do some tests and I'll write it here
or update to java 16 and get neat null pointer exception messages
link the actual stack trace if you haven't already
don't think he has ye 😭
all discussion regarding an error is just juggling broken crystal balls until someone posts the stack trace
I mean, an NPE prior 16 isn't gonna be helpful
at least it has the line number
true 😂 i mean if that failed it is rip
i mostly just want it because i don't trust a random to actually be able to tell whether the npe is thrown because of something wrong in the internals or in their own code
and because I can then look at the source and see where it's blowing up if it is indeed an issue with the internals
does anyone know where in NMS packets are received from the client?
I want to investigate a bug that may be affecting MV Inventories
how do i mark item as special? like wand
with a lore
net.minecraft.server.NetworkManager is the channel inbound handler which calls Packet#a which in the end pushes the packet logic onto the PacketListener
it is implemented in the nms.PlayerConnection class
awesome, thanks @eternal night
Hey guys ! I’m trying to respawn the ender dragon but dragonBattle.initiateRespawn() don’t work :/
( dragonBattle is the battle linked to my end World )
PersistentData?
pdc
what is the best particle for drawing thin, straight lines
redstone
you can color it
it's good for just about anything
and you can choose the size of the particle
is there anyway to change a materials display name or use multiple of 1 itemstack in 1 crafting slot?
the former can be done with RecipeChoice.ExactChoice, the latter is not possible
Hey guys ! I’m trying to respawn the ender dragon but dragonBattle.initiateRespawn() don’t work :/
( dragonBattle is the battle linked to my end World )
I am kinda new to coding what does that mean
exactly xD
what do you not understand
what is the former and what is the latter
ah
not a coding thing
ye no english isnt my first language
if an item doesn't have a custom name set, the name will be determined by the client's translation
alr
But how would i do this
recipe.shape(
" T ",
" T ",
" A "
);
recipe.setIngredient('T', ItemManager.EnchantedGold);
recipe.setIngredient('A', Material.STICK);
i want T to be like 32 of it
can i change it in anyway so it is possible?
can't
Events probably, but that is not a recipe
hmm
i made a little thing that's similar to crafting recipes but allows a lot more ingredients
it's not super efficient and i should probably convert it to RecipeChoice
How does RecipeChoice Work?
thats what it means not how it works
how x works is a vague question
do you want me to cuntpaste the implementation at you
lol
you can check whether an item works as a RecipeChoice with RecipeChoice#test(ItemStack)
it's a glorified itemstack predicate
public void onDispense(BlockDispenseEvent evt) {
Dispenser dispenser = (Dispenser) evt.getBlock().getState();
if (!dispenser.getPersistentDataContainer().has(plugin.compressorKey, PersistentDataType.BYTE)) return;
String selectedRecipe = null;
ConfigurationSection recipeSection = plugin.config.getConfig().getConfigurationSection("recipes");
if (recipeSection == null) return;
ItemStack dispensedItem = evt.getItem();
for (String key : recipeSection.getKeys(false)) {
List<ItemStack> requiredItems = (List<ItemStack>) recipeSection.getList(key + ".from");
boolean valid = true;
for (ItemStack requiredItem : requiredItems) {
if (!dispenser.getInventory().containsAtLeast(requiredItem,
requiredItem.getAmount() + (requiredItem.isSimilar(dispensedItem) ? 0 : 1))) {
valid = false;
break;
}
}
if (!valid) continue;
selectedRecipe = key;
break;
}
if (selectedRecipe == null) {
evt.setCancelled(true);
return;
}
for (ItemStack item : (List<ItemStack>) recipeSection.getList(selectedRecipe + ".from")) {
Task.syncDelayed(() -> ItemUtils.remove(dispenser.getInventory(), item, item.getAmount()));
}
evt.setItem(recipeSection.getItemStack(selectedRecipe + ".to"));``` semi-custom recipes with up to 9 stacks of items as ingredients
depends on what you want to use it for
is there a way i can delay sounds ?
some sounds are clientside so you can't delay every kind of sound, but using the scheduler should work for most
So lets say i have like 5 stacks of gold ingots and i wanna make 1 enchanted ingot with it
For example i'm tryna set delays between those.
p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_CHIME, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_HARP, 1f, 1f); p.playSound(p.getEyeLocation(), Sound.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE, 1f, 1f);
thats what i wanna use it for
you implement recipechoice and return true if the item is the one you want and the amount is more than 5 stacks
it will never return true of course since you can't put 5 stacks in a single slot
But like if i wanna put a psesific amount in each slot
listen to the events or whatever and just check the grid
you could also have recipes to turn 7 gold blocks into compressed gold ¯_(ツ)_/¯
and then use 5 of those
what you're describing isn't supported by the recipe system and as such has nothing to do with recipechoices
beyond you being able to use a recipechoice as an itemstack predicate
also bukkit recipes 🤮
outsource it to the user's custom crafting plugin
no default recipe
lol
or make your own custom crafting plugin B)
without a bukkit recepies half of my CE plugin would be bork
is your ce plugin shit
because I haven't been able to find a not shit ce plugin yet
It does not use NMS, so yes
bro
what is it called
what are your requirements for not shit
does it do retarded and heavy shit in the player move event
EnchantmentsPlus
all of the ones i've seen to date are either super laggy or buggy
hah, I do not use that event!
^ biggest plugin of my server tick B)
i dont know how tf i would make a custom recipe with events
dont
Lol
you dont need to make a plugin for custom items
100% 1 tick repeating tasks, been thinking of using PME instead though
then what?
giving up is an option
im literally trying to learn
ok but dont do it for recipes
maybe give up on the 32 items part
alr whats a good thing to learn
and make it a regular, normal recipe instead
ye i will
already did
that's the spirit
.
in java .-.
write me a decent crates plugin
i'll give the enchants plus plugin a go
in minecraft
time to learn gui
it integrates into enchanting pretty nicely ^
if it doesn't work exactly to my specifications, i will find you and burn your house down @quiet ice
what causes most of the performance issues
I do not know, noone sent me a Spark report yet
Because people tell me that, and honestly I couldn't imagine how it is not
what does it even do that'd impact performance
clone every item in a player's inventory in every player move event?
grab
seen one ce plugin do it
It queries all slots of the inventory of every player at least once a tick and gets the PDC of it to then get other stuff
uh, why
Speaking of that, I should build a safeguard against books for performance exploits
I use PDC to store enchantments
yes but why do you access every slot in the inventory every tick
Because I have some enchantments that are passive
maybe add an option to disable those and the associated slot lookups
so servers with more than 2 players can use the plugin
also can't you just maintain a set of held enchants by listening to inventory/pickup/dispense events
checking every slot is redundant and should maybe only be used as a backup to ensure data integrity every few seconds at most
That could be possible but could be prone to exploits in combination with other plugins
what enchants are active anywhere in the inventory, anyways?
alright that is significantly less retarded
big difference
build against paper and use armor equip event
i guess i need to fork this and optimize it a bit before I can use it
at least it's open source
i already wrote a thing that maintains a set of items equipped by a player in the armor/hand slots so plugging this into it should be trivial
absolutely haram
i'll need to finish up my impl of live-view itemmeta so I don't need to clone the itemmeta for every pdc get
.-.
Redempt what u think of Haskell?
Also if you can could you also drop in a spark report or similar? Would be really nice to have something other than timings report to use
You make one thing that parses text and suddenly it's all anyone knows you for
Haskell seems cool
Alex?
i'll send you screenshots of spark if I remember
Brister mitten
k ty
that's the best anyone'll be getting from me
Knightzmc or whatever he’s called on GitHub
don't want my super secret domains i use for my plugins being leaked
Lol
HEY