#help-development
1 messages · Page 1506 of 1
that's why you use Citizens or NMS to do that. Spigot isnt in charge of making an NPC lib
lol, it is but partially
but that isnt the point here, you should always use the API when possible
why would you stick to NMS if an API option is available?
EXACTLY when possible
there are some things that i prefer do with nms
how do i make it so that the plugin starts because its not starting it keeps saying it will be disabled upon startup
and some with api like itemstack related
Well that means your plugin is throwing an error
are you reloading or restarting
all i need, in some cases*
im restart
smh lmao
Send log
then i use nms.
Just because one thing is missing doesn't mean you should use NMS for everything
i said, i don't use nms for everything
i use nms when i need them
to do what i need
with the current API i can't decide a pose for a player. so i use nms
and with entities i prefer use nms cause TextComponent used for their names
[00:14:19] [Server thread/WARN]: Disabling plugin kiy
Full logs please
yes. but i want to make my own
where's the problem?
no sense
good luck spending nights of debugging lol
wtf lol
f*cking critic
You never said that the first place...
making your own lib is an entire different story
of course you not gonna steal someone else's...
I thought you were referring to normal plugin development
well duh, you should use a lib for that
Give to us method to create laying fake player without using NMS
We've already been past this. This isn't even what I'm trying to talk about right now lmao
if u can't - stop conflict
u can contribute lol.
your commit has been refused.
BUT U DONT NEED NMS
i use nms then
¯_(ツ)_/¯
listen man
Citizens has an extensive API that can be used for making your plugins work with NPCs or even for adding a brand new character that can be attached to an NPC. Make sure you always are using an up-to-date build of the CitizensAPI to ensure that your plugin works with the latest release of Citizens.
and not reflection, cause i want my server run good lol
why i have to use some's api?
Okay, ehm idk, does somone know, how i can make that
-
the enderchest opens with a command
-
the items in the enderchrdts are saved
I never said SPIGOT itself has it
Well then sounds like your using NMS right. I'm leaving the conversation then 
Check how essentials opens an ender chest
of course. i don't use nms to do things like ItemStack, it's useless
but i use nms to do something like NPC
How does essentials opens an ender chest? xd
without extern lib
Which is good
Yes
u can open a stored inventory. so the enderchest is shared with other players. or u can use namespacedkey
I think you can just player.openInventory(player.getEnderChest())
Or you can use that method choco sent
right
That is the method I sent ;p
Tysm it is soo easy!! :DDD*
Where is the "ender dragon has been killed in this world" flag actually stored? Is it just part of the dragon itself, stored in the map?
Idk how to rename my gui items :C
COuld somone please tell me how i do that?
I see DragonBattle but i'm not really sure if that's accessing what I think it is
#setdisplayname
on item meta
Yaaa but how does that know the item meta? :C
getItemMeta
to get the item meta
then use setDisplayName on that specific ItemMeta
and then set it back onto the itemstack
item#getItemMeta#setdisplayname
or
ItemMeta meta = item#getItemMeta
meta#setdisplayname
Mhhh tysm!!
i will try that.
dont you need to set it back tho
i think?
like doesnt it return a copy
could be idk haven't used spigot in a long time lol
Hold up ill check
This
Yeah
Yeah you need to set it
ah yeah
I used this
ItemStack item = new ItemStack(Material.GLASS, 1);
ItemMeta meta = item.getItemMeta();
but forgot I also did
item.setitemmeta
mhm
Will it be possible somehow to get bundle's tooltip item list on another material?
Lore?
The item list is not a lore
why does this not work
I have this
private static final Set<UUID> frozenPlayers= new HashSet<>();
public static HashSet<UUID> getFrozenPlayers() {
return frozenPlayers;
}
Return a Set<UUID> just
ah that does also work
HashSet is not assignable from Set
It crashes discord precisely or smtng
that shouldn't be a reason to remove it
it shouldn't even effect anyone
Anyways the players moves when they die
Conclure abuse!!!
from knockback
Yeah you'll have to nullify the velocity
is that just a minecraft thing?
yeah kb
Hmm pretty sure it isnt
I haven't modified the velocity
altho if you use smtng like the DamageEvent to respawn
hm ok

