#help-development
1 messages · Page 1589 of 1
the plugin
files
it was a whole class
that extended JavaPlugin
lol
I deleted it
How do I check if an entity has been killed? Because isDead() doesn't seem to be acting the way I want
,getHealth
wont that work?
I don't think an Egg has health
lmao
true
Now to use that class you just java RecipesManager manager = new RecipesManager(this); manager.addRecipes();
Or make it a field, passing it this still
Unless all you do with the manager is within one method scope
o
lets not go Fields and passing this at creation just yet 🙂
what class
@unkempt ore also use a projectile hit event then check that the projectile is an egg
Anonymous tradeoff though
@eternal oxide
i already have
private RecipesManager recipies = new RecipesManager(this);
No
recipies.addRecipes();
An egg could die under more circumstances than landing
Call that on the onEnable
https://paste.md-5.net/pazoninexo.cs
Elgar do you remember this?
It's acting odd
I'm doing a little sanity check on the distance from the player. That's my last doubt. But this is a timer task every tick
Yes i already did
thats it then
Not a warning, more of a suggestion
Do it though
How would I get the co-ordinates for the edge of a client hitbox?
Feel like the bounding box would have something to do with that
No
try it
No
ok
I already told you, landing is not the only way to die
And I'm not even inside an event
I'm in a timed task that needs to cancel itself if it sees the that egg has died
Unsupported API version 1.17
i hate intelliJ
Resettted what
i chose 1.16.5 but when i clicked next then previous
it resetted the version i selected
Cringe
so youre using like a spigot development plugin on IJ?
its not wrong but its bad for beginner
it makes you dont know how to set it up yourself without the plugin.
well, thats just my opinion
how can I make a raw message on bungeecord? (BungeeCord Plugin)
its easy though
lol
@unkempt ore sry for pinging but
i searched more
ProjectileHitEvent is the only way
do whatever u like tho
I just said I'm not even in an event, though
The timer task needs to periodically check if the egg has died
Died, not hit
Kill
its supposed to break?
hmm
This is important. I need to make sure the timer task stays alive for as long as the egg is alive. Not doing this will result in timer task leaks
Causing lag
true
Because it doesn't know when to stop running
then I have no clue how you're gonna do that, but if you figure it out you're a legend
I mean, isDead() seems to be the way
But somehow, I don't know, it's being awful to me
@Override
public void run()
{
if (egg.isDead())
{
// This code ran when the egg died
cancel();
return;
}
// This code NEVER ran for some reason
var eggLocation = egg.getLocation().clone();
var distanceFromPlayer = eggLocation.distance(playerLocation);
if (distanceFromPlayer < distance)
{
eggLocation.getBlock()
.setBlockData(blockData);
}
else
{
egg.remove();
cancel();
}
}
So, something really weird seems to be going on here. I set up a debug print inside the isDead() check, and that one actually prints when the egg lands. I set prints after this check though, and none of them ran
None
And this is running every tick, started when the egg is thrown
It does stop, yes, but nothing after the stop check runs, it seems
I set up debug prints after the first if statement, and they never ran
It does not make sense at all
You're returning after cancelling?
Yes, because I don't want the function to continue running one more time
I want it to die right on the spot
cancel() doesn't stop the current method's execution
It doesn't stop but you're calling return causing it to stop
or am I miss understanding something here
Yes, it would seem
Let me reiterate. It stops fine. When the egg lands, that cancel runs because I set up a print statement there and it printed
However, outside of the if (after it), I set up a print, and it never printed
Guys I need help , whats the corrct function or method to add a potion effect to a player
Player#addPotionEffect
wait how do i send a codeblock
@chrome beacon I commented my code above to make it clear
ill send the codeblock
if (sender instanceof Player) {
Player player = (Player) sender;
player.addPotionEffect((new PotionEffect(PotionEffectType.BAD_OMEN, 999, 1)));
}
What is wrong in this method used?
?
```java
Your code here
```
huh xD
No no, back ticks
.
```java
Code
```
Next to 1
if (sender instanceof Player) {
Player player = (Player) sender;
player.addPotionEffect((new PotionEffect(PotionEffectType.BAD_OMEN, 999, 1)));
}
here
what have i done wrong here
in the potion method
you cant do 999
nothing wrong i guess
255
it goes up to 255 pretty sure
255 is unlimited right
huh, thats the duration right?
Not unlimited
it is?
But the max
duration and then amplifier
Ahh
Integer.MAX_VALUE
so instead of using 255 i put Integer.MAX_VALUE right?
What you commented I understood but you're still returning causing the code below to not to run after task is cancelled
yes, or 999 in your code
But ^?
That is the point, man
thats the amplifier
amplifier cannot go over 255
Anyone has an idea of how can I make the custom recipe I made show in the recipe section of minecraft (It does only after you craft it)
This is inside a timer task every tick @chrome beacon
yes, change to duration to Integer.MAX_VALUE for unlimited duration
So it never runs even if the egg isn't dead
Yes
but then the duration tag goes
wait
It makes no sense
max duration is 999,999 isn't it
this is what it is rn
Use Java 16
it becomes like this thne
if (sender instanceof Player player)
Agreed. Where did you place those debug messages
Where the comments are
Right where they are
player.addPotionEffect(new PotionEffect(PotionEffectType.BAD_OMEN,999,1));
sure
Anyone has an idea of how can I make the custom recipe I made show in the recipe section of minecraft (It does only after you craft it)
ShapedRecipe i think?
No, no
I did it
He wants it to show up in the book
actually it needs 3 brackets , one for the addpotioneffect(
one for the (new
one for the new PotionEffect(
afaik it can be Shapeless or shaped
Yes
Yeah idk then
I'm so confused man
@granite stirrup what's your problem
@eternal oxide Any clue?
?
doesnt it show up in book?
Idk
It doesn't except if u craft the recipe
like if you have never crafted it
it does not show up
wtf is this for if you can do that https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/KnowledgeBookMeta.html#setRecipes(java.util.List)
declaration: package: org.bukkit.inventory.meta, interface: KnowledgeBookMeta
You need some more debug to prove that code is not running
this is book meta
The second one never ran
literally right after the isDead test block?
a meta for Books if im not wrong
Yes. I am sure I'm going insane
How would I get the co-ordinates for the edge of a client hitbox? 1.8.8
recipe book meta?
I believe you are too
Let me do it one more time
probably a shortcut
Whats going on here?
Can anyone help me?
@EventHandler
public void onItemHeld(final PlayerItemHeldEvent e) {
if(!e.getPlayer().getInventory().getItem(e.getPreviousSlot()).hasItemMeta()) {
return;
}
}
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.hasItemMeta()" because the return value of "org.bukkit.inventory.PlayerInventory.getItem(int)" is null
getItem is returning null
Yea but why?
@eternal oxide what about this
Too small, can;t read
if its null it means its empty
I'll copy paste
no item involved basically
My console error goes as follows -
java.lang.NullPointerException: null
at me.arjunraid.theraidgame.Theraidgame.onEnable(Theraidgame.java:10) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-640]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-640]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-640]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Okay, is there something I don't understand about BukkitRunnable#runTaskTimer?
It runs the run() method once every period ticks right?
Theraidgame.java:10 is null
As in?
Why is it and how do I fix it?
No clue without knowing what that line of code is
give the code
Ok wait ill send the code for the onEnable and the class
?paste
and you will get answer
correct
I tried this too, how can I fix the error? This didnt do the job
public void onItemHeld(final PlayerItemHeldEvent e) {
if(e.getPlayer().getInventory().getItem(e.getPreviousSlot()).equals(null)) {
return;
}
if(!e.getPlayer().getInventory().getItem(e.getPreviousSlot()).hasItemMeta()) {
return;
}
}```
.equals(null) may not work lmao
try == null
== null, you can;t instance .equals on a null
Oh truuu
public final class Theraidgame extends JavaPlugin {
@Override
public void onEnable() {
getCommand("arjraid").setExecutor(new arjraid());
}
}
That is my main , didnt copy paste the imports
public class arjraid implements CommandExecutor{
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
player.addPotionEffect(new PotionEffect(PotionEffectType.BAD_OMEN,999,1));
}
else{
System.out.println("Nah fam , player only command~!");
}
return false;
}
}
class
nice classnames
Thanks
is this line 10? getCommand("arjraid").setExecutor(new arjraid());
does arjraid exist in your plugin.yml
How can I get the uuid (with the Minecraft Name) on bungeecord? The Player is offline
So...call me insane but, I placed a print before the if check this time too. I'm running this task timer every tick. It only printed "Before", and "Inside" once, when the egg landed
yes line 10
Both at once
you cant without using nms and grabbing username in the cacheplayers file or whatever its called and filling out the profile yourself
sending a pic of my plugin.yml wait
then arjraid is missing from your plugin.yml
bump
elgar you forgot yoru
thats arjunraid not arjraid
wrap all teh code in a try/catch and print any exceptions
Would they show up in logs by default?
all the code in the run()
It's doing this silently
yes usually, but your code is not behaving so don;t trust it
arjraid is the class , but for main the name of the main is me.arjunraid.theraidgame
are you getting a lot of begin messages? or just the one the same as when it dies?
so its there tho innit?
Before
Inside
And that's it
When the egg lands
yep, try/catch and see whats happening
then fix the getCommand in line 10 to correctly ask for arjunraid
you're registering command "arjraid" yet there is no "arjraid" command on the plugin.yml
May I DM you, elgar?
I have everyone blocked from DM's as I hate people 🙂
Yes, that is why I'm asking
jump in text
What?
@summer scroll im a bit confused can you help me in the dms , would be greatly appreciated
yes , bcuz arjraid is the class where the command is so im using it for the command executor
just change it to this.getCommand("arjunraid")...
and keep .setExecutor(new arjraid()); ?
yes thats it really
ok wait
because you have arjunraid as the command on the plugin.yml
ok wait
How do I make a custom recipe have more than 1 item in a slot
like If i want 2 diamonds in 1 slot
you could make the interface a chest instead of a crafting table interface, such as what hypixel skyblock does
ExactChoice recipe maybe?
i play it and i know it, i even made a crafting table like that before
but i dont want to use it because its a pain in the ass
how?
and how I can with nms? 🤔
iirc you need to listen to PrepareCraftEvent or something
idk
xD
all i know is you have to use nms for it
can I also get with mojangapi?
mojangapi?
the default crafting system is using material not itemstack, so you need manually check the amount.
yea
Bruh
¯_(ツ)_/¯
cant i make an item stack
not even related code
pretty sure
wait whats PAPIExpansion
isnt that a papi class i dont think you can just do new PAPIExpansion()
its his own class
pretty sure it a interface or abstract class
that extends PlaceholderExpansion
welp hes done something wrong in there
show PAPIExpansion code @weary geyser
I found the mistake, it was not the Database. I use an API from a buddy for inventorys but the brewing inventory got changed in the 1.17 spigot api. I don't know what was changed in the brewing stand inventory in 1.17, but I tried a different inventory type (a normal inventory) and everything goes normally 😄
isnt it something like this https://paste.md-5.net/merejuruze.java
he showed it already
the class that register the expansion
looks a little different
not the papiexpansion class
yours has onPlaceholderRequest and in the example its onRequest
just incase the imports were wrong perhaps?
oh its that from the new api?
it was onPlaceholderRequest
iirc
is the import correct? im afraid that there is a class named PAPIExpansion from PAPI
well just incase
because the error is kinda weird
never have an error like that before
¯_(ツ)_/¯
what if he has newer api older papi or older api and newer papi?
lol if you have papi do /daddy
could be yeah xd
ok one last try, maybe try to change your class name lol
to SkyCoinsExpansion maybe, idk
i once have a problem like that too
idk why
loop through every player and get they display name
like:
1- Jack
2- Max
3- etc..
well i'm new in spigot api development can you help me with that @granite stirrup
how do i can loop it
?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.
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
yeah so code it yourself
tho i can give you a little bit of info
declaration: package: org.bukkit, class: Bukkit
there is a #getOnlinePlayers method which returns a list with every player online. use a for loop, loop through and send the command sender a message for each player with the name in it
if you want to include offlineplayers tho getOfflinePlayers()
so learn java
and also check the javadocs for spigot
?jd
its handy
Player.getDisplayName()?
Bukkit.getOnlinePlayers().stream().map(Player::getDisplayName).collect(joining(", "))
i dont think hes gonna understand that
he doesnt even know for loops
XD
Welp
yh let alone method references
why would he know about streams
I like to read through here to maybe learn a thing or two and I didn't know about streams before and looking it up I don't quite understand what it is haha
if someone could give a basic explanation or send a link that gives a basic explanation that would be much appreciated :)
I'll handle this
thank you :)
Basically the stream API is a Java framework given to us in Java 8 which, when used properly (such as above) can make functional operations much more clean and concise
Now do you know what a lambda is?
kind of? I remember learning about them
It's an anonymous function implementing a special interface iternally
Now, bad example, but say you have a collection of strings, and you want to make all of them uppercase, and then print them. With no streams:
for (var s : strings)
{
System.out.println(s.toUpperCase());
}
With streams:
strings.stream()
.map(string -> string.toUpperCase())
.forEach(string -> System.out.print);
You'd want to do the top, as its clearer, but this is just to show you the difference between both
does streams even make a difference
trings.stream()
.map(String::toUpperCase)
.forEach(System.out::println);
Performance-wise? They're definitely worse
f
But maintainability wise they can be very nice when used properly
And to use them properly, you must use them functionally
so that means just use for loops?
so its just a way to have something else happen to it
dont think so never heard of it lmao
It basically means taking an input and making an output. Nothing else. You do not depend on state, and you do not modify state
i just learned by looking at forums and tutorials and learned things myself
e.getPlayer().discoverRecipe();
how to use
e.getPlayer().discoverRecipe();
when i do
i dont use streams cuz i dont know how to use them
Same, but I religiously read books lmao
With a bunch of theory
yeah so just like "do it in one line if you can"
pretty sure you need a NamspacedKey
right?
but i have a namespacedkey only in my other class
Hmmmm, that's not a very good mind set
new NamespacedKey("minecraft","zombie");?
ok i misunderstood
idk if this is how
help
With streams, you can essentially give operations to it that will go "for each item" in that. It's like dropping a bunch of things down a set of filters
And collecting the end
Hmmmm
Hey, I'm very new to java and I'm just about ready to finish my first plugin and find out if it works, and I've come across an issue that states there is an "expression expected", does anybody know what is wrong?
send the code
send the code
just copy paste?
uhh
if its big
like the whole project or the line that is broken
the line
line
just send line here
So say you have a list of players, and you want all players whose name has the letter "A" in them
players.stream()
.filter(player -> player.getDisplayName().toLowerCase().contains("a"))
.collect(toList());
player.getWorld().playSound(player, Sound.ITEM_TRIDENT_THUNDER, 5, 5,);
The first line is like dropping the players, the second line is the filter they have to pass through, and the third line is where they're collected
wait pich and volume didnt send
, at the end
where
How to use a namespacedkey from a different class
ahhh so you're basically allowing a filter with a stream
at the end
Yeah
How to use a namespacedkey from a different class
pls
it has one at the end
thank you operation!
add a getter for it
That expression will return a List<Player> with the filter applied
o
A new List<Player> mind you, backed by the Player references
Yeah
how?
I'm pretty sure i'll get an insult for being dumb
You could inject them also, like I was @grim ice
wait so what am I doing wrong if there is a comma on the end
i dont understand how i can do that
But it may be cleaner to make a class to hold these keys, make an instance of it in your plugin, and depend on this class that holds the keys in the places in which you need it
private NamespacedKey zombie;
private NamespacedKey skelly;
public RecipesManager(JavaPlugin plugin) {
this.plugin = plugin;
this.zombie = new NamespacedKey(plugin, "zombie");
this.skelly = new NamespacedKey(plugin, "skelly");
}
public NamespacedKey getZombieKey() {
return zombie;
}```
Modify your class like so, and you then then get teh keys
I have NamespacedKey key3 = new NamespacedKey(plugin, "enderman");
my reciepsmanager class
so i just uh
retype that
with new
Please do not obfuscate the names like that
can anyone please help after you are done helping me after they are done with whatever they are doing I have been working on this error for very long and some people here really seem to know what they are doing lol
maybe spigot just needs a cute NamespacedKeyContainer
there, simpler
@eternal oxide 'RecipesManager(JavaPlugin)' is already defined in 'me.hex.onceuncraftable.RecipesManager'
e
yes, I said modify yoru class, not throw all that code in it as well
F
read teh code and look at yours. See where it needs to go
Okay
then use those keys in teh class, not yoru ones
?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.
thanks xD
@eternal oxide
public NamespacedKey getZombieKey() {
return zombie;
} do i repeat that with eveery namespace i have
i have liek 14 or smth
e
|| at some point, a map like structure would probably be better than fields ||
Probably this point
uuhuhu
a stupid question
Can i just
implement Listener
in my class
or wait
Nevermind
even if i do so ill have the same problem
Im confused aaaaaaaaaaa
also
It's too much work to start learning from zero again
so if u wanna tell me to learn java
what do you mean, learning from zero 😂
link me a tutorial on the topic i dont know
just skip the initial parts ?
true
ok me dumb
still uh
im confused
Elgar you have an idea?
of how can i do it without repeating stuff
you can or one getter that accepts a String
then pull the key based upon name
an enum might be even better
yep
busy, cooking wifes dinner
player.getWorld().playSound(player,Sound.BLOCK_ANVIL_BREAK, 5, 5,); would this work ?
I always have my pc on so mine never shows mobile
there is one , too much
at the end?
yea
lol
declaration: package: org.bukkit, interface: World
lol
e help
How to use a namespacedkey I created in a class in a other class???
please someone help
.-.
This is part of Java basics
You just define an instance of it…
How?
use the constructor
Just do the getters until you are more advanced to know how to use enums
How?
I already showed you
🥲
bump
it must be marked as static if you want to reference it without constructing the object
Don;t make it static
i didnt
what is giving you and unresolved symbol?
?paste show some code
We'll see how close you got 🙂
you need to add the Fields
thats what it suggested
same as I showed in the sample code
private final NamespacedKey skeleton;
private final NamespacedKey zombie;
yep
well, you also need to change yoru code in your addRecipes() method to use getZombieKey() instead of creating a new key in there
this line
ShapedRecipe recipe = new ShapedRecipe(key, new ItemStack(Material.ZOMBIE_SPAWN_EGG));
would become
ShapedRecipe recipe = new ShapedRecipe(getZombieKey(), new ItemStack(Material.ZOMBIE_SPAWN_EGG));
Oh
I have 14 like that
public NamespacedKey getZombieKey() {
return zombie;
}
i repeat that for each one?
yep, until you are more advanced in Java that is your only option
ok
how do I use this
you don;t
its used by Bukkit when you set an entry in your yaml
well, you need to replace the null
to take your object and build the Map
?paste
yeah that is what I was asking, what does the String and Object represent, the "Map containing the current state of the class"
i have like 70 lines of code before my actual plugin starts
lmao
can I drag this at the end of the code
or it has to be before it
hello?
hello!
@eternal oxide
whats the issue with that
is that normal
well this is hopefully in its own file right ?
won't i get clowned on for doing it
the whole class is just for creating the recipes
Yes but, as elgar already said, until you are more comfortable with java this is sadly the way to go
where methods are in a class makes no difference
just add all your getters to teh bottom
okay
get it workign, then worry about how it looks
ok
but
NamespacedKey key5 = new NamespacedKey(plugin, "vindicator");
ShapedRecipe recipe5 = new ShapedRecipe(key5, new ItemStack(Material.VINDICATOR_SPAWN_EGG));
recipe5.shape("EEE", "EME", "EEE");
recipe5.setIngredient('M', Material.EMERALD_BLOCK);
recipe5.setIngredient('E', Material.IRON_BLOCK);
Bukkit.addRecipe(recipe5);
do i remove
first line here
and the
"key5"
n shapedrecipe
how can I disable putting a specific item into an item frame?
is it possible to change the breaking tool type and the breaking speed of a block? For example, a wooden plank that has the same breaking time as obsidian and must be mined with a pickaxe
Field can be converted to a local variable
Private field 'plugin' is assigned but never accessed
you no longer need it as you generate all yoru keys in the constructor
Is their any way for me to make a plugin that allows for one of two things(or both preferably) those things being longer item pickup range and stackable potions
ElgarL
how can i get a random number between 1 and 20?
@eternal oxide sorry for pinging but How do i access the namespacedkeys now ive done all that?
Random rand = new Random();
int num = rand.nextInt(20) + 1;
you use your manager reference like recipiesManager.getZombieKey()
doesnt that just give 1 - 19 ?
since the random will just put out 0 - 18
Non-static method 'getZombieKey()' cannot be referenced from a static context
^
do i make it static
oh yeah it says it is exclusive
don;t access it directly. Remember you made an instance of it in Main
you added a field to Main new RecipesManager
yes
weird question but I never really payed much attention to it, how are you meant to read spgiot build versions and compare them chronologically to other builds?
Yes
but
i still cant get it
AAAA
how am i supposed to get it
like, the commit "numbers" are for the most part just a random string of characters, how can I identify where stuff is?
recipes.getZombieKey() does not work
RecipesManager,getZombieKey() tells me to make stuff static
@eternal oxide sorry for the ping but uh
how?
?learnjava xD
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.
you create a new instance of it
in your onEnable
final RecipesManager manager = new RecipesManager(this);
doesnt work
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getItem() != null) {
if (event.getItem().equals(elunarsBook.elunarsBookItem)) {
event.setCancelled(true);
}
}
}
@eternal night now what
lmao ive been on this
for 2 HOURS
and i still cant finish it
wtf
what is the action type for placing an item to item frame?
u can prob check if item frame is empty and use event playerinteract
and check if its right click and the rightclicked block is an empty item frame
with a held item not being null
thats an alternative way
how would i go about making a plugin that would allow me to change the item pickup range for players as well as allow for stackable potions(doesnt matter if i need to make them in separate plugins or if i can do it in one, just want the features)
@eternal night u here
fam I am not going to guide you through this step by step xD
isnt item frame an entity?
yes
.
What bit are you stuck on?
I don't know how to access the Keys
in a event class
(RecipesManager.getZombieKey());
ok, you must have registered the event class
tells me to make getZombieKey a static
whast the name of yoru event class?
the actual Class is called onJoin?
ok, then you must have at some point use new onJoin()
ok, change that to new onJoin(recipesManager)
if you called your recipesManager field that in yrou main class
Expression expected
yes i have
final RecipesManager recipes = new RecipesManager(this);
ok, then change it to new onJoin(recipes)
Expected 0 arguments but found 1
then in your onJoin Class it will complain about the constructor
so add in yoru constructor (add one if you don;t have one)
you add the RecipesManager, the same as you did the JavaPlugin into your RecipesManager class constructor
'class' or 'interface' expected
wrong place
wait wait
yeah wrong place
di realized
ok no error
Non-static method 'getZombieKey()' cannot be referenced from a static context when i hover over(RecipesManager.getZombieKey());
yes, you shoudl be using teh recipes instance you passed, not teh static RecipesManager
1s
it should be empty?
the public onJoin(RecipesManager recipes) {
or?
private final RecipesManager recipes;
public onJoin(RecipesManager recipes) {
this.recipes = recipes;
}
ok
thats what i have
second one, yes
yes
Elgar I built on Spigot, deployed to Spigot
It still fires when it hits the floor
I don't know anymore
hello
can i get some help please
is there any source code that is that ususal /hub command
?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.
i wrote it but ok
i need somehow to make it to check the location
found something on bucckit forum but no good
Is this over bungeecord btw?
tried it
no, the server does not have bunge
the /hub command needs to teleport the player to the spawn
after 5 seconds of not moving
well, usually you'd have a /setspawn command or something that lets you set the location - afterwards it needs to be somehow stored, but given that it is config serialisable that should not be the issue
well the thing is, we can't get the new location of the player
if he moved
so i think that i need to make a var witch will have the location of the player
and another var witch is the new location and then compare it
well, you could listen for a PlayerMoveEvent
But why can't you do player.getLocation().clone() to get the loc of the player?
(it should return a clone either way, but let's have ti like that for good measure)
so i need to compare player.getLocation().clone() and p.getlocation() ?
Alright, I'll cut straight to the chase
PlayerEggThrowEvent is firing when the egg lands, not actually when it's thrown
Why
@quiet ice so i just make the listen thing to the PlayerMoveEvent and if it happens i cansel the teleportation ?
Is there projectile launch event
?paste
Yes, there is
See what you can get out of that
Yea, that is the alternative; though it is kinda pricey
No, I know it will work. But I've wasted a day of entirely debugging only to find this
I am mad
we will try it, and sorry for the ping
I want to know what the reasoning is behind this
proceeds to ping again
sorry
has even a small idea
accedent
source code?
What that means is up to yourself
In essence it cannot add the ingredient to the recipe because it isn't needed
It isn't needed
what does that mean
recipe4.shape("NEN", "DTD", "GEG");
recipe4.setIngredient('E', Material.EMERALD_BLOCK);
recipe4.setIngredient('Y', Material.ENDER_EYE);
There is no need to declare 'Y' because it isn't used
why it printed the character as an integer is beyond me
Well, I do know why but not why
but
what are the lines i need to change
i dont get anything from the code except symbol does not appear
You have eyes, you can look for that yourself
The error message is badly formatted, I have to agree. Unfortunately I cannot change it because I do not wish to sign the CLA
ok
i changed what u told me to
and i read the whole thing
honestly at this point i just wanna end this frick
but honestly Elgar helped me a lot
pls
what is you maven pom?
Hello how would i make a fake item in the shield slot
like a book but without chaninge the Item
like update inventory packet
and Believe me it's useful
I am not using the maven plugin for it, I tried using the example commands
- its called offhand
Then what exactly did you run?
2.you prob can setoffhandslot to a certain itemstack
if u have one
declaration: package: org.bukkit.event.player, class: PlayerSwapHandItemsEvent
Minecraft will do that to ya. You start figuring out it’s bs and does not teach you very proper practices
My guess is that you are not running the shaded jar. One way to solve it is to put specialsource on the classpath
java -cp $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar:$HOME/.m2/repository/org/spigotmc/spigot/1.17-R0.1-SNAPSHOT/spigot-1.17-R0.1-SNAPSHOT-remapped-mojang.jar net.md_5.specialsource.SpecialSource --live -i TridentGamesPlugin.jar -o TridentGamesPlugin-obf.jar -m $HOME/.m2/repository/org/spigotmc/minecraft-server/1.17-R0.1-SNAPSHOT/minecraft-server-1.17-R0.1-SNAPSHOT-maps-mojang.txt --reverse
it is copied from the forum post
#setOffHandItem
Hex you’re not helping him
o
He said a fake item
im bad at helping
An item that isn’t real
does he mean an item that doesnt exist
He’s trying to mess with packets
The server
if it is nms item, it does exit for server, but not for clients ;)
Are you sure that $HOME/.m2/repository/net/md-5/SpecialSource/1.10.0/SpecialSource-1.10.0-shaded.jar exists?
Yeah I understand…
wait, I'll look
That’s not what he wants though
For the item to show up for the client a setSlot packet is sent.
oh, so idk why, I have there only the unshaded jar, how can I get the shaded?
@round finch
I’m not sure why he would want this
But it sounds like what he’s asking
That’s the raw protocol wiki
My guess is wrong
ignore it
He’s probably on about protocol lib
That would still help him
True
well, the library is not specified
That’s the best place to reference to
it need to be fake item there doesn't change the item
like sending a fake item packet
Doesent change the item for who what
