#help-development
1 messages · Page 1449 of 1
there isnt even a persistent data container method in blockstate :/
but I need it to work for a mob too
Code to execute when a player wants a lock (/protect)
if (cmdName.equals("protect")) {
if (args.length == 0) {
Player target = (Player) sender;
MagmaBuildNetwork.playersWantingLock.add(target.getUniqueId());
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', "&2Right click a chest/ barrel etc to lock it\n Or type /protect cancel"));
}
else if(args.length == 1 && args[0].equalsIgnoreCase("cancel")) {
Player p = (Player) sender;
MagmaBuildNetwork.playersWantingLock.remove(p.getUniqueId());
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&2Cancelled!"));
}
else if (args.length == 1 && args[0].equalsIgnoreCase("public")) {
// TODO add method to make container public (lock.remove)
}
}
Eventhandler who continue checks if a player executes the command (when executed uuid is added to hashset and eventlistener looks for that)
@EventHandler
public void onContainerClick(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
Player p = event.getPlayer();
block.setMetadata("MBN", new FixedMetadataValue(plugin, p.getUniqueId()));
ItemStack itemStack = (ItemStack) event.getClickedBlock();
NamespacedKey key = new NamespacedKey(plugin, "MBN");
if (MagmaBuildNetwork.playersWantingLock.contains(event.getPlayer().getUniqueId())) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block.getState() instanceof InventoryHolder && block.getState() instanceof Lockable) {
event.setCancelled(true);
//lock
itemStack.getItemMeta().getPersistentDataContainer().set(key, PersistentDataType.STRING, p.getUniqueId().toString());
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&2Locked!"));
MagmaBuildNetwork.playersWantingLock.remove(event.getPlayer().getUniqueId());
} else {
event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&2This block can't be locked!"));
MagmaBuildNetwork.playersWantingLock.remove(event.getPlayer().getUniqueId());
}
}
}
declaration: package: org.bukkit.block, interface: TileState
Guess you need to cast
hmm
It seems to share all the same subinterfaces as BlockState, so /shrug
how?
How what
how to cast and to what?
^
do entity events fire for players?
lmao to what do i need to cast?
Depends on the event
block.getState
what :/
EntityChangeBlockEvent
Possibly
I don't know of any changes a player makes that don't have a specific event though
^
This is what you need to cast to
Then you can use the linked method
does it trigger when a creeper blows up a chest?
EntityExplodeEvent
for(int i = 0; i < 20; ++i) { int spawnLocation = i; }
im using a schedueler rn but im confsued, I wanna run it for everyone but I also want that everyone sees their location compared to the border so how will I get the player value if no one sends anything?
I believe that is just some pretty simple logic your are needing
if this is your first plugin you should start with something easier
i would check which side of the border the player is closest to, and get the distance to that location by location#getDistance()
this would 100% be easier tham perms
and kits probably
but i agree
start simple
I already figured how to get the distance value im just not sure how to display it for everyone
ah
you should loop the players
Loop all players in the scheduler
well cycle through all online players and set their actionbar
Calculate their distance, show it to them
for (Player player : Bukkit.getOnlinePlayers())
okay I will try that thanks a lot
something like that
thanks for the help the plugin works now I appreciate it
np
Can you edit the code for me pls
@EventHandler (priority = EventPriority.HIGH)
public void onPlayerDeath(PlayerDeathEvent event) {
event.getDrops().removeIf(is -> is != null && is.getType() != Material.DIAMOND_PICKAXE);
}
Like this?
TY
You don't
In console log?
You use if
Not work same rip
so ``` switch (args[0]) {
case "add":
switch (args[1]) {
case "location":
player.sendMessage("adding location");
return true;
case "loot":
if(isInt(args[2])) player.sendMessage("addming loot");
return true;
}
}
would that brake?
with index out of bounds
and then what do I do?
and theres no way to not check the length
ah
args.length
You could catch the exception I guess
thank
But like, please don't
hahaha
` @EventHandler
public void onDropEvent(PlayerDropItemEvent e) {
Player player = e.getPlayer();
Item it = e.getItemDrop();
ItemStack is = it.getItemStack();if(it != null && is != null && is.getType() != Material.AIR) { if(is.getType() == Material.DIAMOND_PICKAXE) { e.setCancelled(true); String Drop = plugin.getConfig().getString("Drop"); player.sendMessage(ChatColor.translateAlternateColorCodes('&', Drop)); } } }`
I made this code, but when I use Q in inventory it gives me an error in console and moves my pickaxe to other slots, how do I get it back to the first slot?
Would it be wise to store user data for your plugin in pdc? e.g. in essentialsX, they got their user data in individual yaml files, couldn't they just store em in pdc for each player's data? Or did I misunderstand how pdc works
That is?
so, i am trying to make a custom tablist, and want to remove all players first. i use this code for that:
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER ,worldserver.getPlayers());
problem is; it removes the player for the client (it dopesnt render it) how do i make it so it only deletes the tab?
Do you mean the default player list that appears in the tab completion? You wish to remove that?
basically, yes
guys Are there any usable thing for all colors? I mean how can I use Coloured with lore?
It will work for all colors I mean
player join event, delayed 1 second
You don't need to do all that, just create a new arraylist and return that in your onTabComplete event
(1.16.4) by the way
Also check out the XY problem
wait no i mean
FUCK NO MSG PERMS
caps
the player list
'the tab list
whnen you press tab
caps btw, sorry for that
[19:14:06] [Server thread/ERROR]: Could not pass event InventoryCreativeEvent to BlockPickaxe v1.0
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[server.jar:git-TacoSpigot-bf023c7d]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78) ~[server.jar:git-TacoSpigot-bf023c7d]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-TacoSpigot-bf023c7d]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [server.jar:git-TacoSpigot-bf023c7d]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [server.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1821) [server.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.PacketPlayInSetCreativeSlot.a(SourceFile:23) [server.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.PacketPlayInSetCreativeSlot.a(SourceFile:9) [server.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-TacoSpigot-bf023c7d]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_292]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_292]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [server.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:808) [server.jar:git-TacoSpigot-bf023c7d]
net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:645) [server.jar:git-TacoSpigot-bf023c7d]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Caused by: java.lang.NullPointerException
at BP.ItemBlockEvent.onClickEvent(ItemBlockEvent.java:28) ~[?:?]
Ohh the tab list, mb
dw lol
Have you checked this page out? https://www.spigotmc.org/threads/remove-player-from-tablist.55175/
According to the third post in this thread, if the player isn't in the tab list it will not be rendered (1.8+)
wynncraft does it
Haven't done that myself, but from my experience with other plugins with NPCs, their names appear for a split second before it disappears when the player goes near them
- Use the PlayerMoveEvent, only check from block changes & check the radius. If they're within the radius remove them again so you don't have to constantly remove them with a repeating task.
I guess that's what this is talkign about
Hey Gecko, I actual got my weird question solve, the one every one sed cant be done 😝
any player, so apparantly, that packet is effectively a destroy packet
Help me pls
current would be null
ill look into citizens 2 src for it
;/ replied to the wrong message
if that isnt considdered skidding lol
?
current is null
Ey, so long as you're learning, it's alright in my book lol
ItemStack current = e.getCurrentItem();
Yeah current item is null ;/
And an if check
I do not understand
lol im new to NMS, this all is a bit confusing to me
does the * enable all perms that go after the chest.?
chest.*:
children:
chest.add.item: true```
i have that
and 3 perms
chest.add.item
chest.add.loot
and chest.add.location
pls help me
when i set chest.* to true
ill use protocollib, i guess. makes it a bit easier. i have heard bad things about it though..
i can add locations and loots
even tho the chest.* only has chest.add.items as children
you cant have .s in your path
wdym
i have seen this same example a few times
Ehy
but, i will need to resend the tab each time a player joins, right?
Can u help me?
correct me if im wrong but, basicallt: player gets removed > player enters chunk of other player > player gets added?
running a SignChangeEvent to see if any line of a sign contains certain text
for (String line : sign.getLines()) {
this.plugin.sendMessage(event.getPlayer(), line); }
i run that to get the contents of the lines
but they send as blank?
no matter what type of sign i use and what text
How do I see if it is null?
It sends four empty lines
.
ah, thank you!
Ok now it doesn't give me more error
But the part where I have to hold the pickaxe even after death doesn't work
weird enough, if I check the lines on the sign on a BlockBreakEvent, it works properly...
Perhaps im using the wrong event
I tried to remove all plugins
player placing
How can I do?
This part @EventHandler (priority = EventPriority.HIGHEST) public void onPlayerDeath(PlayerDeathEvent event) { event.getDrops().removeIf(is -> is != null && is.getType() != Material.DIAMOND_PICKAXE); } not work
Op doesn't affect that code
ik
Make sure you don't have another plugin messing with drops
Even if i do:
this.plugin.sendMessage(event.getPlayer(), sign.getLine(0)); this.plugin.sendMessage(event.getPlayer(), sign.getLine(1)); this.plugin.sendMessage(event.getPlayer(), sign.getLine(2)); this.plugin.sendMessage(event.getPlayer(), sign.getLine(3));
it still sends empty lines ;///
I have already tried to disable everything with plugman
Don't use PlugMan
ah
Delete plugins and restart
bruh
could you show me how you did that?
this is so weird ;////
that worked
what the heck
what did i do differently
1...
Sign sign = (Sign) event.getBlock().getState();
thats probably why...
it used to be a blockplaceevent
Yeah the event fires before the sign is actually changed
It is possible to make a custom 'Monument' to spawn in the world?
It would span over more than one chunk ideally
I would assume you would use the 'ChunkLoadEvent' or something
However, im not too sure if this is very possible
Custom structures are possible but a mess to make
Is that cause of the terrain?
like making them look gd
What is happening?
ok..... im not sure how much this really helps
what is happening in 1.17 or do you think it will break things like this?
hey so I just used Location.setDirection(Vector) for the first time. Goal: teleport the player to the location, with their pitch and yaw looking at a block. Result: teleports the player to the location looking the exact opposite direction of the block.
Does anyone know what I'm missing here?
I know I can multiply the direction by -1 to fix it, but I'm confused why I need to.
riiiight, ok
when i do a crafting recipe
i want the result to be a chest that has stuff inside of it
how do i put items inside a chest that is an itemstack?
an unplaced chest has no inventory
What error
Yeah I see what the issue is
You're checking if the sender isn't a player
Then you're forcing it to be a player and sending the message anyway
Causing that error
You are casting to Player without checkign first
anyone?
ok then
when they place the chest
how do i add stuff to its inventory
Its still going to error because you are casting sender to Player without checking first.
instanceof
He's already doing the check
Removed all the plugins, I only have mine but I still drop the pickaxe !!
But casting before it
@chrome beacon @quaint mantle
he's doing the test After he creates his player variable and casts
But you want to drop the pickaxe
?
No
Then why did you make the code so it would delete everything but the pickaxe
Change != to ==
you can;t create your player object without checking instanceof first.
I want it to stay in my inventory, how it works in creative
so only create your player variable when you know it IS a player
Where
I'm not spoonfeeding you code since you obviously have no idea what you're doing
public void onPlayerDeath(PlayerDeathEvent event) {
event.getDrops().removeIf(is -> is != null && is.getType() != Material.DIAMOND_PICKAXE);
}
to
public void onPlayerDeath(PlayerDeathEvent event) {
event.getDrops().removeIf(is -> is != null && is.getType() == Material.DIAMOND_PICKAXE);
}
Yes
ok
the same
I said I didn't want the pickaxe to fall, always in the inventory
How can I do?
Yeah you need to add the pickaxe back when the player respawns
Now you just removed it from the drops
I'm not spoonfeeding you code
?
but use the PlayerRespawnEvent and then add the item back
You might have to delay that with one tick not sure tbh
Yes, but this is an UltraPrisonCore pickaxe
and?
With enchant
ok
Help me pls
I was wanting to use PlayerPickupItemEvent but its depraced is there another way I can see if a player picks up an item?
look at the javadoc for it
.
We are not writing the code for you. If you have a problem or an error we can help.
Ok
@EventHandler
public void onPlace(BlockPlaceEvent e) {
if (e.getBlockPlaced() instanceof Chest) {
Chest chest = (Chest) e.getBlockPlaced();
chest.getBlockInventory().addItem(new ItemStack(Material.ACACIA_BOAT));
}
}
why isnt this working?
when i place the chest and open it there are no errors
but there is no boat in it
.getState instanceof Chest
ok
ok thx
Has anyone here worked with lighting before? I'm working on a method to change blocks faster (very original not done to death idea, i know) and i can't for the life of me get lighting to update properly. i looked at paper's fix-light-command patch and got it somewhat working, but it doesn't update everything. This is what i'm doing atm, ```java
LightEngineThreaded lightEngine = (LightEngineThreaded) world.getChunkProvider().getLightEngine();
for (Block b : blocks) {
lightEngine.a(new BlockPosition(b.getX(), b.getY(), b.getZ()));
}
lightEngine.queueUpdate();
and here's a video of what it does:
public class TrapCrates extends JavaPlugin implements Listener {
ItemStack trapItem;
@Override
public void onEnable() {
trapItem = new ItemStack(Material.CHEST);
ItemMeta trapItemMeta = trapItem.getItemMeta();
trapItemMeta.setDisplayName(ChatColor.DARK_PURPLE + "Trap Crate");
trapItem.setItemMeta(trapItemMeta);
ShapelessRecipe trapRecipe = new ShapelessRecipe(new NamespacedKey(this, "trap"), trapItem);
trapRecipe.addIngredient(Material.CHEST);
trapRecipe.addIngredient(Material.TRIPWIRE);
Bukkit.addRecipe(trapRecipe);
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlace(BlockPlaceEvent e) {
if (e.getBlockPlaced().getState() instanceof Chest && e.getPlayer().getInventory().getItemInMainHand().equals(trapItem)) {
Chest chest = (Chest) e.getBlockPlaced().getState();
chest.getBlockInventory().addItem(new ItemStack(Material.ACACIA_BOAT));
}
}
}
this is what i have
it doesnt work
when i do the crafting recipe it justs gives me a trapped chest
and when i place the trapped chest it doesnt give me the boat
ok thx
but i want to check if the chest is trapItem
trap item is an itemstack
then how do i check?
i want to check if the block display name is something
@EventHandler
public void onPlace(BlockPlaceEvent e) {
if (e.getBlockPlaced().getState() instanceof Chest) {
Chest chest = (Chest) e.getBlockPlaced().getState();
chest.getBlockInventory().addItem(new ItemStack(Material.ACACIA_BOAT));
}
}
same thing
Are you just trying to make the lighting look good with changing blocks?
yeah
I think that you have to bear in mind, light updates are really expensive
fully aware, i can design a system to spread out the load, just need to figure out how to actually update it first
So that lag, is most likely due to you looping thru every block
Iirc, there is a method to send a chunk light update
Although I completely forget where
Afaik, this is the better way to do it, rather than blockwise
Yeah, it is a pain
I remember a while back I made a method that just sent a new light update for a chunk, however I just deleted it as I changed the approach I was using
U have to get the lighting provider or sommin
<
I’m not sure if I like that
that causes a lot of client side lag then since it's computing it all, no?
i don't mind going deep into nms, i'm not looking for an easy solution to my problem
Is it possible, to hack nms enough to get a custom mob in the /summon list?
Like an actually custom mob
relogging or flying away and coming back fixes the lighting, so not entirely sure what that means but it's somethin haha
Arghh, it’s so annoying cause I had this issue with a plugin a while back and literally fixed it, and iirc it wasn’t that difficult but I cannot remember at all
What is it with you and spamming packets lmao
I don’t have to
U*
Not for everything
Calm down
😆
Yeah Ik why you mean
Fair
But, ehh
I mean, here is the packet @elder ferry
https://wiki.vg/Protocol#Update_Light
You will probably want to use nms to make it tho, rather than protocollib as there are a lot of fields to fill
I remember this was one of those page ten of google type problems
yeah i am sending that packet, just giving it the chunks pos, light engine, and false
Ok
yeah i've looked through like 20 different google searches, spigot's source, paper's source, and the source of 4 or 5 other plugins and still haven't found a way that works lmao
nah guess i can try there
They tend to know a lot of stuff on the technical side
(Not that People here don’t)
We all dumb as shit
Yuhuh
stfu you made group manager you are a smartie
lmao
?kick @wraith rapids
👢 Kicked NNYaKNpGms0eUVpiSdHx#5618
?kick @quaint mantle
👢 Kicked NNYaKNpGms0eUVpiSdHx#5615
?kick @limpid pumice
👢 Kicked NNYaKNpGms0eUVpiSdHz#3326
wtf why so many of him
what did he do wrong
He's the kicking boy
what method do I have to call to make a command that opens another players gui?
wut
what is the gui
player.openInventory
How do you add a location to a map?
You mean like a map marker?
Yeah probably
Is there any way to track locations in the word and navigate to them using the map
I’ve tried looking at the mapcanvas class but I don’t need that much customization
I just need to be able to add a marker that is located at a certain Location
see the MapMeta class
you can also modify the map pixels manually
and send map packets to users if you want
for custom icons
https://github.com/BananaPuncher714/Cartographer2 im not a big fan of the naming conventions, but banana knows how to perform map operations fast and quick so maybe take a look here
maps are really powerful
yes
you can add arbitrary text and markers to them
I've messed with them in the past and they are very cool
resending the entire map repeatedly can supposedly use quite a bit of bandwidth
zzz get gud internet
lol
i remember one 'minimap' plugin that used maps facing bandwidth issues
but yes that is true
Yeah, I’ve been looking into them for the past couple days and I do see that they’re quite powerful
But I was having a hard time determining whether there’s a simple way to track a couple of pre-set locations
pretty sure the MapMeta and MapView classes let you do that pretty trivially
I like the banner idea, thanks for that. And I’ll look into the Cartogropher project
No, not that I can tell
You have to write a renderer I believe, and I don’t see a way to do that without drawing the entire map object
I am relatively new to spigot though so I could be weong
Wrong*
you'd think there'd be some sort of api for it but i guess bukkit is pretty incomplete around some of the more recent parts
but yeah it doesn't look like there is anything sane for it in the api
cough cough legacy compatibility
you can do it with packets
is there something you can't do with packets
^
pass in byte array for data values
for the colors
i beleieve its like
let me search the packet name
PacketPlayOutMap
you cant actually pass a byte[]
you pass in the color for each pixel
Yeah, I think I’ll just spawn invisible banners and let the Minecraft server take care of the rest
That’s not an override, thats an eventlistener
oh im so fucking stupid
maps can have multiple renderers, just add one with cursors on top?
is there a way I can add buildtools as a dependency with gradle/maven?
as in buildtools itself?
I need nms but this is not provided by the spigot api alone
yes it does
add spigot as artifact
^
it also installs into maven local tho
can I avoid having to manually add artifacts? it would be easier to have it similarly to how I have spigot:
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT' from my build.gradle
again, from what i said:
compileOnly 'org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT'
try this
for nms
how do you set the slot for the items in the gui?
https://pastebin.com/80bbvJEZ
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.
with this I don't even have spigot in my external libraries
mavenLocal()
is there somewhere I should put the buildtools output? my build.gradle follows almost directly from this page: https://www.spigotmc.org/wiki/spigot-gradle/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you dont really need the output
how do you set the slot of an item in an inventory
have you tried looking at the javadocs?
declaration: package: org.bukkit.inventory, interface: Inventory
Just finished java, what is a good way to go about learning spigot
@paper viper how would you do that here?
you tell me
@warm vapor that page says ' // mavenLocal() // This is needed for CraftBukkit and Spigot.' uncomment it
my build.gradle: https://hatebin.com/mvlzskorsj
just added the mavenLocal but the references are all unresolved still
did you run buildtools
yes
did it finish?
idk then, I dont use gradle
did you reimport the project or whatever rubbish intellij makes you do
I could try rthat
maveners amirite
i actually use both
but seriously is there a good api page on spigot or...
same, I think both have their advantages
gradle seems much more concise than maven
?jd
package index
just google if you have a quesiton lol
chances are
you will meet the spigot forum post
or bukkit forums
i prefer maven in smaller projects
but idk
thats just for me
?kick @wraith rapids rr 1.1, 3.3
👢 Kicked NNYaKNpGms0eUVpiSdHx#5618
Take note that to use NMS you need to have run BuildTools for the appropriate version locally, in such a way it is found located under ~/.m2.
where is this .m2 directory?
in your user dir
lmao 6th kick xD
for windows C:\Users\<user>\.m2\repository
linux, well no idea 🤷♂️
it has bukkit, craftbukkit, spigot but my project still does not recognize them
I do also need nms but I can't find that in my m2
C:/Users/you/.m2
nms is included in craftbukkit/spigot
in that case I really don't know what I am missing that none of these are recognized with my build.gradle setup
try building with the command line not your ide?
I'm not trying to build, I am trying to get the ide to add the dependencies so that when I am programming they are not highlighted as errors
did you reimport it
never got a response 😔 guess i'll go to the warzone that is the forums lmao
if I use maven instead of gradle is there anything extra I need in the pom xml besides what the wiki provides?
(besides running BuildTools)
no
I still have a ton of unresolved symbols using maven
idea gives me the option to add maven dependencies but this adds spigot 1.12
everything works
except the recipe
it gives me a trapped chest instead of the trapItem ItemStack
did u seriously put everything in the main file ;-;
but i mean
im only using one event
its bad practice just putting everything into one file
i guess its fine for now
anyways can you help me with my problem?
idk whats wrong
ive even tried the prepare item crafting event
i dont know if that recipe works with named results
¯_(ツ)_/¯
i never tried making a recipe
in spigot
so u might be able to do it but i dont know how
I actually had an error while running BuildTools that I didn't notice: https://hatebin.com
I don't know what the compilation error means, but I have set the git user.name and email now and previously but this changed nothing
whats the error?
I wish it would tell me when there are too many characters
¯_(ツ)_/¯
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.
wait for buildtools dont u just run the application?
¯_(ツ)_/¯
i think u need to put ur github name and email
tho
I have done that with the commands it says
is there somewhere else I should put them?
did u replace the email to ur email and replaced the name to ur name for github
idk then ¯_(ツ)_/¯
does anyone know if its possible to connect direct to a server instead of to the BungeeCord main server... atm when i try to join on of the server that is not the main BungeeCord server i get "If you wish to use IP forwarding, please enable it in your BungeeCord config as well!"
u have to enable it
in the config
for bungeecoord
it should be called ip-forwarding
yes i have that to ture, that why i can join the main BungeeCord server, but is ther a option for the other servers in the cluster?
have restarted them all like a 1000 times :/
k then just connect via bungeecoord?
if u want to connect to a different server when u join just do bungee ip:port
im useing a plugin that changes the server icon when pinging the server, cant use it on the main bungee thing atm.. they dont have the option to code that
lol, i made the plugin and bundgee dont have the function i need in the library 😦
if you can join the servers directly your bungee setup is broken and insecure
and pointless
also u can also just connect with the bungeecoord and a port
and bungee absolutely has a setFavicon method
;-;
No one ever follows teh guide past the installation section
lmao what
cant find it in the bungee documentation
thye have the on ping evnet, but cant change the server icon with it
ProxyPingEvent.getResponse().setFavicon
is setFavicon the smae as server icon?
yes
thank you!!!!
why do u want to do that anyway seems pointless
@idkidk123123 true, but i saw a server that had it and i got obsessed to make it my self....
lmao
mod menu is weird
has anyone btw gotten optifabric working
i never got it working
;-;
it just crashes
without a proper error message, error code or logs
just code 0
lol
does anyone know a way i can make a plugin that applies a certain potion effect when i right click it with a cooldown?
a CustomModelData item
ive never made a plugin before i was just wondering if it was an easy thing to do ;-;
send a message to the player when they join the server.?
?
oh I only read the 2nd part
does anyone know an easy way of doing it
getItem().getItemMeta().equals()
uhhh how does one
thank you very very much, now I have to look up how to make it a plug-in
and shove it in the server
@quaint mantle you just spooned feed lemon and he doesn't even have a program to make a plugin ...lol
yeah
skeleton.getKiller().getInventory().addItem(Material.DIAMOND_BLOCK)
how would I make it 64 block instead of 1
@sullen marlin Thank you so much for the info!! Finally got it to work!!
i've seen a table of contents in some written books. is this possible programmatically?
Can some1 explain gradle to me and why it should be used in spigot
gradle?
Yeah sorry
Gradle is an example of a build management software. It isn't only limited to Spigot, but also usually used in other general projects that rely on dependencies. Another example of a popular build management software is called Maven. There isn't really one you "should" particularaly use for Spigot projects, as both are viable.
As in for build management, the basic idea is that you specify dependencies that your project relies on, as well as settings such as the compiler settings to tweak, general java settings, or other stuff. One of the most useful features is shading.
Kk thx
no?
Btw is this a good thing to use as a beginner https://youtu.be/Om5Kon5WpV8
Hey guys! Today I am showcasing my famous Minecraft Craftbukkit / Spigot Plugin Template! With it, you can get right to making the fun stuff instead of fiddling with the annoying behind the scenes work. Also, using this template got my plugins immediately approved on SpigotMC, so you know everything is implemented according to proper OOP princip...
Idk
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Hard to read his text to follow along bad
do I need to be using java 8 for the buildtools setup to work?
If I recall it supports up to Java 15
Thats the last I knew of it, may support newer now
Im talking about buildtools
Tbh I think every version supported on buildtools
Above 8
8-16
I think
Just checked myself in the source code of BuildTools
max atm is 16
That was updated a few months ago
Wdym java 17 isn't out???
they better release it for 1.17!!!
No lol
BRO thats the WRONG number of o's!!!!!
reddit tier
I got the buildtools to run successfully but it doesn't seem to be putting the 1.16.5 craftbukkit jar in my m2 directory
it just generates the spigot jar and that is all
maven doesn't add nms or craftbukkit as external libraries
It doesn't build craftbukkit anymore
It says that on the page I believe
There may be a flag to enable it
declaration: package: org.bukkit.entity, interface: LivingEntity
just convert the args to the effect type time and level
there are many ways to do that
if args is speed
add speed
if args is jump_boost
add jump boost
or for a more efficient way create a hashmap with the potion name as the key and the potion effect as the value
hmm
yeah
also you could loop through PotionEffectType#values and put the effect type with PotionEffectType#toString@quaint mantle
thanks
i just noticed yours lol
Grogu is the best
is there a specific place that the plugin yml needs to be in
mine is in the jar but the server says it isn't
it needs to be in your src
it is
I put it in src/resources and that didn't work even though it was in the jar
now I moved it to src and it hasn't shown up in the jar
send a screenshot
whats the exact error
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:170) ~[spigot.jar:3082-Spigot-9fb885e-d49530f]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:144) ~[spigot.jar:3082-Spigot-9fb885e-d49530f]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:381) ~[spigot.jar:3082-Spigot-9fb885e-d49530f]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:224) ~[spigot.jar:3082-Spigot-9fb885e-d49530f]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[spigot.jar:3082-Spigot-9fb885e-d49530f]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot.jar:3082-Spigot-9fb885e-d49530f]
at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
maybe it is something within the plugin yml?
?paste
if anyone wants to yell at me and compile a list fo things im doing wrong, please do
just dm me what i need to fix
is BlockState thread safe?
Ty
i formatted it so it looks nicer now
Can you help me with the fact that when I die I never have to lose the pickaxe?
no one answered me so i fixed everything myself
?paste
really depends what you mean by thread safe. Can you call .update from another thread, no. Can you do most other things from an async thread, yes
what part of it is not working
Want the error log?
Installation. I uninstalled it to install something else and now it wont install.
@sullen marlin
sure
delete C:\Users\shikh.p2\ and C:\Users\shikh\eclipse\ before trying again maybe?
also you just need eclipse for java developers, not the enterprise/webdev one
check your task manager to make sure eclipse isn't still running
Failed again
I think I should just install an alternative and report the issue to the devs
So what should I use?
C:\Users\shikh.p2\
C:\Users\shikh\.p2\
not sure why discord removed the \ originally
delete C:\Users\shikh\.p2\ and C:\Users\shikh\eclipse\ before trying again maybe?
So the .p2 or the contents?
whole folder, remove both of those
I created this code only that when I respawn I get a new pickaxe and not one with the enchants from before
` @EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
pickaxe(e.getPlayer());
}
private void pickaxe (Player p) {
PlayerInventory inv = p.getInventory();
inv.clear();
inv.addItem(new ItemStack(Material.DIAMOND_PICKAXE));
}`
I want the pickaxe back from before with enchant
You get a new Pickaxe because you are creating a new ItemStack and not giving the item you lost on death
And how do I get the old pickaxe?
public void onDropEvent(PlayerDropItemEvent e) {
Player player = e.getPlayer();
Item it = e.getItemDrop();
ItemStack is = it.getItemStack();
if(it != null && is != null && is.getType() != Material.AIR) {
if(is.getType() == Material.DIAMOND_PICKAXE) {
e.setCancelled(true);
String Drop = plugin.getConfig().getString("Drop");
player.sendMessage(ChatColor.translateAlternateColorCodes('&', Drop));
}
from this for example
How do I put the lost item?
ok
don;t use nbttags
an
and add it to the inventory
And I lose the enchants like that?
get the item you want to copy in the death event...
and how would he find it?
public void onPlayerDeath(PlayerDeathEvent event) {
event.getDrops().removeIf(is -> is != null && is.getType() == Material.DIAMOND_PICKAXE);
}
he keeps a copy of it in memory to add back to teh player upon respawn
is it a specific pick or all diamond picks?
currently you seem to be checking for all diamond picks
is a diamond pickaxe with plugin enchants
You create it?
and are custom enchants or vanilla?
custom enchants
what plugin
hmm
Is it just the one pick you are trying to give back to teh player? or all custom picks?
You could make a list of all the enchantments from the plugin
With ultraprisoncore api
ah
chech with hasEnchant if the item has one of the enchantments from the list
one custom pick
If its just one I'd store a clone in a map against the players UUID upon death. Then give it back upon respawn
👍
You can only have a pickaxe with certain enchants, if you die I want the enchants to return to the pickaxe
on death, loop thru inventory, check for every item if it has the name, material and all enchants that the pickaxe that you are looking for has
store the item and player name/uuid in a hashmap (as elgarl said)
and on respawn, check if player uuid is in hashmap, if he is, get value from the key (player uuid)
and add item to inventory
Map<UUID, ItemStack>
👍
or if you know a way to
add a special nbttag to the item when it's created
and check only for that tag
instead of name material enchants
He's not ok with Maps, he'd no way handle nbt. He should use PDC over nbt anyway

definately no
this is what the PDC is for
PDC adds nbt tags, and its a built in API
How to make entity npc? (I already made EntityPlayer npc, but I don't know how to make entity npc)
can i check if playerA is in render distance of playerB, and have events based on entering / leaving?
im okay with using NMS, since i have not seen any spigot methods for this
or is that not possible
lookup Location#distance or Entity#getNearbyEntities and create your own custom event for it
The PDC tags are within its own tag, with the plugin name iirc
You can't really do crazy edits on existing NBT tags
His use case did not require "crazy edits"
I didn't really read his code, just telling you that NBT APIs have extra features that PDC's don't
It isn't always a replacement
In this specific case, sure
Hi guys, I would love it, if you would go through my source and review it.
https://www.spigotmc.org/resources/block4block.92566/
e
It seems you'd be better off having a whitelist instead of a blacklist
there are hundreds of blocks in minecraft, so it's the same either way in this case. I actually did want a whitelist, but a guy we aren't working with any longer started it out with a blacklist for some reason haha
Hello, does anyone know how to get the /command <args> <-- from a command
@coral sparrow
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String arg1 = args[0];
String arg2 = args[1];
String arg3 = args[2];
}
Thanks
np
Anyone know how to use a good text to speech api which doesn’t sound like a robot
Tag me
does ChunkLoadEvent get called everytime a player loads a chunk, or everytime the server loads a chunk?
like, a player loads a chunk already loaded for another player, does the event still get called?
server load
The event gets thrown for chunks that need to load, not for chunks that are already loaded if that helps clarify anything 😉
if I use a PlayerEvent and use instanceof so i can check for specific events (PlayerJoinEvent or PlayerMoveEvent) in one method can i get like do setJoinMessage somehow?
ok
im just trying to not have multiple events with the exact same code
d;PlayerEvent
Most of the generic events are just simply there for the API and not something to be used most of the time
Uh you can create ur own method taking any PlayerEvent
have a handler method. Like you can pass teh teleport event through teh exact same move event code
And you beat me to it
🥲
yeah you can create your own events which is probably what you are wanting so you can take in whatever events without having to have multiple event listeners for the same thing 😉
Then you would just listen for your own events instead
You don't
open it up like a zip file
How?
however, depends what you want to edit in said jar
Its all compiled code. Without a decompiler you can do nothing meaningful with it
I meant, if you are wanting to edit say like the plugin.yml opening the jar is fine
I just need to open it and change some things
Lets say I have a decompiled folder
Can I upload that?
upload?
decompiling someone elses jar to use in yours without express permission is not ok
We can;t comment unless you are more specific
Well I could publish an update. I am using Multiverse-NetherPortals which does not teleport you to a specific portal when you go In then go back out again. Like randomised
If it makes you feel better I will make a push request
It does not matter as long as I can get the files
so I can test a solution
Anyways after I decompile the jar file then can I folder inside the decompiled files to the jar file. Basically add a existing folder to the jar file
Sounds like an xy problem in a sense
with all the java files inside
hmm, if i want to access Chunk, it only gives me 2 options. what do i have to do to be able to listen to that?
All I want to do is fix it for my server
Will I be able to edit It on eclipse though?
@quaint mantle
what should I use for all color codes?
I mean every color will work with the text
I am using getLore.contain()
Wait so can I edit the compiled jar file on eclipes?
just check distance between players
i need the render distance of the player for that
i fucking hate nms
but, ill do that lol
There would be no noticable performance impact if you only check when a player moves between chunks
ooh
ill try both options
but like
if there's lets say 50 players online
join
He's only looking for when a player moves in/out of view range
^
source code for multiverse stuff is available on github. Yes you can go the route of decompiling, but I mean why do something the super hard way, when you can just do it the easy way? Clone the repo on github to your computer, pull the project into whatever editor you like, make your changes and then compile it.
?
No clue. He linked some post
Basically from what I've seen you ask you are looking to detect when a player moves into view range of another.
Not such a simple task as you can;t tell the players client view range.
Hey, I'm trying to debug my plugin with eclipse on a server I opened on my pc and it says:
Failed to connect to remove VM. Connection refused.
Any idea on how to fix this?
You can base it on teh servers view range setting
if a client chooses to set a lower range, they will be at a disadvantage is all
so; sending the package while they cant view the player yet, wont break it?
You should not really be using packets at all for this
I keep getting a "Null" error on "pchx" even though in the yml its set to '1'
int pchx = 0;
try {
BufferedReader is = new BufferedReader(new FileReader("./plugins/Data/UserData/"+user+".yml"));
Properties props = new Properties();
props.load(is);
is.close();
pchx = Integer.parseInt(props.getProperty("Pets.haspet"));
} catch (IOException e) {
e.printStackTrace();
}
``` (The reason its set to a specific folder set is cause multiple plugins use it), but this is the only one that wants to push "Null", what would be causing this, I checked to make sure its valid yml and everything else is working reading the yml but this
i see
Use teams and it will handle all the packets for you
i dont get it, do i just put all the players in the same team? and then what? does it make the players visible automatic?
(i havent used teams yet, sorry for not knowing much about it)
No you put each player in his own team
isnt this too resource intensive?
Actually you only need to manage the invisible yoruself from Player#hidePlayer
Its quite simple. Detect when a player moves to a different chunk, then check distance to other players. If in range showHidden.
No its not too resource intensive
you use distanceSquared so you are not square rooting every calculation and it very light
That doesn;t sound like what he was asking
Cause each player has their own custom yml file, plus like I said, this method works for me, but for some odd reason this is the only instance out of all of them that does not want to work and push a null
i want the player removed from the tablist, but that also removes them from the client
Why do you want them removed from tablist?
@eternal oxide
I see
LOL???
my msgs are getting deleted lol
tab
custom
custom tab
not anymore lol
why do you want them removed from the tab list?
that doesn;t answer my question
i want them removed to have a clean workspace
whats the difference between toLowerCase() and toLowerCase(Locale.ROOT)
Thats still very vague. What do you mean
i want nothing on there, so i can work easier. something like this
i want to make something like this
but, i can only have 3 rows
"Work easier"? You need to explain WHY you don;t want anyone in teh tab list. It seems pointless and a lot of work for no end result
literally what I sent is everything except for the after:
if (pchx == 1) {
//run continued
} else {
//throw error to admins
}
if you look on the github you can see the text better
the difference is one takes localization into account since characters of your language can be different
oh okay thank you
If you hide player A from player B they should not show up in the tab list. You can then simply set Visible when they are in range.
and does it matter if i use the with or without the Locale?
so hide everyone from everyone else
i want no one in the tab, so i can fill it in myself. more control
it can depending on the language being used that you are lower casing @quaint mantle
Ok, you seem to be wanting to do a pointless task
okay thank you
thats what i want! but i dont know how to do so without them showing up in tab again
Explain better because what you are askign right now has no purpose
okay
if you use hidePlayer they will only show up when visible and in range
I think they just want to do what most other servers do @eternal oxide and that is use the tablist to advertise stuff other then just the players lol
so if everyone is hidden you woudl see only yourself in the tablist
so, we will have 3 categories: "global": all players in that server, "party" people in party, "guild" people in guild. all 3 rows are a different thing
does that explain it?
basically a ordered tablist
But, sounds like what you are wanting and would work better is scoreboards
ok, but yes, you are describing a scoreboard
no
What he is describing is an empty tab list he can put his own data into. A Scoreboard
Yes, but you do know that list isn't expandable? it only shows so many things lol
oh shit sorry that wasnt my intention
i do
@quaint mantle nms isn't needed, but I would agree it is the most reliable way with messing with the tablist
yea
sorry
os, i create a packet listener for chunkloadpacket (whatever its name may be) and work on that?
I stopped once I realized you wanted to use the tab list as something its not designed for. 😦
np
yo @quaint mantle i didnt read your full message, and i apologise. i am doing what you told me to rn. thank you for helping me
Can anyone share me a tutorial on how to use the APIs of other plugins?
it depends on the plugin and your IDE
void means it doesn't return anything, and the method takes in an offlineplayer object and a long is just a number object like an int, just can hold more numbers. Should learn some java before diving into a plugins API
ah ok
Ok so I have this thing here
ArenaConfig.get().getConfigurationSection(player.getWorld().getName()).set("playerLocation.location" + index, player.getLocation());```
and this thing to be able to use it
```java
ArenaManager.setPlayerSpawn(player, ArenaConfig.get().getConfigurationSection(player.getWorld().getName()).getKeys(false). size());```
There are no errors at all but it only seems to do 2 locations only, nothing more. When there are 2 locations, it just changes the last one when the command is executed
index is the int number, so if location1 exists, it'll do location2
why not just use a list
Your issue is probably you need to get("playerLocation").getKeys(false).size()
as your key size would always be 1
Can't use getKeys#size() after get("playerLocation")
ArenaManager.setPlayerSpawn(player, ArenaConfig.get().getConfigurationSection(player.getWorld().getName() + ".playerLocation").getKeys(false). size());```
your issue is you are getting the world key but you have a nested map under it.
"playerLocation.location" + index issue is at this line right here
either get rid of playerLocation. or read it correctly to get the children
change it to "playerLocation.location." + index notice I added a . or do what ElgarL said.
just depends on your use case which is better
Most of the time, you would want it as a list
It ends up like this which looks fine but it won't add new locations, it only replaces the last one with a new one
map1:
playerLocation:
'0':
==: org.bukkit.Location
world: map1
x: -55.0
y: 149.0
z: 93.0
pitch: 0.0
yaw: 0.0
'1':
==: org.bukkit.Location
world: map1
x: -63.73502188532504
y: 149.0
z: 103.54363610558642
pitch: 0.0
yaw: 0.0```
^ thats going to skip 1
Do I see spoon-feeding
eh haven't figured out a solution yet either way as nothing that was said above seems to help
ElgarL just basically told you
we gave you everything you need to fix it
To prevent constant use of reflection, would it be a good idea to cache player connections so that I don't have to fetch it via reflection every time?
your code is going to skip the first index the way you have it
hence only getting the second one
Just switch to using a list
far simpler
Hey
! How can I make multiple NMS entity extends class? for example, I want use EntityZombie, EntityChicken, EntityArmorStand in same class. {For your information, nms entity extends class looks like : ```public class EntityNPC extends Entity(Type) {
public EntityNPC(Location location){
super(EntityType.(Type),((CraftWorld)location.getWorld()).getHandle());
this.setPosition(location.getX(),location.getY(),location.getZ());
}
@Override
public void initPathfinder() {
}
}
I'd assume you'd just extend Entity without specifying the type
@quaint mantle if you insist on doing it the way you are wanting it to, here is a link for you that you can use for reference
https://github.com/hawkfalcon/ServerTutorial/blob/master/src/main/java/pw/hwk/tutorial/data/Caching.java#L36
Bukkit Plugin for in-game player tutorials. Contribute to hawkfalcon/ServerTutorial development by creating an account on GitHub.
one of these days, I will remake that plugin XD
clean it up etc lol
public EntityNPC(Location location) {
super(EntityType.ZOMBIE,((CraftWorld)location.getWorld()).getHandle());
this.setPosition(location.getX(),location.getY(),location.getZ());
}
@Override
public void initPathfinder() {
}
}``` they having errors 😦