so idk if this is true or not, but my friend said that reddit turned that into a white supremacist symbol
and thats why people dont really use it that often anymore
lmao
when i reload my server does that clear static hashsets?
oh
my
bad
lmao
yes
it should at least
it does
it's kinda annoying that it does
I mean if you do some class loader hackery it might be possible to bypass that but it's irrelevant anyways
/reload is my favorite command
plugman reload tho
i was just asking ._.
yeah don't do /reload at all. use /rl instead
Anyone know why the scoreboard isn't showing up?
//Scoreboard
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Team testTeam = board.registerNewTeam("testTeam");
@SuppressWarnings("deprecation")
Objective objective = board.registerNewObjective("test", "dummy");
testTeam.setCanSeeFriendlyInvisibles(false);
testTeam.setColor(ChatColor.GRAY);
testTeam.setAllowFriendlyFire(true);
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName(ChatColor.GOLD + "OPProject");
for(Player player : Bukkit.getOnlinePlayers()) {
@SuppressWarnings("deprecation")
Score score = objective.getScore(player);
score.setScore(15);
}
/whooooosh
did you also set the scoreboard?
Probably should find oht why jts deprecated
Scoreboard api is usable without the deprecated methods
scoreboard supports non-player entries
Not much to worry about
^
yea ik
java.lang.reflect.InaccessibleObjectException: Unable to make field final java.util.List java.util.Collections$SynchronizedList.list accessible: module java.base does not "opens java.util" to unnamed module @50b2e960
private static void setAccessible(AccessibleObject accessibleObject)
{
try
{
accessibleObject.setAccessible(true);
}
catch(InaccessibleObjectException ignored)
{
AccessController.doPrivileged(new PrivilegedAction()
{
public Object run()
{
accessibleObject.setAccessible(true); //Here
return null;
}
});
}
}
You can't do it anymore
It is a private final List
Oh yeah you cant modify it
Reflection is dumb in java 16
anymore
Java 16 does not allow it, nothing you can do
So you cant modify
Where is that list located even?
In NMS
Where exactly is a good place to put the scoreboard btw?
manager class
on the right hand side
In your code
yeah in my code
in the jar
mk
dedicated to scoreboard
in a scoreboard manager
LOL
ok guys, I have a problem in need of solving:
I need a Block instance, but I want to dictate the Block's type without changing the type at the actual location. Is there a way to do that
what?
wdym by dictate
?xy
Asking about your attempted solution rather than your actual problem
Would I have to implement something?
means block.getType() == sth I want
?xy
Asking about your attempted solution rather than your actual problem
what would the scoreboard manager look like?
@hardy swan what is your problem
wym
Darkened im not here to teach java sorry
ok the actual problem is this, GriefPrevention API
mk then
under allowBreak() method
block.getType() == Material 
Wait, could somone show me how to set there the name?
I am trying this since an half hour :C
``package sircapalonge.cbsystem.commands;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.CompassMeta;
public class Guicommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player){
Player player = (Player) sender;
Inventory inv = Bukkit.createInventory(player,9,"§e§lTeleporter");
player.openInventory(inv);
inv.setItem(0,new ItemStack(Material.COMPASS));
inv.setItem(1,new ItemStack(Material.WRITABLE_BOOK));
inv.setItem(2,new ItemStack(Material.ENDER_CHEST));
}
return false;
}
}``
?paste
but in reality, it only uses the block's type for verification
Ok but why do you want to fake-change the blocks type
e.getRecipients().removeIf(nearPlayer -> !nearPlayer.getWorld().equals(p.getWorld()) && nearPlayer.getLocation().distanceSquared(p.getLocation()) > chatRange * chatRange);```
it back IliegalArgumentException(Can't measure distance between world and world).
But I wrote nearPlayer -> !nearPlayer.getWorld().equals(p.getWorld()). How can I solve this?
Show me the griefprevention method
but, how would I even know if there are stone around that location
Hm if I do it without check and just get it it works so
search allowBreak(Player player, Block block, Location location, BlockBreakEvent breakEvent)
Ehm could somone please help me? o.o
wait what are trying to do again
what name do you want to set where?
Cant you just do claim.allowbreak? @hardy swan
but the rest of the method takes care of wilderness, doesn't it
maybe imma tell the dev to change it to material type lmao
Idk im still confused what you want
so I want to know if a player can break a stone at a given location
without having a physical stone there
that simple
I want to set Compass to §3Citybuild ; the Book to §eHelp ; and the enderchtest to §5Enderchest
may want to get its ItemMeta, set DisplayName and setItemMeta
before adding to inventory
create for every item a new itemstack and set them a modified itemmeta
How do i do that? xd
item.getItemMeta()
Basicly:
(I made it SUPER noob friendly btw ^_^ )
Material material = Material.STICK;
int ammount = 1;
String name =...
yea...
But my item is red now xd
@hybrid spoke ?
Lookup the chat
cool kids do Optional.filter().filter().filter().
Nom i don`t undertand it :C
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
what does your openMainShop and openShopSection do?
@hybrid spoke When i try this with iteem, item is red xd
It opens the main shop inventory and/or a shop section. So its a inventory
ItemStack 
any collection you use there?
Yea, possibly 🤣 But like, the stacktrace doesn't show me anything thats wrong in my code, isn't it a IndexOutOfBouds Exeption by the server code?
Bcs it leads to jdk and playerconnection classes
seems so. but it is in contact with your intention
Mhh ok, will look at my code when Im home, thanks though
when a server crashes, the crash log shows all
and 50% it tells you nothing lol
in his case it just shows what did go internally wrong
?paste
You set the items in the inventory after show it to the player
First populate the inventory then open it to the player
Wait o.o
How do i do that?


