#help-development
1 messages · Page 1846 of 1
i thought there was no difference unless you're using it in a method
Yeah precisely
If you just have i++ it wouldn’t matter if you’d rather use ++i
array[i]
Well that applies to Java nonetheless
if you'd do this.a++ it would have the same result?
Yes
yes
bruh
if you did it in a condition or in an instruction, there would be the utility
you'd see the difference
post increment looks cleaner
yeah why not also rewrite whole spigot etc
I don't see any advantage in rewriting what already exists
Let’s rewrite Java 🌝
and let's call it "sillcock"
nice thing to do in the holidays 🤡
🥲
spigot is a fork of craftbukkit no
4 and 4
Yeah essentially

be the main fork
hmm
or rewrite bukkit to get rid of those 10 year old code blunders
fork vanilla
hmm, weird
nothing weird 😂
i=3;
++i; //i is 4 now
i++; //somehow i is now 3?
oh lol, didn't know you reset it inbetween
i see no reset inbetween
how would we call our fork
sillcock
yeah lmao
is odd means cool
but it's basically the same as a spigot
what does it mean lol
sPIgOT
no
To regain our ego ^
sIlLc0cK
thankyou
if craftbukkit logo is a bucket, spigot a spigot, sillcock logo is...
oh
How can I get a player, that another player is looking at?
get nearby entities and do some math
there's no "getEntityPlayerIsLookingAt"
i think thats the function he's willing to make
yeah, get nearby entities, apply some vector magic and .... then redo everything because it doesn't work a few times, and done :3
with f3, you can see a redline where the player looks at
is there a way to get those infos with a getRedLine
something like that
no
but it's basically just a vector starting from your eyeline to the direction where you're looking
so: easy to replicate
in vanilla you can teleport a player by modifying his head position
if we can set, we can get
Yeah I know that much.. 😅
say I have
option1: abcd
option2: 1234
how do I get option2 specifically
int i = config.getInt("option2")
Highly recommend you read: https://www.spigotmc.org/wiki/config-files/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
writing abcd there without " " will cause an exception i guess
Hello it is possible remove color code after player use colored tabComplete argument?
Don't put colors in the tabComplete like that
so how can i achieve colors in tabComplete?
if you want to mimic the coloring of vanilla commands use the Brigadier library
ok
Could use brigadier + commodore
guys quick question- if ive got spigot 1.18.1 do i need to install buildtools as well?
No you use BuildTools to get Spigot
No BuildTools will make the 1.18 spigot jar
Where ever you got your jar from it's not official
yea so ill use that instead of installing manually spigot only like i did
from spigot site
anyhow thanks for help
Spigot has no download page
You're not on an official site
you aren't supposed to download spigot from anywhere, if you downloaded it from some website, stop using it, it could have malicious code.
you download buildtools from spigotmc and run it, it will build spigot
i mean if u go on www.spigotmc.org there is the download option
That gets you to BuildTools
basicly at the same place got buildtools from
Not a Spigot jar download
anyhow imma just use them rn thanks for help
yea just sayin theres also spigot.jar there
There isn't
send the link, i don't believe you
oh and if link is auto deleted it's not an official site
okay lemme just find it real quick
u guys were right, it was not on spigots site
my bad
Help
val userV = ProxyServer.getInstance().getPlayer(v2)?: return player.sendMessage(*ComponentBuilder(("§cPlayer não encontrado")).create())
userV.sendMessage(*ComponentBuilder (" ").color(ChatColor.RED).create())
userV.sendMessage(*ComponentBuilder ("§aVocê recebeu uma solicitação de amizade de ${player.name}").create())
var aceitar = TextComponent("§a§lAQUI")
var negar = TextComponent("§c§lAQUI")
aceitar.clickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/amigos aceitar ${player.name}")
negar.clickEvent = ClickEvent(ClickEvent.Action.RUN_COMMAND, "/amigos negar ${player.name}")
aceitar.hoverEvent = HoverEvent(
HoverEvent.Action.SHOW_TEXT,
ComponentBuilder("/amigos aceitar ${player.name}").create()
)
negar.hoverEvent = HoverEvent(
HoverEvent.Action.SHOW_TEXT,
ComponentBuilder("/amigos negar ${player.name}").create()
)
userV.sendMessage(*ComponentBuilder("§aClique ${aceitar}§a para aceitar e ${negar}§a para negar.").create())
userV.sendMessage(*ComponentBuilder(" ").create())```
np, also you should run /version from time to time, spigot updates often
oh thanks for tip
if it says you are behind just run buildtools again
it says its fine for now but ill be checking it
Hi, I'm having a error, this is the code
public static boolean hasFullIron(Player player) {
ItemStack[] armorContents = Objects.requireNonNull(player.getEquipment()).getArmorContents();
if(armorContents.length < 4) {
return false;
}
for (ItemStack armorItem : armorContents) {
if(!armorItem.getType().name().contains("IRON")) {
return false;
}
}
return true;
}
And this is the error
the line 28 of IronArmor is
It was working on 1.8 but not on 1.16
I'm missing something that have been changed between versions?
It’s a NPE meaning armorItem is probably null
Yea because it happens if you don't have armor equipped
not sure about API changes in regards to inventory nullability, I thought it was nullable even in 1.8
slap a null continue check and you should be fine
things seem to go back and forth between empty slots being air and being null with each version, just check if the armorItem is null before you try to access its members
I didn't put RequireNonNUll on 1.8, but when switching to 1.16, the IDE suggested me that
Must be nullable now ¯_(ツ)_/¯
so on 1.8 it was null
and 1.16 air?
sorry for the ping btw
I wish Spgiot could be more consistent with null and air
Yeah, air > null
RequireNonNull won't work but a condition to check if's null yes?
Any help?
i don't remember, and idk what the trend is going towards, but sometimes it's air, other times it's null, i just check both
Okay tysm
What do you even need help with? Just a wall of code tells us nothing.
check image under code
What does that imply?
isn't it Player#spigot()#sendMessage() for sending textcomponents? or am I mistaken
BungeeCord I believe
@quaint mantle anyways why do you need to use *?
ComponentBuilder::create returns the desired type
Kotlin
kotlin stuff
Hmm I thought you could just pass an array type to a vararg without having to use *
I using Bungeecord
'-
who ghost pinged me
you asked if it's that shape, i said i use bungeecord and that's how you do it
wow, only 2701 sonarlint issues
google will be giving me a call with a blank check any day now
to be fair it takes a very high iq to understand my code
ParticleEffect.ITEM_CRACK.display((ParticleEffect.ParticleData)new ParticleEffect.ItemData(Material.BLACK_WOOL, (byte)0), 0.3F, 0.3F, 0.3F, 0.1F, 10, location, 20.0D);```
any1 know
how to change this to 1.8 ID
black_wool doesnt exist and i dont know how to change it to 1.8
i think ( idk if it works ) to make a itemstack and set the data id and transform to a material
Does it matter if you have one main event class or multiple little classes that use the same events ?
Prioritization is important but aside from that don’t think it matters
anyone know what causes this error......?
I tried the [Help 1] but i got nothing from it
You’re targetting Java 5
lol
update to Java 16 bro
wtf
Nah its required for 1.18 right?
Guess it does
to RUN 1.18 yes
that doesnt mean anything
but if you're devleoping i havent seen any issue
ur pom doesnt specify it
oh wat
You have to change the compiler settings
its not only ancient, but not even usable
i fixed it 💀
I understand that using the same string over and over again isn't great but I feel like sonarlint is a bit too strict with it
are they in different classes
lol
you could create a constant but it depends on the context of your code
not sure what you mean by this?
object re-use is preferred and generally more optimal
I mean the opposite, as in defining the same string over and over again in multiple locations
make a constant or smthing
I mean yeah sort of
i guess
I just don't see it as being very practical a lot of the time
sometimes it isn't
anyone know
Hey there! When players walk on a tripwire, this triggers a redstone signal. I would like to disable this mechanism. How could I do so?
I am already disabling BlocksPhysics and I tried to play with BlockRedstoneEvent but it is not triggered
yeah
Not #help-server XD
mb
wait this isn't Wendy's?
lmao
Nope its Burger King
no wonder my fries were taking forever to get here
i thought this was Roy Rogers, where the fuck is my chicken??
Am I in the right channe;?
no
what word does gordon ramsey say the most
Where should I ask about spigot plugin development?
lamb sauce
this channel
probably best to not confuse people lmao
So why did you say I am not in the right channel? I am a bit confused
this is the right channel for spigot plugin dev yes
no
unless someone doesnt get to it in like a day
ur sure BlockRedstoneEvent isnt getting fired by tripwires?
Use PlayerInteractEvent with Action = PHYSICAL
Alright, thank you
yes
ah, looks like freq got answer for u
redstone is a bit finicky to mess with
and really not a whole lot of events for it unfortunately
if i'm making a java plugin can i just have a random kotlin file (apart of the plugin, like an event listener for example) in there, and it'll still work?
Kotlin will run both java and kotlin, where as java only runs well java
is it allowed? sure as long as everything conforms to the rules
I will try this:
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPoweringTripwire(final PlayerInteractEvent event) {
final Block block = event.getClickedBlock();
if (event.getAction() == Action.PHYSICAL
&& block != null
&& block.getType() == Material.TRIPWIRE) {
event.setCancelled(true);
}
}
Hmm unfortunately it doesn't seem to work, I'll try to debug it
Is it fired?
can you give me a link to your message?
maybe its TRIPWIRE_HOOK? idk
yeah
no it's the name of the kind of key, here we are trying with strings
No not fired
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPoweringTripwire(final PlayerInteractEvent event) {
final Block block = event.getClickedBlock();
Bukkit.broadcastMessage("d");
if (event.getAction() == Action.PHYSICAL
&& block != null
&& block.getType() == Material.TRIPWIRE) {
Bukkit.broadcastMessage("canceled");
event.setCancelled(true);
}
}
I do not see any "d" in the chat when walking into my block
Is it fired when left/right clicking a block?
is there another way to trigger this event to ensure it is really registered?
2 fast 4 me
yeah it is
Is your tripwire hooked?
no it is not
But I just want to disable the redstone thing
Any help? ( Check Image )
only works with tripwire_hooks
you are going to have to get a bit creative with just a tripwire
I'm actually using tripwire variations to "add" new blocks
ok, well it needs to be variants of tripwire_hooks
otherwise again going to need to get creative with the events
You will have to go with MoveEvent
the issue is that when I walk on it it gets powered
ah shit
what would you suggest with move event?
and then?
Then BlockRedstoneEvent
how could you know if this block used to be unpowered?
what do you want to do with it?
like I said you are going to have to get creative
Yes this is what I am asking for help here 😛
there is not unfortunately an easy solution for everything
again, that's why I am asking for help
I know, but this might not be something you are going to be able to get help on as a whole
Listen for MoveEvent, when the player steps on a wire save the location somewhere, then listen to BlockRedstoneEvent, check if the current block is connected to that saved location, if yes set the new current to 0
probably better off getting help in small slices to the over all problem as you encounter the smaller ones
Are instead of saving the location create a Map with the Player as key and a boolean as value, then set it to true when the player is standing on a wire
but the block redstone event is not triggered
It is not triggered when a block is being powered?
You need to connect a block which can actually be powered for it to fire
what I want to disable is this:
you see it is written: powered
so my block lost its texture
in comparison to this
this is a server side change when you walk on a tripwire, unrelated with hooks
it becomes "powered"
this is this mechanism that I am trying to disable
Yeah same thing, you don't even need BlockRedstoneEvent
it's probably easy to disable it from the server source code but I would prefer to do it in a plugin
blockphysicsevent
maybe
or
interact event, check the physical action
idk if that triggers if its not connected to hooks tho
I have a question, I am writing a plugin with its own economy, warps and ranks and such, but if I have other plugins like EssentialsX for example, with those same features/commands,
how do I tackle compatibility/command overlapping issues? and other issues like permissions/economy
Doesnt
playing whack-a-mole with sonarlint issues is like popping bubble wrap
personally I default to using my own economy but have vault compatibility to bridge it with other economy systems, in which case my own system completely shuts down
i have a class that handles all transactions, all I need to do is change where to read / write from
only works if its a tripwire hook
anyways, the person keeps asking for help on something that you really can't get help for
it is just unfortunate
no matter how many times they keep asking the responses for it are simply not going to change XD
and what about things like /warp? also would i have to add integration of essentialsX into my plugin for it to work properly :/
yep, and that's even assuming the warp system people would use is essentials
I just let people turn my system off for teleports if they want to do their own
darn
that's why my config files have thousands of lines lol
As I said I already cancelled it
why do you think I can't get help for this?
So you would still use the map to remember the real state, right?
Object[] asd = event.getBlock().getDrops().toArray();
System.out.println(asd[0]);
gives me ItemStack{COBBLESTONE x 1} how can I get the amount of the cobblestone
you can, just the solution for your problem as a whole is not simple and there isn't going to be an answer anyone can give that would make it to where you could solve it
I just need help, I don't need someone to do it for me 😛
you are going to have to get creative to work around the lack of a solution
I actually don't really know where to start, that's why I am asking for help
the easiest solution is probably going to be NMS
why?
because there is no direct API to solve it
you are going to have to make use of multiple events
with various checks
.
I don't know how to explain it any clearer then that
its player.spigot.sendmessage
first of all you dont need to use toArray method use the list that given to you
anyway, ItemStack#getAmount()
idk sorry
Help, my plugin is registred, and works perfectly economyimpleter from vault
but this appears when I download some other plugin that needs a vault
[Vault] Economy: null [null] (After using /vault-info)
econ = new EconomyImplementer();
getPlugin().getServer().getServicesManager().register(Economy.class, econ, this, ServicePriority.Normal);
console.sendMessage("§aLBEconomy: Vault is working");
}```
Why does
pl.getLogger().warning("DEBUG >> Stream: "+Boolean.valueOf(Arrays.stream(inv.getContents()) == null)); output: false
but
pl.getLogger().warning("DEBUG >> Stream: "+Boolean.valueOf(Arrays.stream(inv.getContents()).findAny() == null)); outputs: NullPointerException?
probably has to do with the findAny() method
.findAny() should just return null if it doesn't exist though.
ParticleEffect.ITEM_CRACK.display((ParticleEffect.ParticleData)new ParticleEffect.ItemData(Material.END_STONE, (byte)0), 0.3F, 0.3F, 0.3F, 0.1F, 6, location, 20.0D);```
why does END_STONE
not get recognised
its in 1.8 item format
What version is your server?
Should. One sec.
https://www.digminecraft.com/lists/item_id_list_pc_1_8.php using this so i know it is
Here is an interactive list of Minecraft IDs for all items, blocks, tools, dyes, foods, armor, weapons, mechanisms, transportation, decorations, and potions for Minecraft Java Edition (PC/Mac) 1.8. Each block or item has an ID value assigned to it in Minecraft.
On the Click.Action.CHANGE_PAGE, how can i change the page?
if the inventory doesn't exist to begin with
it will NPE
It does
I already have null checks for that
obviously something before it is null
you can't use methods on an object that is null
Well look at the message the first one outputs false so the stream isn't null but findAny() throws and NPE
yes, which leaves me to suspect something about the inventory object is null
It can't be because then stream would say null is true
if(chest == null) return;
Inventory inv = chest.getInventory();
pl.getLogger().warning("DEBUG >> Stream: "+Boolean.valueOf(Arrays.stream(inv.getContents()).findAny().isPresent()));
can anyone help me
.
not sure what response you want from me
already told you something before findAny() is null then
its not magic
🤷 lol just proving nothing besides findAny() can cause the NPE
but obviously something is
otherwise you wouldn't get an NPE
I'm not seeing Item_Crack in 1.8 effects
Java doesn't throw NPE for stuff that isn't null 😉
declaration: package: org.bukkit, enum: Particle
Thats 1.18
not 1.8
👍 well Material is red so check for another material?
end_portal_frame doesnt work either
my name should be in &7 color, the prefix is there, but its not chaning my names color (I know theres my prefix because when i give myself a group with visible prefix it shows it)
#help-server ? or is it your plugin
yes + luckperms
its team in scoreboard
oh wait
you gave my a idea
:D
@stone sinew
for findAny()
Exception : If the element selected is null, NullPointerException is thrown.
So I have to use a try catch?
ItemStack[] might not be null, but individual items can be
That defeates the purpose of isPresent()
thank you 😄
Welp. Ill just use my ugly method from yesterday xD
that checks if the stream is empty
not quite the same
yw :)
Aight. I'll just use
if(Arrays.stream(inv.getContents()).filter(i -> (i != null && i.getType() != Material.AIR)).collect(Collectors.toList()).isEmpty()) return;
use whatever, was just telling you why findAny() was throwing an NPE which was my first suggestion, second being something with the inventory
and ironically both are correct/related XD
👍 thx for the help.
Hello!
I am creating an NPC in 1.18.x.
I want to give it a second layer of skin, is there a good way to do this?
npc.ai().a(new DataWatcherObject<>(16, DataWatcherRegistry.a), (byte)127);
I'm getting an error with
Thanks in advance !!!
Another one
Why are so many making their own npcs
And you all get stuck on the same step
Citizens are expensive 😫
But I want to do it without using the API. Because I'm still a beginner and I want to learn a lot of things
Can someone help me? My plugin is disabled because there is no vault on my server, but it is.
.
Its almost like we can't help you with no error logs :/
lol
Does it show on /pl
It doesn't give any error, it just disables the plugin and says the vault isn't on the server.
Many reasons, Avoiding dependency hell is one of them
Some of us don't want to rely on another dev to update their plugin every time a new release comes
Then update or fork things yourself. The problem isn't people making NPCs it's that they have no idea what they're doing
Another reason is that not everyone wants to just flat out use API's and not look into how they work
some people just want to build NPC stuff themselves
because its more fun that way
Almost all of them simply copy paste code
not everyone needs a large lib for NPC's either
This is very true
I am more comfortable coding something myself usually as opposed to relying on some lib as well
^
there are some freedoms you give up when using a lib
a lot
if you're coding something that breaks the lib because its a weird edge case.. well now you have to contact the dev and he'll probably not care
Now that isn't to say I am going to advocate people do it themselves, if they really have no idea in what they are doing I do recommend a lib to help them out
or you have to reverse engineer
I think code snippets are more useful than a lib
or at least, the lib but with the source
I tried to fork it, but it was not in that source code. When I tried it in the old code, I was able to do it, so I wonder if I can run it as long as I know the simplified variables.
I have a large collection of snippets myself
whenever I find a piece of code that I found handy I save it 🙂
You gotta learn how it all works
internally
if it breaks, gotta learn how to fix it too
reason why I have all kinds of projects that I keep around too even if they are super old
^
yup
I have too many methods that I don't want to throw away because I spent hours on them
only to find a better way of doing something
this
its not that I spent hours but rather they are just nifty lmao
and I don't want to forget them because at some point it will come handy
oh yeah for sure. They're not the sort of thing you can just rattle out in 10 seconds
guys do i need craftbukkit and spigot for 1.18.1 plugins?
I think craftbukkit is already in the codebase of spigot
you only need spigot
It is
because i just finished installing buildtools and some versions have option to install bukkit and spigot jars and some have only spigot
Newer versions don't have craftbukkit jars
if you don't have a specific reason to target bukkit/Craftbukkit only, then only worry about spigot
oh okay
most people don't have a reason to target those things
I do hate the change of implementation of 1.18 though
thanks for help
How so?
why is spigot in Manifest.mf lol
because maven adds it there
why are all the libs no longer integrated like they were before
what libs are you referring to?
oh btw if i can ask here- is making plugins on newer versions of mc harder?
read
Newer is easier
the libs folder
everything is nested inside META-INF
oh cool
META-INF is created by maven
well yes, because that is how dependencies work
We could get in a long conversation about META-INF, but for the most part no one really has a reason to worry about it or care about it
So you're expected to use Maven now?
They're talkikg about the fact that Spigot is a bootstrap jar
No, as I said, its not an essential file
ye
META-INF helps tools like maven itself find dependencies or identify when dependencies are transitive etc
the bootstrap stuff
You can skip maven. Read the post md5 sent
Yes do that XD
Main class file split because of nested classes
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or use a dependency manager such as Maven or Gradle to handle this automatically.
Yes I read that
So you just throw that into the server but plugin developing wise, you depend on the nested jars
no...
aight I'm lost haha
the API jar is hosted in spigots maven repo. You can depend on that, proper development is even if the jar you depend on does provide other libs, you should depend on the libs locally yourself. The libs being present in the server is more a convenience to the server operators in not having to go fetch them and for the developer in not having to shade them.
I really did not think this change would cause so much confusion
So any lib not spigot related got yeeted from spigot and is now its own jar file you need to reference
I am not entirely sure how you are missing the crucial information
I mean sure, thats one way of putting it
been a long day, just trying to get my head around it
Let me compact it for you;
Depend on Spigot API jar or the Shaded version of the Spigot jar. NOT the one that ends up in the root folder where you ran BuildTools
why is shading called shading anyway
Or you know just use Maven/Gradle
because you also have fat jars
how dare you
which are jars with all the libraries inside them
I know I gained some weight with the xmas food but it's not that bad
Yeah that I know
and then depend on the other libs
in the lib folder
if you need them?
or does spigot need them
guys one more thing- im having troubles importing stuff, eclipse just keeps pretending org.bukkit doesnt exist ive written these 3 lines and it highlights JavaPlugin and org.bukkit.java. when im checking on javaplugin its not showing me an option to import it from org.bukkit even tho i think it should package me.Stephen.firstplugin2;
import org.bukkit.java.JavaPlugin;
public class Main extends JavaPlugin {
}
what am i doing wrong?
shading just forces specific class paths right
that's shady
well did you add spigot-api as a library
I did
talking to stephen
oh, sorry
i added spigot 1.18.1 as an external path, is that it?
I don't like the term shading, someone call up mr oracle and tell them to rename that term
you cannot depend on spigot-1.18.1.jar
someone call up oracle and tell them to stop updating java every 6 months
while you're at it tell mr oracle to find a shorter spelling for boolean
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar (download), or the contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
that's just getting lazy
lol
honestly i cant even understand some of them
if I didn't want to be lazy I wouldn't have gone into programming
replace spigot-1.18.1.jar with Spigot/Spigot-API/target/spigot-api-1.18.1-R0.1-SNAPSHOT-shaded.jar
it will devolve into the rust language where all key words are 3 letters long
why assert when you can ass
okay thanks
it should be in buildtools folder already, shouldnt it?
yes
because anyone who doesn't know the language well will have no idea why you want to ass
I don't need a reason to want to ass
honestly tempted to make buildtools copy the api out as well
yeah was going to say md_5
ye
you're just making more work for yourself by not doing that
but then server owners will get confused by spigot-api 😉
also let me go back to my amazing \^-^ username, those were the glory days
Java if it had rust like levels of lazyness:
pub sta voi mai(Str arg[])
{
Ass.fal(tru);
}
package the api in a folder called "developer"
okay got it thanks a ton
or "developers"
Using Apache Http is possible to send a post request with json parameters and files?
Thanks
I mean, I've always used the api to develop and to throw it into the server to run
also this might be a really dumb question but why cant i delete spigot.jar file from referenced libraries
i mean the delete option is gray
🤷♂️ I use Intellij and Maven
Should be straightforward. https://hc.apache.org/httpcomponents-client-5.1.x/quickstart.html
Thanks
🤷♂️ Eclipse and custom build scripts
Dont use eclipse pleasee
nevermind i figured that out
?
Let people use what they want
Is the ender pearl item cooldown overlay changeable?
the time delay is
It can also be applied to any item
can put it on non-ender pearl projectiles also
What is it called?
i forgot, ill check in a bit and let you know if someone else doesn't say before i get back
md_5 how often is the spigot api updated?
hella
If I listen for projectilelaunchevent and set the cooldown in that it will always happen after the vanilla cooldown tried to set?
Or will i need to set the priority
daily-weekly
quick question how to make run.exe inside build tools
because i really dont want to break anything by doing it wrong
what? o.O
need to set your view in windows to show file extensions
then create a text document
rename it to run.bat
it will turn it to a bat file
you can add what it is you want in the file before or after renaming doesn't matter
should there be something specific?
java -Xmx2G -Xms2G (or whatever ram you want to give it or just exclude those entirely) -jar BuildTools.jar
this is the minimum
you can go fancier if you want
not required however
am i stupid or can you not ChatColor.translateAlternateColorCodes(); on bungeecord..?
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 saw something like this echo off
@echo off
IF NOT EXIST BuildTools (
mkdir BuildTools
)
cd BuildTools
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
java -jar BuildTools.jar --rev %Input%
pause
I normally just execute BuiltTools from the command line though since nothing special is needed
that works too, just does more things is all
line 39..?
so what that does is if BuildTools Directory doesn't exist, it will make it. Once it is made or identified, it changes the active directory to that buildtools directory. Next it downloads buildtools and then afterwards it pauses and waits for your input on the version you want built which then automatically invokes the command to run buildtools and version you want 🙂
as I said you can go fancier if you want it just isn't required
I'm facing extremely weird issues
Apparently Bukkit.getWorld(worldName) returns a non-null world but attempting to load any chunks gives me a world unloaded exception
Even though my code gets called after WorldLoadEvents and such
are you ensuring that the world is done loading before trying to load chunks?
well I don't know what your code looks like so not sure if the loading of the world is being done and then immediately after that code loading a chunk
oh thanks for explaination
yes there is
declaration: package: org.bukkit.event.world, class: WorldLoadEvent
I'm doing something very hacky which is basically unloading a world, replacing region files async and reloading it async
Uhh
Yeah I listen to that
That event seems to be called as soon as I call createWorld or anything similar
the async part is probably where its going wrong unless chunks are async now in spigot
it's a bit annoying
this is roughly the process
lots of latching, futures and lambdas are involved
I make sure to resync some essential stuff like teleports and such
oh yeah and there's a 50% chance the server crashes with a huge chunk log (I assume loading world)
Why not use 1 world, I swear that’s how every sever I have played works
Scalability
This core is made to dynamically load worlds, pull islands from a central database (mongo / sql) and load them whenever
How is that scalability
Or 1 world with each island spaced x Amount away
You'd have to sync islands and such
This is closer to a hypixel skyblock island system
Yeah 400 won't do it
How big is your server?
This is a public project
Give me a min I think I have an idea
I'll do some test runs on 1k players but I really don't want to be limited by player counts
not sure why people insist on continuing to support old verisons
Which version are you having issues?
I currently run tests on 1.17.1
And will add support for lower versions as the project develops
well, lastest is 1.18
Ehh I started this before 1.18 was a thing
It should still work, as long as I update the .mca files
I don't use NMS so
¯_(ツ)_/¯
Ok so how about this, instead of doing worlds per server, do x islands per server. For example if you want to only have 100 player on a server, the amount of islands in the 1 world would be limited to 100. Then, when a player logs on to the hub and selects the gamemode, access the database and check if there are any servers with free slots in its worlds. Then load them into the server the same way you are doing now, but instead of worlds, a 100x100 chunk.
1 world is usually 1 island
Pasting the islands without unloading a world is a challenge
you want each player to have their own island in their own world?
Im saying to help reduce RAM/Storage/CPU usage use 1 world.
that isn't going to be feasible
Not all in 1 server
Basically I have up to 25 islands (configurable) in a server
And you basically lend a world from an island server
it loads the world with your island
that isn't a scalable solution or scales horribly
you can play, whatever
anyways its up to you, I am not entirely sure where it is going wrong in your code
then when you leave, your island gets saved to a database and the world gets released for another island
hopefully someone else might spot the issue in your code 🙂
Each instance only needs enough resources for 25 islands / worlds running at once
Which you can ofc lower if you don't have that much RAM / cpu / whatever
The database might get overloaded but I can segment database stuff in the future
The intention is to have multiple island servers and keep a seemless island world across them all
Without instances keeping copies of the island after unloading them
And then there's a bungee side that handles matching members together so I don't load the same island on 2 servers simultaneously
and some redis stuff because some servers have more than 1 proxy...
You could always go a more sharded route with each sub server have up to x dedicated islands on it. Having 1 server per person has the issue of all that extra resources that each server would require
Oh I'm not doing 1 server per person
Each server has 25 islands that can be loaded at any time
Once the entire island team logs off, that world is unloaded and reverted to being a plain void world
I imagine you could have way more islands per server though since chunk loading wouldn't really be an issue.
To load an island I need to unload the world, replace region files and reload it
25 is a safe number, I have a .yml file that you can just set whatever number you want
idk why you need to mess with region files
that didn't really answer why you need to mess with region files
to load or unload a world that contains an island
The island's contents are saved on the region file
fuck it, 24
if each island has its own world, then why mess with the region files when you can just invoke the unload or load for the world
includes crop status, lighting and whatever
The world is made from region files
the island worlds are just templates where the region files are pasted on top
I am quite aware of this
don't need to explain to me mojangs format
I don't serialize the entire world, only the region files
you don't need to serialize anything
I can load and unload a world without ever touching a region file in code
I want to load the same island across 2 servers ... ??
then you are better off saving that island in a different format
instead of messing with region files
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
Main main;
public int getInt(UUID id) {return main.getConfig().getInt("Player." + id + ".Int");}
public String Att(UUID id) {
String a = "[Admin]";
String b = "[Player]";
if(getInt(id) == 0) {
return a;
} else return b;
}
@EventHandler
public void Chat(AsyncPlayerChatEvent e) {
e.setFormat(Att(e.getPlayer().getUniqueId()) + e.getPlayer().getDisplayName() + e.getMessage());
}
Well
this is not working for some reason
your Main is probably null
it uses String.format internally and needs to have 2 %s iirc
if I'm not using the Att() in the format it's working
I also got a huge error message in the console
But I can't upload screenshots here
so like e.setFormat(Att(e.getPlayer().getUniqueId()) + " %s >> %s");
[01:37:14 ERROR]: Could not pass event AsyncPlayerChatEvent to StarWarsEssentials v1.0-SNAPSHOT
java.lang.NullPointerException: null
at starwarsessentials.starwarsessentials.chats.test.getInt(test.java:14) ~[?:?]
at starwarsessentials.starwarsessentials.chats.test.Att(test.java:20) ~[?:?]
at starwarsessentials.starwarsessentials.chats.test.Chat(test.java:27) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor63.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-579]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[patched_1.16.5.jar:git-Paper-579]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-579]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.5.jar:git-Paper-579]
at io.papermc.paper.adventure.ChatProcessor.post(ChatProcessor.java:222) ~[patched_1.16.5.jar:git-Paper-579]
at io.papermc.paper.adventure.ChatProcessor.processingLegacyFirst(ChatProcessor.java:102) ~[patched_1.16.5.jar:git-Paper-579]
looks like main could be null
at io.papermc.paper.adventure.ChatProcessor.process(ChatProcessor.java:60) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PlayerConnection.chat(PlayerConnection.java:2085) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1938) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PacketPlayInChat$1.run(PacketPlayInChat.java:43) ~[patched_1.16.5.jar:git-Paper-579]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_311]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_311]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_311]
[01:37:14 INFO]: <Darth_Mango> hi
but my main is not null
The plugin wouldn't work without a main class
... main isn't null, the config is
ok but do u make sure to set the fields value
o
at starwarsessentials.starwarsessentials.chats.test.getInt(test.java:14) ~[?:?]
at starwarsessentials.starwarsessentials.chats.test.Att(test.java:20) ~[?:?]
at starwarsessentials.starwarsessentials.chats.test.Chat(test.java:27) ~[?:?]
would look around in Test at those methods
follow it from bottom to top
odds are its probably your getInt() method
the config is not 0
if its not the config, then yea all i can say is do what frostalf showed above
it was working in another class
same value?
yes
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
lol
hey uh, theres multiversion servers, and lets say I have multiple clients and custom textures on my server
how do i make sure 1.8 resourcepack goes to 1.8 clients?
Hey can someone help? I'm trying to create a custom spigot fork but when i build the project with buildtools there is no pom.xml so i can't use mvn? How can i setup buildtools with a pom.xml file?
is there a way to whitelist a player using the bukkit api?
I found this:
if(Bukkit.getWhitelistedPlayers().contains(player)){
//check if player is on whitelist
}
player.setWhitelisted(true); //set player on whitelist
player.setWhitelisted(false); //remove player from whitelist
Bukkit.setWhitelist(true); //enable whitelist
Bukkit.setWhitelist(false); //disable whitelist
Bukkit.reloadWhitelist() //reload whitelist
but how will i be able to get a player instance if the player has not ever joined the server before?
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(UUID);
offlinePlayer.setWhitelisted(true); //set player on whitelist
offlinePlayer.setWhitelisted(false); //remove player from whitelist
Bukkit.setWhitelist(true); //enable whitelist
Bukkit.setWhitelist(false); //disable whitelist
Bukkit.reloadWhitelist() //reload whitelist
Use OfflinePlayer
Or can i just build it without maven?
does translateAlternateColorCodes return a string or a textcomponent?
String
if you want to use the components API
just use one of the builders
translateAlternateColorCodes is considered "legacy" at this point
whats the hot new way to do color codes now?
and please don't tell me concat ing strings is preferred
translateAlternate is fine
I use the term "legacy" here as any usage of color codes is deemed "legacy" since it uses Minecraft's legacy text
components (Bungee/Adventure) are preferred
nvm
Hi, Im again i have read what someone sent about Apache http client. But i cannot find how to send ONE post with json parameters and files (all at the same time).
Hello. im trying to do a beautiful /f map with some hover text and etc
This is the code of the command: https://paste.md-5.net/uxaqagexiq.cs
The event: https://paste.md-5.net/igogugamik.java
The listener: https://paste.md-5.net/geyuqajope.java
Basically i want to create a hover text around the yellow square, but it is creating the hover at this area as if the squares got shifted to the right
I would like a help to fix that
1.8
how do i set item in hand, amount currently held - 1
so im tryna make a bed trap and i need the bed that was placed to be added to a hashmap of the bed and the player who placed it but i dont know how to get the bed the player placed as a Bed class to put in the hashmap
cuz i also need to detect if a player enters the bed
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerBedEnterEvent.html and could store the location of the bed placed
declaration: package: org.bukkit.event.player, class: PlayerBedEnterEvent
or can i just make the program see the bed as a block and i can still use bed enter event and shit
yea but theres 2 halves of the bed
so i cant just store 1 location
ok im just gonna try that
PlayerEnterBedEvent has a getBed method
im trying to get the Bed object and put it into a hashmap as its placed not when someone enters it
how do i get the bed object from a blockplaceevent is what im tryna say
Listen to BlockPlaceEvent then
ItemStack held = player.getInventory().getItemInMainHand();
if(held.getType() != Material.AIR) {
held.setAmount(held.getAmount() - 1);
player.getInventory().setItemInMainHand(held);
}
?
Check the material type then store whatever you need to store
if(event.getBlock() instanceof Bed bed) {
//use bed object
}
this is what i did
if(e.getItemInHand().isSimilar(Recipes.EXPLOSIONBED)){
traps.put((Bed) e.getBlockPlaced(), e.getPlayer().getUniqueId());
}
is that alright or is it shit
That's fine
alr ty
Provided Recipes.EXPLOSIONBED returns an ItemStack that's a bed, which I assume it does 
lol it does
How to check if biome is snowy?
Like, if it snows in the biome?
Yes
You might not be able to, I assume that's client side.
The server just tells the client the current weather state I'm pretty sure
Seems like a not very good way to do that
It might just be best if you write out all the biomes that snow and check against that method 🤷♂️
Depends on what you need it for specifically
I mean, that's the obvious thing, but there are a ton of biomes and I'm not sure if client checks if there should be snow the same way
i think thats what i did in my plugin lol
Although, it's absolutely possible, it's Mojang after all
just compared it against a handful of biomes
the last time we collectively searched at how mojang handled weather here it didnt go well iirc
That sounds intriguing for some reason
How accurate does it need to be? I think some biomes it can snow AND rain depending on altitude.
basically the server tells the client its not raining, and then it starts raining
Accurate enough to tell, that if the player stays at specific location, they should see snow
If it's raining ofc
Then yeah you're going to have to use the altitude of their current position as well then
Like, it will snow on top of mountains but not at the bottom, even though they can be the same biome.
leave to mojang to give us pain and suffering
Ah-ha
if(world.getTemperature(x, y, z) < 0.15) { /* ... */ }
That should work I guess
The required temperature values for snow and rain are less than 0.15 for snow and above 0.15 for rain.
The only thing I don't like about this explanation
Is that it doesn't explain what should happen at temperature == 0.15
ah so they actually made it easier to check weather? pog
well I mean you have a 50/50 chance of it either being snow or rain
just set it to 0.15 and find out
Hi
So I am not sure if this is possible anymore as I haven't seen anything to help me with this
But I have seen other spigot plugins do this so I think it is
So I need help making my arguments in my commands basically say what the arguments are for
like mid typing the command
lemme get a screenshot on what i mean
And also show certain options instead of just showing a list of players
ok, well I cant send a screenshot :/
But does anyone know what I mean?
implement TabExecutor instead of CommandExecutor
What is tab executor?
You can then control what options are shown in the TabCompleter method
Oh
alr
Ok, so how do I use the TabCompleter method
does it show it automatically?
depending on the length of args you return a List<String> of the options you want to show
Ah ok
if(event.getBlock().getType() == Material.IRON_ORE){
event.getBlock().getDrops().clear();```
why doesnt it clear the drops
public void onBlockBreak(BlockBreakEvent event){
if(event.getBlock().getType().equals(Material.IRON_ORE)){
event.getBlock().getDrops().clear();
my best guess is to try that
ik I have to do that with strings
??
doesnt getBlock and getDrops return copies
No, getDrops() returns a collection of all the blocks in the server that have been dropped
The reason why i say to do this is because ItemStacks are messed up
Theres nothign wrong with ItemStacks
o
Use the correct event and iterate the Items
Well I mean like whenever I do if (player.getInventory().getItemInMainHand() == stick) {}
the if statement never runs
Thats instance checkign and will always fail
Or in this case, isSimilar
and I made a variable for stick as an ItemStack
Compare Enums with ==, objects with .equals
Your variable will never == the item in hand
So i have been doing this all wrong 💀
you use stick.isSimilar(getItemInMainHand())
Ah ok, thx for the help
how do i get the direction between 2 points
im trying to find what direction to teleport the player in to get closer to a block
final Vector directionVector = targetLoc.toVector().subtract(startLoc().toVector());
ty
is it possible to make crafting recipe to get armour more that prot 4
Sure
enchantment books are what are used to apply such things, so not sure why you would need to make a crafting recipe
yah but i want t o make is to that players could cratf armour which has aprotection value of mroe than pro 4
by using speacial things
thats why i am asking is it possible to make armour more than prot 4
or any enchants more then their max level
cuz when i use commands to make these items
is does not say the enchant discription properly
like for prot 4 armour it says "Protection IV" and for prot 10 armour generated by commands it says "proTection lvl:-10"
Yeah that’s an issue of the client tho
Or well
Protection X should work fine?
Altho what you wrote indicates you tried to give yourself negative protection
i meant protection:10
/give @s wooden_sword{Enchantments:[{id:protection,lvl:10}]} 1
That should work splendid, and it should say Protection X
i am thinking of making a crafting recipe
if we covered a sharnpness 5 dia swro with diamond in a crafting table
it should give out sharpness 6
so i was asking for help about it
You got some code?
I won’t be doing this for you, but I don’t mind guiding you loosely through it, with that being said I do demand that you have actually given it a try first, before coming here.
@dark arrow normally you'd want to use a RecipeChoice.ExactChoice
Buuuut
that won't work if your sword is already damaged or has been renamed on an anvil etc
so my particle is starting at the red circle but theyre going everywhere, anyone know why? http://prntscr.com/24lq7fr
you will need to use the CraftItemPrepareEvent or however it's called
theyre being spawned every tick fyi
Thanks for reminding me about my idea to add a PDCChoice
Although that doesn’t really help here either
PDCChoice?
what will it do?
can you pls upload the screenshot directly?
Matches the item as long as it has the designated PDC entry
that website always thinks I'm a robot and won'T show anything lol
dont have image perms
You are spawning them with a velocity vector
@tender shard
wtf is wrong with prntscr.com
yes
LOL
show your particle code pls
oh I meant you @tidal skiff
show your code pls
smh
i.getWorld().spawnParticle(Particle.FLAME, new Location(i.getWorld(), base.getX() + -bounds, i.getLocation().getY(), base.getZ() + -bounds), 1);
i.getWorld().spawnParticle(Particle.FLAME, new Location(i.getWorld(), base.getX() + bounds, i.getLocation().getY(), base.getZ() + -bounds), 1);
i.getWorld().spawnParticle(Particle.FLAME, new Location(i.getWorld(), base.getX() + -bounds, i.getLocation().getY(), base.getZ() + bounds), 1);
i.getWorld().spawnParticle(Particle.FLAME, new Location(i.getWorld(), base.getX() + bounds, i.getLocation().getY(), base.getZ() + bounds), 1);
i is the player object btw
its in a for loop
try to use the function that also lets you define the offset for x,y,z
and set it to 0
spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force)
Hi, so I'm compiling Spigot on Win10 (https://www.spigotmc.org/wiki/buildtools/#Running BuildTools)
and it compiles, but the result in Spigot/Spigot-Server/target
when I try to run it it gives this error (gimme a sec)
oh wait
Error: Unable to initialize main class org.bukkit.craftbukkit.Main
Caused by: java.lang.NoClassDefFoundError: joptsimple/OptionException
Press any key to continue . . .
the .jar you want to run is NOT in that directory
ik, but I want to patch spigot
You don't run that
hmm