#help-development
1 messages · Page 173 of 1
It’s easy to implement anyway
public enum Action
{
/**
* Open a url at the path given by
* {@link net.md_5.bungee.api.chat.ClickEvent#value}.
*/
OPEN_URL,
/**
* Open a file at the path given by
* {@link net.md_5.bungee.api.chat.ClickEvent#value}.
*/
OPEN_FILE,
/**
* Run the command given by
* {@link net.md_5.bungee.api.chat.ClickEvent#value}.
*/
RUN_COMMAND,
/**
* Inserts the string given by
* {@link net.md_5.bungee.api.chat.ClickEvent#value} into the player's
* text box.
*/
SUGGEST_COMMAND,
/**
* Change to the page number given by
* {@link net.md_5.bungee.api.chat.ClickEvent#value} in a book.
*/
CHANGE_PAGE,
/**
* Copy the string given by
* {@link net.md_5.bungee.api.chat.ClickEvent#value} into the player's
* clipboard.
*/
COPY_TO_CLIPBOARD
}
This is all you get
Just have a map with a consumer
and if u execute a command this way its gonna be executed via console?
alright, thx
Can I use bungeecord to link to my Paper servers?
or do they have to be spigot servers
both work
great
is gitk built in in git or im tripping and i forgot installing it?
what is gitk?
git gui
Probably not built into git by default
also is there a way to make a crafting table gui open for a player?
(with a command)
it comes with git
for my installation at least..
how?
Decompile a plugin with the crafting table cmd and youll see
and can u also make it so u cant put items out if it?
I think you cna just create a regular crafting inv
oof
Player#openCrafting... or somethign close
log
that inventory you want to open for player is null
i don't know much about inventories btw its null
but its not null
ye ik
Can you paste on paste site
oh nvm it needs to be InventoryType.workbench
i fixed it
and how do u cancel itemtakeevent if u run a command?
you can't do that in the command
you should check in listeners
InventoryClickEvent iirc
how u check if its that inventory
Use some sort of id system
Most people use custom inventory holders
Or keep a map of each active inventory
can i make a listerer in the same class as the command?
Sure
How can I access a config file from another server on my bungee cord network?
you can, better do not
It’s not good practice though
Symbolic link probs
Or a shared file
Or just use a db
is db the easiest
Yeah id say so
my panel has a sql db with it but I can't read the db with a program or anything with a user friendly view
depends on your use case
I just want to store 1 string per player UUID
actually I would also need to store maybe 3 other values like 2 more strings and an Integer
does ItemMeta#getLore return mutable or immutable list?
Pretty sure it’s mutable
could this work??
its set true if u get the inventory
.
how does that work?
Have a class which extends InventoryHolder
Then in the listener you can check if the holder is this
u mean sth like this?https://www.spigotmc.org/threads/custom-inventoryholders.253149/
I have good experience in coding spigot/paper plugins but new to BungeeCord networks. My goal is to create a minigame server with a lobby that when 4 people join a queue, they are moved to 1 of 4 match servers.
Are there any resources that will help me with the lobby side of things? I saw MinigamesLib (https://www.spigotmc.org/resources/minigameslib.1899/) but it looks like it was discontinued
Yup
You probably want a redis server for communication between servers. And a master server to orchestrate everything
Could be a standalone master or the proxy could be it
Well there needs to be something to control everything
Could I not use the lobby for that
I mean yeah but what if you have multiple lobbies
Or the lovby needs to restart while the minigame servers are live
A proxy master is more reliable
I was thinking the lobby would control queues and sending players to the match servers, and the match servers would control the match and resetting
I see
Yeah pretty much same thing just depends where you want the controller to be
I am slightly confused on how the servers will work together with this
would I need to create a different plugin for each server type
one for lobby and a different one for match
Ideally, yes
Okay and how can redis help with this?
It’s just a fast messaging system between servers
Redis pubsub*
You could use default bungee messaging but it’s a pain
Plus redis could communicate to external sources
in what way?
I've not hahah
not even sure what it's use for
by messaging system do you literally mean player messages?
or a different kind of info between servers?
Nah info between servers
what kind of info?
Uuh idk depends on your usecase
If you have a network you are going to have to send data between servers eventually
I thought thats what the db would be for
like saving the selected kit in the db in the lobby
then the match server would find the kit from the db
Db is super inefficient for messaging
Would you rather me talk to you directly, or wait for mail to show up in your mailbox
Db isnt for messaging, just saving data
I see okay
Thanks for the info
Will look into redis now
assuming it's this RedisBungee plugin?
No, jedis
Or an equivalent redis library for java
Redis bungee was discontinued iirc
this is the wrong thing? https://github.com/ProxioDev/RedisBungee
it looks like it was picked up by someone else
I mean you could but im not sure of it’s limitations
location#getBlockX, Y, Z return the middle location of a block?
how do u do that tho?
i did
Very last code block of the response
u mean this?
how i get the width and height from a aabb?
Yeah it’s not intended, like I said before keeping an instance would ve ideal
But they aint changing it any time soon
Why?
Then you cant have multiple instances
May aswell be static at that point
Spigots BB has getWidthX and getWidthZ
src?
declaration: package: org.bukkit.util, class: BoundingBox
this part?
Yup
i was meaning github code
Src is on spigot hub
and what was the event that detects if u right/left click?
basically i want to make it so u cant get those items in the gui
i canceled it but it only doesnt work for shift click
but i already setcanceled the whole thing
@drowsy helm
https://paste.md-5.net/upomiyidar.java
You need to set the holder of the inventory
You are setting it to player
Not the new holder
wdym?
u mean this?
No in the code in the answer
Hi
I have that:
File f = new File(plugin.getDataFolder().getAbsolutePath(), "Cargo" + ".yml");
FileConfiguration c = YamlConfiguration.loadConfiguration(f);
Object items = c.get("inventory.content");
How can I convert the items to an ItemStack[] array?
How?
If I print the items I got this:
[ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"text":" "}],"text":""}, custom-model-data=10067}}, null, null]
Does anyone know or have an yaml reader / writer which works like the spigot one?
Snakeyaml
but
I just can show it with link sorry
It's says it's a object, not list
Is it a single item or more items set in a config?
Just cast it to List<ItemStack> iirc
This is the items
So i think more items
This is the content of the yml
A list ya
Then why I can't do this: ? 😐
spigot builds on snakeyaml
L8
List<ItemStack> items = c.get("inventory.content");
What do you mean by that?
Just cast it
It's give error
configuration.getList("something")
Tried to
List<?> items = c.getList("inventory.content");
ItemStack[] content = Objects.requireNonNull(items).toArray(new ItemStack[0]);
inv.setContents(content);
Tried this
If you just set the block to air then nothing drops. I dont understand your problem.
Oh not an entity
Cast it
A better way to achieve what exactly?
List<ItemStack> ll = (List<ItemStack>) gett
I did this
List<ItemStack> items = (List<ItemStack>) c.getList("inventory.content");
ItemStack[] content = Objects.requireNonNull(items).toArray(new ItemStack[0]);
inv.setContents(content);
But the code stop
no error
tho you don't need new ItemStack[0]
if you store itemstack in sections then you need old good for loop
If list, then you need to cast
It’s a list
Also
event.getDrops().clear
SetContents take an array
I need an error or smth to help you
and?
If you want to change the drops of a Block then you can simply use the BlockDropItemEvent
what's the point on new ItemStack[0]
Just how that stupid method work
To have a typed array initializer
Which returns an untyped array
Object[] -> ItemStack[]
It's provide Object[]
sad java devs
hey, so I use
if (player.getWorld().getEnvironment().equals(World.Environment.NETHER))
to check if the world is = to the nether but I check the world type using the cmd executor, aka. the players environment. I need to use this in a utility file that doesn't have an implemented cmd executor. Does anyone know how I can do this?
((Player) sender).setInvulnerable(sender);
'setInvulnerable(boolean)' in 'org.bukkit.entity.Entity' cannot be applied to '(org.bukkit.command.CommandSender)'
Well you cant exactly cast an array like that
you sent command through console?
This method has a boolean parameter and not a CommandSender...
No
Object[] content = ((List<ItemStack>) c.get("inventory.content")).toArray(new ItemStack[0]);
inv.setContents(content);
p.openInventory(inv);
I tried this, but this does nothing
Oh thanks smile
I can't.
explain yourself better then
I think I was clear enough.
ItemStack[] content = ((List<ItemStack>) c.get("inventory.content")).toArray(new ItemStack[0]);
inv.setContents(content);
p.openInventory(inv);
clearly not
i don't think so
what is your method
which you can't pass a player to
what exactly is your problem
Also does nothing
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Not open the inventory
The code just stop
Even if I put a print after that, I can't see the print
public boolean onCommand(blah) {
Player p = (Player) sender;
if (UtilClass.isInNetherEnvironment(p)) {/* your code */}
}```
No utility "file" needs an implement cmd executor. This question makes no sense.
public class UtilClass {
public static boolean isInNetherEnvironment(Player player) {
return p.getWorld().getEnvironment() == World.Environment.NETHER;
}
}```
*boolean
Yes...
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
((Player) sender).setInvulnerable(true);
Ik
ty
This is what my utils file looks like, how do I check if the world is = to nether? https://srcb.in/wdcsGpCjse
A util class is stateless. Thats not really a util class, its just a lot of statics
You have also been told how to check if you are in the Nether
ok, how do I check if its the nether though?
cuz I can't check the players environment
where do you want to check? the Location?
if the place the command is executed from is = to the nether.
You are checking the World environment, not teh players
oh, right-
return location.getWorld().getEnvironment() == World.Environment.NETHER;```
exactly
how do I define location though?
all of your methods have a location
cuz it says it can't be resolved?
where precisely are you trying to check the environment?
I wan't to wrap all methods
?paste
that is stateless, it has no world assignment
Any way I can set a players hunger level?
your bad_blocks is just a Collection of blocks
Here's the thing, I'm making a random tp plugin (well updating it) and I wan't it to check if the world is = to the nether change the x, y, z to find a safe location and then do the same for the overworld
if you want it per world type you need a map<Environment, Set<Material>>
https://paste.md-5.net/aloleruxow.cs
https://paste.md-5.net/iyayetugij.java
Hey,
im a bit new to minecraft plugin programming... why is my runnable a nullpointer?
no, I don't need to do anything with the materials-
then you don;t need to test the environment in that method
uh, w-
only where you have a Location/Player
let me try smth
yeah, I think this will work I just have to test it, thx @eternal oxide
I meant with an equal api
Because I like how the file is build with FileConfiguration etc
If you know what I mean
If you are working in Spigot just extend FileConfiguration.
I'm not that's the reason why I am looking for an alternative
Then no, you will need to work with Snake and do your own implementaion
Alr thx
is it possible to make a player see another player with a different skin (doesnt have to be w/ API)
I'm attempting to set the display name of an item using NMS, and I'm close. I'm basically needing to correctly serialize the compound tag containing the name. I tried using CompoundTag#getAsString but this results in {text: "Scythe"} when it needs to be {"text": "Scythe"} for it to be recognised in game. How would I go about serializing it in a recognisable way?
is there any way to set a players skin
well i know there is i just am not sure how to do it
i am trying to set it to a bufferedimage of a skin
Its not, Skitaru.getPlugin() is null probably
show getPlugin method
omg im dumb
thank you very much bud!
now its workin
public void OnPlayerLoseHungerEvent(Playerwhateventisit evnt) {
?jd-s
Cannot resolve method 'getPlayer' in 'FoodLevelChangeEvent'
declaration: package: org.bukkit.event.entity, class: FoodLevelChangeEvent
I recommend consulting the docs next time
nvm it's getEntity
Time for doc
Guys, what the hell is this?Beta 1.7.3 have creative mode?https://cdn.discordapp.com/attachments/1001258308373581824/1028336782061863033/unknown.png
https://cdn.discordapp.com/attachments/1001258308373581824/1028336863792070867/unknown.png
what ?
What spigot build are you on?
Or well - bukkit since spigot didnt exist at that point
jesus that is ages ago
yeah
https://paste.md-5.net/anuyakuhac.java
Method 'OnPlayerLeaveEvent(org.bukkit.event.player.PlayerQuitEvent)' is never used
wait I had to add @EventHandler
nvm
how can i change somebodies skin to an existing BufferedImage
i want to change the players skin to a bufferedimage
i dont really know how else to put that
Not possible. You need to let the skin be signed by mojang.
You can use an api like Mineskin which use a couple of accounts to generate skins.
MineSkin.org allows you to generate skin texture data for Minecraft which is signed by Mojang.
will it work quickly
Sure. Takes a couple of seconds.
i mean like can i call it from my code
i am trying to make someones skin grayscale when they die
But you can locally cache the signature.
This means you need to generate a skin when a player joins. Be sure to cache the skin+signature right away so you dont get rate limited.
where would i cache the skin
Wherever you like
Its posible to disable player auto kicking via code?
What is "auto kicking"?
I mean im doing an afk plugin
But if the player stay like more than 5m afk the server kick it out
Then dont?
Thats not a feature of minecraft
spigot inactivity timeout?
I have tested it on 1.8, 1.12 and 1.19 and stil ltake the player out when have success more than 5 minutes
that the shit name right - Perfect i wil llook how ti disable it?
I can just log in and stay on my server inactive for weeks if i wanted to...
^
yeah
Yep. I know of no timeout. I can stay online for hours with no activity
does anyone know how some servers get that "translucent" effect when someone is invisible
is that like a teams thing?
Yeah it's teams
player-idle-timeout=0In server.properties
tf was i doing a few months ago
when I use teams like that i cant see myself like that
Does anyone know why the particle enum doesn't contain all particles? Stuff like minecraft:rain, minecraft:underwater and the elder guardian particle aren't there
Well that's because they aren't particles
I mean you'd think so but I looked for it and I don't think it's there
I wish there was a list of the particle enums and their respective particles
or at least enum -> mc name
cant u just go to that class?
the particle class?
yeah
try all the ones that have something to do with water and maybe you get what your looking for
How can i send a list saved in a yaml file to a player, like /gang list returns all the existing gangs
just send each element
Is there any way to check if server instance has bungeecord enabled in spigot.yml?
with a stringbuilder probably
Dont use yaml files on runtime that much. Rather load everything into properly named classes and data
structures when the server starts or when the linked object (like a Player) gets active.
Should i use SQL?
he means you shouldnt get your stuff from persistent storages on runtime, cache it before
You can get the content of the spigot.yml Bukkit.spigot().getConfig();
This includes files and databases
thank you
This is the most important part:
Load your data into memory when the session of this data starts.
hi guys,my spigot acc get steal by narfman24@gmail.com,but i don't know how to get it back and my english so worse.i am malaysian,can somebody help me?
nah
i have buy ecoboss,ecoitem and residence at spigot
now get steal by narfman24@gmail.com,i wan to find it back to my server
pretty sure its not related to #help-development
Write to google support
?support
i try now
where can i contact residence and eco plugin owner
i think need to tell they
they have no control over your account
get your spigot account back and it will be sorted
i have send email to spigot now,but i don't sure they can solved this problem or not
i have bill to prove i buy that plugin
is there an event that triggers when an inventory collects an item, not only from the ground but also by /give or inventory#addItem?
i have a really complicated idea and i need a lot of help with it because i have no idea where to start
i am trying to make a world on my server where everything is on the player
like everyone is technically in the same spot but if they kill mobs on their end, the mobs are just normal on anothers
almost like singeplayer
but on a server
a single world for each player?
Hypixel had the right idea doing it with skyblock
so you want everyone on the same world but they cant interact with anything on the screens of others?
no thanks, I think that wont have a good solution
oh alright
sort of like that
at least none I can help with
you would have to do a lot with packets, and even then there would be problems i think
idk i just want something similar to how wyncraft does singleplayer quests
a world for each player would be fine for now i guess
havent played wynncraft in a while
you would have to make sure that the worlds you create are light weight
i just want them to be a few chunks
they can be either deleted or replaced sort of like how hypixel skyblock does it
You could probably make fake entities, then send them entities to certain people who you want to see em
w.hat do u mean
Basically, you can create a "virtual" entity by doing something like this: "new Server/EntityZombie(...)"
And you can send a packet to specific players
to display that entity
or to hide it
i want that entity to interact with the player aswell
like i want the player to fight it
and be able to take damage and stuff
If you want to implement that, you only have very limited options. You can either create your own entity like I showed above and handle your own physics and pathfinder for it. Or, not sure if this will work, create an attack pathfinder so the zombie/enemy only targets that one player, and hide the zombie from everyone else by sending a "PacketPlayOutDestroyEntity" or whatever it's called.
@jaunty crag
hm
would it be easier to just somehow create copies and different spawn locations for different people
can I add you to a thread
Make different entities for different players
is it possible to make a player show a different skin to different players? (packets/non api)
why would blockbreakevent be triggered
falling blocks are entities
maybe try using EntityDeathEvent
Probably Physics Events
hi
how do i prevent a mob from despawning when it's too far away using nms?
supressedwarnings go brt
i found removeWhenFarAway(double arg0) under the Mob/EntityInsentient class but not sure what the double represents
double = 0.00
bet, will try
probably distance in blocks
Pretty sure there's a persistent flag for entities
how did u know this
making everything generic goes brr too
lol sometimes generics are interesting... I'm talking about c# here
c# generics are weird
why can't there be an anonymous type generic 😭 <?>
looking at the parameter name
like bruh
There is also LivingEntity#setRemoveWhenFarAway
is there a tool for this? i was using nms.screamingsandals.org but the parameters are just say arg0, etc
I just have the server source checked out locally
ok i just set the param to a ridiculously high number but the mobs still despawn after moving a few blocks away
no 😅
generics 💀
that method is called to determine if the entity should be removed
its not a "set this to a number"
ohh
is there any other way besides ((LivingEntity) this.getBukkitEntity()).setRemoveWhenFarAway(false);
any reason why that line is an issue
since "this" extends entitycreature, a nms class, i felt like there was a more elegant way to do it thru nms
this.persist
oh?
is a method on nms's Mob
what does this do? just curious
that is the method setRemoveWhenFarAway calls
@Override
public void setRemoveWhenFarAway(boolean remove) {
if (this.getHandle() instanceof Mob) {
((Mob) this.getHandle()).setPersistenceRequired(!remove);
}
}
how would i make a for loop that loops through all players in a map?
You use entryset
its a dependency based map btw which is why its not caps
no
sorry xD
lmaoo
ill think about my code when in bed lol
it was made by hempfest on the spigot forums for a plugin he made
🤔
it won't cancel the event
i've tried alot of things
idfk
Did you register the event?
How did you register them both?
purple go back to work
shut up
thats the main class for the map thingy
sorry illusion, love you ❤️
getCommand("enchant").setExecutor(new miningGUI());```
Create an instance before you register and place the instantiated object inside of the parameters instead
where conventions