follow a tutorial, learn some java. it will explain everything to you
if its not a bad tutorial
You first open, then set the contents
You need to first set the contents before opening
Okay, ehm i changed it:
https://paste.md-5.net/xojimofepe.java
I puttedt the open inv at the bottom, but it is like before o.o
Or is that false?
What do you get?
The same like before :C
the compass isn`t renamed
You didn't set the meta to the item
you are now creating 2 itemstacks for each item. you are creating 1, modifying his meta but doesn't update it and let it fly in space and creating the other to set it NEWLY into the inventory
uffff how do i do that? xd
could xyou pleaseeee show me this? it is red :C
ItemMeta meta = item.getItemMeta(); // Gets the item meta
// Do stuff with the meta
item.setItemMeta(meta); // Sets the modified meta to the item
nol i don?T understand it, it gets red when i put that in my code :C
Dude, don't copypaste, just understand what I'm trying to say
That's why I leaved comments
yaaaa but idk, it dosen`t work :C
show your code
Grrrrr, it used a default access method
should I copy and paste the default method too 🤔
nvm submitted PR
nothing happens after you set display name ? XD
^^
and in your code, you never add item2 in your custom inventory
- Name your variables properly so you (and the people reviewing your code) will have a better understanding of what's happening.
- Check you're following the steps properly.
I just see a mix of things doing stuff in your code expecting to work
SQLite queries are easier in nature to grasp
Why not a general purpose library instead of a plugin?
I wish they were the same as SQL queries though
sql is sql man, its just what the db can do is what you want to go for.
somewat the same
no its not, basic shit is the same but isn't when you need specific things done
like updating a input if it exists already queries different on sqllite than on plain sql
it is though, from SQL Server to SQLite to MySQL to Oracle I have not noticed anything really different in the sql then what the dB function have to others.
lol
It's still sql, ofc is not the same as MySQL, but it's sql, basic stuff is meant to be the same
Yea sql is sql its the syntax you are talking about
there is, I would say, quite a bit of difference
MrTommy could you please help me with this and do an example? xd
I don`t really understand how i can do that :C
even syntax
example = solution
cue the command
Sadly, I can't, ofc we went through the same situation as you but I'd recommend you to get away from it by yourself, grab a Java tutorial if you want, but you need to understand what you're doing wrong and how to improve it
he is trying to set item meta
you've already got enough examples - even solutions, patrick (here his name)
oh
However you're not going to make a GUI command that way, just fyi
Exaclty
Is not too complex what he's trying to do
But there are concepts he's not having clear
So it's better for him to know what he's doing wrong by himself
I want pizza
talking about getting itemmeta....
How would i get what the command returns ```java
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), consolemessage[1]);```
you know there are times where the doc says return a copy of item... where it only returns a shallow copy
You can't, commands doesn't return anything 🤷♂️
that returns a boolean if it failed
Commands usally respons with something is it possible to get the response
Would anyone know where PlayerInteractEvent for block placement is called in CraftBukkit?
I need it to better understand how Minecraft works
which iirc only returns if the code returns false which most devs just ignore
I thought he meant to the output messages and stuff
something I do 😅
I directly return false I don't give a fk
Okay, ty!!
I always return true for my own syntax warnings
actually should just return true tbh
But idk i have to fix that xd
plugin.yml usage is shit 😦
If I had to make an error message I do it by myself, But iirc, returning false automatically returns the command usage defined in the plugin.yml
^^
it is false i think, contrary
no? Return true does the opposite
return true means successful, false means failure
brigadier 😌
that's why always return true
it's ok
How do i get all messages console gets
someone not writing usages hhaa
Own implementation homies
I just slap my commands through one big ass switch statement /s
I haven't even seen how brigadier works
why do you want to do that?
to send it to discord
I've an idea of how you can do it
haha SRP go brr
DiscordSRV has a feature where you can output console data to a channel
Create your own implementation of the CommandSender interface, and override the sendMessage method to send the method to discord
its actually pretty neat
i mean, it's already been done EzBedWars don't know why you wanna remake it
maybe for the know-how
ah yes learning by asking to be walked through something perfect
I used to, but now I usually make separate classes for each subcommand and command
otherwise he would learn from others who asked on spigotmc or stackoverflow. where is the difference?
it really doesnt seem like he's doin it to learn, probably needs it for his server
does sending an actionbar reset the title?
hm
then why does it happen? this is it: https://acrack.store/HH3HF4MV_
no idea
what tf is acrack.store
image host doamin thing
it redirects to pays.host
^
oh that's quite neat
probably stole my ip about 10 times
ah
what do you mean deprecated
ow i see i have to use the one with 3 strings as argument
does the server shutting down properly xall playerleaveevent ?
If I try to add my packet handler before the server's I get this error: java.util.NoSuchElementException: packet_handler
protected static final String KEY_HANDLER = "packet_handler";
protected static final String KEY_PLAYER = "packet_listener_player";
protected static final String KEY_SERVER = "packet_listener_server";
//Method which uses fields above
System.out.println("injecting " + object);
io.netty.channel.Channel channel = new Reflection(object).getField("channel").getObject();
if(channel == null)
channel = new Reflection(object).getField(Channel.class).getObject();
System.out.println("channel " + channel);
if(remove)
{
channel.pipeline().remove(KEY_SERVER);
}
else
{
if(channel.pipeline().get(KEY_SERVER) == null)
channel.pipeline().addBefore(KEY_HANDLER, KEY_SERVER, new ChannelHandler(new INCChannelWrapper(channel))); //Here
System.out.println("KEY_SERVER " + channel.pipeline().get(KEY_SERVER));
System.out.println("KEY_HANDLER " + channel.pipeline().get(KEY_HANDLER));
System.out.println("Channels");
channel.pipeline().forEach(System.out::println);
}
THE CHANNEL IS NOT NULL AND PRINTS IN CONSOLE
How can I get an output when the player is pressing W / is moving forward? I know it is in the move Listener and I know how I would get in which Direction the player is moving but not if he is walking forwards backwards or left or right.... ping me pls
Hello, how can I access of a file YML of another plugin ?
yes but don't
why ?
access the plugins api if it has one
Okay thank you
Bukkit has a method getPlugin(String) and then get the data folder? Or new File(JavaPlugin.getDataFolder().getParent(), "FOLDER")
has somone the link to the websiet with all spigot events?
?jd
@eternal oxide can I do that https://paste.md-5.net/uzopanupiq.nginx ?
@maiden briar thank you, I do that. Sorry I didn't see your message
Ok
probably
@eternal oxide okay thank you 🙂
There is nothing that shows the difference between version are there?
Tysm!!
Does somone know how to create a shulkerbackpack?
or how to make, that you open a shulkerbox, with a command?
On right click you can hook into the inventory of the item and display it in a custom bukkit inventory. Then on close get the inventory and save it back to the items inventory.
You have to be carful thought to make sure you put logic that will not allow you to move the shulker box item into the inventory cause then you will nest it and be lost forever lol
oufff okeee tysm!!
And how do i "save" the items in the custom inventory?
When i do something like a backpack with a custom invenzory it doesen`t safe :C
you have to save but grabbing the item in the inventory in inventorycloseevent
and know what it is and then save it back to the items inventory
could anyone teach me how to make this grappling hook?
https://streamable.com/8alhkt
i tried searching online but i only found grappling hooks that push you towards the hook
this one howerver lets you fly around
i found this video from the same creator of the video i showed that explains how to make the grappling gun in C# in Unity, but i do not understand anything.
https://www.youtube.com/watch?v=Xgh4v1w5DxU&ab_channel=DanisTutorials
this is a channel to get help with the Spigot and BungeeCord API, you're showing footage of something that is not even Minecraft...
well yeah but i want to make it in minecraft
found a minecraft mod: https://youtu.be/Bj0N-5B81mM?t=565
i just don't know how to do it in java
How do I know if someone is in a sign gui?
there's probably get inventory type syntax
what is it?
have you tried searching your browser?
found it in less than a minute of searching on google
try harder, i'm not gonna do this easy for you because you're too lazy to search
theyre all using protocollib
any way of checking if a bossbar exsists?
do custom datapack recipes show in the book when you have all items in your inventory?
wrong server
where should I ask this?
idk
well
how can I get and set nbt tags of an item?
which tags?
Does anybody know what this error message means? I'm trying to make a crafting recipe (Which has been successfully been done earlier in the plugin) but this error always shows https://hastebin.com/ahewevagix.apache
Line 116 ```java
ShapedRecipe recipeCom = new ShapedRecipe(new NamespacedKey(this, "COMPACTED_DIAMOND"), compactedDiamond);
the result stack is null or air
then compactedDiamond is null
just any
you need to set the namespacedkey first and then use it as a variable in the shaped recipe thing
or atleast that's what i did when it didn't work for me
either you wanna access minecraft tags -> use the API or you wanna use custom tags -> use PDC
Ty
The reason I ask is that the API has a full PDC for adding/reading tags on items
Ah, well would there be any way to add metadata to a block? From what I can tell metadata does not persist across reboots?
😭
only blocks that have a TileEntity
we were, then he asked about a block
wild.
All ItemStacks have a PDC but blocks in the world, only those which have a TileEntity have a PDC
well im wondering if metadata that gets added to items persists when you place said item
no
hm
metadata is transient
i still need help btw
Those anyone know why im having this issue when trying to load my plugin? I know its a NPE but I wen't to where it said the issue was and it was were I was just registering my commands?
link: https://pastebin.com/xHPPiLMt
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I think that you don't register the command in plugin.yml
try lowercase
How can I change the Explosion of Fireball?
What is the line 72 of DivineCoreMain class
also it might need a description though
Fireball class has no power
The line where im registering the first command
try giving it a description and put the command in lower case
it's been an hour and a half someone please help
Well you never awnsered my question and we can't really help without it
Also, is anyone familiar with what is causing this to suddenly happen?:```
you using maven or gradle?
Maven
nvm i dont know much about Maven as i use gradle
where i find my ApiVersion for the plugin.yml?
But does anyone else why this is now happening? Same module build successfully just a day ago
Now, however, it is failing to build for some reason
ProudMix.java(Main)
https://pastebin.com/DUwVVKpF
Balance.java
https://pastebin.com/fzr2FAVy
plugin.yml
https://pastebin.com/N0cGhynM
This works perfectly when i don't register the "walletadd" command, but when i do i it dosen't get registered because it dosen't exist when i try to run it, and if i try to run any other command that uses my Config i get this error: Caused by: java.lang.NullPointerException: Cannot invoke "me.prouddesk.proudmix.ProudMix.getConfig()" because "me.prouddesk.proudmix.ProudMix.plugin" is null. (even if i remove everything inside "walletadd" it still happens)
You cannot access your main class like this
I'm making an instant respawn plugin but it doesn't works, can someone tell me what is the issue?
public void onDie(EntityDamageEvent e) {
if(e.getEntity() instanceof Player) {
Player p = (Player)e.getEntity();
if(p.getHealth() - e.getFinalDamage() <= 0.0D) {
e.setCancelled(true);
for(ItemStack contents : p.getInventory().getContents()) {
if(contents != null && contents.getType() != Material.AIR) {
p.getWorld().dropItemNaturally(p.getLocation(), contents);
}
}
for (ItemStack armor : p.getInventory().getArmorContents()) {
if(armor != null && armor.getType() != Material.AIR) {
p.getWorld().dropItemNaturally(p.getLocation(), armor);
}
}
}
p.setGameMode(GameMode.SPECTATOR);
}
}
}```
you need to pass the instance of the class when you instanciate it
with a constructor and then a private field that contains the plugin
https://pastebin.com/RKUnZQAe full code for Main.java and the class with the listener inside of it
onPlayerDeathEvent is not being called even though i've followed the wiki on listeners and the event api completely, intellij even says that Method 'onPlayerDeathEvent(org.bukkit.event.entity.PlayerDeathEvent)' is never used , is there a fix to this?
Define "doesn't work"
Does somone know for scoreboard how i can put in the xp which you have?
That is not an issue
It will always say that
the event is still not registering and nothing is being printed out in the chat or console
It makes you respawn and change ur gamemode to spectator in the same place withot the "YOU DIE!" screen, but it doesn't works, thats all
yes you can because i fixed it. The indent in my plugin.yml was just incorrect.
Hey there, curious, is there a reason one can't access the server's properties through the Bukkit API? (Or have I just completely missed it?)
you can use java's filereader class and read the server.properties file
Does the plugin get enabled
Does someone know whats the best way to recreate custom spawn eggs? Im trying to spawn my custom chickens with chicken spawn eggs, i have a lil system and it works fine, the thing is im spawning my custom chicken under playerinteractevent and in e.getclickedblock. Now my problem is I need to modify the location because currently im adding y + 1 to the location so when i click a block with the spawn egg it will spawn it right on the block. Now if i click under the block, it spawns in on top of the block, which should not happen. The same goes for clicking the side of the block, then it still spawns on top of the block. Anybody has any idea whats the best way to modify the cords so it acts like normal spawn eggs? Sorry for a bit messy explanation, tried to explain it as good as possible, heres my current code:
https://paste.md-5.net/ayoravofey.cs
You can yes, but not optimal, since it's already been read
e.g. Does: System.out.println("e&lHeadDrop&r enabled!"); this run
no
Have you made your plugin.yml
yes
Currently I've been using reflection to call getProperties on CraftServer, and then get the properties like that but not optimal
Do you register your main class in the plugin.yml?
main: com.arkfish.spigot.headdrop
if this is what you mean then yes
thats not ur main class
does bukkit complain about anything on startup?
It must
cause that headdrop class is in package
com.arkfish.headdrop
as much as anything
And what is the output of /pl (in terms of colours)
let alone the fact it doesn't extend JavaPlugin
Looks like a spree of many issues
Yep - looks like someone who learnt java thru a bukkit tutorial 
Hey, can anyone tell my why BukkitRunnable doesn't work?
@Override
public void onEnable(){
}
@Override
public void onDisable(){
}
public void runnable() {
new BukkitRunnable() {
@Override
public void run() {
Bukkit.broadcastMessage("lol");
}
}.runTaskTimerAsynchronously(this, 0, 20);
}
i learned java before learning bukkit or spigot but i guess it wasn't enough
Use lambdas instead of anonymous classes ffs
you don't run the runnable method
and yes
where and how
use lamda expressions
should i run it
ill write an example for ya
Bukkit.getScheduler().runTaskTimer(this, () -> {
Bukkit.broadcastMessage("lol");
}, 0, 20);
Much nicer
How do I detect what item is dropped with PlayerDropItemEvent? I can't find anything that I can use to find the ItemStack type.
Depends on where exactly given that this is used
yep, that was ur main class
Does someone know whats the best way to recreate custom spawn eggs? Im trying to spawn my custom chickens with chicken spawn eggs, i have a lil system and it works fine, the thing is im spawning my custom chicken under playerinteractevent and in e.getclickedblock. Now my problem is I need to modify the location because currently im adding y + 1 to the location so when i click a block with the spawn egg it will spawn it right on the block. Now if i click under the block, it spawns in on top of the block, which should not happen. The same goes for clicking the side of the block, then it still spawns on top of the block. Anybody has any idea whats the best way to modify the cords so it acts like normal spawn eggs? Sorry for a bit messy explanation, tried to explain it as good as possible, heres my current code:
https://paste.md-5.net/ayoravofey.cs
but you need to call it onEnable
So event.getItemDrop().getItemStack()
ur probs gonna need to get the block face and then work out the offset from there
No problem!
You can also do it pretty much everywhere else, btw
Yeh - but i assumed that was where he wanted it
seen as it was just there as an empty method
event.getItemDrop().getItemStack
so blockface is returning which side it was clicked from?
including playerinteractevent
Yeah - it returns an enum of the blockface
Figured that out, but I can't use it in an if statement?
What are you trying to compare?
Why wouldn't you be able to use an if statement
Is the item dropped a diamond chestplate
So you have the itemstack, then you can compare the type
.getType == Material.DIAMOND_CHESTPLATE does not work?
e.g: if (event.getItemDrop().getItemStack.getType == Material.DIAMOND_CHESTPLATE) {}
yep
Someone can help me?
?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.
It was complaining that I was using an ! :/
don't forget the ()
wrap the whole thing in another set of brackets and put the ! in between
Did that
Send code then
unneeded in most cases
I'm actually making an instant respwan plugin, but when I die in game it actually shows the "YOU DIE!" screen, it's there something wrong in it?
Yep, but sometimes needed
I fixed it
why is there so many of em like north_east and north_west
I cant rly understand the javadocs
the java docs for blockstate
Actually let me test it a bit
Blockfaces aren't always just the cardinal positions
You can do if (rayTraceResult != null) { btw
So whats wrong? can You explain what I need to change pls?
You are not at fault if the stacktrace were to be believed
Hello guys, could please someone explain to me, how to use the new 1.17 nms with the mappings?
how can I change a players velocity?
unless of course the stacktrace is cropped (which it honestly is)
Well the Spigot post was pretty clear on how to use it
I can I do anything to prevent the server from crashing or lagging that much?
ok hello, so im using this script to not generate enchanted items, but when the chest gets broken it will still generate enchanted items, any quick fixes?
Use an else statement
i mean the script to generate unenchanted items upon break is obviously unrelated to what i sent
I would also use some lambda there to clean it up
Yea, but I am dumb enough to make it not workling.
Could you show what you tried
What's up with people using !(boolean) instead of !boolean
I forgot but how could I fix this issue again? https://gyazo.com/c7825ddf9da244436f1c54ee56d05e09
So can I do anything about it so its not crashing or lagging that much?
set velocity to 0 after tp-ing?
I basiclly copied everything from the post (except the commands, since I don't get what are they for) and IDE doesn't see the classes
so then I would do that on the death event
The error you showed is cropped so no idea
If it isn't then I am a bit confused
because you just killed the main thread
Now show us that
So if I get an different error we know whats going on maybe?
Oh, it actually works, but they have removed one class, so I thought, it doesn't work 😅 sorry
Watchdog usually produces stacktraces of multiple threads, not a single stacktrace so something is wrong as I said multiple times now
It seems that pathfinders have changed alot..
Okay thank you a lot might help: the error only appeared after adding this code I sent you and only when using that one
Does PlayerDeathEvent not have setVolocity
and after we timed out and we join again the code funktioned
the player has the method though
Strange, but if it works it works ¯_(ツ)_/¯
hm I guess you can't do e.getPlayer
yeah but it should be a battle at the end without having to reconnect everytime an ability was used haha
Well, the javadocs does make it clear
I'm actually trying to make a place event but I don't know how to put the owner head of the dead player, someone can help me?
That looks fine
is that error better ? https://gist.github.com/ItzJustNico/b8bb540ce2aacc0fadad33a3f48e7652
Well, the place event will not change anything
How I can do it so?
lool
really does not look like it is your fault. The errors only appear if the server halts for multiple seconds, which your code is never going to accomplish
Well you did comment out the code where it sets the player owner
If only I knew what the ThreadedMailbox is
But whos fault is it I really wanna fix it haha so weird
Cause I don't know if it was good, but I tried with the code on
spigot/minecraft I guess
Or perhaps your code and something else, idk
And I have this error
Nor do I know why your code caused this
Is there an event fired if a player jumps on a big dripleaf?
Are you sure that block is a valid variable?
Are come on, you can read the error for yourself
He probably just copy pasted that code tbh
Compiler errors are the easiest things to solve
Yeah block isn't a variable
you dont have a field named block
?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.
?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.
This is def. spoonfeeding right there
Exactly
Do you know an other option of giving the other player the movement you are doing like pushing him to the right when you are waking right and leftclicking and pushing him to the left when you are walking left,... and so on?
But, what is the solution so?
lmao
I set the players velocity to 0 on death but it the player still moves when they respawn
You could run it on the next tick, idk
I recommend reading the Java tutorials above
Oh no, that won't work
I will
Good then you will know what the error is 🙂
But I want to finish this for a friends server, thats all
And I'll start reading that
Can you give me the solution please?
We're not spoon feeding you
Hey! so trying to set up Bungee cord with 4 servers
3 of the servers says the Port is used and then when i connect to the Hub ,says i need to enable IP Portforwarding , im confused as ive already done that
bruh
oke, thanks for the help I guess
Do you know an other option of giving the other player the movement you are doing like pushing him to the right when you are waking right and leftclicking and pushing him to the left when you are walking left,... and so on? sry If I am anoying you
any ideas how to set dropped items by item break, since many are struggling with this
since blockbreakevent doesnt have a method that could set the drops
You could just give player A player B's velocity every tick
But it would not be too smoth
And leftclicking/rightclicking will be even more complicated no idea where to even get started here
but I just want it once not all the time if you now what I mean
thats why I did it with left clicking
its kind of an ability
oof the npc player changes are kind of big lol
If I set a players velocity to 0 then they shouldn't move correct?
under normal circumstances, yes
If set in the right place
If you set it somewhere and something can override it based event order
Unless you use the right event to set it
you could cancel the movement in the moveListener for some time but looks weird then
I'm just annoyed on what happens when a player gets killed
Not recommended imo
?paste
Okay, so, I'm making a crafting thing where you drop a custom book and chestplate on the ground and get the enchantment on the chestplate that was dropped. I have the code for removing the custom book if it was dropped with a chestplate, but I now need to edit the dropped chestplate. I don't know how to access the chestplate from what I have here.
https://paste.md-5.net/ojasapetad.cs
please I need the solution :( @chrome beacon
Just only that and I'll start the ?learnjava
what's the issue?
I'm making like a tombstone plugin, so basically I'm making the head place part and I need the variable of block and I don't know what it's the correct one
I'm a noobie coding
^
Skull is not a block state its a item meta type
block is not a valid field
create it
🙏 to god that this man will understand wtf his code is erroring
can someone please help? it's been hours
StackOverflow is your friend
we dont do game development
idkidk relax lmao
You still need to assign it to the correct value
im done with him
yes
So creating a variable is not the only needed step
the thing is, he probably does not know what he wants to
Of course, I know what he wants, but I won't spoonfeed further there
In all seriousness, you already obtains your block a few lines above
Recycling code is the most useful tool you will have, ever
are u in a event
He obtained the block via a location the line above, so I do not think so
can someone please help
well, nvm
I just need that for getting the owner head
We already said, we do not do game development
Block block = loc2.getBlock();
did you read what i said after it?
Or p.getLocation().getBlock
THANKS OMG <3
You decide what makes sense
Imma try both
what you wanna make a grapple hook like the one from karlson 3d
yee
yeah in minecraft, pretty much near impossible
if you actually read what i said afterwards you'd see that i sent a link to a mod that did it
:(
just lettin you know.
its not but its probs not gonna be easy
a mod
yeah thats what I meant because I can only make the one from Hypixel Skyblock
So you wanna make a mod or plugin
A MOD IS INDESCRIPTIVE
a plugin
WHY ARE YOU YELLING
I think anyway
dont you have update the block state. like state.update
Its not impossible to make it, but without some good coding experience then its not gonna be possible
he did skull.update not on the block state.
well that's a problem
THANKS THANKS THANKS
Have you coded before?
add location of the object
i started java a few days ago and i do know skript
skript won't help you make the grapple hook for sure
THANKS @quiet ice @granite stirrup for helping me, istg I'll not disturb anymore
Thanks
but if you keep learning you'll maybe one day be able to make one
Grappling hooks require vector maths
Which is pretty much gg get reckt
heya, this is no option
did you know that dying is in-fact not healthy
perhaps someone can make a simple, easy to understand java plugin explanation from this video?
vector maths are very complicated, you cannot really break it down into understandable portions
o o f
How do I teleport players to different worlds using mulitverse core. I want to do it directly from inside one of my plugins. Haven't written the code yet just want to know if its possible
Why not do it in a traditional bukkit way?
teleporting has nothing to do with MV Core
You just need to obtain the target world, but you have multiple options for that
How would I do it?
All MV worlds are registered with Bukkit
Bukkit#getWorld(String) or Bukkit#getWorld(UUID) I think
you dont need MVC to do that
do people even ddos anymore?
ok ok ok ok
finnbon has some good tutorials on the basics of vector math in spigot
yes
How would I do it the traditional bukkit way
https://www.spigotmc.org/threads/drawing-a-line.176695/ https://www.spigotmc.org/threads/radians.176792/
Hello people of spigot!
Today, as a start of my new & last high school year, I decided to write a tutorial on how to display a line of particles using...
Just set the world in the teleport method
Bad programmers do it to themselves 🙂
i just opened mc and i accidently clicked exit
Ok
🥲
ex:
player.teleport(new Location(Bukkit.getWorld("world"), 2899.5, 24.5, 3983.5, 0, 0));
player.teleport(new Location(Bukkit.getWorld("newWorld"), 2899.5, 24.5, 3983.5, 0, 0));
Shouldn't this delay their respawn? ```java
public void onDeath(PlayerDeathEvent e) {
Player player = e.getEntity().getPlayer();
player.setVelocity(new Vector(0, 0, 0));
World world = e.getEntity().getWorld();
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
player.teleport(world.getSpawnLocation());
}
}, 200L);
}
help me guys
i would also check to validate that works is real
Wait 50 years inevitably
BRUH IT FUCKING CORRUPTED THE LAUNCHER
no.
Also lambdas > anonymous classes
Lol
yes please lambdas lol
This is thinking they player has it respawn and not quit
does anyone know how to make a player stop falling? perhaps a level of levitation or slow falling?
why do u want to delay respawn
^
to stop this https://gyazo.com/c7825ddf9da244436f1c54ee56d05e09
Why not cancel the event and tp them manually :thinksmart:
cancel the respawn?
I don't see a issue with that gif, and I blind?
When the player gets killed he gets pushed on respawn
Is there a event to check if a player is in the same world?
Elaborate
that's the thing?
That looks like to me you have code somewhere pushing him on respawn
the same world as what!
respawn does not do that
go to vanilla and see what happens
that sure in the heck does not happen
e.g. If I would want to make that when a players write smth that only players see the messages that are actually in the world
So just curious, how expensive is World#getHighestBlockAt()? It's specifically this call that is giving some very heavy performance issues.
nah i think its cuz of auto respawn the player keeps some momentum for a bit so it pushes him
Then make your own auto respawn
Yea lag would do that
the packets don't catch up fast enough
#GETABETTERSERVER ?
y?
It may be taco spigot doing that
taco spigot
its a fork
well maybe don't use that lol
Almost like we dont help with forks cause its not normal spigot
Like do i get a taco when i start spigot? Cause i am down for that.
yes
hahahaha omg that moment when you are trying to find out what is going with your NPC and you create a infitite spawn loop hahaha
oops
how i can set custom durability for item? item.setDurability doesn't work
You can’t change max durability iirc although an alternative would be to scale it
how i can do this?
copy the logic of durability
anyone know why this is red?
https://i.imgur.com/MmoIWie.png
please do not do this to me🥺
?basics
Send more code
how do I prevent the player from putting items into custom inventory?
What is Main
you must to get instance
listen to inventoryclickevent,check if the inventory is yours,cancel it
public String ifConfigValueIsSet(String ConfigValue) {
return ConfigValue;
}```
just testing
thanks
method != field
?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.
You are using it like a field, though you are declaring it like a method
i'm already learnin in codeacadamy
If it’s a method you need to put parenthesis and pass in a string
even then, since it just returns that string, you could just use the original string
ye
Basics?
We have learnjava
?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.
alias it ples
Lol floofsy strikes again
Stellrow what alias should I add
Why not use tags?
just ?basics
How often is this called?
every second.
?cc add basics 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.
Custom command successfully added.
through material enum
It could use regex, which is pretty resource intensive
thanks
But idk how #contains works
how do i use the normal config syntaxes?
https://www.spigotmc.org/wiki/config-files/
plugin doesn't work
should eb the classic for each and checking instance/value
syntaxes?
// Reading from the config
String name = plugin.getConfig().getString("player-name");
// Writing to the config
plugin.getConfig().set("player-name", name);```
looks good
so? That should work
?learnjava
however ur not saving
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.
it does not
Please
are you saving after setting?
'To read and write to the config using the above method, we call the getConfig() method. However, if you will be calling getConfig() outside of your main class, you should use the main class's instance' first sentence.
yeah thats a rip
"It does not work"
WHY DOES IT NOT WORK
He doesn't have a plugin variable
1 sec lemme re-write my code
lol
