#help-archived
1 messages Β· Page 56 of 1
The problem is the player can avoid fall damage by logging out, and logging back in since their noDamageTicks will not be zero, completely avoiding all fall damage
is this plugin help?
just an idea
what if you calculate the fall distance + what's left till below and apply the damage on quit ? π€
That's not how fall damage works though
What if a player logs out before going into water?
is this plugin help?
@frigid ember It is coding, server and plugin support, but if you have questions to existing plugins please contact the author, if you want to get a plugin coded please use the forum
I'm really not looking for some hacky way to apply fall damage to the player. All I wanted to know is why setNoDamageTicks is not working
setNoDamageTicks was broken eversince 1.8
So there's no way to set it with the bukkit api? If so why would it still be in the latest version
there is but setNoDamageTicks is not exactly doing what the method name suggests to be doing
"Sets the living entity's current no damage ticks." ?
i don't think it's what you're looking for tbh
π€
that's only if you take damage
it's doing exactly that
if you'd take a look in the NMS class, no damage ticks is not exacly ticks without getting damaged
Where to rent a free server machine
in heaven
host it on your own pc, nothing else is free
there are free hosts, but then you'll *pay *with your personal data
Thanks
@agile whale Here at CraftLivingEntity class
public int getNoDamageTicks() { return (getHandle()).noDamageTicks; }
public void setNoDamageTicks(int ticks) { (getHandle()).noDamageTicks = ticks; }
they should have the same number
as said noDamageTicks is not exacly what you are looking for
@subtle blade i got it
private int getBreakTime(Block block, Player player) {
net.minecraft.server.v1_15_R1.World world = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
IBlockData data = world.getType(pos);
net.minecraft.server.v1_15_R1.EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
return (int) (1/data.getDamage(nmsPlayer, world, pos));
}
lol
1/hardness?
Thatβs the problem though, itβs not correctly setting noDamageTicks
Theoretically it should return the number I just set it to
NMS checks some things before you can set this number
wait a second I'll send you the proof
How can I do a permanent IP?
home hosted?
ask your service provider to make it static
buy a domain or use no-ip and its free domains
But as said, please be careful when hosting a server at your home
It has some major security risks if not done properly
always keep your ports closed except 25565 :p
Hi one of my friends tried to set up a localhost on their Mac and somehow duplicated every file on their computer
They followed the wiki
Any ideas
@subtle blade it takes into account alot of factors
I printed it out while breaking a block and I found out that it was 5 times longer when I was in the air versus when I was on the ground
@tacit geyser is the idiot who duped every file on their PC whilst attempting to set up a localhost on their Mac
Yep. Even more so when swimming
It also Increases under water
If anyone has any idea please help ! Tyvm (he's on 10 mins timer from joining)
It's only took me in entire freaking day
is the idiot who duped every file on their PC whilst attempting to set up a localhost on their Mac
@frigid ember please mind your language
Thanks
is idiot a bad word?
If you say it to a person, it is an insult
@stone fossil who cares
ah, okay. was just cofused. my mummy doesn't mind me saying
MFMKillCrafter clearly does
In private enviroment I don't mind either, but if you are in a public chat, you should be a little bit more polite. But that's just my opinion
@warped shuttle idiot
ππΊ
@vale slate idiot
@vale slate sorry SJW, it was a joke as they're a friend of mine
Why?
I worked in support for too long to feel insulted, so don't even try. XD
Look out boys the local 14 year olds have arrived
Lol imagine calling someone sjw
@vale slate not everything is a personal attack on you
ok 10 mins is up
im alright with him calling me an idiot lmao dw
but ye downloading it duped by files by 14
so i just wrote a python script to delete all dupes
Trying to fight for the blind elderly people's feelings is a bad cause
thanks for the help !!
@vast arch I think more to the point there's a time and a place, when trying to get support from the community, you should show some level of respect π€·
@vale slate not everything is a personal attack on you
pinging me for no reason counts as personal attack π
π @vale slate
@vast arch and if you want our support, keeping in mind we are not obligated to actually help anyone here at all, I would suggest people show a little bit of respect. Don't forget we don't have to help people with their issues, we choose to
@frigid ember Good for you π
.
@frigid ember @vale slate I went ahead and already did this, but right click their user-name and do "Block"
people like him are probably under alot of stress and it leaks out in this chat
@frigid ember never a bad time π
Is it a bad idea to learn Java only for making plugins in minecraft? I already know python so it wouldn't be to difficult to learn Java
No it's not a bad idea, it'd work as quite a good way of getting into java to be honest
funny thing is, I learned java purely to do minecraft, but then I used it for other things
like sable said
Before making plugins, I'd only been working with C, C++ and C# really (With some python thrown in the mix)
Ok. And how did you jump into making minecraft plugins?
What api, libraries, etc
There's loads of great entry-level tutorials out there
private static final Pattern pattern = Pattern.compile("[0-9]+-[0-9]+");
... method {
line = "* 1-2% Success Dust"
Matcher matcher = pattern.matcher(line)
System.out.println(matcher.find()) --> false
}
bleh, whats up with my regex
but please, check the tutorials, because some of them give a shit on every Java convention that exists
of course, feel free to come back here along the way
regex has been my worst nightmare eversince
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
there should be a system with java that is kind of like pypi and maven; basically just enter the alias for the library and it will be autorecognized in your ide
like for example
get-break-delay==1.0.0
protocol-lib==3.2.1
I liked the idea of making an entire pypi resource for one specific function
oh for get-break-delay?
oh
private int getBreakTime(Block block, Player player) {
net.minecraft.server.v1_15_R1.World world = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
IBlockData data = world.getType(pos);
net.minecraft.server.v1_15_R1.EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
return (int) (1/data.getDamage(nmsPlayer, world, pos));
}
i recently made this lol
Guys
hola
Is there any one who can help me in a block.setMetaData thing?
does that calculate when the player is underwater and have aqua afinity enchanted helmet?
yes @pastel basin
oh sweet
I am trying to create a function to set an owner for a block placed.
it is nms, and it is basically what runs whenever you begin to break something
well
the methods under it
sorryh
Is there any one who can help me in a block.setMetaData thing?
?ask
public void setBlockOwner(Block b, String name)
{
b.setMetaData("owner", new FixedMetadataValue(MainClassInstance,name));
}
That's the function
however, the setMetaData is not recognizible
cannot resolve 'setMetaData'
it is Metadata not MetaData
still same error
b.setMetadata("", new FixedMetadataValue(MainClassInstance, name));
should work
or did you import the nms block
and not the bukkit one
@spring sapphire do you want it to save even after the server shuts down?
import org.bukkit.block.Block; should be somewhere in your import list
Yes, Perzan
Isnt that only for tiles?
setMetaData won't save after shutdown?
no
Im pretty confident you cant store data over restart in a block..
import org.bukkit.block.Block; should be somewhere in your import list
@vale slate I imported it, but nothing changed.
unless a tile like chest...
unless a tile like chest...
@vernal spruce I am working on a chest lock
then u need to use NBT tags
PersistentDataHolder works for chests?
Anyone have an example of a blockgrow event I could use to help me with my project?
ah yes
and if yes, what does it return?
block state? @vernal spruce
ayyy!
Chests are TileEntities, therefore they are working
Anyone know of a way to detect when an arrow is removed from an ItemStack in the inventory?
@naive stratus on click events?
will PersistentDataHolder return the owner UUID?
@hallow surge I want to detect an arrow being removed from the inventory
you can set it to have
idk if thats what your looking for
be more specific? when a player shoots a bow?
@hallow surge I have an arrow with metadata, I need that on ProjectileHitEvent, but cant get it, since it's not an ItemStack, but an entity.
Yes
And it does not seem to persist the data in any way. If I pick up the arrow the meta is gone.
Listen to projectilelaunchevent check if its an arrow,check if the bow has infinity and so on
^
I need to do it through the arrow, not the bow. If possible. I have created a custom arrow type. Not an enchanted bow.
Can I use PersistentDataHolder with eventHandler playerInteractEvent?
why not,here is a model adding data to an item
cm.getPersistentDataContainer().set(pl.ciNK.sieverKey, PersistentDataType.STRING, "ssba.siever");
you should have the method as well for the block/state
also cink.sieverkey is this sieverKey = new NamespacedKey(pl,"ssba.siever");
there is 1 import for it.. import org.bukkit.persistence.PersistentDataType;
buddy i think ur IDE is broken if it can find imports automatically
Are you casting the block to a chest first?
I don't know
public void onBlockPlace(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemStack block = event.getItem();
if (block.getType() == Material.CHEST) {
player.sendMessage(ChatColor.GREEN + "YOU PLACED CHEST!");
block.getPersistentDataContainer().set(player, PersistentDataType.STRING, "owner");
}
}
take a look
I asked if you are casting it to a chest before setting the data
I added an if situation to check if the block is a chest
but I have no idea how to make it a chest
if(chest.getState() instanceof DoubleChest) { DoubleChest dchest = (DoubleChest)chest.getState();
Same for normal Chest
"chest" is the block
We expect a basic understanding of the language before you make plugins
@spring sapphire ```java
private NamespacedKey owner_key = new NamespacedKey(plugin, "Chest Owner UUID");
private void setOwner(Chest chest, @Nullable UUID owner) {
PersistentDataContainer container = chest.getPersistentDataContainer();
if (owner == null) {
container.remove(owner_key);
} else {
container.set(owner_key, PersistentDataType.STRING, owner.toString());
}
}
@Nullable
private UUID getOwner(Chest chest) {
PersistentDataContainer container = chest.getPersistentDataContainer();
String raw = container.get(owner_key, PersistentDataType.STRING);
if (raw == null) return null;
return UUID.fromString(raw);
}
Ahh yes,spoon feeding at its finest π
I wanna keep them interested lol
You shouldv seen me get excited when i made my first plugin with no feed code π
then they will get interested
the messiah
I actually red the code and I felt like I wanna delete the IDE and never try again lol
welp
its actually not hard just that you skipped some important steps in the java tutorials
im going to delete my life and never try again
don't get me wrong Perzan
Also most of us do it for fun/hobby
my IDE is just "I DON'T KNOW WHAT CHEST IS, SO GET OUT"
what ide?
Intelji
strange didnt have a problem with it yet
it always autosuggest casting and correct imports
I did however met a problem where intellij for w/e reason didnt know java.utils.List existed
but it autosuggested to change to it??
Eclipse gang rise up
you prob are mistaking aws with the util one
we need :eclipse:
does eclipse have a minecraft plugin?
For a beginner, I guess I need it
intellij going ham
@atomic rapids
Still doesnt know java.utils one exist LUL
I mean is your own plugin?
@patent monolith excuse my stupidty, what you gave me is not the full code, correct?
looks like a debug
its just some methods for you to use in your code
no he gave you some methods to easly call
I get it
when you have a Block instance, make sure to check if it is instanceof Chest
bet
I give up
Check this,the myth,the legend,TheSourceCode https://www.youtube.com/channel/UCNXt2MrZaqfIBknamqwzeXA/playlists
He covered too much of bukkit...
I will check him
I shouldn't have started before doing that, thought C++ knowledge is enough lol
its not much different than java
I know, that's why I just rushed in
but i still think you are missing some important parts... like casting
I will watch the source code videos
hopefully can be ready tomorrow
thank you
Time to install eclipse
Yeah gonna change back to eclipse
for some reason my other nitro emotes wont work here lol
after i finish this plugin
:aspoggies:
i dont like intellij π
I used both for a long period of time and for me intellij is better, at least for me
it is easier to configure and prettier to look
@pastel basin Eclipse themes exist π
I am not talking about themes, its the UI in general, Intellij feels more modern
Idk, to me, Intellij is like discord and Eclipse is teamspeak
lol
Hello
hey so i'm downloading spigot on mac, i've done the whole
#!/bin/sh
cd "$( dirname "$0" )"
java -Xms512M -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot.jar nogui
and i've put a space between it and the chmod a+x but it still doesn't do anything
Hello everyone! I've installed the Spigot server on my linux machine. How do I install a texture packet and where do I find them? I've looked at the Resources page on the Spigot website, but it yielded nothing.
Thanks a lot
Is this considered a GET to a url? `String surl = getConfig().getString("UrlToCall");
try {
URL url = new URL(surl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
} catch (IOException e) {
getServer().getConsoleSender().sendMessage(ChatColor.RED+"[StartupHTTP]Found wrong or missing link to call!");
}`
Are there plugins where the player cannot place blocks on top of chests?
pretty sure there should be
Is it possible to have tooltips on tabCompletion suggestions?
The TabCompleter supports it
it works the same as the command api
you just return the possible tooltips in a list when the player tries to autocomplete it
Are you refering to the purple outlined minecraft tooltip?
Hey, sorry. Not sure if this question fits here, but on my server clearlag is reporting that the end and the nether both have 529 chunks loaded, and the overworld has around that many extra loaded as well. I'm thinking that this might be affecting the tps on the server. TIA
when I do inventory#getItem(n) and an item isn't there, is the itemstack null or is it type material.air
because I always check both but I want to increase performance (lol, more like code readability)
who knows, Bukkit isnt very consistent about that unfortunately
π ty
how do i enable so, when i wear the armor piece i get the effect instead of just whnr its in my incentory?
1 method and from there u should be good to change it based on what you need
ItemStack helmet = p.getInventory().getBoots();
if(helmet==null){
return;
}
if(!helmet.hasItemMeta()){
return;
}
if(!helmet.getItemMeta().hasLore()){
return;
}
List<String> lore = helmet.getItemMeta().getLore();
for(String s : lore){
if(s.contains(ChatColor.stripColor("Infused with Speed"))){
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,5*20,1));
}
}
}```
ignore the name..
too lazy to replace "helmet" with "boots"
do i put that in my item class?
yeah it screwed it
there we go
And that method gets called every potion time -1
so it makes an infinite effect as long as its equipped
so would 999999 work?
to avoid just equiping armor,get the infinite effect then get it off
oh boy..
so i check every 4 seconds and i add the effect for 5
i think you get what this does..
Hello! How can I make an entity only visible per player?
So far as I could read is using packets (with the ProtocolLib)
I don't know how to do it with protocol lib but I know you can spawn an entity to a specific player using nms packets
Filter outgoing packet
And just send them to the specific player
I remember doing this a long time ago with NMS, honestly no idea how ProtocolLib would implement that
Well, I'm kinda new to plugins... So I might confused it a bit
And thanks for the fast response!
> ./start.sh: line 1: 7833 Killed java -Xms2048M -Xmx3700M -jar server.jar nogui
[root@minecraft-anarchy-server minecraft]#
randomly happens after like 1 or 2 days
Omg
running it on screen and it just gets killed
that's like the worse flags and setup I've seen
You're literally running a server as root and with improper flags
what's wrong with running a server as root?
π©
and which flags are wrong
You're not using any garbage collector for the JVM
yeah i know but if u run it as sudo can't it rm -rf too?
then dont run it as sudo or root
Not to mention non matching flags
or how are u supposed to run it
even that is risky
just make a user without sudo permissions
hey,
i can not connect to other servers on a bungee network.
I only get to the lobby server.
i entered the IP and port of the servers at the Bungee config, set online-mode to false and set bungee in Spigot and paper.yml to true
whats the matter?
@sturdy oar so what do i change the flags to
And use proper JVM flags
or what's wrong
/what do i add
From the startup scripts
just give me a hint so i can do some research ty
kk il see cause i got those from the minecraft wiki i think
(changed min and max memory values ofc)
let me see if I remember the command
java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=8 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=βhttps://mcflags.emc.gsβ -Daikars.new.flags=true -jar spigot.jar nogui these were made by aikar
They weren't tested on spigot but they should work great as well
alright ty
so the process getting killed could be because the JVM garbage collector has no memory?
@green epoch the default spigot recommended flags:
https://www.spigotmc.org/wiki/start-up-parameters/
but you should stick with @sturdy oar flags which will perform better.
yeah ty
Those are spigot flags you sent
What I've sent are mainly jvm and garbage collector tweaks
Oh sorry, there you go: https://www.spigotmc.org/wiki/spigot-installation/
its in the middle of the page
Yeah I'd not recommend those π
team?
ok so
[notroot@minecraft-anarchy-server minecraft]# ./start.sh
./start.sh: line 1: 25913 Killed java -Xms3000M -Xmx3000M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=8 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=βhttps://mcflags.emc.gsβ -Daikars.new.flags=true -jar server.jar nogui```
modified it slightly
it just kills the process
> [23:55:41 WARN]: [SellChest] Task #186 for SellChest v1.1.2 generated an exception
java.lang.RuntimeException: Economy username cannot be null
at com.earth2me.essentials.api.Economy.getUserByName(Economy.java:67) ~[?:?]
at com.earth2me.essentials.api.Economy.playerExists(Economy.java:378) ~[?:?]
at net.milkbowl.vault.economy.plugins.Economy_Essentials.hasAccount(Economy_Essentials.java:289) ~[?:?]
at net.milkbowl.vault.economy.AbstractEconomy.hasAccount(AbstractEconomy.java:10) ~[?:?]
at codes.biscuit.sellchest.hooks.HookUtils.addPlayerMoney(HookUtils.java:199) ~[?:?]
at codes.biscuit.sellchest.hooks.HookUtils.giveMoney(HookUtils.java:148) ~[?:?]
at codes.biscuit.sellchest.utils.Utils.lambda$runSellTimer$0(Utils.java:99) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:59) ~[beerspigot.jar:git-TacoSpigot-bf023c7d]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:349) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:794) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:422) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:724) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:627) [beerspigot.jar:git-TacoSpigot-bf023c7d]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
Anyone know what could be causing this?
although i am not experienced with java and i might just be talking shit,
java.lang.RuntimeException: Economy username cannot be null
your plugin does not check if that string is null which causes the exception
It's not my plugin, shit,,,
Essentials & Vault not playing nicely together
If you're using EssX, contact them. If you're not, do that. Or just don't use Essentials because it really isn't an essential plugin
It's bloatware
If you're using EssX, contact them. If you're not, do that. Or just don't use Essentials because it really isn't an essential plugin
@subtle blade Couldn't have said it better myself
Back in the day it was amazing
it went downhill
It was never great to begin with. My biggest gripe with that plugin is its insistence on overriding vanilla commands. why
The amount of times I've had to answer "/give @p diamond_sword" isn't working is ridiculous
true, tp and kill commands were completely unnecessary
yes
and ugh
The amount of times I try to type /kill @e[type=x] or something of some sort then have to change to /minecraft:kill are too many of my liking
and also /tp ~ ~10 ~
Is there a way to get the current hopper rate using the API or should I just read spigot.yml?
Nice π
My plugin makes use of a custom hopper implementation for virtual inventories and I never considered the fact that the hopper rate could change lol
int size;
if (emotes.size() <= 9) {
size = 9;
}
else if (emotes.size() <= 18) {
size = 18;
}
else if (emotes.size() <= 27) {
size = 27;
}
else if (emotes.size() <= 36) {
size = 36;
}
else if (emotes.size() <= 45) {
size = 45;
}
else {
size = 54;
}
Is there a nice way to do this
Divide by 9, round up, times 9 again?
that's what i was thinking
if you need to, you can clamp it to 54 if it's above 45. Unless you assume it'll never go above 54.
So something like this then.
size = (int)Math.ceil(emotes.size() / 9.0f) * 9;
From stack overflow
Avoids floating point math
i'm caching the inventory and the last calculation is made at plugin load up
so i prefer the readability i think
How do you rotate a shulkerbox?
How do you rotate a shulkerbox?
@frozen cedar Entity#teleport(Location)
How about shulkerbox block -> entity?
how do u make it so when u put the item stack armor on it gives u the potion effect but when its not on take the potion effect off?
:/
@frozen cedar do you not rotate it as you would any other block
How would you do it for any other block?
hang on let me check its correct first
i think it counts as a chest
you get blockData and set facing
here's a similar question https://www.spigotmc.org/threads/setting-blockface-for-a-chest-in-1-12.348475/
how do u make it so when u put the item stack armor on it gives u the potion effect but when its not on take the potion effect off?
listen for inventory click events -> add or remove effect
I would personally abstract it and make a PlayerEquipArmorEvent
i have 4 armor pieces executing commands do i need to make a seperate class for the listener?
but i have 4 classes each with one command to get an itemstack
What do the commands do exactly?
give you an item
Ok how is that relevent to listening to armor equiping?
becaue its an armor piece
i want so when u wear the armor u get the potioneffect
instead of just when its in your inventory
Ok, so you just give the armor metadata when they do the command and then have one listener
how do you learn bukkit?
find a way to listen to armor equip and add the effect, then find a way to listen to armor unequip and remove the effect
im not understanding anything :/
When they equip the armor look for the metadata in the listener
And based on that metadata do y
:/
How do I install plugins to my server? I'm using a debian linux VPS to run my server and keep getting error codes when trying to wget. Any help is appreciated.
download plugins at spigotmc.org and drop em in your plugins folder
Well he's on a server so there probably isn't a GUI..
What error code when you do wget?
I'm using ssh. I get a 503, Service Temporarily Unavailable.
It worked just fine when trying to install paper.
What's the command you are using?
If I want to broadcast a textcomponent to all online players, I'll probably have to loop through all online players and do player.spigot().sendMessage, huh?
yes
how would i make it where people leave and auto go to the hub server?
wget [url]
If I want to broadcast a textcomponent to all online players, I'll probably have to loop through all online players and do player.spigot().sendMessage, huh?
@frigid ember server.spigot().broadcast(TextComponent)
hehe was just reading that
which does the same thing, but makes my code cleaner, thanks spigot β€οΈ
What's the URL you were using though
Yea, I mean you could one-line Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(textcomponent));
Though broadcast() is a bit nicer
Sorry to ask, but is it true that the hiring post will need to wait a 48-hour moderation period?
Sometimes longer but yes
Thank you
They're all manually reviewed by just one person
Ah I see
Is there a way to build a 1.16 snapshot version of spigot through buildtools currently?
No
Alright
How do I install plugins to my server? I'm using a debian linux VPS to run my server and keep getting 503 error code when trying to wget. Any help is appreciated.
Hello, so i just got the bedwars plugin and im sonfused on hwo to get 2 worlds on one server, btw we are using aternos
I suggest you read the instructions for the plugin
you might need an additional plugin like Multiverse-Core to get another world
install a world management plugin
Ok, thanks
how do u make it so when u put the item stack armor on it gives u the potion effect but when its not on take the potion effect off? minecraft bukkit plugin btw also pls give an event listener example pls and ty
i suck at understanding lol
you already asked this about 10 times and we gave you the answer..
we're not spoonfeeding code, as I said before you need to listen when a player equips an armour, probably with InventoryClickEvent and add or remove your effects
wait so under the inventory click event u put the potion effect?
yes
you should probably listen for PlayerInteractEvent and InventoryMoveEvent as armor can be equipped when a player right click and through dispensers
You'd be best off creating a "ArmorEquipEvent" that is called within those events, keeps all the messy part in one place
You'd be best off creating a "ArmorEquipEvent" that is called within those events, keeps all the messy part in one place
One is being PR'd. Just under its final review. Should be merged sometime soon into Bukkit
PlayerArmorChangeEvent
I'd wait for that then
?stash
?cla
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Sign the CLA, takes up to 24 hours or so to be approved. After which point you have access to pull requests
Fork, make changes, pull request. The usual
?help
Hello
I need a help, after long time I came back to play minecraft and ofcorse I like do it on my server, so I used to bukkit server a years ago but now I installed the spigot, all good, server is running, but please can you remind me how do I install the plugins (Timber Plugin trying to but won't work)? Regards!
Put the plugin in the plugins folder then restart. If it does not load, link a pastebin of the startup log.
When i used the bedwars plugin, i restarted the server and the arena deleted even though i saved it. Not the world, but when i do the arena command it adds a new one. I spent like 2 hours coding everything and its all gone. Is this a glitch or what?
You will probably have to ask the bedwars author.
Hi Iβm having trouble with the chat of my server Im using essentials chat but the /mute doesnβt work I donβt why cause the muted players can write message and when someone join the server can write messages without login
Can anybody help me?
oh it did load, but did not work maybe because I forgot to use an axe, lol: [04:23:31] [Server thread/INFO]: [Timber] Enabling Timber v1.0.7
[04:23:31] [Server thread/INFO]: Timber Log Materials: [SPRUCE_LOG, BIRCH_LOG, ACACIA_LOG, DARK_OAK_LOG, OAK_LOG, JUNGLE_LOG]
[04:23:31] [Server thread/INFO]: Timber Axe Materials: [STONE_AXE, GOLDEN_AXE, WOODEN_AXE, IRON_AXE, DIAMOND_AXE] ------ but maybe you would know how to make it work with hands or whatever else instead of only AXE?
idk you will have to ask the author of the Timber plugin.
thank you, anyway main think now is that all is working, thank you for a quick respond!
Hi, I bought a plugin and apparently it had a problem and it was not bought, but if my money has consumed me
@loud kindle
check paypal and make sure its not pending in paypal or wasnt declined
give it 24-48 hours and if you still dont have it you will need to contact the author.
or just ping the author
if they are even in here ^
ye, if they are here, what plugin did u buy @bitter tide
let's ping him 2gether
delete that lmao
i didnt understand anything in that image
shame, the author aint here
don't post transaction details in a public chat
yes, DM him
if you dont get it within 24-48 hours, yes
@tropic nacelle the author isnt in here, so we cant ping him π¦
But I'm supposed to give it to you right now, not in a day 1 or 2
depends on your bank
It has never happened to me with any other plugin
if its pending, you will have to wait
But I bought it with paypal
I literally said that minutes ago legoman
@bitter tide wait 24-48 hours and you should get it without pinging the author
It is not normal
the author may have to manually approve it, some author have it setup that way.
^
So do I have to speak to the author?
he will probably see it when he wakes up
^
Hey guys, how can I get the Player who spawned a mob from the EntitySpawnEvent?
how can a player spawn a mob?
using a spawn egg
using an egg spawner
then listen for PlayerInteractEvent
check if the action is right click and if the item is an egg spawner
there isn't a way to get the player through EntitySpawnEvent
Right, cheers! Can I get the entity spawned using the PlayerInteractEvent?
Just check the type of egg
yes, through the egg spawn material type
??
Ah right, thanks very much! π
How do you make an empty ItemStack? I've tried making an ItemStack of Material.AIR with quantities of 0 and 1, I've tried making a normal ItemStack with a quantity of 0, and I've tried setting an item slot to null, but they all result in a java.lang.AssertionError: TRAP.
didn't new ItemStack(Material.AIR) work?
Nope, that resulted in the same TRAP error.
I'm using Spigot 1.15.2, if that helps.
I'm trying to get this to work with PlayerInventory#setItemInMainHand() and PlayerInventory#setItemInOffHand(), but it's resulting in the error for both.
Yes, it is @Nullable.
should fix your issue
Yeah, I just tried nulling it. Same AssertionError.
hm
But I checked the CraftBukkit patches, that TRAP error should only come up if the ItemStack is a Material.AIR.
That's why I'm a little stuck here. π
i think trap is when you're trying to click something that doesn't exist
maybe try to cancell player interact? π€
^
This is actually in a PlayerInteractEvent, I'm trying to make it so that when you right click an item it reduces its quantity.
Yeah, it's a little huge, though, I'll have to trim it down a bit. π
@manic raptor PlayerInteractEvent is what you want. But don't you want to consider when players use dispensers to spawn them as well?
What if I tried PlayerInteractEvent#setCancelled()?
that should work imo
You'd want to cancel it under the right conditions, not altogether x)
yeah
Yeah, I noticed that it kind of screws up eating food at the same time, for example.
shootHatchet() is just some NMS magic. π
How can i do the same in #spigotcraft ?
Wait, so you want to cancel the monster from spawning and do something else? Does you want it to do the same thing regardless of which hand it is in? Or does it do something different in the left/right hand?
It does something slightly different in each hand. Mostly different sound effects.
So, come to think of it, I could just condense it and use the action with a ternary operator or something to change the sound, but this works for now.
So, you can't remove an item while it's active in an event from what I understand
yup
You'd have to start a runnable that waits like .1 of a second then removes it
Just use || and merge them, then check which one when you're playing the sound.
so the event finishes, then the item is removed
You could save quite a few lines of code.
Yeah, just thought about that.
that should solve your issue
Alright, I'll try putting it a 1-tick runTaskLater(). Hopefully that should be enough.
Also, it looks so much neater if you just do for instance if(!(inv.getItemInOffHand.isSimilar(AuroraItems.hatchet(1)) || inv.getItemInMainHand().isSimilar(AuroraItems.hatchet(1))){ return; } then do else if else if.. return. You'll probably save even more lines that way as well.
I tried to edit the craftbukkit code to add a way to change the player sample inside the ServerListPingEvent without using packets, but I need to edit the file PacketStatusListener but this causes a conflict with the spigot patch "0045-Configurable-Ping-Sample-Size" and i get the error in the image. I tried to manually modify the patch files but i get an error that says "Did you manually modified the patch?". Also i want to compile only craftbukkit and not spigot, is there a way to skip this phase. sorry if this was hard to follow
Also, you use player.getUniqueId() various times, make a variable.
Yep, I've done that in some other events. Usually what I try to do is avoid more complex stuff like that and get something working, and then I condense it down much more.
here is the problematic patch file
When you make your code cleaner, bugs/errors are so much easier to spot.
I've had way too many instances occur where I've done something like that and the code ends up not working and I blame it on the stuff itself. π
Hi all, I asked a question here about 30 mins ago and am a bit stuck with a similar problem.
I'm trying to find a way to get the Player, and an ArmorStand that a Player spawns when they place down an Armor Stand.
BlockPlaceEvent only runs for placing ArmorStands under very specific circumstances, such as placing it on grass where the grass is replaced with an Armor Stand.
EntitySpawnEvent does not have a way to access the Player,
which leaves PlayerInteractEvent. My plugin is for spawning NPC players, and I want to be able to get the direction that the armor stand is facing when the Player places it down(So I can spawn the Player facing that direction). Is there a way I can get this in the PlayerInteractEvent?
You could get the player, grab their location, and then get their yaw. You can use their yaw and invert it to determine the direction. I forget the exact specifics but I've done something similar before.
you would need to listen to EntitySpawnEvent and PlayerInteractEvent
It faces the player directly right? So you can just reverse the yaw?
I've used the direction as one example, but Ideally I'd like to get the entity too; but that's a great way to do the direction
Well, realistically, a yaw of 0 would reverse to a yaw of 180/-180.
That would work for a 90/-90 degree inversion, but that's about it.
What you can do is get their direction as a vector, multiply the vector by -1, and then do a Math.toDegrees() of the x value of the vector and use that as a yaw I think.
Would it be easier if you were to convert them to radians, work it out then reverse back?
I might be chatting complete shit, haven't slept in a while lmao
I should note, I don't want this to work for all Armor Stands, only for Armor Stands that have been summoned in via a command, which I've specified by them containing a custom data key with PersistentDataContainer. This means that when the Player spawns the ArmorStand, I need access to the item in their hand.
I am almost certain this exists but I am probably searching for the wrong things - Is there a method that I can use to trigger a bonemeal use event at a certain location?
By the looks of it as you said @pastel basin , the solution is to listen for both EntitySpawnEvent and PlayerInteractEvent, but how I might I go about sharing information between these two events?
You can store the information in the Listener class.
Create the armour stand entity, spawn it then alter it? Seeing as you'll still have access to the entity no?
^
Removing the need for listening to the spawn event?
cancel the playerinteractevent and spawn the armor stand yourself
if you only want to get it if it's spawned via a command you don't need to listen for anything?
You just need your command executor?
Just gimmie 1 sec...
if you only want to get it if it's spawned via a command you don't need to listen for anything?
in that case entityspawnevent would be necessary
Why? Seeing as he's creating the entity, spawning, then altering, he can do it all without listening for the event?
but you said you want to check when players use armor stand item, right?
I should note, I don't want this to work for all Armor Stands, only for Armor Stands that have been summoned in via a command, which I've specified by them containing a custom data key with PersistentDataContainer. This means that when the Player spawns the ArmorStand, I need access to the item in their hand.
@manic raptor
This contradicts
Hi all, I asked a question here about 30 mins ago and am a bit stuck with a similar problem.
I'm trying to find a way to get the Player, and an ArmorStand that a Player spawns when they place down an Armor Stand.
@manic raptor
Why? Seeing as he's creating the entity, spawning, then altering, he can do it all without listening for the event?
if you want to check for when an armor stand is spawn by command or any other way, even by another plugin you would need entityspawnevent
Pretty sure he's spawning the entity and then trying to get said entity
if you have your own command just do it all yourself
Not trying to get an entity spawned somewhere else
spawn the entity and get it, pretty straight foward
Let me clarify it all:
I've got the plugin working by spawning via a command. eg. /npc spawn <name> <x> <y> <z> <direction>
This all works well ^
I'm now trying to add a more "user-friendly" way to spawn npcs in, in bulk.
To accomplish this, typing /npc armorstand <name> will give you a special ArmorStand, that has a custom key, and the value is the string name (Using PersistentDataContainer and NamespacedKey).
I've done it this way so that regular armorstands can still be used without creating npcs.
I want it so that:
When you place down an ArmorStand only when using an ArmorStand given with the command, it spawns an npc that faces the same direction that the spawned in armorstand would have.
The problem with this, is that the special custom key is stored in the Item, in which you would need access to the Player's item in hand.
You'd be better off giving it an identifier, listening for the interact event, seeing if it's that item, if it is run the command you've already created as the player
Nothing fancy, just give it a custom lore, on interact, check if it has that lore, if it does then force the player to run the command
But how would I go about getting the Armorstands direction from just the PlayerInteractEvent?
In PlayerInteractEvent check if the player used the item with your persistent data and cancel the usage of this item, then spawn the armor stand in the clicked block and get direction from there
Spawn it, then get the body pose
that'll give you an EulerAngle
which is the x,y,z
Thanks for the help by the way guys :)
When you say spawn it, is this still in the PlayerInteractEvent? Wouldn't I need to create a new ArmorStand, (where does the direction come from)?
Wait, what is an NPC?
Yeah, what I'd do is move the spawning to a new method, call that method on command and on interact, it'll be more manageable
Set it to where the player is looking?
Yeah, I'd just get the player's yaw and use that
Presume you're thinking of having a way to manipulate the stand using commands?
Basically what I wanted to do, was by getting the ArmorStand entity, I could grab the direction and then convert it into a yaw to pass into my function.
The ArmorStand itself will actually be deleted, or the spawning of it will be cancelled. I've got an NPC class to handle the EntityPlayer.
So an NPC is not an ArmorStand but an EntityPlayer?
Using the ArmorStand as an item, just makes it more user-friendly to spawn them in.
That makes things a lot simpler, you don't even need to use an ArmorStand entity, then.
Location newLoc = armorStand.getLocation()
newLoc.setDirection(target.getLocation().getDirection());
armorStand.teleport(newLoc);
@ivory musk yeah, that's right.
target being the player
Or just add 180 to the players yaw and call it a day
lmao
@frigid ember might actually do that LOL
But would a 360 degree yaw work?
If your yaw was 180, you'd want a yaw of 0 to match with what the game expects. I'm not sure if Bukkit actually looks at 360 as 0.
I'll just cap it back round by subtracting 360 if it goes over 180
or adding 360 if it goes under -180
What you can do is this.
float newYaw = (player.getLocation().getYaw() + 180) % 360;
I think.
Actually tell a lie, they spawn it on the players location
which is the other option, just spawn it on the player facing the same direction as the player
would save all the hassle
@manic raptor
protip, Location.normalizeYaw
Minecraft is otherwise all over the place with directions
Didn't even realise that was a thing, that's really handy (not done much with NPCs)
Huh, didn't know Spigot had a utility for it. Sounds really handy.
@manic raptor there you go, add 180 then normalize it
@frigid ember
Cheers for the help! π
That's on @fleet crane didn't even know that was an option until he mentioned it π
ikr, I was going to make a similar implemention later on today..
are you bot?
Beep bop bzzzt
ok i mean is portforwarding one time process?
Usually, if your ip doesnβt change
i mean after port forwarding and connecting the minecraft server do i need to have my lap connected to the router always?
to connect to my MC server?
If thatβs where your server is hosted
or can i use mobile data instead after connecting?
oh so i always need the router connected to the server hot?
i mean host...
You generally donβt need to port forward if you have an external host
Port forward is only if you host your server at home
yeah im hosting at home so
i dont have a router...my friend have one so i was wondering if i can port forward with it and then using MC server from my home..π
Uh your server needs to be connected to the router
you need to have a static ip to host a server, you have to check if the connection has nat
you guys know jiofi?
i googled it, is it the mobile router?
i don't know if you can host a minecraft server with the mobile connection tho
no its not mobile connection...it act as router and have port forwrding
port forward=connect MC server right?
I know but is not as easy as that, you need port forwarding, but you also need a static ip which you get by buying a business connection
usualy ips are natted so there is a public ip and is shared between many users
it's like if you have a router at home, many people can connect to it and everyone has a local ip but they all share a public ip
@fleet crane when compiling craftbukkit by using buildtools is there a way to skip the part where it applies the Spigot patches
so i can use my domains instead of ip...
and share domain name..
there are free domain hosts
i think you can do that.
Is there any way to clone inventories?
I would like to cache one of my inventories and then clone it each time i wanna use
Creating a new one each time will cause a lot of lagh
lag*
Convert inventory to class. Whenever use it just convert class to inventory.
You can also use GSON api for json.
Wdym?
Why would I need JSON?
Im just gonna cache it in a hashmap or something
hard coded
This is not a public plugin
Okay just make a class for inventory datas and save in hashmap
Yes
Doesn't that still create an inventory or does that give a new instance without creating it with bukkit
You make a class that contains items. I think it'd be better use like that
I don't really understand serialization well I just use resources I find lol
Using Bukkit.createInventory() will cause lag
How?
players can probably create up to 100 inventories a minute with what im doing
Ok
Ill try it tomorrow its 3:52 am lol i probably should not be coding
public static Inventory fromBase64(String data) throws IOException {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
Inventory inventory = Bukkit.getServer().createInventory(null, dataInput.readInt());
// Read the serialized inventory
for (int i = 0; i < inventory.getSize(); i++) {
inventory.setItem(i, (ItemStack) dataInput.readObject());
}
dataInput.close();
return inventory;
} catch (ClassNotFoundException e) {
throw new IOException("Unable to decode class type.", e);
}
}
it still creates the inventory
idk how to bypass that lol
maybe make something like a connection pool with SQL but instead for inventories?
I meant to say like that;
private Map<Integer, ItemStack> items;
public InventoryManager(Player player) {
for (int slot = 0; slot<36; slot++) {
ItemStack item = player.getInventory().getItem(slot);
if (item == null || item.getType() == Material.AIR)
continue;
items.put(slot, item);
}
}
public Map<Integer, ItemStack> getItems() {
return items;
}
}```
Make a class like that for storing items and slot then save class in hashmap you created. Get whenever you want
You may make another method that calls class as a inventory.
is there a plugin which in tab and nametag the perfix? for luckperms
@chrome edge Iβm already doing that the issue is just creating the inventory lol
Iβve got all the items I use in the inventory cached
is there a plugin which in tab and nametag the perfix? for luckperms
Itβs just stupid because you canβt clone inventories so you are forced to use one instance, or create a new one
Idk Aaron
I am almost certain this exists but I am probably searching for the wrong things - Is there a method that I can use to essentially bonemeal a location?
@buoyant path How many inventory will you create? For each player?
Like I said before, it can be up to 100 a minute. Basically itβs a mini crates system that is like a roulette and gives the item in the middle after 8 seconds of rolling g
Rolling*
idk why you wouldn't pre-generate a random item list with the total items it'll cycle through and just move them along in one inventory as opposed to making loads?
They are pre generated
I've no idea about that. I thought after using inventory that created bukkit method is delete it self
The issue is because if I cache the inventory it will edit it on that same instance
Are you sure you're using inventory method correct?
Which I cannot fix unless thereβs a way to clone inventories
Yes
Iβll send some of my code
You shouldn't use get inventory method. Just create new one when player clicks the crystal
And update players inventory
when rolling
^
Hello ! I just did:
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
super.channelRead(ctx, msg);
if (!(msg instanceof PacketPlayInUseEntity)){
return;
}
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) msg;
}```
And I wanna get the entity which the player has clicked on. So the so-called entity is an entityPlayer that I've linked to a DataWatcher where I put the entity ID. So do you know to get the entity id via the packet ?
But even then I still think thatβs going to cause lag with the create inventory method, I was able to use 1% of my servers cpu by myself
Okay I take a look at it and there's no problem about. It's normal method which is every one using it
I'm not sure about it sorry
yours
Damn
Iβll see if I can find a cloneable inventories resource tomorrow
Doubt it exists but
Actually not. If you create a packet entity, its id never changes if server is not closed/reloaded
try to test it with debug messages
You mean that the private int a; is "final" ?
yes you cannot change entity ids that is created
you should try by yourself. you can understand easly
Ty i'll try it
can someone send me a link where i can learn how to serialize itemstack[]?
Euhm
i got told to try serialize instead of saving the itemstack[] to yaml
but that looks like itemstack in yaml
ah you want to base64 it?
i think so, im working with saving chests to yaml and loading them
cause i had some weird funcation that worked but i should go with serialize
just found this
is 5y/o
You can always use the ItemStack.serialize()????? Creates a map representation of it
euhm but i have a inventory.getContents
so thats a itemstack[]
ItemStack[] chestinv = chestblock.getInventory().getContents();
What would be the best way of having the server only run in a certain 3-hour timeframe every day? I'm running a daily event and wouldn't like players to be able to interact with the world outside of that time slot, whether that means closing the server or restricting player interaction or something, whatever would be the easiest. Thanks
If you literally don't want them joining then a timed whitelist would be your best option
you could start and stop the server but eh
Does anyone know how you can make a NonClickable item in ShopGui+?
thanks sable
Does that do what you're after Rik?
Jowsey, you could try timed actions and close the server and open it
i think so
cause i do have 2 methods that worked already but its weird cause only 1 of them works depending on if you saved the chest before a restart or after a restart
ItemStack[] contents = (ItemStack[])(chestloot.get("loot." + args[0].toString() ));
and
ItemStack[] contents = chestloot.getList("loot." + args[0].toString()).toArray(new ItemStack[0]);
if i save a chest and load it than method 2 works but if i save a chest, restart server then only method 1 works
so then people told me do look into serialize
//The task which you want to execute
private static class MyTimeTask extends TimerTask
{
public void run()
{
//write your code here
}
}
public static void main(String[] args) {
//the Date and time at which you want to execute
DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = dateFormatter .parse("2012-07-06 13:05:45");
//Now create the time and schedule it
Timer timer = new Timer();
//Use this if you want to execute it once
timer.schedule(new MyTimeTask(), date);
//Use this if you want to execute it repeatedly
//int period = 10000;//10secs
//timer.schedule(new MyTimeTask(), date, period );
}
@ocean anvil presuming you're developing a plugin for the server, this is the best way to run specified code at a certain time, have it just toggle a Boolean, then when they join, check if it's true or false and kick them respectively
@narrow crypt You've to serialize chest again. You may want to try how it works. If so, try to save Player then quit/rejoin game the player data will not working 'cause the old data is not new players
Oh damn, thanks man, will take a look into that!
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
super.channelRead(ctx, msg);
if (!(msg instanceof PacketPlayInUseEntity)){
return;
}
if (!manager.IsDev(player)){
player.sendMessage("mode dev reuquier");
return;
}
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) msg;
Class<? extends PacketPlayInUseEntity> c = packet.getClass();
Field[] fields = c.getDeclaredFields();
fields[0].setAccessible(true);
// the stream just returns the NPC that I created
for (EntityPlayer entity : manager.getAllNPC().stream().map(StaticNPC::getNpcAssocied).collect(Collectors.toList()))
if (entity.getUniqueID() == fields[0].get(packet)){
// my code
}
}```
@chrome edge Sounds good ?
Will the plugin support multi version?
you talk to me?
Yes
if (!p.a().name().equals("ATTACK"))
return;
if (p.a(((CraftWorld) player.getWorld()).getHandle()) == null)
return;
if (!p.a(((CraftWorld) player.getWorld()).getHandle()).isAlive())
return;
Entity entity = p.a(((CraftWorld) player.getWorld()).getHandle()).getBukkitEntity();```
i imported the code you sent me @frigid ember but what shoudl Itemutils be?
I think it's explaining everything
???
mmm mm mmm
@narrow crypt what does need you?
?paste
I don't think versions are a problem.
my ide doesnt know what to do with net.minecraft.server.v1_7_R4 and ItemUtils
like no import functions
https://pastebin.com/rc3Pgq24 @narrow crypt
@lament wolf I meant to say I sent you the code you can figure out how it works.
You can get entity like that with packets
Use that method
What's this line for? Is it the player or the entity affected?
Entity entity = p.a(((CraftWorld) player.getWorld()).getHandle()).getBukkitEntity();
I had already marked that line before, but it throw me an NPE.
It should works. May I see your codes?
Well for the moment my code is what I send a little higher
If you just need entity ID, you can get it with fields.
Integer mobID = Integer.parseInt(Reader.getValue(packet, "a").toString());
try {
Field field = obj.getClass().getDeclaredField(name);
field.setAccessible(true);
return field.get(obj);
} catch (Exception var3) {
return null;
}
}```
When entity spawns, save its id
@frigid ember thats again just Itemstack and not Itemstack[]
or do i loop that function
I meant to say entity that you created as a NPC.
@narrow crypt I'd loop it, serialize each item, then rebuild it with a loop when it's needed
if (mobID == npc.getId())
ah okay
Ok ok
should i save it as a stringlist then(to yaml)?
where every string is a base64 serialized itemstack?
That'd be the easiest method @narrow crypt
You could build it to a single string and take it back out of that using the split method, but a string list would work just as well
does it also save empty slots?
Not sure how they're represented in an ItemStack[] tbh
as null
should do then
If not then you could loop through, replace any null ItemStacks with something the player will never have, like a barrier block and then reverse that when you de-serialize it again
good idea
@chrome edge That's it ?
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) msg;
Class<? extends PacketPlayInUseEntity> c = packet.getClass();
Integer mobID = Integer.parseInt(getValue(packet, "a").toString());
for (StaticNPC NPC : manager.getAllNPC()){
if (NPC.getNpcAssocied().getId() == mobID){
// code
}
}```
NPC.getNpcAssocied() returns all NPC that I created
Yes like that. Try to use it
which line?
NMS doesn't give me line. But I think I found the cause
(for..)
I guess I can solve it
Okay, good luck. I suggest you to make debug system. If you get any error, you can send datas to console or player for understand which one is null etc.
Or use a proper debugger with breakpoints...
@frigid ember https://paste.gg/p/anonymous/4bf676490b804fab80968b14e1a76abe
getting this error
when loading
the saving works perfectly
it returns null as itemstack :(
maybe your version doesn't support the method;
whut
It's NMS, it may have changed, but should show a fault in the IDE
Plus, those methods use reflection so
any idea what i should do?
But yeah, there server doesn't doesn't seem to support net.minecraft.server.v1_15_R1.ItemStack.createStack
Is the plugin built around spigot or paper?
Give it a go on spigot
hmmmm
CTRL+Click on ItemStack class
and search "create"
Maybe you can find method
that has changed
itemstack class?
net.minecraft.server.v1_15_R1.ItemStack