this isnt c++ kekw
Convention is for the birds
convention is for goats
I don't even think for the birds is a common phrase anymore
thats a baby chick
Change this
.
its really not in my experience
dont create two different objects
alr
// Instance of the object here
getServer().getPluginManager().registerEvents(miningGUI, this);
getCommand("enchant").setExecutor(miningGUI);```
not spoonfeeding! L @tardy delta
?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.
im very proud of my fancy code ive written today but it does exactly nothing
for()
?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.
thank me later
lets not date ig

i say he's 14--
i dont want to get into the basement of some old man
I'm 18 ;3
where did that 40 year old spigot developer & DJ go
a for() {

magmaguy?
omg
smh bonk my head
isnt akair like 48
date with illision man
no he isnt
both happy
magma is 28 and likes to threaten me
illusion wanna date
D:
What did I come back to XD
hes 42, i was close
well gn ig
Is it the beard?
It seems I've returned to a tragic tale of sorrow and loss.
get alex to shoot his other dog
wtf
do you like me
no
Fuck
plottwist
@floral drum rn: 

really? D:
Ebic preparing for manslaughter
shhh
I wanted to come home and eat russian food
just charge at him with a diamond sword
first thing I see is the fuckin backrooms
what is considered russian food
apparently we had a painter over
cheburek with cottage cheese
vodka
omg give it
but instead of tomato sauce
and cheese
and all those topics
it's pure oil
and meat / cheese
oh
any of you want pizza
you let it cool down
but then you warm it up in the microwave
and now it's properly soft, slightly soggy
instead of a sharp saltiness, it's subtle
😭
The egg that has been mixed with the cheese starts popping out, giving you the nutrients and proper flavor
im surprised none of you want pizza
do you want pizza
epicebic
I want food
thats not healthy
stop offering more
this is my way of flexing I got cash
don't die illusion pls
frozen pizza is... a fruit sure
we need you at emerald
purple
hi
you do realize I'm not gonna get much money from emerald lol
it's a 4 hour task that needs like 10 hours of learning the core
public Inventory GUI(String current) {
Inventory gui = Bukkit.createInventory(null, 36, "Ranks");
ItemStack glassEmpty = new ItemStack(Material.PURPLE_STAINED_GLASS_PANE);
ItemMeta metaEmpty = glassEmpty.getItemMeta();
glassEmpty.setItemMeta(metaEmpty);
ItemStack previousRanks = new ItemStack(Material.HONEY_BLOCK);
ItemStack currentRank = new ItemStack(Material.EMERALD_BLOCK);
ItemStack lockedRanks = new ItemStack(Material.REDSTONE_BLOCK);
for (int i = 0; i <= 9; i++) {
gui.setItem(1, glassEmpty);
}
gui.setItem(17, glassEmpty);
gui.setItem(18, glassEmpty);
for (String group : previousGroups(current)){
ItemMeta metaPrevious = previousRanks.getItemMeta();
metaPrevious.setDisplayName(ChatColor.GOLD + group);
previousRanks.setItemMeta(metaPrevious);
gui.addItem(previousRanks);
}
ItemMeta metaCurrent = currentRank.getItemMeta();
metaCurrent.setDisplayName(ChatColor.GREEN + current);
currentRank.setItemMeta(metaCurrent);
gui.addItem(currentRank);
for (String group : lockedGroups(current)){
ItemMeta metaLocked = previousRanks.getItemMeta();
metaLocked.setDisplayName(ChatColor.RED + group);
lockedRanks.setItemMeta(metaLocked);
gui.addItem(lockedRanks);
}
gui.setItem(26, glassEmpty);
gui.setItem(27, glassEmpty);
gui.setItem(28, glassEmpty);
gui.setItem(29, glassEmpty);
gui.setItem(30, glassEmpty);
gui.setItem(31, glassEmpty);
gui.setItem(32, glassEmpty);
gui.setItem(33, glassEmpty);
gui.setItem(34, glassEmpty);
gui.setItem(35, glassEmpty);
return gui;
}
My code shows this gui
But i would like it to look like this
is there a way to use PDC on anvil?
In your first for loop you put 1 instead of i
for (int i = 0; i <= 9; i++) {
gui.setItem(1, glassEmpty);
}
```Why are you setting the same item 9 times?
🤦 thanks
How else am I supposed to do it?
He's also referring to the 1 instead of i
Oh- right right
Change it to i and it should look right 
yup yup
Is there anyway i could further improve the code? like a method to fill all empty spots
For now i have to go thanks for the help guys! :D
gui.setItem(26, glassEmpty);
gui.setItem(27, glassEmpty);
gui.setItem(28, glassEmpty);
gui.setItem(29, glassEmpty);
gui.setItem(30, glassEmpty);
gui.setItem(31, glassEmpty);
gui.setItem(32, glassEmpty);
gui.setItem(33, glassEmpty);
gui.setItem(34, glassEmpty);
gui.setItem(35, glassEmpty);
that could also be replaced with a loop
Ye still gotta get there 💀 and i need to add 3 items at the bottom but that's simple work
OH HELL NAW
I'd recommend also having this:
ItemStack previousRanks = new ItemStack(Material.HONEY_BLOCK);
ItemStack currentRank = new ItemStack(Material.EMERALD_BLOCK);
ItemStack lockedRanks = new ItemStack(Material.REDSTONE_BLOCK);
```Somewhere else and having it `static` and `final`
you have reached the stage where you need to make some GUI util code
Eh it's just for 1 plugin for 1 server but ill def consider this if making a public plugin
Your encoding is probably wrong, although ideally you should probably use & and translateAlternateColorCodes.
depends a bit
for example, I made a "menu chain"
Well a basic one is easy
oh shit it breaks with the menu.hold code fuck fuck
fixed it with a single if statement
basically just a fancy LinkedList for those "Go Back!" buttons
Yup
Opening menu:
- Assign last element in the list as the "last closed" element
- Open target GUI (closes current one, "last closed" matches current one so we don't clear the chain)
Going back:
- Assign current menu as the "last closed" element
- Open the second last element
Cleaning the clain:
- If the last closed element is not the same as the menu that has been closed, then the chain should snap
The last closed element is basically just indicates what menu you're about to close, assuming you're doing valid hops
I am making a command for my BungeeCord server, "/lobby". I am making them run /server hub when they run /lobby so they can do it easier and quicker. It knows /lobby is a command because it is in the options for the command when I start to type it. That means the command is messed up. My command is registered and set with the right executor and in the spigot.yml.
public class Lobby implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("§cOnly players can use this command.");
return true;
}
((Player) sender).performCommand("/server hub"); // I have tried " ...preformCommand("server hub") " and I get the same result
return true;
}
}
Mine works slightly differently than yours but I think the premise is basically the same
Is this a BungeeCord plugin or a Spigot one?
Because BungeeCord plugins don't have access to Player iirc
Should be ProxiedPlayer or something
worst case scenario we link a gui to another
and if people spam click enough, the server crashes
That seems like a pretty bad worse case
this is a spigot plugin running on a paper server that is connected to by a bungeecord server
Did you put it in the plugin.yml?
yea
Send your onEnable and plugin.yml
mk
Spigot.yml:
name: WildGamesBCE
version: '${project.version}'
main: wildgamesbce.wildgamesbce.WildGamesBCE
api-version: 1.19
authors: [ BeatThis101 ]
commands:
lobby:
description: Moves the player to the lobby.
aliases: [hub]
onEnable:
@Override
public void onEnable() {
// Plugin startup logic
getCommand("lobby").setExecutor(new Lobby());
}
spigot.yml or plugin.yml?
If I understand correctly, you can't do /server lobby in a "performCommand", since the player sends the packet to the bungeecord instance, the bungeecord instance checks if the player sends the command before spigot. So bungeecord commands running inside of a spigot server won't work
If you want the player to be transferred
to the hub server
its a spigot plugin
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Okay, and you can't do "performCommand("/server lobby")" on the spigot side
Because bungeecord doesn't detect the player executing a command
only the spigot server
if you do it that way
. @fresh timber
mk
no no this is not what im talking about
this is only on the spigot server and im trying to make the player run /server hub
https://prnt.sc/bornevAjYSVq
My problem is that the proxy is always pinged by a single person and this crashes the servers. I've been sitting there for 5 days and can't find a solution, does anyone have an idea?
because when they do that it teleports them to the hub
all I want is for /lobby to make the player execute /server hub
@floral drum
But that's not possible on a spigot-sided plugin
and its saying its a unknown command
it isn't?
why is it a spigot method then
to make the player run a command
Bungeecord doesn't detect the player executing the command "/server lobby" if it's done through "performCommand"
oh
You have to use what I sent above
Bungeecord is just a proxy server - it routes packets
yeah ik
Spigot API methods run on spigot's jvm, it doesn't send any packets to the client asking it to reply with a command packet
I thought it would think it was a command tho
it simply pretends like a command packet has been received and it executes it
hm
It skips the bungee layer
but like is there a way to tell the bungeecord that the player ran /server hub so it will send it to hub like it happens when you run /server hub normally in game besides this or do I have to set up all of this just to do a /lobby command
or you can make a bungee plugin
yeah thats what I dont want to do
When the player types it it goes from teh client through bungee. When the server executes it, it never leaves the server so Bungee never sees it
ohh, ok that makes sense
how do I make a bungeecord plugin?
CraftPlayer{name=deemmooo}
why does this output when i use Bukkit.getPlayer(args[1]);?
because you did a sysout
Player target = Bukkit.getPlayer(args[1]);
you used System.out.println(target);
i didnt
yes you did
ik what ur saying but i didnt
player.sendMessage(ChatColor.WHITE.toString() + ChatColor.BOLD + target + ChatColor.RED + ChatColor.BOLD + " is already in a kingdom");
So im having some problems, I am using java entity.setVelocity(new Vector(0, 3, 0))
and it will launch an iron golem up, but it won't launch say a cow up
I dont know why
Anyone have any ideas?
Doesn't sound right. Probably your code doesn't even get called?
I know it does through printing messages, and if It didnt then why would the iron golem get launched
Well. I wouldn't know whether you try to launch both in the same or in seperate functions
its inside of an entity damage entity event
Hey, quick question. I am making a BungeeCord plugin on IntelliJ IDEA. How do I save the project to my files so I can put it on my server? Like, I want to do the same thing as building the artifacts on a Spigot plugin I just have no idea how to do this on a bungeecord plugin. I am using Maven.
just wait
ppl will respond when they can
they have lives too
m ok
same command i would guess
I didnt run a command
how are you building then
I just hit this but I can no longer use it
which is probably a command
but I cannot use that now
press control twice then type mvn clean package
mvn clean package is a build command
Maybe try delay the setVelocity for a few ticks
alr ill try running it 2 ticks later
gradle build*
they said they were using maven
i was using build as a general term
example: "mvn clean package builds the project to a jar file to be used on a server"
mvn install - Install the artifacts into local repo
mvn deploy - Deploy the artifacts into remote repository
I am using maven and it worked to build my project, @next stratus
Gradle is far more up to date than maven, I don't know why it's the most used thing in spigot sadly.
Hi all! I have a question how to make a randomizer and not just a randomizer that takes some numbers, but numbers / symbols
which are taken from the config (as shown in the picture)
this is more of a java question but is there any way to get all the outputs in a hashmap except the output to one specific input
Gradle isn't more up to date than maven
Or rather said it does not make sense to make such a comparision
loop through the entry set and filter it
uhh... ?
Little confused towards what you're tryna do?
It's much tidier.
can i grab the entry set from the hashmap
However for the things that gradle and maven share (i.e. the ability to created jars), they are almost the same
why
please put more effort towards replies
Gradle is a bit worse in that it does not support FTP and SFTP (using keys) repos
yeah i just realized im sorry
However once you go to the API it is an entirely different story - maven is easier to learn but requires a lot more workarounds than gradle
and it uses a java-like style where maven is closer to html (based off a markup language)
The java-like style becomes something I don't like about gradle however as it isn't actually java
just pretend it's javascript
oh no
Any one know I way I could check for line of sight between 2 locations? If an entity was standing a certain spot, could it see a certain location
Raytracing I guess
there is a hasLineOfSight method, bit I need to use a location
?jd-s spigot has an API for that, lemme look it up
thanks 🙂
You'd need to use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Block.html#rayTrace(org.bukkit.Location,org.bukkit.util.Vector,double,org.bukkit.FluidCollisionMode), a bit annoying considering that you need to create the direction vector yourself, but nothing impossible if you have worked with vectors before
It's groovy
Let's be real: Who uses groovy outside of gradle?
This is cool, Would work for what I need. Lots of my users are on 1.8 though, id prefer to support all versions if possible. Something like this exist in older versions?
If you can find a decent site hosting J8-style javadocs for 1.8.8 I could check
You think I could do it with this? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/util/BlockIterator.html#<init>(org.bukkit.World,org.bukkit.util.Vector,org.bukkit.util.Vector,double,int)
declaration: package: org.bukkit.util, class: BlockIterator
I believe this exists in 1.8
If it exists you could probably use that yeah
it does allow you to make some nice programmatical scripts for automating shit though
You could probably just do the ray tracing yourself (if needed)
you can include one common file to configure your module as well
Ill check. Thanks for the quick help. Much appreciated
gradle init 🙂
If you know how to use groovy though
its java with some quirks
Some is an underexaggeration
sure but java code works with groovy as well
?
so not too much to learn
There are a lot of rather huge quirks that it is better to just write the stuff in java proper
only thing is the gradle API is quite big and shit
And the documentation is fucking shit
closures are nice
looks much better for configuration than it would in java
Relocating bstats looks like this: https://github.com/Geolykt/EnchantmentsPlus/blob/4xx/pom.xml#L317
I wonder if kids find the tutorial on how to install spigot see the maven one then never change
He uses FTP
lol
Gradle does not support FTP
🤨
Yes
Sure buddy if you say so.
I have checked, using FTP for maven repos is near-impossible
Unless you want to code it yourself
At which point you might as well shoot yourself in the head if maven can already do it
dependencies {
implementation project(":util")
}
looks better than
Dependencies deps = project.getDependencies();
deps.implementation(getProject(":util"));
imo
Plugins exist
These plugins dont do that though
As I said, I already checked
Gradles argument is basically "FTP is unsecure you shouldn't use it lol"
Use external plugins then
Maven artifacts can be uploaded through ftp
<distributionManagement>
<repository>
<id>jeff-ftp</id>
<url>ftps://ftp.jeff-media.de/maven2</url>
</repository>
</distributionManagement>




