#help-development
1 messages · Page 1498 of 1
They already say. "Kept on death!"
LORE
public static void encryptItem(ItemStack i, String message) {
ItemMeta im = i.getItemMeta();
List<String> lore = new ArrayList<String>(im.getLore());
String crypt = encryptString(message);
lore.add(0, crypt);
im.setLore(lore);
i.setItemMeta(im);
}
public static String encryptString(String message) {
String crypt = "";
for (char c : message.toCharArray()) {
crypt += ChatColor.COLOR_CHAR + Character.toString(c);
}
return crypt;
}
public static String decryptItem(ItemStack i) {
if (i != null) {
if (i.hasItemMeta()) {
List<String> lore = i.getItemMeta().getLore();
if (lore != null) {
if (lore.size() > 0) {
StringBuilder sb = new StringBuilder();
for (char c : lore.get(0).toCharArray()) {
if (c != ChatColor.COLOR_CHAR) {
sb.append(c);
}
}
return sb.toString();
}
}
}
}
return null;
}
Could probably use that
//setting
ItemStack stack = ...;
net.minecraft.server.1_8_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
tag.setInt("keepOnDeath",1);
nmsStack.setTag(tag);
stack = CraftItemStack.asBukkitCopy(nmsStack);
//checking
boolean keepOnDeath;
ItemStack stack = ...;
net.minecraft.server.1_8_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
NBTTagCompound tag = nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound();
keepOnDeath = tag.getInt("keepOnDeath") == 1;
if (keepOnDeath) {
//todo
}
With lore, couldn't I just do something like if lore == "this" run other stuff?
yeah im pretty sure you can
you'd need to manually loop and see if each string might be equal to your string
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Inventory inv = player.getInventory();
event.getDrops().clear();
for (int i = 0; i < inv.getSize(); i++) {
ItemStack invItem = inv.getItem(i);
if(invItem != null) {
ItemMeta metaofItem = invItem.getItemMeta();
List<String> lore = metaofItem.getLore();
if (lore != null && metaofItem .getLore().contains("KeptOnDeath")) {
player.sendMessage(ChatColor.PURPLE+"Found Soulbound item!");
player.getInventory().addItem(invItem.clone());
return;
}
}
}
}
try that
Guess what isn't in 1.8 this time
getitemmeta?
getLore
PvP and runs better overall
theres plugins that convert it to old PVP
ive used them in the past
and pretty decent
Eh
my plugin is PVP orientated as well
i guess the performance is debatable tho.. there is mods for that however
oh forgot a line
in yml is it True or true
the yaml language
in python its True in java its true just wondering which one yaml is
i think lowercase should work fine
thx
i dont mess with yml too much
What?
What do you mess with
if (lore != null
Do you use json?
nope, i just havent done much work involving yml/json
although i do understand json a little more than yml probably
Me too I think json is just better but not as newuser friendly as yml
Ehhhh - it’s better for storage rather than configs imo
take a look at the class implementation
you know what super does obviously right
super isnt a plugin concept...
it was previously super(EntityType.Zombie, loc)
and not erroring
in 1.16
then in 1.17 it decided that the constructor is undefined
research what super does
then
it calls the parent constructor
so whatever class you are extending
in this case Entity
alright
@fierce barn doesn't work
no error?
Here's an example of the pants btw
Hey Guys! I have (hopefully) a small question: does anyone know if net.minecraft.server.v1_16_5.EntityPlayer has been renamed in 1.17? I am updating my plugin to 1.17. This is the error that i am getting: java.lang.ClassNotFoundException: net.minecraft.server.v1_17_R1.EntityPlayer
Yes
they completely changed the package names
oh noes
just import them normally via your IDE
now i have to filter if the server is running > or < 1.16.5... nice
lets print out the list
thanks guys!
and see if theres anything there
do you use reflection
:/
Not that i know. I made this plugin with a friend, he was the geek that put most things in the plugin.
It does get the packets from a class called "reflect", which changes the server version in the package names
what are you calling getWorld on
ic
previously what it was in 1.16
1.17 made the constructors throw a fit
just trying to backtrack and go from there
what is the error?
ok i will say this again
go into the Entity class
and find the constructors
Eclipse gotta have some "Open Declaration"
or something like that
@fierce barn this is good, right?
List<String> lore = metaofItem.getLore();
System.out.println(lore);
Yes
If so, it prints nothing
@shadow gazelle
if (lore != null) {
for (String getLore: lore) {
player.sendMessage(lore);
}
}
damn what are all the plugins using reflection to access nms gonna do!?
it just changed
nms changes very frequently anyways
you have to adapt to the changes
yeah....
@fierce barn no idea what I did wrong here, but it won't build
public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity();
Inventory inv = player.getInventory();
//event.getDrops().clear();
for (int i = 0; i < inv.getSize(); i++) {
ItemStack invItem = inv.getItem(i);
if(invItem != null) {
ItemMeta metaofItem = invItem.getItemMeta();
List<String> lore = metaofItem.getLore();
if (lore != null) {
for (String getLore: lore) {
player.sendMessage(lore);
}
Closing brackets are below that
For those using NMS (like myself) i came across an interesting change that I didnt see documented today. When you need to supply an enum to a method/constructor signature, it previously was OK to use yourEnumConstant.getClass(), this no longer works, you need to get the class of the actual enum, rather than the class of a constant in that enum 😄
just a PSA I Suppose
Event handler?
oh yeah
What
def need event handler
@EventHandler
above the event
then you need to register the event
Did you put the eventhandler annotation
Oh
in your main do
@EventHandler
inside your main
private static Plugin plugin;
getServer().getPluginManager().registerEvents(new ClassNameWithDeath(), this);
inside your class with the death event
public Main plugin = Main.getPlugin(Main.class);
oh god
so much = nearly everything
^
first plugin 🤷♀️
Use objects
also never had prior java experience
lmao
at least he did something
lmao
Lol
yeah, no prior java experience
¯\_(ツ)_/¯
did something > did nothing
only have actually like
then learn java first
no he just have to learn java conventions
no he has to learn java
look at that static
I though static abuse belongs to java conventions?
...
your screenshots are the examples
its a mistake
instead of static do what?
its not a convention issue
The term abuse should already ring bells
you should never overuse static
^^
How is that convention
encapsulate
Lol
so instead of
private static Plugin plugin;
do
private Plugin plugin;
?
In that case you need to use dependency injection
there are some things that can be static
and other things cannot
in this case, if you dont use static (which is recommended in general for plugin instances)
you have to use dependency injection
whats the drawbacks of abusing static then?
goodluck with that Fatul
Good luck
thanks
thanks lol.
one of the drawbacks is NPE problem
??
..
gonna die real now
the only 2 statics i have in my entire code just about are these 2
instance variable are more susceptible for NPEs than statics
The main reason is due to how you should really only be using static for tasks that are for caching
and immutable
would that still be considered abuse?
and certain cases
we consider abuse if any is used inapropriately
in this context, it is used inappropriately
f.e. constants are a good use of statics
^
in your case DI, just like pulse said, would be the right way
so something like this
private Plugin plugin;
public ListenerClass(JavaPlugin plugin) {
this.plugin = plugin;
}
// in your onEnable
...registerEvents(new ListenerClass(this), this);
^
i'll definitely work into going that route then
once i fix my prior problem
may reply to you later on lol
not that i know of
you can track the command though
?
post made by HunteR(2nd one)
@fierce barn not sure I did it right, but here's the code from the class with the death listener
https://paste.md-5.net/feqabikove.java
im trying to only register a command if something is true in the config
player.sendMessage(lore); huh
getLore instead of lore ^^^
would this be a good use
i couldnt tell you per sey about the events elephant with that usage
Also, is this right for enabling it?
getServer().getPluginManager().registerEvents(new death(), this);
if death() is the name of the class then yeah
It is
that would also be the reason why nothing was printing beforehand btw
since the event wasnt registered
i couldnt tell you how doing it that way
if you want it quick and dirty this will work probably in 1.8
spoiled it to not burn anyones eyes
in your death class:
that destroys the whole point...
you make the static instance to get from the plugin class
in that case, the static Plugin isnt necessary. Then again
brother,
this is not a recommended approach
neither of us are at that level, and you'll need to guide us a little more than you probably want to in that regard
but hes just trying to get one thing to work, if it works, it'll work.
pulse really trying to tell the spigot community what the recommended way is smh
yeah we're doomed
somehow i still have hope
but then most of us are burned out
sounds like a mental problem
🥲 true
nice
i didnt realize you werent registering the event from earlier
may of saved a lot of time
Sorry lol
all good
did targetSelector and goalSelector completely disappear in 1.17?
basically the last crux of my problem, i hope
Because it's the same light gray, I would assume I need to include the §7 in the contains?
does 1.8 haveimport net.md_5.bungee.api.ChatColor;?
or are you talking about the color of the text in the lore?
Second thing
i dont think you need to include the color
when it printed out the list did it include "kept on death!"?
If you are comparing a String with colours in you can just use ChatColor.stripColor();
@fierce barn this is an interesting new issue
I think it has something to do with the position of the item deleting thing, but the pants all got deleted
show new code
may need to have it wait for a small second
uh
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
public void run(){
}
}, 20*10);
its highly unlikely that 1.8 will be compatible with this
Hey, if there's any spigot devs who wouldn't mind helping me with a small coding problem, please let me know if u can help, thx
just ask your question in here 👍
My Nitro is gone :sad:
I need the codeblock for changing text in chat to other characters, if that's not too complicated
3 months Nitro from EG for free time
And remove return?
yeah.
i doubt it'll work
delayedtask/etc has changed naming convention through quite a few versions
Are you using that to give them the items back when they respawn?
^
In the PluginMessageEvent@Bungeecord, the getSender() is what? A "Server" Object or ProxiedPlayer?
also need to do @Override over run() too. forgot.
Works
create a HashMap<UUID, List<ItemStack>> and save all the items into the list when they die, then listen to the PlayerRespawnEvent and if the hashmap contains their UUID as a key, loop through the list and give them their items back.
like does it work completely?
uh
But that should be simple enough to fix
KeepInventory
lemon
They only want some items to be given back right?
Only the ones with the right lore
ok
And it works, I just get spammed in chat
do this to fix the spam
So keepinventory wont work then :/ but use what i said
can someone answer my question? if ya guys know?
It spammed because I have 35 in my inv, but
It still sends one message for every item saved
jadss pretty sure you can see that in the javadocs
ty Dave
nop
bruh
it just says Connection object
brb, gotta eat dinner
So click on it
omg...
jadss
did you read my question?
I know about it ok?
I'm not oblivious
I even asked "A "server" object or a ProxiedPlayer?"
All Known Subinterfaces:
ConnectedPlayer, PendingConnection, ProxiedPlayer, Server
new BukkitRunnable() {
int count = 0;
public void run() {
//code
}
count++;
if (count == 1) {
this.cancel();
}
}.runTaskTimer(plugin, 0, 20);
This does not explain anything.
@shadow gazelle maybe.
It does
woops. k
I just want to know what I am receiving here..
A Conneciton
it can be different
"A Conneciton"
ok I had to do that
I couldn't look at it without saying a word sorry.
It wouldn't return Connection if it only returns one of the subinterfaces of Connection
yeah but which one...
Different
smh
it can vary from dispatch to dispatch
write your code to be able to handle all of them
In case you need lets say a ProxiedPlayer then safely cast it to that
I am guessing the server also needs java 16 to run 1.17?
I'm sorry that I'm persistent....
Its not that we have told you the answer
correct
I guess.
imagine if there was a specific value each time.
it would be worth, less, to check if it is a connected player, proxied player.
etc.
hmm now how to get my docker system to have 16 work lol
there is. ConnectedPlayer, PendingConnection, ProxiedPlayer, or Server
Same story goes for an event like EntityDamageEvent, the instance method getEntity() return type is Entity because it can be any subtype of Entity if that makes sense.
so basically just write a check to see if it's the subinterface you want, and if it is then act on it and if it isnt then dont
openjdk for the server it is 🙂
✅
oo
well that doesnt work lol
what u tryna do
setup my docker image to support java 16
it seems with using openjdk it can not find the file for the deb http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
and kill the image create
and with i change it to java 16 it cant find java in the build hmmmm
I am very inexperienced with docker so wont be able to help you out sry
🥲
I hate java, why did they have to change to charge for server usage.
🥴
how would I go about setting an ender crystal beam to a player loc with updates
without lag
@shut field is that a particle or what would u categorize it as
Thanks but I end up doing something different
Hmm crota I mean the least laggy thing would be to use the scheduler
it would allow u to change the location 20 times per second at most
so once per tick, that's good with me
Yeah
like this?
no
😢
more like
Bukkit.getScheduler().runTaskTimer(JavaPlugin.getPlugin(Style.class), () -> {
enderCryst.setBeamTarget(damager.getLocation());
},1L,1L);
without the while loop
what does the second 1L do
ok thx
How do i unregister a command
probably PluginCommand#unregister
hmm... the docker manifest doen't see java:16 as vaild
How would i get discord#enabled yaml discord: enabled: true message: - Hi - This is the discord - here
wdym exactly?
like how would i get the value of discord enabled from config
which config
config.yml
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
if i see it right:
getConfig().getBoolean("discord.enabled");
i recommend reading
i first thought he uses jda or smt, but it was just such a simple question lol. i thought too complicated
Lmao
?
Does it return null if its not found?
thx
else if (args[0].equalsIgnoreCase("reload")){
Socials.getInstance().reloadConfig();
boolean dEnabled = config.getBoolean("discord.enabled");
if(dEnabled){
Socials.getInstance().getCommand("discord").setExecutor(new DiscordCmd());
} else{
Socials.getInstance().getCommand("discord").unregister();
}```How do i un register a command
No
Where should issues regarding the Mojang/Spigot mappings be directed to? I've found some things that don't map correctly
?jira
Hey, I following the tutorial for a plugin- Do I need to name the YAML file something specific or is any name fine?
thanks in advance
plugin.yml
ty
Does anyone know I can you can apply to help with spigot development?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
see readme.md / contributing.md in the repos too
do you need optifine to have textures of entities based of their names
like two mobs of the same type with different textures because they have specific names

So now with this new 1.17 situation going on, if someone's using NMS, does that mean they have to rename every single class/method/field that they're using thru reflection?
For example PlayerConnection was moved to net.minecraft.server.network
I was previously using net.minecraft.server.VERSION.PlayerConnection I guess that counts as mojang mappings
oh yes packages moved too
With the new system does that at least mean that these are not going to be renamed or moved in the future? I mean the version barrier in the package is gone, but they're not going to rename these fields on future updates, will they?
Is there any way to access the child object in https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityBreedEvent.html ? I cant see any getter/setter classes
ty, wasnt sure if it'd default to that
would be nice to have a way to get to those classes at our own risk
? you can ?
Oh, well right sigh Anyways thanks for the help!
We can, but it's really messy, like, package names are changed between versions so, we would need to use Reflection
I mean, accessing the low level CraftBukkit/NMS packages without the constant version realocation
Wouldn't that mean you're basically saying "add an official Bukkit API for it"
What'd you suggest?
I'm not sure what's the reason behind the constant version realocation, but I think it might be omited
Well, like md_5 mentioned above, it's up to Mojang you gotta ask them. Spigot can't do anything about that other than to add an official API for it.
So, the org.bukkit.craftbukkit packages are realocated by mojang?
they're not api and especially in the cases of mojang classes can change wildly between versions
plus you should be adding api rather than using nms
Did the way MapCanvas draws images get changed? Because im ending up with this werid transparency stuff. Is there new meta data I have to set to the map to make it work correctly?
how would i create custom potion effects (dont mind creating them) but put a 45 min duration on them and have it only tick down while on the server?
in more terms of java rather than spigot
@undone light that kind of looks like a client render bug
though I can't say for sure it isnt a spigot issue
but it definitely looks more like a render issue
try making a similar thing with normal maps in single player
Normal maps render fine. The custom ones render werid even if its one map, the normal are fine in frames and on there own
are you relying on spigot to match colours? maybe some of the new colours have weird transparency
Yes, im just using the MapCanvas.drawImage function. I attempted to figure out how to do it myself but was left kinda lost
Do you mean you have a UUID as the key and the Pet as teh value in a Map and you want to look up using either?
then use the UUID. Thats what its for
then give it a UUID
The same as any other field in any class
the Players UUID is just a field
Java getters
I think you need to store the object on a List or Map, so you can easily access them whenever you want.
So I have 2 list, and I need somehow to make List 2 the same order as the List 1, how can I do that?
List 1: List 2:
one three
two two
three one
If you want them both sorted you can simply use teh sort method of Collections, or change them to TreeList and it will auto sort
Not sort like a number, basically I have like a list of items that will be shown on the GUI.
And after restart, I want to keep the list order, not resetting back to the configured order.
a LInkedHashSet retains insertion order
No no, the List hold different object.
One is a TypeItem object and one is a String.
Then you are making no sense
It's so hard to explain and I'm stuck here.
Is one a key and the other a value?
Is that a question for me?
We are trying to figrure out your question
If you're trying to do a key:value thing, use hashmap
Otherwise uh, I'm not a mind reader
Yes, sorry, I'm trying to think what is the exact question
well I mean you could just iterate over the array to save it to a file o.O
Well I covered sorting, ordering and insertion order. It wasn't any of those.
So in my GUI, it will show the first 3 items on the List.
And after the server stop, I will have a list of String.
And on the server start, I will load all items on the config.
And I store it to a List, and of course the order will be the same as the order on the config.
And I want somehow to make the order the same as the List that I got from the server stop.
so just save the list into yaml when server is shutting down by iterating your array or hashmap, and then on server start just re-create the list or hashmap using the data you saved 🙂
If its just a list of strings you simply push it to your config
I've done that part.
Here's how I load my items. https://paste.helpch.at/bevuyacoye.java
if you pushed it as a list of string, load it the same, config.getList
This is what I received on server stop
normalItems:
- diamondSword
- tnt
- diamondBoots
- diamondHelmet
- diamondLeggings
- hoppers
- diamondChestplate
- glass
omg, so hard to explain
You want it exactly the same as it is in the config, right?
unless their issue is they are having a problem saving the correct data o.O
So I have an object called TypeItem and it holds a String which is the config key
items:
tnt: <--- this one
material:
...
It's more complicated than that.
I've done the config part.
They need to loop through normalitems as well as items
I think the issue is they are not saving the data correctly or the expected data isn't being saved as it should be
not that too
Or they're not loading it properly
they load properly too
no need to loop items, just use the list you have from normalItems and pull teh key from items
ok I am at a loss at what the issue is then o.o
How about showing us the expected output and what you get
Lets start again, what exactly is going wrong with your current code?
That might actually help more
I have a feeling I get whats happening
items not going into the correct slots?
You are loading the list of items and displaying the first 3, but you are moving/rotating them somehow. So you save them as a list of the new order. But you don't know how to use that order to display the next time.
Okay, here's the expected output, the TypeItem order needs to be
configKey3
configKey1
configKey2
``` but my result is
```yaml
configKey1
configKey2
configKey3
``` and I'm having a problem with filtering which items should be put onto the List first.
I want the rotated item to be on the display even after server restart.
do as frostalf said, ignore your string list and rotate yorur original item list
you don't need to worry how they are saved or loaded really
since you are rotating them around anyways
alwasy display from the item list so it always matches
however it gets saved is how it will be loaded for next time
That's not like that, I rotate the items using Collections.shuffle()
then save it after shuffling
I already do that, but the thing is I only save the configKey.
Not the whole TypeItem.
then don't. Save teh full items
if you want to use a string list then you use that for displaying too
you could just serialize the items
Well, If I do that the value won't change, like If I modify the lore, or displayname.
ItemStacks are serializable
It's not ItemStack tho
you can just push your whole item list and it will save/load
if you are putting them into a GUI you have to be making ItemStacks
I need more than just ItemStack, I'm trying to create a Rotating Shop basically
every item you put in yoru "Shop" is an ItemStack
Why can't it find it?
because its not a full release yet
you need to run BuildTools
for Spigot you'd have to run BT anyway
I did java -jar BuildTools.jar --rev 1.17 --compile craftbukkit and java -jar BuildTools.jar --rev 1.17
Yes, correct, but ItemStack has nothing to do with my current problem tho.
You didn't use --remapped
Thanks!
Also you don't need craftbukkit
Oh
@eternal oxide
List<TypeItem> rotatingItems = // load from config
List<String> rotatingItemsOrder = // get the list from config
sysout("Rotating items order");
for(TypeItem item : rotatingItems){
sysout(item.getConfigKey());
// Result:
// configKey1
// configKey2
// configKey3
// configKey4
// configKey5
}
sysout("Last rotating items order before server restart");
for(String configKey : rotatingItemsOrder){
sysout(configKey);
// Result:
// configKey3
// configKey1
// configKey2
// configKey5
// configKey4
}
// I want to make rotating items order the same as last rotating items order
Store your TypeItems in a Map<String, TypeItem> then you can grab them as you need based upon your configKey
Alright, I'll try.
https://www.youtube.com/watch?v=gsvFOJWECGE&t=575s in this tutorial, he says that you can use that to detect when a player clicks on an entity, but you can't. it's a local entity (it doesn't trigger any events). does anyone have any good tutorials on player npcs that DO trigger events?
ive been trying to research for hours but my brain isnt working anymore.
Are you trying to detect when Player interact with NPC?
wooo nice job solving that @eternal oxide 🙂
lol
yep @summer scroll 😄
PlayerInteractAtEntityEvent?
ill try
brb
just changed my listener to that
it doesn't get called
because the player is just a packet sent to my client, it doesn't actually exist server-side
?jd
can someone tell me what would happen if i turn off verbose in confiig
you get less junk messages
thanks
no world generation spam
oh that was what i was finding
my braincells are injured
can someone help me with skript crashing my server sorry for posting here coz noone is available in #help-server
Hey there. I have a hard time thinking and deciding how to approach modifications on a players attribute.
At first I just changed the basevalue, but then found out about the modifiers, but these give me a headach, because I am not able to remove them properly.
I have the line to set it and to remove it right next to each other, so when it would work like expected. Nothing should happen:
// These values are normally generated or are from my list, but it would be to much to put everything in here so lets work with test values.
Attribute mappedAttribute = Attribute.GENERIC_MOVEMENT_SPEED
double evaluatedValue = 0.7d
player.getAttribute(mappedAttribute).addModifier(new AttributeModifier("rpg-plugin-mod", evaluatedValue - player.getAttribute(mappedAttribute).getBaseValue(), AttributeModifier.Operation.ADD_NUMBER ));
player.getAttribute(mappedAttribute).getModifiers().removeAll(player.getAttribute(mappedAttribute).getModifiers());
In the case above the movement speed increases everytime the method is called. Do you may know what I am doing wrong here?
?jd
is there a way to make it that just like how the config file generated in a directory in the plugins folder a readme will generate
Without much thinking I would say, that you could get the location of the config file by getConfig().getCurrentPath(); and then just create a new file like you do with plain java SE
ok thanks
right ok thanks
Hello, I will try to use nms in spigot 1.17 but when I compile my project, I have this error :
Error:(24, 9) java: cannot access net.minecraft.nbt.NBTTagCompound bad class file: /D:/Developpement/Apis/spigot/spigot-1.17.jar!/net/minecraft/nbt/NBTTagCompound.class class file has wrong version 60.0, should be 55.0 Please remove or make sure it appears in the correct subdirectory of the classpath.
I have jdk 1.16 when I compile my project and java 1.16 is installed in my computer (when I made the cmd java -version)
IN my project structure, in the section project JDK, It's "16 (java version "16.0.1").
I don't use maven
And target version?
Does intellij have that ?
Yes
where ?
Just below where you select the jdk
Oh sweet, never knew that 😅
I remove java 1.8 from my project, I have no error but I have an other error :
Error:java: invalid source release 13 with --enable-preview (preview language features are only supported for release 16)
In the Project Structure, section Project and "Project language level", the maximum I have is "13 (preview) - Switch expressions, text blocs"
Are you sure you selected the Java 16 jdk
yes
Hm
in Project SDK, it's 16 (java version "16.0.1") and when I compile, the console says that Information:javac 16.0.1 was used to compile java sources
Hello, Im using nms 1.17 and i get error syntax in nmsEntity.dead, but it no error in nms 1.16 so how i know name of variable nmsEntity.dead in nms 1.17?
It's not dead. 1.17 doesn't have mappings. How do you know then? Well you have to find it on your own. NMS is generally unsupported
Ah I choose X - Experimental features in Project language level and I have no error
Ah cool
ok
curious, is there a meta setting limit for items?
because my plugin stores enchant data in the item meta but the item keeps getting its data reset randomly and breaking the item
1mb is the max player data size
Tinkers construct spigot 
There already is a public one
Possibly havent used it
there is an old one for 1.12 that is inactive resource and thats the one I now own
and then another
the other is laggy crap
I doubt you're reaching the NBT limit though
Like the item basically bricks itself
wipes enchants, and stops registering as the tinkers item
Worst case you can handle the data in straight up binary like hideflags does
I mean so far redone a lot of code and still can't find the issue
even with extra debug it just fucks itself
Storing it in the item meta is not the best idea
solution?
?
was thinking about using proper pdc container instead
as thought it may just be overloading the meta
would be possible to transfer existing items?
Wdym?
am still learning some so sorry if dumb questions
You would have to set up some conversion system
Most likely on playerJoinEvent and openInventory check all their items
weird thing is it just seems to be swords
never had any other item break
tbf this has a lot less https://screenshots.skizzles.me/wAnA3/JOtiKOSu43.png
moved there, thanks for answering tho :)
"cannot access net.minecraft.network.chat.ChatComponentText" I get this when compiling my minecraft plugin, anyone else?
NMS is a bit different in 1.17
Could you show your code
Yeah sure
?paste
I'm not at my PC but make sure that class exists with that constructor
I'm getting this also that's similar
ig you and I are pretty much going to have the same solution
If I fix it, I will let you know 🙂
How do you determine if a pumpkin has grown on its own or placed by the player?
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /E:/project/Intellj-IDEA/Git/World1-6Utils/World1-6Utils_V1_17_R1/src/main/java/com/andrew121410/mc/world16utils/sign/SignUtils_V1_17_R1.java:[3,26] cannot access net.minecraft.core.BlockPos
bad class file: C:\Users\andre\.m2\repository\org\spigotmc\spigot\1.17-R0.1-SNAPSHOT\spigot-1.17-R0.1-SNAPSHOT-remapped-mojang.jar(net/minecraft/core/BlockPos.class)
class file has wrong version 60.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------```
You need Java 16
I have java 16
Could you send the full error too?
I am retard
I also got class file has wrong version 60.0, should be 52.0
lol
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/steve/Documents/Intellij IDEA Projects/Sucrose/src/main/java/me/nykorrin/sucrose/events/bloodmoon/entities/BloodmoonSkeleton.java:[4,34] cannot access net.minecraft.network.chat.ChatComponentText
bad class file: C:\Users\steve\Documents\Intellij IDEA Projects\Sucrose\libs\spigot-1.17.jar(net/minecraft/network/chat/ChatComponentText.class)
class file has wrong version 60.0, should be 52.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------```
Time to use Java 16 xd
THAT'S MY PROBLEM TOO
I just changed to Java 16 everything seems to be working now thanks!
java 16.0.1 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
C:\Users\steve>```
You need to set it in your project
can not accept class
OH LOL
Lol we all dumb
fr
Build success! Thanks for the help Olivo & andrew 🙂
I've do this all, but i've cannot access net.minecraft.network.game.protocol.Packet
Full error
@past maple and @quaint mantle
?
I've Java16
Wait a second, Olivo
AWWW SHIT
Hi I am updating my plugin which uses TinyProtocol to 1.17. At times I use NMS with reflection, how should I go about it? There is no more net.minecraft.server.v1_17_R1 package?
I haven't setted Java in project
wtf
use jd gui
what do you mean?
Use decompiler
Or
I'm using the builtin intellij decompiler, I think it is fernflower.
U can see suggestions
For net.minecraft
Yeah I saw them
There are game, network
And all other
so you confirm there is no more version within it?
I didn't understand what the --remapped was for
Yes. But org.bukkit.craftbukkit have version now
yes
It readds mappings
They've always had that
thanks
This option will install additional Spigot jars into your local Maven repository with the classifiers remapped-obf and remapped-mojang. You can use these to develop against a 'Mojang Mapped' Spigot jar, and then use the below Maven configuration to produce a jar suitable for distribution.
I don't really understand
If I don't use those jars I'll have to deal with obfuscated code?
Hello there , I need help related setting up a proxy with geyser , I tried many times. But it has been bugged.
It shows this message when trying to join from bedrock
Yes
Can't send image
This is Spigot and Bungee support
Wrong message reply but yeah obfuscated jar
Yea , Bunge is used for proxy , and it is bugged

you need #help-server. This is for plugin development
Oof
K bye
Better I not waste time here , lemme ask a developer
Hello, I really can't solve my problem on my personalized chat event, someone can help me ? My Code : https://paste.md-5.net/vafasusiyo.java
How do you determine if a pumpkin has grown on its own or placed by the player?
I'd guess watch for BlockFormEvent
ty
once its there you can;t tell, unless you tracked it being placed or grown
What's the problem
Actually I think I know
@chrome beacon I would like to create a chat event to separate chat per world. And when I send a message in a chat there is no personalize chat but there is the vanilla chat
Is your custom event set to work async
I don't know because it's my first custom event
Sounds like you didnt
And so how can I set my event to work async ?
I know its now some time ago but I tried it and it still is getting called twice is there anything else I could do to prevent it?
@chrome beacon ?
In your event constructor call super(true)
ow never thought there were limitations to name length
Yeah there is
Is there currently a bug with the maven-shade-plugin and updating to java 16 (cos it hates me atm)
@chrome beacon https://paste.md-5.net/bopocogimi.java sorry but there is an error, it's normal ?
Not that Ive noticed
Super needs to be first
i need help creating a plugin,to be more specific , placing blocks
And what part if it
how can i use the relative position of the player to place blocks around it ?
@chrome beacon Okay I try it
Hmm because it won't stop complaining about unsupported class file major version 60
That's not a bug
You're using the wrong Java version
` @EventHandler
public void onHit(ProjectileHitEvent e) {
if (e.getEntity().getShooter() instanceof Skeleton && e.getHitEntity() instanceof Player) {
Player a =(Player) e.getHitEntity();
int x =a.getLocation().getBlockX();
int y =a.getLocation().getBlockY();
int z =a.getLocation().getBlockZ();`
this is what i already tried, but i dont know how to assign it to a block and stuff
Everything is set to java 16. Triple checked it all
wew captain america
Is the system running Java 16
YEah, I updated my pc to java 16 before I updated the plugins - Even changed the JAVA_HOME to java 16
hey good job
Run java -version
In CMD
Says java 16.0.1
Are you building via the command line or your IDE
IDE
Make sure you've told your IDE to use Java 16
Which IDE are you using?
k, just eclipse required an special download/update to work with 16
@chrome beacon The super(true) doesn't fix my problem
Project Structure is set to the java 16 jdk - I'm just at a loss what it could be.
?paste your event class
im new to all of this.So maybe my code isnt right.
This is correct
ah i can build them in
thats all fine
suffocate it
how can i place blocks on the player position?
@eternal oxide But when I send a message in the chat, there is nothing
@eternal oxide https://paste.md-5.net/vafasusiyo.java
god level
do some debug. Make sure you event is actually being called
Call getBlock on the location then call setType on that
@eternal oxide Okay thank you
@eternal oxide you once sent someone how to hide the NPCs on tab, could you send that again please? 🙂
if it is on another coordinates? like if it is 5 blocks in the z direction? (thanks btw!)
something with protocollib i guess
Then use add on the location
how so?
ive seen it before, but i dont know how to implement it... because is different on how i usually declarate instances.
for example: Player a =(Player) e.getHitEntity();
in here i need to link the object to a variable at the end
and i dont know who to link it to...
Wdym?
from what im learning i declare instances by House house = new House(); but now i got to link the object to a variable.
i got to do this House house = (House) variable
or i dont know the diference yet
Yeah that's casting. You're essentially forcing one type to another
i understand the concept of it but i just cant wrap my head around the "how to implement it"...
i want to put blocks around the player
in a 3x3 x3
Then you will have to loop
but i dont know how construct the instance of the block(on the documentantion it doesnt exist https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Block.html)
i cant find it,or the constructor at least
thanks!
both of you
this was just fixed
hey uh what am i doing wrong https://paste.md-5.net/zodisixupo.java
my EntitySkeleton skeleton = new EntitySkeleton(EntityType.SKELETON); line is underlined in red
I've tried using world in the () and that didnt work eithert
Is there any possibility to save configs with comments in Bungee? Because bungee's Configuration class is final
if its underlined in red you're using IntelliJ/Eclipse/VSCode or whatever. It'll tell you what you're doing wrong quicker than if you ask it on a discord server.
don't bring any logic into this
Description Resource Path Location Type The constructor EntitySkeleton(EntityType) is undefined capnlynxo.java /commands/src/me/renndrew/commands/cmds line 29 Java Problem
it's the internet after all
yes, that's very true
however spoon feeding is still bad, as they'll continue on doing the same 🤷♂️
Currently only headers are supported iirc
Also extending YamlConfiguration is also impossible
@urban trout I'm looking at some ancient code but it seems new EntitySkeleton wants a World, not an EntityType.
Also I just found this by accident: https://github.com/squallblade/Spigot
Isn't that a major licensing issue?
Comments are not supported at all because of the nature snakeyaml works. Your best bet would be copying the file over and never saving to it.
Description Resource Path Location Type
The constructor EntitySkeleton(World) is undefined capnlynxo.java /commands/src/me/renndrew/commands/cmds line 29 Java Problem
nop
Can't I get the file into Java and read the lines and find out where the comments are?
And then after saving putting them back
i changed EntityType.blah blah to world because i have World world = ((CraftWorld)player.getWorld());
hey, how do I make some command to have cooldown?
well surely you could hack smth together, but really its not thaaat easy. You should check out libraries like eo-yaml which have built in support. I also saw md_5 posting something about comment support in the 1.17 forums post.
@urban trout Sorry for that last message. EntitySkeleton simply doesn't exist anymore, are you using an ancient API/Tutorial?
world.spawnEntity(Location, EntityType.SKELETON);
Is the proper API.
Anything before 2015, maybe. Or a 1.8.x tutorial maybe
well?
Ok thanks
Hi, I have a question, is there any known bug about the server crashing when the player is standing on a stalagmite and recieves damage from a falling object anvil/stalactite
Can I add aliases when registering command?
how would i change stuff such as the health?
You can separate each alias by a comma
i mean without plugin.yml
You mean the command map?
I have this, but doesn't work
public void registerThisCommand(){
plugin.getCommand(COMMAND_NAME).setExecutor(this);
plugin.getCommand(COMMAND_NAME).setTabCompleter(this);
FileConfiguration config = plugin.getConfig();
// Create a list with configured value
List<String> aliases = config.getStringList("aliases");
// Set the command aliases
plugin.getCommand(COMMAND_NAME).setAliases(aliases);
}
ah
spawnEntity returns an Entity. In your case you could cast it to Skeleton. Then you can do setHealth or setMaxHealth. See https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Skeleton.html for more details.
declaration: package: org.bukkit.entity, interface: Skeleton
guys, how do I make a command to have cooldown, like /heal or /feed?
not too sure then, I've never done that before
how can I stop a parrot from randomly flying? (stall at mid-air).
I tried to override its pathgoals but without success.
Skeleton skeleton = (Skeleton) world.spawnEntity(loc, EntityType.SKELETON); ?
I think so
thats what i've done
If there's no errors from your IDE, it should work
Yes
how fast did you just test that 🤔
@quaint mantle I've tried and it doesn't work.
yeah, that is required
how can I stop a parrot from randomly flying? (stall at mid-air).
I tried to override its pathgoals but without success.
o
4th time asking
Store the time the command was executed and check the elapsed time to check if the elapsed time is or greater than your cooldown duration
how do I do that?
E.g:
if ((System.currentTimeMillis() - lastExecuted) >= 5000L) {
lastExecuted = System.currentTimeMillis();
// code to execute
}
for 5 secs
just for reference, 1000ms = 1 sec
lastExecuted is int, long, float or what
what System.currentTimeMillis() returns, long
thank you very much 💙
how can I stop a parrot from randomly flying? (stall at mid-air).
I tried to override its pathgoals but without success.
Isn’t that a goal after all
any suggestions on how can I solve then?
How did you override it?
Overriding the public initPathfinder method, I'm in 1.16.2
Then I created a custom pathfinder goal extending the PathfinderGoal class but I don't seem to find a way to let the parrot stall at mid air.
I encountered the same issue. It seems like the plugin isn't really working with Java 16 yet.
If you haven't fixed it already have a look at this thread: https://www.reddit.com/r/Maven/comments/mw58hq/mavenshadeplugin_java_16/?utm_source=share&utm_medium=web2x&context=3
The answer by ProjectEden fixed my issue.
how would i make it so when i summon my skeleton boss everyone gets its health in their bossbar
i know how to do a boss bar just not the health
@ivory sleet
Hmm I will take a look once I get on my pc, on phone right now 😅
you can also copy the <dependencies> section from spigot's use of maven shade
That's what I used to fix it
Is it possible to get generic.luck of player?
yes, look up attributes in the javadocs
ok
I see... the dependencies of asm fixes the issue too. thanks
where do i get 1.17 spigot?
I'm trynna check if an item has the same name and then do something with the InventoryClick event but it doesn't work. I tried this:
if (event.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.translateAlternateColorCodes('&', "&etest"))) {
player.sendMessage("test");
}```
ChatColor.translateAlternateColorCodes('&', "&etest")
I can't figure out how to use NMS.
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.spigotmc:spigot:jar:remapped-mojang:1.17-R0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.063 s
[INFO] Finished at: 2021-06-12T14:24:37+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project theomonty: Could not resolve dependencies for project theomonty:theomonty:jar:1.0-SNAPSHOT: Failure to find org.spigotmc:spigot:jar:remapped-mojang:1.17-R0.1-SNAPSHOT in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of spigotmc-repo has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Process finished with exit code 1
what about spigotcraft at 1.17 is spigot 1.17 already out
yes, see #announcements
Did you follow exactly what was written on the second post, on that link. He explains it in detail
considering sharing compiled Spigot jars is illegal I'm going to remove that message 👀
Mhm
huh, what?
Then sleep
2-4 or 24 XD jk
ignore everything i say
it looked like that contained some compiled spigot jar in previous version
it does?
ok sure ^^
Yes?
Hmm I haven't used NSM in a long time so not 100% sure. All I could suggest is making sure you're running the latest spigot version and have all the dependencies added correctly.
Yes i am sure
Can I prevent the server preparingspawn when I call createWorld() ? Or change the number of chunks it generates?
hi, how can I set the 1.16 completition of the selectors in a spigot command plz?
@crude hound You mean this? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/command/TabExecutor.html
declaration: package: org.bukkit.command, interface: TabExecutor
if you mean the @e[this=that] selectors, you'll need brigadier
I still cannot use NMS for 1.17.
you can, they just removed the mapping.
yes I found thx
mapping? wym
<!-- spigot dependency -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
<!-- spigot repo -->
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
is this correct
Did you add all the stuff in the Example Maven Config as well from that link
